viced-shutdown-avoid-deadlock-20030424
authorRainer Toebbicke <rtb@pclella.cern.ch>
Thu, 24 Apr 2003 14:37:15 +0000 (14:37 +0000)
committerDerrick Brashear <shadow@dementia.org>
Thu, 24 Apr 2003 14:37:15 +0000 (14:37 +0000)
don't deadlock on H_LOCK if we need to shut down in an emergency

src/viced/callback.c
src/viced/viced.c

index f3c3af9..11348a1 100644 (file)
@@ -445,7 +445,7 @@ static int CDel(struct CallBack *cb, int deletefe)
        assert(0);
        ViceLog(0,("CDel: Internal Error -- shutting down: wanted %d from %d, now at %d\n",cbi,fe->firstcb,*cbp));
        DumpCallBackState();
-       ShutDown();
+       ShutDownAndCore(PANIC);
       }
     }
     CDelPtr(fe, cbp, deletefe);
@@ -488,7 +488,7 @@ static afs_uint32 *FindCBPtr(struct FileEntry *fe, struct host *host)
        if (safety > cbstuff.nblks) {
          ViceLog(0,("FindCBPtr: Internal Error -- shutting down.\n"));
          DumpCallBackState();
-         ShutDown();
+         ShutDownAndCore(PANIC);
        }
        cb = itocb(*cbp);
        if (cb->hhead == hostindex)
@@ -674,7 +674,7 @@ static int AddCallBack1_r(struct host *host, AFSFid *fid, afs_uint32 *thead,
        if (safety > cbstuff.nblks) {
          ViceLog(0,("AddCallBack1: Internal Error -- shutting down.\n"));
          DumpCallBackState();
-         ShutDown();
+         ShutDownAndCore(PANIC);
        }
        if (cb->hhead == h_htoi(host))
            break;
@@ -1460,7 +1460,7 @@ int CleanupTimedOutCallBacks_r(void)
                if (ntimedout > cbstuff.nblks) {
                  ViceLog(0,("CCB: Internal Error -- shutting down...\n"));
                  DumpCallBackState();
-                 ShutDown();
+                 ShutDownAndCore(PANIC);
                }
            } while (cbi != *thead);
            *thead = 0;
index fc5370f..c3a3783 100644 (file)
@@ -589,7 +589,7 @@ void ShutDownAndCore(int dopanic)
     }
 #endif
     DFlush();
-    PrintCounters();
+    if (!dopanic) PrintCounters();
 
     /* do not allows new reqests to be served from now on, all new requests
        are returned with an error code of RX_RESTARTING ( transient failure ) */