]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-check-host-optimize-20060123
authorJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 23 Jan 2006 21:28:43 +0000 (21:28 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 23 Jan 2006 21:28:43 +0000 (21:28 +0000)
There should never be a case where h_Enumerate calls CheckHost with a
host whose callback_rxcon that is NULL.  However, due to a bug it ended up
being the case that it happened.  An examination of the CheckHost code
showed that the check for the HOSTDELETED flag should take place before
a reference to callback_rxcon is obtained.  If HOSTDELETED were set, the
code would simply release the reference immediately.  However, the process
of obtaining and releasing the reference required dropping and obtaining
locks that would be a performance hit.

(cherry picked from commit ff40c87da3ce4c6a7a58c08eaa223e8760dc8f73)

src/viced/host.c

index df94db09b1eb6c5064a12ae10ec2ebf480f46753..38c12651523fb7d154b328c97ad579c13d2b98ff 100644 (file)
@@ -2205,9 +2205,9 @@ CheckHost(register struct host *host, int held)
     }
     if (host->LastCall < checktime) {
        h_Lock_r(host);
-       cb_conn = host->callback_rxcon;
-       rx_GetConnection(cb_conn);
        if (!(host->hostFlags & HOSTDELETED)) {
+           cb_conn = host->callback_rxcon;
+           rx_GetConnection(cb_conn);
            if (host->LastCall < clientdeletetime) {
                host->hostFlags |= HOSTDELETED;
                if (!(host->hostFlags & VENUSDOWN)) {
@@ -2272,11 +2272,11 @@ CheckHost(register struct host *host, int held)
                    }
                }
            }
+           H_UNLOCK;
+           rx_PutConnection(cb_conn);
+           cb_conn=NULL;
+           H_LOCK;
        }
-       H_UNLOCK;
-       rx_PutConnection(cb_conn);
-       cb_conn=NULL;
-       H_LOCK;
        h_Unlock_r(host);
     }
     H_UNLOCK;