From e4961402747d02f51b0ea82aad7f0d4f774dbeac Mon Sep 17 00:00:00 2001 From: Rainer Toebbicke Date: Thu, 13 Jan 2005 23:55:27 +0000 Subject: [PATCH] lih-host-hold-20050113 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 | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/viced/callback.c b/src/viced/callback.c index cd900634a..642a55117 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -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 { -- 2.39.5