2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afsconfig.h>
11 #include <afs/param.h>
14 #include <sys/types.h>
26 #include <netinet/in.h>
33 #include <afs/afsutil.h>
35 #define UBIK_INTERNALS
40 * This module is responsible for determining when the system has
41 * recovered to the point that it can handle new transactions. It
42 * replays logs, polls to determine the current dbase after a crash,
43 * and distributes the new database to the others.
45 * The sync site associates a version number with each database. It
46 * broadcasts the version associated with its current dbase in every
47 * one of its beacon messages. When the sync site send a dbase to a
48 * server, it also sends the db's version. A non-sync site server can
49 * tell if it has the right dbase version by simply comparing the
50 * version from the beacon message \p uvote_dbVersion with the version
51 * associated with the database \p ubik_dbase->version. The sync site
52 * itself simply has one counter to keep track of all of this (again
53 * \p ubik_dbase->version).
55 * sync site: routine called when the sync site loses its quorum; this
56 * procedure is called "up" from the beacon package. It resyncs the
57 * dbase and nudges the recovery daemon to try to propagate out the
58 * changes. It also resets the recovery daemon's state, since
59 * recovery must potentially find a new dbase to propagate out. This
60 * routine should not do anything with variables used by non-sync site
65 * if this flag is set, then ubik will use only the primary address
66 * (the address specified in the CellServDB) to contact other
67 * ubik servers. Ubik recovery will not try opening connections
68 * to the alternate interface addresses.
70 int ubikPrimaryAddrOnly;
73 urecovery_ResetState(void)
76 #if !defined(AFS_PTHREAD_ENV)
77 /* No corresponding LWP_WaitProcess found anywhere for this -- klm */
78 LWP_NoYieldSignal(&urecovery_state);
86 * routine called when a non-sync site server goes down; restarts recovery
87 * process to send missing server the new db when it comes back up.
89 * \note This routine should not do anything with variables used by non-sync site servers.
92 urecovery_LostServer(void)
94 #if !defined(AFS_PTHREAD_ENV)
95 /* No corresponding LWP_WaitProcess found anywhere for this -- klm */
96 LWP_NoYieldSignal(&urecovery_state);
102 * return true iff we have a current database (called by both sync
103 * sites and non-sync sites) How do we determine this? If we're the
104 * sync site, we wait until recovery has finished fetching and
105 * re-labelling its dbase (it may still be trying to propagate it out
106 * to everyone else; that's THEIR problem). If we're not the sync
107 * site, then we must have a dbase labelled with the right version,
108 * and we must have a currently-good sync site.
111 urecovery_AllBetter(struct ubik_dbase *adbase, int areadAny)
115 ubik_dprint_25("allbetter checking\n");
120 if (ubik_dbase->version.epoch > 1)
121 rcode = 1; /* Happy with any good version of database */
124 /* Check if we're sync site and we've got the right data */
125 else if (ubeacon_AmSyncSite() && (urecovery_state & UBIK_RECHAVEDB)) {
129 /* next, check if we're aux site, and we've ever been sent the
130 * right data (note that if a dbase update fails, we won't think
131 * that the sync site is still the sync site, 'cause it won't talk
132 * to us until a timeout period has gone by. When we recover, we
133 * leave this clear until we get a new dbase */
134 else if ((uvote_GetSyncSite() && (vcmp(ubik_dbVersion, ubik_dbase->version) == 0))) { /* && order is important */
138 ubik_dprint_25("allbetter: returning %d\n", rcode);
143 * \brief abort all transactions on this database
146 urecovery_AbortAll(struct ubik_dbase *adbase)
148 struct ubik_trans *tt;
149 for (tt = adbase->activeTrans; tt; tt = tt->next) {
156 * \brief this routine aborts the current remote transaction, if any, if the tid is wrong
159 urecovery_CheckTid(struct ubik_tid *atid)
161 if (ubik_currentTrans) {
162 /* there is remote write trans, see if we match, see if this
163 * is a new transaction */
164 if (atid->epoch != ubik_currentTrans->tid.epoch
165 || atid->counter > ubik_currentTrans->tid.counter) {
166 /* don't match, abort it */
167 /* If the thread is not waiting for lock - ok to end it */
168 #if !defined(UBIK_PAUSE)
169 if (ubik_currentTrans->locktype != LOCKWAIT) {
170 #endif /* UBIK_PAUSE */
171 udisk_end(ubik_currentTrans);
172 #if !defined(UBIK_PAUSE)
174 #endif /* UBIK_PAUSE */
175 ubik_currentTrans = (struct ubik_trans *)0;
184 * log format is defined here, and implicitly in disk.c
186 * 4 byte opcode, followed by parameters, each 4 bytes long. All integers
187 * are in logged in network standard byte order, in case we want to move logs
188 * from machine-to-machine someday.
190 * Begin transaction: opcode \n
191 * Commit transaction: opcode, version (8 bytes) \n
192 * Truncate file: opcode, file number, length \n
193 * Abort transaction: opcode \n
194 * Write data: opcode, file, position, length, <length> data bytes \n
196 * A very simple routine, it just replays the log. Note that this is a new-value only log, which
197 * implies that no uncommitted data is written to the dbase: one writes data to the log, including
198 * the commit record, then we allow data to be written through to the dbase. In our particular
199 * implementation, once a transaction is done, we write out the pages to the database, so that
200 * our buffer package doesn't have to know about stable and uncommitted data in the memory buffers:
201 * any changed data while there is an uncommitted write transaction can be zapped during an
202 * abort and the remaining dbase on the disk is exactly the right dbase, without having to read
206 ReplayLog(struct ubik_dbase *adbase)
209 afs_int32 code, tpos;
211 afs_int32 len, thisSize, tfile, filePos;
213 afs_int32 syncFile = -1;
214 afs_int32 data[1024];
216 /* read the lock twice, once to see whether we have a transaction to deal
217 * with that committed, (theoretically, we should support more than one
218 * trans in the log at once, but not yet), and once replaying the
222 /* for now, assume that all ops in log pertain to one transaction; see if there's a commit */
225 (*adbase->read) (adbase, LOGFILE, (char *)&opcode, tpos,
227 if (code != sizeof(afs_int32))
229 opcode = ntohl(opcode);
230 if (opcode == LOGNEW) {
231 /* handle begin trans */
232 tpos += sizeof(afs_int32);
233 } else if (opcode == LOGABORT)
235 else if (opcode == LOGEND) {
238 } else if (opcode == LOGTRUNCATE) {
241 (*adbase->read) (adbase, LOGFILE, (char *)buffer, tpos,
242 2 * sizeof(afs_int32));
243 if (code != 2 * sizeof(afs_int32))
244 break; /* premature eof or io error */
245 tpos += 2 * sizeof(afs_int32);
246 } else if (opcode == LOGDATA) {
249 (*adbase->read) (adbase, LOGFILE, (char *)buffer, tpos,
250 3 * sizeof(afs_int32));
251 if (code != 3 * sizeof(afs_int32))
253 /* otherwise, skip over the data bytes, too */
254 tpos += ntohl(buffer[2]) + 3 * sizeof(afs_int32);
256 ubik_print("corrupt log opcode (%d) at position %d\n", opcode,
258 break; /* corrupt log! */
262 /* actually do the replay; log should go all the way through the commit record, since
263 * we just read it above. */
269 (*adbase->read) (adbase, LOGFILE, (char *)&opcode, tpos,
271 if (code != sizeof(afs_int32))
273 opcode = ntohl(opcode);
274 if (opcode == LOGNEW) {
275 /* handle begin trans */
276 tpos += sizeof(afs_int32);
277 } else if (opcode == LOGABORT)
278 panic("log abort\n");
279 else if (opcode == LOGEND) {
282 (*adbase->read) (adbase, LOGFILE, (char *)buffer, tpos,
283 2 * sizeof(afs_int32));
284 if (code != 2 * sizeof(afs_int32))
286 code = (*adbase->setlabel) (adbase, 0, (ubik_version *)buffer);
290 break; /* all done now */
291 } else if (opcode == LOGTRUNCATE) {
294 (*adbase->read) (adbase, LOGFILE, (char *)buffer, tpos,
295 2 * sizeof(afs_int32));
296 if (code != 2 * sizeof(afs_int32))
297 break; /* premature eof or io error */
298 tpos += 2 * sizeof(afs_int32);
300 (*adbase->truncate) (adbase, ntohl(buffer[0]),
304 } else if (opcode == LOGDATA) {
307 (*adbase->read) (adbase, LOGFILE, (char *)buffer, tpos,
308 3 * sizeof(afs_int32));
309 if (code != 3 * sizeof(afs_int32))
311 tpos += 3 * sizeof(afs_int32);
312 /* otherwise, skip over the data bytes, too */
313 len = ntohl(buffer[2]); /* total number of bytes to copy */
314 filePos = ntohl(buffer[1]);
315 tfile = ntohl(buffer[0]);
316 /* try to minimize file syncs */
317 if (syncFile != tfile) {
319 code = (*adbase->sync) (adbase, syncFile);
327 thisSize = (len > sizeof(data) ? sizeof(data) : len);
328 /* copy sizeof(data) buffer bytes at a time */
330 (*adbase->read) (adbase, LOGFILE, (char *)data, tpos,
332 if (code != thisSize)
335 (*adbase->write) (adbase, tfile, (char *)data, filePos,
337 if (code != thisSize)
344 ubik_print("corrupt log opcode (%d) at position %d\n",
346 break; /* corrupt log! */
351 code = (*adbase->sync) (adbase, syncFile);
355 ubik_print("Log read error on pass 2\n");
360 /* now truncate the log, we're done with it */
361 code = (*adbase->truncate) (adbase, LOGFILE, 0);
366 * Called at initialization to figure out version of the dbase we really have.
368 * This routine is called after replaying the log; it reads the restored labels.
371 InitializeDB(struct ubik_dbase *adbase)
375 code = (*adbase->getlabel) (adbase, 0, &adbase->version);
377 /* try setting the label to a new value */
378 adbase->version.epoch = 1; /* value for newly-initialized db */
379 adbase->version.counter = 1;
380 code = (*adbase->setlabel) (adbase, 0, &adbase->version);
382 /* failed, try to set it back */
383 adbase->version.epoch = 0;
384 adbase->version.counter = 0;
385 (*adbase->setlabel) (adbase, 0, &adbase->version);
387 #ifdef AFS_PTHREAD_ENV
388 assert(pthread_cond_broadcast(&adbase->version_cond) == 0);
390 LWP_NoYieldSignal(&adbase->version);
397 * \brief initialize the local ubik_dbase
399 * We replay the logs and then read the resulting file to figure out what version we've really got.
402 urecovery_Initialize(struct ubik_dbase *adbase)
406 code = ReplayLog(adbase);
409 code = InitializeDB(adbase);
414 * \brief Main interaction loop for the recovery manager
416 * The recovery light-weight process only runs when you're the
417 * synchronization site. It performs the following tasks, if and only
418 * if the prerequisite tasks have been performed successfully (it
419 * keeps track of which ones have been performed in its bit map,
420 * \p urecovery_state).
422 * First, it is responsible for probing that all servers are up. This
423 * is the only operation that must be performed even if this is not
424 * yet the sync site, since otherwise this site may not notice that
425 * enough other machines are running to even elect this guy to be the
428 * After that, the recovery process does nothing until the beacon and
429 * voting modules manage to get this site elected sync site.
431 * After becoming sync site, recovery first attempts to find the best
432 * database available in the network (it must do this in order to
433 * ensure finding the latest committed data). After finding the right
434 * database, it must fetch this dbase to the sync site.
436 * After fetching the dbase, it relabels it with a new version number,
437 * to ensure that everyone recognizes this dbase as the most recent
440 * One the dbase has been relabelled, this machine can start handling
441 * requests. However, the recovery module still has one more task:
442 * propagating the dbase out to everyone who is up in the network.
445 urecovery_Interact(void *dummy)
447 afs_int32 code, tcode;
448 struct ubik_server *bestServer = NULL;
449 struct ubik_server *ts;
450 int dbok, doingRPC, now;
451 afs_int32 lastProbeTime, lastDBVCheck;
452 /* if we're the sync site, the best db version we've found yet */
453 static struct ubik_version bestDBVersion;
454 struct ubik_version tversion;
456 int length, tlen, offset, file, nbytes;
457 struct rx_call *rxcall;
459 struct ubik_stat ubikstat;
460 struct in_addr inAddr;
462 #ifndef OLD_URECOVERY
468 /* otherwise, begin interaction */
473 /* Run through this loop every 4 seconds */
476 #ifdef AFS_PTHREAD_ENV
477 select(0, 0, 0, 0, &tv);
479 IOMGR_Select(0, 0, 0, 0, &tv);
482 ubik_dprint("recovery running in state %x\n", urecovery_state);
484 /* Every 30 seconds, check all the down servers and mark them
485 * as up if they respond. When a server comes up or found to
486 * not be current, then re-find the the best database and
489 if ((now = FT_ApproxTime()) > 30 + lastProbeTime) {
490 for (ts = ubik_servers, doingRPC = 0; ts; ts = ts->next) {
496 urecovery_state &= ~UBIK_RECFOUNDDB;
498 } else if (!ts->currentDB) {
499 urecovery_state &= ~UBIK_RECFOUNDDB;
503 now = FT_ApproxTime();
507 /* Mark whether we are the sync site */
508 if (!ubeacon_AmSyncSite()) {
509 urecovery_state &= ~UBIK_RECSYNCSITE;
510 continue; /* nothing to do */
512 urecovery_state |= UBIK_RECSYNCSITE;
514 /* If a server has just come up or if we have not found the
515 * most current database, then go find the most current db.
517 if (!(urecovery_state & UBIK_RECFOUNDDB)) {
518 bestServer = (struct ubik_server *)0;
519 bestDBVersion.epoch = 0;
520 bestDBVersion.counter = 0;
521 for (ts = ubik_servers; ts; ts = ts->next) {
523 continue; /* don't bother with these guys */
526 code = DISK_GetVersion(ts->disk_rxcid, &ts->version);
528 /* perhaps this is the best version */
529 if (vcmp(ts->version, bestDBVersion) > 0) {
530 /* new best version */
531 bestDBVersion = ts->version;
536 /* take into consideration our version. Remember if we,
537 * the sync site, have the best version. Also note that
538 * we may need to send the best version out.
540 if (vcmp(ubik_dbase->version, bestDBVersion) >= 0) {
541 bestDBVersion = ubik_dbase->version;
542 bestServer = (struct ubik_server *)0;
543 urecovery_state |= UBIK_RECHAVEDB;
545 /* Clear the flag only when we know we have to retrieve
546 * the db. Because urecovery_AllBetter() looks at it.
548 urecovery_state &= ~UBIK_RECHAVEDB;
550 lastDBVCheck = FT_ApproxTime();
551 urecovery_state |= UBIK_RECFOUNDDB;
552 urecovery_state &= ~UBIK_RECSENTDB;
554 #if defined(UBIK_PAUSE)
555 /* it's not possible for UBIK_RECFOUNDDB not to be set here.
556 * However, we might have lost UBIK_RECSYNCSITE, and that
559 if (!(urecovery_state & UBIK_RECSYNCSITE))
560 continue; /* lost sync */
562 if (!(urecovery_state & UBIK_RECFOUNDDB))
563 continue; /* not ready */
564 #endif /* UBIK_PAUSE */
566 /* If we, the sync site, do not have the best db version, then
567 * go and get it from the server that does.
569 if ((urecovery_state & UBIK_RECHAVEDB) || !bestServer) {
570 urecovery_state |= UBIK_RECHAVEDB;
572 /* we don't have the best version; we should fetch it. */
574 urecovery_AbortAll(ubik_dbase);
576 /* Rx code to do the Bulk fetch */
579 rxcall = rx_NewCall(bestServer->disk_rxcid);
581 ubik_print("Ubik: Synchronize database with server %s\n",
582 afs_inet_ntoa_r(bestServer->addr[0], hoststr));
584 code = StartDISK_GetFile(rxcall, file);
586 ubik_dprint("StartDiskGetFile failed=%d\n", code);
589 nbytes = rx_Read(rxcall, (char *)&length, sizeof(afs_int32));
590 length = ntohl(length);
591 if (nbytes != sizeof(afs_int32)) {
592 ubik_dprint("Rx-read length error=%d\n", code = BULK_ERROR);
598 /* Truncate the file first */
599 code = (*ubik_dbase->truncate) (ubik_dbase, file, 0);
601 ubik_dprint("truncate io error=%d\n", code);
604 tversion.counter = 0;
606 /* give invalid label during file transit */
608 code = (*ubik_dbase->setlabel) (ubik_dbase, file, &tversion);
610 ubik_dprint("setlabel io error=%d\n", code);
613 #ifndef OLD_URECOVERY
615 afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
616 fd = open(pbuffer, O_CREAT | O_RDWR | O_TRUNC, 0600);
621 code = lseek(fd, HDRSIZE, 0);
622 if (code != HDRSIZE) {
630 tlen = (length > sizeof(tbuffer) ? sizeof(tbuffer) : length);
631 #ifndef AFS_PTHREAD_ENV
635 nbytes = rx_Read(rxcall, tbuffer, tlen);
636 if (nbytes != tlen) {
637 ubik_dprint("Rx-read bulk error=%d\n", code = BULK_ERROR);
644 (*ubik_dbase->write) (ubik_dbase, file, tbuffer, offset,
647 nbytes = write(fd, tbuffer, tlen);
650 if (nbytes != tlen) {
658 #ifndef OLD_URECOVERY
663 code = EndDISK_GetFile(rxcall, &tversion);
665 tcode = rx_EndCall(rxcall, code);
669 /* we got a new file, set up its header */
670 urecovery_state |= UBIK_RECHAVEDB;
671 memcpy(&ubik_dbase->version, &tversion,
672 sizeof(struct ubik_version));
674 (*ubik_dbase->sync) (ubik_dbase, 0); /* get data out first */
676 afs_snprintf(tbuffer, sizeof(tbuffer), "%s.DB%s%d", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
678 afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
679 code = unlink(pbuffer);
681 code = rename(tbuffer, pbuffer);
682 afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
685 code = rename(pbuffer, tbuffer);
687 (*ubik_dbase->open) (ubik_dbase, 0);
689 /* after data is good, sync disk with correct label */
691 (*ubik_dbase->setlabel) (ubik_dbase, 0,
692 &ubik_dbase->version);
693 #ifndef OLD_URECOVERY
696 afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
702 #ifndef OLD_URECOVERY
705 * We will effectively invalidate the old data forever now.
706 * Unclear if we *should* but we do.
709 ubik_dbase->version.epoch = 0;
710 ubik_dbase->version.counter = 0;
711 ubik_print("Ubik: Synchronize database failed (error = %d)\n",
714 ubik_print("Ubik: Synchronize database completed\n");
715 urecovery_state |= UBIK_RECHAVEDB;
717 udisk_Invalidate(ubik_dbase, 0); /* data has changed */
718 #ifdef AFS_PTHREAD_ENV
719 assert(pthread_cond_broadcast(&ubik_dbase->version_cond) == 0);
721 LWP_NoYieldSignal(&ubik_dbase->version);
725 #if defined(UBIK_PAUSE)
726 if (!(urecovery_state & UBIK_RECSYNCSITE))
727 continue; /* lost sync */
728 #endif /* UBIK_PAUSE */
729 if (!(urecovery_state & UBIK_RECHAVEDB))
730 continue; /* not ready */
732 /* If the database was newly initialized, then when we establish quorum, write
733 * a new label. This allows urecovery_AllBetter() to allow access for reads.
734 * Setting it to 2 also allows another site to come along with a newer
735 * database and overwrite this one.
737 if (ubik_dbase->version.epoch == 1) {
739 urecovery_AbortAll(ubik_dbase);
741 ubik_dbase->version.epoch = ubik_epochTime;
742 ubik_dbase->version.counter = 1;
744 (*ubik_dbase->setlabel) (ubik_dbase, 0, &ubik_dbase->version);
745 udisk_Invalidate(ubik_dbase, 0); /* data may have changed */
746 #ifdef AFS_PTHREAD_ENV
747 assert(pthread_cond_broadcast(&ubik_dbase->version_cond) == 0);
749 LWP_NoYieldSignal(&ubik_dbase->version);
754 /* Check the other sites and send the database to them if they
755 * do not have the current db.
757 if (!(urecovery_state & UBIK_RECSENTDB)) {
758 /* now propagate out new version to everyone else */
759 dbok = 1; /* start off assuming they all worked */
763 * Check if a write transaction is in progress. We can't send the
764 * db when a write is in progress here because the db would be
765 * obsolete as soon as it goes there. Also, ops after the begin
766 * trans would reach the recepient and wouldn't find a transaction
767 * pending there. Frankly, I don't think it's possible to get past
768 * the write-lock above if there is a write transaction in progress,
769 * but then, it won't hurt to check, will it?
771 if (ubik_dbase->flags & DBWRITING) {
776 while ((ubik_dbase->flags & DBWRITING) && (safety < 500)) {
778 /* sleep for a little while */
779 #ifdef AFS_PTHREAD_ENV
780 select(0, 0, 0, 0, &tv);
782 IOMGR_Select(0, 0, 0, 0, &tv);
790 for (ts = ubik_servers; ts; ts = ts->next) {
791 inAddr.s_addr = ts->addr[0];
793 ubik_dprint("recovery cannot send version to %s\n",
794 afs_inet_ntoa_r(inAddr.s_addr, hoststr));
798 ubik_dprint("recovery sending version to %s\n",
799 afs_inet_ntoa_r(inAddr.s_addr, hoststr));
800 if (vcmp(ts->version, ubik_dbase->version) != 0) {
801 ubik_dprint("recovery stating local database\n");
803 /* Rx code to do the Bulk Store */
804 code = (*ubik_dbase->stat) (ubik_dbase, 0, &ubikstat);
806 length = ubikstat.size;
808 rxcall = rx_NewCall(ts->disk_rxcid);
810 StartDISK_SendFile(rxcall, file, length,
811 &ubik_dbase->version);
813 ubik_dprint("StartDiskSendFile failed=%d\n",
820 sizeof(tbuffer) ? sizeof(tbuffer) : length);
822 (*ubik_dbase->read) (ubik_dbase, file,
823 tbuffer, offset, tlen);
824 if (nbytes != tlen) {
825 ubik_dprint("Local disk read error=%d\n",
829 nbytes = rx_Write(rxcall, tbuffer, tlen);
830 if (nbytes != tlen) {
831 ubik_dprint("Rx-write bulk error=%d\n", code =
838 code = EndDISK_SendFile(rxcall);
840 code = rx_EndCall(rxcall, code);
843 /* we set a new file, process its header */
844 ts->version = ubik_dbase->version;
849 /* mark file up to date */
855 urecovery_state |= UBIK_RECSENTDB;
862 * \brief send a Probe to all the network address of this server
864 * \return 0 if success, else return 1
867 DoProbe(struct ubik_server *server)
869 struct rx_connection *conns[UBIK_MAX_INTERFACE_ADDR];
870 struct rx_connection *connSuccess = 0;
875 extern afs_int32 ubikSecIndex;
876 extern struct rx_securityClass *ubikSecClass;
878 for (i = 0; (addr = server->addr[i]) && (i < UBIK_MAX_INTERFACE_ADDR);
881 rx_NewConnection(addr, ubik_callPortal, DISK_SERVICE_ID,
882 ubikSecClass, ubikSecIndex);
884 /* user requirement to use only the primary interface */
885 if (ubikPrimaryAddrOnly) {
890 assert(i); /* at least one interface address for this server */
894 if (!multi_error) { /* first success */
895 addr = server->addr[multi_i]; /* successful interface addr */
897 if (server->disk_rxcid) /* destroy existing conn */
898 rx_DestroyConnection(server->disk_rxcid);
899 if (server->vote_rxcid)
900 rx_DestroyConnection(server->vote_rxcid);
902 /* make new connections */
903 server->disk_rxcid = conns[multi_i];
904 server->vote_rxcid = rx_NewConnection(addr, ubik_callPortal, VOTE_SERVICE_ID, ubikSecClass, ubikSecIndex); /* for vote reqs */
906 connSuccess = conns[multi_i];
907 strcpy(buffer, afs_inet_ntoa_r(server->addr[0], hoststr));
909 ("ubik:server %s is back up: will be contacted through %s\n",
910 buffer, afs_inet_ntoa_r(addr, hoststr));
916 /* Destroy all connections except the one on which we succeeded */
917 for (j = 0; j < i; j++)
918 if (conns[j] != connSuccess)
919 rx_DestroyConnection(conns[j]);
922 ubik_dprint("ubik:server %s still down\n",
923 afs_inet_ntoa_r(server->addr[0], hoststr));
926 return 0; /* success */
928 return 1; /* failure */