]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
lih-host-hold-20050113
authorRainer Toebbicke <rtb@pclella.cern.ch>
Thu, 13 Jan 2005 23:55:27 +0000 (23:55 +0000)
committerDerrick Brashear <shadow@dementia.org>
Thu, 13 Jan 2005 23:55:27 +0000 (23:55 +0000)
FIXES 17211

"lih_r now leaves the current lih_host held, and h_Releases those for which
it changed mind during h_Enumerate. It also closes the window that
ClearHostCallbacks_r opens.

The problem was: due to the leak on the h_Hold table, rx connections and
host and client structures stopped being garbage collected once the
fileserver went through GetSomeSpace_r. Only relevant for "busy" servers,
many would never even invoke this routine."

src/viced/callback.c

index cd900634a9c3732bf44744df0b7dfb44f93ca044..642a5511755ead6c125e74e921e891f3efa7fc92 100644 (file)
@@ -1552,21 +1552,21 @@ CleanupTimedOutCallBacks_r(void)
 }
 
 static struct host *lih_host;
-static int lih_host_held = 0;
+static int lih_host_held;
 
 static int
 lih_r(register struct host *host, register int held,
       register struct host *hostp)
 {
-    lih_host_held = 0;
     if (host->cblist
        && ((hostp && host != hostp) || (!held && !h_OtherHolds_r(host)))
        && (!lih_host || host->ActiveCall < lih_host->ActiveCall)) {
+       if (lih_host != NULL && lih_host_held) {
+           h_Release_r(lih_host);
+       }
        lih_host = host;
-    }
-    if (!held) {
+       lih_host_held = !held;
        held = 1;
-       lih_host_held = 1;
     }
     return held;
 }
@@ -1594,13 +1594,15 @@ GetSomeSpace_r(struct host *hostp, int locked)
        h_Enumerate_r(lih_r, hp2, (char *)hp1);
        hp = lih_host;
        if (hp) {
+           /* set in lih_r! private copy before giving up H_LOCK */
+           int lih_host_held2=lih_host_held;   
            cbstuff.GSS4++;
            if (!ClearHostCallbacks_r(hp, 0 /* not locked or held */ )) {
-               if (lih_host_held
+               if (lih_host_held2)
                    h_Release_r(hp);
                return 0;
            }
-           if (lih_host_held
+           if (lih_host_held2)
                h_Release_r(hp);
            hp2 = hp->next;
        } else {