rx: Remove delays in multi_End_Ignore
[openafs.git] / src / ubik / recovery.c
index 27a3588..e622505 100644 (file)
@@ -159,8 +159,20 @@ urecovery_CheckTid(struct ubik_tid *atid, int abortalways)
        if (atid->epoch != ubik_currentTrans->tid.epoch
            || atid->counter > ubik_currentTrans->tid.counter || abortalways) {
            /* don't match, abort it */
+           int endit = 0;
            /* If the thread is not waiting for lock - ok to end it */
            if (ubik_currentTrans->locktype != LOCKWAIT) {
+               endit = 1;
+           }
+
+           ViceLog(0, ("urecovery_CheckTid: Aborting/ending bad remote "
+                       "transaction. (tx %d.%d, atid %d.%d, abortalways %d, "
+                       "endit %d)\n",
+                       ubik_currentTrans->tid.epoch,
+                       ubik_currentTrans->tid.counter,
+                       atid->epoch, atid->counter,
+                       abortalways, endit));
+           if (endit) {
                udisk_end(ubik_currentTrans);
            }
            ubik_currentTrans = (struct ubik_trans *)0;
@@ -382,11 +394,6 @@ InitializeDB(struct ubik_dbase *adbase)
            adbase->version.counter = 0;
            (*adbase->setlabel) (adbase, 0, &adbase->version);
        }
-#ifdef AFS_PTHREAD_ENV
-       opr_cv_broadcast(&adbase->version_cond);
-#else
-       LWP_NoYieldSignal(&adbase->version);
-#endif
        UBIK_VERSION_UNLOCK;
     }
     return 0;
@@ -465,7 +472,9 @@ urecovery_Interact(void *dummy)
     int fd = -1;
     afs_int32 pass;
 
-    afs_pthread_setname_self("recovery");
+    memset(pbuffer, 0, sizeof(pbuffer));
+
+    opr_threadname_set("recovery");
 
     /* otherwise, begin interaction */
     urecovery_state = 0;
@@ -601,6 +610,8 @@ urecovery_Interact(void *dummy)
            /* we don't have the best version; we should fetch it. */
            urecovery_AbortAll(ubik_dbase);
 
+           pbuffer[0] = '\0';
+
            /* Rx code to do the Bulk fetch */
            file = 0;
            offset = 0;
@@ -716,7 +727,9 @@ urecovery_Interact(void *dummy)
 #endif
            }
            if (code) {
-               unlink(pbuffer);
+               if (pbuffer[0] != '\0') {
+                   unlink(pbuffer);
+               }
                /*
                 * We will effectively invalidate the old data forever now.
                 * Unclear if we *should* but we do.
@@ -739,11 +752,6 @@ urecovery_Interact(void *dummy)
                urecovery_state |= UBIK_RECHAVEDB;
            }
            udisk_Invalidate(ubik_dbase, 0);    /* data has changed */
-#ifdef AFS_PTHREAD_ENV
-           opr_cv_broadcast(&ubik_dbase->version_cond);
-#else
-           LWP_NoYieldSignal(&ubik_dbase->version);
-#endif
        }
        if (!(urecovery_state & UBIK_RECHAVEDB)) {
            DBRELE(ubik_dbase);
@@ -764,11 +772,6 @@ urecovery_Interact(void *dummy)
                (*ubik_dbase->setlabel) (ubik_dbase, 0, &ubik_dbase->version);
            UBIK_VERSION_UNLOCK;
            udisk_Invalidate(ubik_dbase, 0);    /* data may have changed */
-#ifdef AFS_PTHREAD_ENV
-           opr_cv_broadcast(&ubik_dbase->version_cond);
-#else
-           LWP_NoYieldSignal(&ubik_dbase->version);
-#endif
        }
 
        /* Check the other sites and send the database to them if they
@@ -787,11 +790,11 @@ urecovery_Interact(void *dummy)
             * the write-lock above if there is a write transaction in progress,
             * but then, it won't hurt to check, will it?
             */
-           if (ubik_dbase->flags & DBWRITING) {
+           if (ubik_dbase->dbFlags & DBWRITING) {
                struct timeval tv;
                int safety = 0;
                long cur_usec = 50000;
-               while ((ubik_dbase->flags & DBWRITING) && (safety < 500)) {
+               while ((ubik_dbase->dbFlags & DBWRITING) && (safety < 500)) {
                    DBRELE(ubik_dbase);
                    /* sleep for a little while */
                    tv.tv_sec = 0;
@@ -943,7 +946,7 @@ DoProbe(struct ubik_server *server)
 
            multi_Abort;
        }
-    } multi_End_Ignore;
+    } multi_End;
 
     if (success_i >= 0) {
        UBIK_ADDR_LOCK;