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>
15 #include <sys/types.h>
26 #include <netinet/in.h>
33 #include <afs/afsutil.h>
34 #include <afs/cellconfig.h>
36 #define UBIK_INTERNALS
41 * This module is responsible for determining when the system has
42 * recovered to the point that it can handle new transactions. It
43 * replays logs, polls to determine the current dbase after a crash,
44 * and distributes the new database to the others.
46 * The sync site associates a version number with each database. It
47 * broadcasts the version associated with its current dbase in every
48 * one of its beacon messages. When the sync site send a dbase to a
49 * server, it also sends the db's version. A non-sync site server can
50 * tell if it has the right dbase version by simply comparing the
51 * version from the beacon message \p uvote_dbVersion with the version
52 * associated with the database \p ubik_dbase->version. The sync site
53 * itself simply has one counter to keep track of all of this (again
54 * \p ubik_dbase->version).
56 * sync site: routine called when the sync site loses its quorum; this
57 * procedure is called "up" from the beacon package. It resyncs the
58 * dbase and nudges the recovery daemon to try to propagate out the
59 * changes. It also resets the recovery daemon's state, since
60 * recovery must potentially find a new dbase to propagate out. This
61 * routine should not do anything with variables used by non-sync site
66 * if this flag is set, then ubik will use only the primary address
67 * (the address specified in the CellServDB) to contact other
68 * ubik servers. Ubik recovery will not try opening connections
69 * to the alternate interface addresses.
71 int ubikPrimaryAddrOnly;
74 urecovery_ResetState(void)
77 #if !defined(AFS_PTHREAD_ENV)
78 /* No corresponding LWP_WaitProcess found anywhere for this -- klm */
79 LWP_NoYieldSignal(&urecovery_state);
87 * routine called when a non-sync site server goes down; restarts recovery
88 * process to send missing server the new db when it comes back up for
89 * non-sync site servers.
91 * \note This routine should not do anything with variables used by non-sync site servers.
94 urecovery_LostServer(struct ubik_server *ts)
96 ubeacon_ReinitServer(ts);
97 #if !defined(AFS_PTHREAD_ENV)
98 /* No corresponding LWP_WaitProcess found anywhere for this -- klm */
99 LWP_NoYieldSignal(&urecovery_state);
105 * return true iff we have a current database (called by both sync
106 * sites and non-sync sites) How do we determine this? If we're the
107 * sync site, we wait until recovery has finished fetching and
108 * re-labelling its dbase (it may still be trying to propagate it out
109 * to everyone else; that's THEIR problem). If we're not the sync
110 * site, then we must have a dbase labelled with the right version,
111 * and we must have a currently-good sync site.
114 urecovery_AllBetter(struct ubik_dbase *adbase, int areadAny)
118 ubik_dprint_25("allbetter checking\n");
123 if (ubik_dbase->version.epoch > 1)
124 rcode = 1; /* Happy with any good version of database */
127 /* Check if we're sync site and we've got the right data */
128 else if (ubeacon_AmSyncSite() && (urecovery_state & UBIK_RECHAVEDB)) {
132 /* next, check if we're aux site, and we've ever been sent the
133 * right data (note that if a dbase update fails, we won't think
134 * that the sync site is still the sync site, 'cause it won't talk
135 * to us until a timeout period has gone by. When we recover, we
136 * leave this clear until we get a new dbase */
137 else if ((uvote_GetSyncSite() && (vcmp(ubik_dbVersion, ubik_dbase->version) == 0))) { /* && order is important */
141 ubik_dprint_25("allbetter: returning %d\n", rcode);
146 * \brief abort all transactions on this database
149 urecovery_AbortAll(struct ubik_dbase *adbase)
151 struct ubik_trans *tt;
152 for (tt = adbase->activeTrans; tt; tt = tt->next) {
159 * \brief this routine aborts the current remote transaction, if any, if the tid is wrong
162 urecovery_CheckTid(struct ubik_tid *atid, int abortalways)
164 if (ubik_currentTrans) {
165 /* there is remote write trans, see if we match, see if this
166 * is a new transaction */
167 if (atid->epoch != ubik_currentTrans->tid.epoch
168 || atid->counter > ubik_currentTrans->tid.counter || abortalways) {
169 /* don't match, abort it */
170 /* If the thread is not waiting for lock - ok to end it */
171 #if !defined(UBIK_PAUSE)
172 if (ubik_currentTrans->locktype != LOCKWAIT) {
173 #endif /* UBIK_PAUSE */
174 udisk_end(ubik_currentTrans);
175 #if !defined(UBIK_PAUSE)
177 #endif /* UBIK_PAUSE */
178 ubik_currentTrans = (struct ubik_trans *)0;
187 * log format is defined here, and implicitly in disk.c
189 * 4 byte opcode, followed by parameters, each 4 bytes long. All integers
190 * are in logged in network standard byte order, in case we want to move logs
191 * from machine-to-machine someday.
193 * Begin transaction: opcode \n
194 * Commit transaction: opcode, version (8 bytes) \n
195 * Truncate file: opcode, file number, length \n
196 * Abort transaction: opcode \n
197 * Write data: opcode, file, position, length, <length> data bytes \n
199 * A very simple routine, it just replays the log. Note that this is a new-value only log, which
200 * implies that no uncommitted data is written to the dbase: one writes data to the log, including
201 * the commit record, then we allow data to be written through to the dbase. In our particular
202 * implementation, once a transaction is done, we write out the pages to the database, so that
203 * our buffer package doesn't have to know about stable and uncommitted data in the memory buffers:
204 * any changed data while there is an uncommitted write transaction can be zapped during an
205 * abort and the remaining dbase on the disk is exactly the right dbase, without having to read
209 ReplayLog(struct ubik_dbase *adbase)
212 afs_int32 code, tpos;
214 afs_int32 len, thisSize, tfile, filePos;
216 afs_int32 syncFile = -1;
217 afs_int32 data[1024];
219 /* read the lock twice, once to see whether we have a transaction to deal
220 * with that committed, (theoretically, we should support more than one
221 * trans in the log at once, but not yet), and once replaying the
225 /* for now, assume that all ops in log pertain to one transaction; see if there's a commit */
228 (*adbase->read) (adbase, LOGFILE, (char *)&opcode, tpos,
230 if (code != sizeof(afs_int32))
232 opcode = ntohl(opcode);
233 if (opcode == LOGNEW) {
234 /* handle begin trans */
235 tpos += sizeof(afs_int32);
236 } else if (opcode == LOGABORT)
238 else if (opcode == LOGEND) {
241 } else if (opcode == LOGTRUNCATE) {
244 (*adbase->read) (adbase, LOGFILE, (char *)buffer, tpos,
245 2 * sizeof(afs_int32));
246 if (code != 2 * sizeof(afs_int32))
247 break; /* premature eof or io error */
248 tpos += 2 * sizeof(afs_int32);
249 } else if (opcode == LOGDATA) {
252 (*adbase->read) (adbase, LOGFILE, (char *)buffer, tpos,
253 3 * sizeof(afs_int32));
254 if (code != 3 * sizeof(afs_int32))
256 /* otherwise, skip over the data bytes, too */
257 tpos += ntohl(buffer[2]) + 3 * sizeof(afs_int32);
259 ubik_print("corrupt log opcode (%d) at position %d\n", opcode,
261 break; /* corrupt log! */
265 /* actually do the replay; log should go all the way through the commit record, since
266 * we just read it above. */
272 (*adbase->read) (adbase, LOGFILE, (char *)&opcode, tpos,
274 if (code != sizeof(afs_int32))
276 opcode = ntohl(opcode);
277 if (opcode == LOGNEW) {
278 /* handle begin trans */
279 tpos += sizeof(afs_int32);
280 } else if (opcode == LOGABORT)
281 panic("log abort\n");
282 else if (opcode == LOGEND) {
283 struct ubik_version version;
286 (*adbase->read) (adbase, LOGFILE, (char *)buffer, tpos,
287 2 * sizeof(afs_int32));
288 if (code != 2 * sizeof(afs_int32))
290 version.epoch = ntohl(buffer[0]);
291 version.counter = ntohl(buffer[1]);
292 code = (*adbase->setlabel) (adbase, 0, &version);
295 ubik_print("Successfully replayed log for interrupted "
296 "transaction; db version is now %ld.%ld\n",
297 (long) version.epoch, (long) version.counter);
299 break; /* all done now */
300 } else if (opcode == LOGTRUNCATE) {
303 (*adbase->read) (adbase, LOGFILE, (char *)buffer, tpos,
304 2 * sizeof(afs_int32));
305 if (code != 2 * sizeof(afs_int32))
306 break; /* premature eof or io error */
307 tpos += 2 * sizeof(afs_int32);
309 (*adbase->truncate) (adbase, ntohl(buffer[0]),
313 } else if (opcode == LOGDATA) {
316 (*adbase->read) (adbase, LOGFILE, (char *)buffer, tpos,
317 3 * sizeof(afs_int32));
318 if (code != 3 * sizeof(afs_int32))
320 tpos += 3 * sizeof(afs_int32);
321 /* otherwise, skip over the data bytes, too */
322 len = ntohl(buffer[2]); /* total number of bytes to copy */
323 filePos = ntohl(buffer[1]);
324 tfile = ntohl(buffer[0]);
325 /* try to minimize file syncs */
326 if (syncFile != tfile) {
328 code = (*adbase->sync) (adbase, syncFile);
336 thisSize = (len > sizeof(data) ? sizeof(data) : len);
337 /* copy sizeof(data) buffer bytes at a time */
339 (*adbase->read) (adbase, LOGFILE, (char *)data, tpos,
341 if (code != thisSize)
344 (*adbase->write) (adbase, tfile, (char *)data, filePos,
346 if (code != thisSize)
353 ubik_print("corrupt log opcode (%d) at position %d\n",
355 break; /* corrupt log! */
360 code = (*adbase->sync) (adbase, syncFile);
364 ubik_print("Log read error on pass 2\n");
369 /* now truncate the log, we're done with it */
370 code = (*adbase->truncate) (adbase, LOGFILE, 0);
375 * Called at initialization to figure out version of the dbase we really have.
377 * This routine is called after replaying the log; it reads the restored labels.
380 InitializeDB(struct ubik_dbase *adbase)
384 code = (*adbase->getlabel) (adbase, 0, &adbase->version);
386 /* try setting the label to a new value */
387 adbase->version.epoch = 1; /* value for newly-initialized db */
388 adbase->version.counter = 1;
389 code = (*adbase->setlabel) (adbase, 0, &adbase->version);
391 /* failed, try to set it back */
392 adbase->version.epoch = 0;
393 adbase->version.counter = 0;
394 (*adbase->setlabel) (adbase, 0, &adbase->version);
396 #ifdef AFS_PTHREAD_ENV
397 CV_BROADCAST(&adbase->version_cond);
399 LWP_NoYieldSignal(&adbase->version);
406 * \brief initialize the local ubik_dbase
408 * We replay the logs and then read the resulting file to figure out what version we've really got.
411 urecovery_Initialize(struct ubik_dbase *adbase)
415 code = ReplayLog(adbase);
418 code = InitializeDB(adbase);
423 * \brief Main interaction loop for the recovery manager
425 * The recovery light-weight process only runs when you're the
426 * synchronization site. It performs the following tasks, if and only
427 * if the prerequisite tasks have been performed successfully (it
428 * keeps track of which ones have been performed in its bit map,
429 * \p urecovery_state).
431 * First, it is responsible for probing that all servers are up. This
432 * is the only operation that must be performed even if this is not
433 * yet the sync site, since otherwise this site may not notice that
434 * enough other machines are running to even elect this guy to be the
437 * After that, the recovery process does nothing until the beacon and
438 * voting modules manage to get this site elected sync site.
440 * After becoming sync site, recovery first attempts to find the best
441 * database available in the network (it must do this in order to
442 * ensure finding the latest committed data). After finding the right
443 * database, it must fetch this dbase to the sync site.
445 * After fetching the dbase, it relabels it with a new version number,
446 * to ensure that everyone recognizes this dbase as the most recent
449 * One the dbase has been relabelled, this machine can start handling
450 * requests. However, the recovery module still has one more task:
451 * propagating the dbase out to everyone who is up in the network.
454 urecovery_Interact(void *dummy)
456 afs_int32 code, tcode;
457 struct ubik_server *bestServer = NULL;
458 struct ubik_server *ts;
459 int dbok, doingRPC, now;
460 afs_int32 lastProbeTime;
461 /* if we're the sync site, the best db version we've found yet */
462 static struct ubik_version bestDBVersion;
463 struct ubik_version tversion;
465 int length, tlen, offset, file, nbytes;
466 struct rx_call *rxcall;
468 struct ubik_stat ubikstat;
469 struct in_addr inAddr;
475 /* otherwise, begin interaction */
479 /* Run through this loop every 4 seconds */
482 #ifdef AFS_PTHREAD_ENV
483 select(0, 0, 0, 0, &tv);
485 IOMGR_Select(0, 0, 0, 0, &tv);
488 ubik_dprint("recovery running in state %x\n", urecovery_state);
490 /* Every 30 seconds, check all the down servers and mark them
491 * as up if they respond. When a server comes up or found to
492 * not be current, then re-find the the best database and
495 if ((now = FT_ApproxTime()) > 30 + lastProbeTime) {
497 #ifdef AFS_PTHREAD_ENV
501 for (ts = ubik_servers, doingRPC = 0; ts; ts = ts->next) {
507 urecovery_state &= ~UBIK_RECFOUNDDB;
509 } else if (!ts->currentDB) {
510 urecovery_state &= ~UBIK_RECFOUNDDB;
514 #ifdef AFS_PTHREAD_ENV
519 now = FT_ApproxTime();
523 /* Mark whether we are the sync site */
524 if (!ubeacon_AmSyncSite()) {
525 urecovery_state &= ~UBIK_RECSYNCSITE;
526 continue; /* nothing to do */
528 urecovery_state |= UBIK_RECSYNCSITE;
530 /* If a server has just come up or if we have not found the
531 * most current database, then go find the most current db.
533 if (!(urecovery_state & UBIK_RECFOUNDDB)) {
534 bestServer = (struct ubik_server *)0;
535 bestDBVersion.epoch = 0;
536 bestDBVersion.counter = 0;
537 for (ts = ubik_servers; ts; ts = ts->next) {
539 continue; /* don't bother with these guys */
542 code = DISK_GetVersion(ts->disk_rxcid, &ts->version);
544 /* perhaps this is the best version */
545 if (vcmp(ts->version, bestDBVersion) > 0) {
546 /* new best version */
547 bestDBVersion = ts->version;
552 /* take into consideration our version. Remember if we,
553 * the sync site, have the best version. Also note that
554 * we may need to send the best version out.
556 if (vcmp(ubik_dbase->version, bestDBVersion) >= 0) {
557 bestDBVersion = ubik_dbase->version;
558 bestServer = (struct ubik_server *)0;
559 urecovery_state |= UBIK_RECHAVEDB;
561 /* Clear the flag only when we know we have to retrieve
562 * the db. Because urecovery_AllBetter() looks at it.
564 urecovery_state &= ~UBIK_RECHAVEDB;
566 urecovery_state |= UBIK_RECFOUNDDB;
567 urecovery_state &= ~UBIK_RECSENTDB;
569 #if defined(UBIK_PAUSE)
570 /* it's not possible for UBIK_RECFOUNDDB not to be set here.
571 * However, we might have lost UBIK_RECSYNCSITE, and that
574 if (!(urecovery_state & UBIK_RECSYNCSITE))
575 continue; /* lost sync */
577 if (!(urecovery_state & UBIK_RECFOUNDDB))
578 continue; /* not ready */
579 #endif /* UBIK_PAUSE */
581 /* If we, the sync site, do not have the best db version, then
582 * go and get it from the server that does.
584 if ((urecovery_state & UBIK_RECHAVEDB) || !bestServer) {
585 urecovery_state |= UBIK_RECHAVEDB;
587 /* we don't have the best version; we should fetch it. */
589 urecovery_AbortAll(ubik_dbase);
591 /* Rx code to do the Bulk fetch */
594 rxcall = rx_NewCall(bestServer->disk_rxcid);
596 ubik_print("Ubik: Synchronize database with server %s\n",
597 afs_inet_ntoa_r(bestServer->addr[0], hoststr));
599 code = StartDISK_GetFile(rxcall, file);
601 ubik_dprint("StartDiskGetFile failed=%d\n", code);
604 nbytes = rx_Read(rxcall, (char *)&length, sizeof(afs_int32));
605 length = ntohl(length);
606 if (nbytes != sizeof(afs_int32)) {
607 ubik_dprint("Rx-read length error=%d\n", code = BULK_ERROR);
612 /* give invalid label during file transit */
614 code = (*ubik_dbase->setlabel) (ubik_dbase, file, &tversion);
616 ubik_dprint("setlabel io error=%d\n", code);
619 afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
620 fd = open(pbuffer, O_CREAT | O_RDWR | O_TRUNC, 0600);
625 code = lseek(fd, HDRSIZE, 0);
626 if (code != HDRSIZE) {
633 tlen = (length > sizeof(tbuffer) ? sizeof(tbuffer) : length);
634 #ifndef AFS_PTHREAD_ENV
638 nbytes = rx_Read(rxcall, tbuffer, tlen);
639 if (nbytes != tlen) {
640 ubik_dprint("Rx-read bulk error=%d\n", code = BULK_ERROR);
645 nbytes = write(fd, tbuffer, tlen);
647 if (nbytes != tlen) {
658 code = EndDISK_GetFile(rxcall, &tversion);
660 tcode = rx_EndCall(rxcall, code);
664 /* we got a new file, set up its header */
665 urecovery_state |= UBIK_RECHAVEDB;
666 memcpy(&ubik_dbase->version, &tversion,
667 sizeof(struct ubik_version));
668 afs_snprintf(tbuffer, sizeof(tbuffer), "%s.DB%s%d", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
670 afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
671 code = unlink(pbuffer);
673 code = rename(tbuffer, pbuffer);
674 afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
677 code = rename(pbuffer, tbuffer);
679 (*ubik_dbase->open) (ubik_dbase, file);
680 /* after data is good, sync disk with correct label */
682 (*ubik_dbase->setlabel) (ubik_dbase, 0,
683 &ubik_dbase->version);
686 afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
693 * We will effectively invalidate the old data forever now.
694 * Unclear if we *should* but we do.
696 ubik_dbase->version.epoch = 0;
697 ubik_dbase->version.counter = 0;
698 ubik_print("Ubik: Synchronize database failed (error = %d)\n",
701 ubik_print("Ubik: Synchronize database completed\n");
702 urecovery_state |= UBIK_RECHAVEDB;
704 udisk_Invalidate(ubik_dbase, 0); /* data has changed */
705 #ifdef AFS_PTHREAD_ENV
706 CV_BROADCAST(&ubik_dbase->version_cond);
708 LWP_NoYieldSignal(&ubik_dbase->version);
712 #if defined(UBIK_PAUSE)
713 if (!(urecovery_state & UBIK_RECSYNCSITE))
714 continue; /* lost sync */
715 #endif /* UBIK_PAUSE */
716 if (!(urecovery_state & UBIK_RECHAVEDB))
717 continue; /* not ready */
719 /* If the database was newly initialized, then when we establish quorum, write
720 * a new label. This allows urecovery_AllBetter() to allow access for reads.
721 * Setting it to 2 also allows another site to come along with a newer
722 * database and overwrite this one.
724 if (ubik_dbase->version.epoch == 1) {
726 urecovery_AbortAll(ubik_dbase);
728 ubik_dbase->version.epoch = ubik_epochTime;
729 ubik_dbase->version.counter = 1;
731 (*ubik_dbase->setlabel) (ubik_dbase, 0, &ubik_dbase->version);
732 udisk_Invalidate(ubik_dbase, 0); /* data may have changed */
733 #ifdef AFS_PTHREAD_ENV
734 CV_BROADCAST(&ubik_dbase->version_cond);
736 LWP_NoYieldSignal(&ubik_dbase->version);
741 /* Check the other sites and send the database to them if they
742 * do not have the current db.
744 if (!(urecovery_state & UBIK_RECSENTDB)) {
745 /* now propagate out new version to everyone else */
746 dbok = 1; /* start off assuming they all worked */
750 * Check if a write transaction is in progress. We can't send the
751 * db when a write is in progress here because the db would be
752 * obsolete as soon as it goes there. Also, ops after the begin
753 * trans would reach the recepient and wouldn't find a transaction
754 * pending there. Frankly, I don't think it's possible to get past
755 * the write-lock above if there is a write transaction in progress,
756 * but then, it won't hurt to check, will it?
758 if (ubik_dbase->flags & DBWRITING) {
763 while ((ubik_dbase->flags & DBWRITING) && (safety < 500)) {
765 /* sleep for a little while */
766 #ifdef AFS_PTHREAD_ENV
767 select(0, 0, 0, 0, &tv);
769 IOMGR_Select(0, 0, 0, 0, &tv);
777 for (ts = ubik_servers; ts; ts = ts->next) {
778 inAddr.s_addr = ts->addr[0];
780 ubik_dprint("recovery cannot send version to %s\n",
781 afs_inet_ntoa_r(inAddr.s_addr, hoststr));
785 ubik_dprint("recovery sending version to %s\n",
786 afs_inet_ntoa_r(inAddr.s_addr, hoststr));
787 if (vcmp(ts->version, ubik_dbase->version) != 0) {
788 ubik_dprint("recovery stating local database\n");
790 /* Rx code to do the Bulk Store */
791 code = (*ubik_dbase->stat) (ubik_dbase, 0, &ubikstat);
793 length = ubikstat.size;
795 rxcall = rx_NewCall(ts->disk_rxcid);
797 StartDISK_SendFile(rxcall, file, length,
798 &ubik_dbase->version);
800 ubik_dprint("StartDiskSendFile failed=%d\n",
807 sizeof(tbuffer) ? sizeof(tbuffer) : length);
809 (*ubik_dbase->read) (ubik_dbase, file,
810 tbuffer, offset, tlen);
811 if (nbytes != tlen) {
812 ubik_dprint("Local disk read error=%d\n",
816 nbytes = rx_Write(rxcall, tbuffer, tlen);
817 if (nbytes != tlen) {
818 ubik_dprint("Rx-write bulk error=%d\n", code =
825 code = EndDISK_SendFile(rxcall);
827 code = rx_EndCall(rxcall, code);
830 /* we set a new file, process its header */
831 ts->version = ubik_dbase->version;
836 /* mark file up to date */
842 urecovery_state |= UBIK_RECSENTDB;
849 * \brief send a Probe to all the network address of this server
851 * \return 0 if success, else return 1
854 DoProbe(struct ubik_server *server)
856 struct rx_connection *conns[UBIK_MAX_INTERFACE_ADDR];
857 struct rx_connection *connSuccess = 0;
858 int i, j, success_i = -1;
862 extern afs_int32 ubikSecIndex;
863 extern struct rx_securityClass *ubikSecClass;
865 for (i = 0; (addr = server->addr[i]) && (i < UBIK_MAX_INTERFACE_ADDR);
868 rx_NewConnection(addr, ubik_callPortal, DISK_SERVICE_ID,
869 ubikSecClass, ubikSecIndex);
871 /* user requirement to use only the primary interface */
872 if (ubikPrimaryAddrOnly) {
877 osi_Assert(i); /* at least one interface address for this server */
879 #ifdef AFS_PTHREAD_ENV
885 if (!multi_error) { /* first success */
892 #ifdef AFS_PTHREAD_ENV
896 if (success_i >= 0) {
897 addr = server->addr[success_i]; /* successful interface addr */
899 if (server->disk_rxcid) /* destroy existing conn */
900 rx_DestroyConnection(server->disk_rxcid);
901 if (server->vote_rxcid)
902 rx_DestroyConnection(server->vote_rxcid);
904 /* make new connections */
905 server->disk_rxcid = conns[success_i];
906 server->vote_rxcid = rx_NewConnection(addr, ubik_callPortal,
907 VOTE_SERVICE_ID, ubikSecClass,
910 connSuccess = conns[success_i];
911 strcpy(buffer, afs_inet_ntoa_r(server->addr[0], hoststr));
913 ubik_print("ubik:server %s is back up: will be contacted through %s\n",
914 buffer, afs_inet_ntoa_r(addr, hoststr));
917 /* Destroy all connections except the one on which we succeeded */
918 for (j = 0; j < i; j++)
919 if (conns[j] != connSuccess)
920 rx_DestroyConnection(conns[j]);
923 ubik_dprint("ubik:server %s still down\n",
924 afs_inet_ntoa_r(server->addr[0], hoststr));
927 return 0; /* success */
929 return 1; /* failure */