Hi,

the patch for a fileserver looping problem 

http://www.openafs.org/cgi-bin/wdelta/viced-callback-avoid-potential-looping-problem-20020201

didn't really solve the problem.

We have seen it again several times during the last months.
Below you will find a patch which we have in our production cell 
for more than two weeks.

Please take a look at it.

Regards,
Thomas.
-- 
-------------------------------------------------
Thomas M�ller, TU Chemnitz, URZ, D-09107 Chemnitz
Tel: +49 (0)371 5311755   Fax: +49 (0)371 5311629
-------------------------------------------------
diff -Naurw openafs-1.2.6.orig/src/viced/callback.c openafs-1.2.6/src/viced/callback.c
--- openafs-1.2.6.orig/src/viced/callback.c     Wed Aug 21 09:25:44 2002
+++ openafs-1.2.6/src/viced/callback.c  Wed Aug 21 11:09:36 2002
@@ -1391,16 +1391,16 @@
 
 } /*lih*/
 
-
 /* This could be upgraded to get more space each time */
 /* first pass: find the oldest host which isn't held by anyone */
 /* second pass: find the oldest host who isn't "me" */
 /* always called with hostp unlocked */
+extern struct host *hostList;
 static int GetSomeSpace_r(hostp, locked)
     struct host *hostp;
     int locked;
 {
-    register struct host *hp, *hp1 = (struct host *)0;
+    register struct host *hp, *hp1 = (struct host *)0, *hp2 = hostList;
     int i=0;
 
     cbstuff.GotSomeSpaces++;
@@ -1411,14 +1411,15 @@
     }
     do {
        lih_host = 0;
-       h_Enumerate_r(lih_r, (char *)hp1);
+       h_Enumerate_r(lih_r, hp2, (char *)hp1);
        hp = lih_host;
        if (hp) {
            cbstuff.GSS4++;
            if ( ! ClearHostCallbacks_r(hp, 0 /* not locked or held */) )
                return;
-           hp1 = hp;
+           hp2 = hp->next;
        } else {
+           hp2 = hostList;
            hp1 = hostp;
            cbstuff.GSS1++;
            ViceLog(5,("GSS: Try harder for longest inactive host cnt= %d\n", i));
diff -Naurw openafs-1.2.6.orig/src/viced/host.c openafs-1.2.6/src/viced/host.c
--- openafs-1.2.6.orig/src/viced/host.c Wed Aug 21 09:25:44 2002
+++ openafs-1.2.6/src/viced/host.c      Wed Aug 21 09:25:23 2002
@@ -914,16 +914,19 @@
     free((void *)held);
 } /*h_Enumerate*/
 
-/* h_Enumerate_r: Calls (*proc)(host, held, param) for at least each host in
- * the at the start of the enumeration (perhaps more).  Hosts may be deleted
- * (have delete flag set); ditto for clients.  (*proc) is always called with
+/* h_Enumerate_r (revised):
+ * Calls (*proc)(host, held, param) for each host in hostList, starting
+ * at enumstart
+ * Hosts may be deleted (have delete flag set); ditto for clients.
+ * (*proc) is always called with
  * host h_held() and the global host lock (H_LOCK) locked.The hold state of the
  * host with respect to this lwp is passed to (*proc) as the param held.
  * The proc should return 0 if the host should be released, 1 if it should
  * be held after enumeration.
  */
-h_Enumerate_r(proc, param)
+h_Enumerate_r(proc, enumstart, param)
     int (*proc)();
+    struct host* enumstart;
     char *param;
 
 {
@@ -933,15 +936,14 @@
     if (hostCount == 0) {
        return;
     }
-    for (host = hostList ; host ; host = host->next) {
+    for (host = enumstart ; host ; host = host->next) {
        if (!(held = h_Held_r(host)))
            h_Hold_r(host);
        held = (*proc)(host, held, param);
        if (!held)
            h_Release_r(host);/* this might free up the host */
     }
-} /*h_Enumerate*/
-
+} /*h_Enumerate_r*/
 
 /* Host is returned held */
 struct host *h_GetHost_r(tcon)

Reply via email to