h-release-r-should-try-harder-to-reap-deleted-hosts-20011008
authorDerrick Brashear <shadow@dementia.org>
Wed, 10 Oct 2001 15:00:54 +0000 (15:00 +0000)
committerDerrick Brashear <shadow@dementia.org>
Wed, 10 Oct 2001 15:00:54 +0000 (15:00 +0000)
based on complaint from and work with jimmy@e.kth.se

h_OtherHolds_r will never return 0 if we mask our own hold
bit before calling it. however we must be careful to mask before h_TossStuff_r
so we aren't still "holding" then

otherwise just release our hold

====================
This delta was composed from multiple commits as part of the CVS->Git migration.
The checkin message with each commit was inconsistent.
The following are the additional commit messages.
====================

mask holdbit in case i missed

src/viced/host.c

index 79d3fe3..31c044d 100644 (file)
@@ -270,14 +270,20 @@ int h_Release_r(host)
     register struct host *host;
 {      
     
-    if (!((host)->holds[h_holdSlot()] &= ~h_holdbit()) ) {
+    if (!((host)->holds[h_holdSlot()] & ~h_holdbit()) ) {
        if (! h_OtherHolds_r(host) ) {
+           /* must avoid masking this until after h_OtherHolds_r runs
+              but it should be run before h_TossStuff_r */
+           (host)->holds[h_holdSlot()] &= ~h_holdbit();
            if ( (host->hostFlags & HOSTDELETED) || 
                (host->hostFlags & CLIENTDELETED) ) {
                h_TossStuff_r(host);
            }           
-       }
-    }
+       } else 
+           (host)->holds[h_holdSlot()] &= ~h_holdbit();
+    } else 
+      (host)->holds[h_holdSlot()] &= ~h_holdbit();
+
     return 0;
 }