]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DEVEL15-viced-deadlock-20060620
authorRainer Toebbicke <rtb@pclella.cern.ch>
Tue, 20 Jun 2006 15:53:18 +0000 (15:53 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 20 Jun 2006 15:53:18 +0000 (15:53 +0000)
FIXES 34073

* checks for client == oldClient

* drops the H_LOCK prior to obtaining the WriteLock on oldClient
  in order to prevent a deadlock

(cherry picked from commit efd74baa950133de6ed92b7395be6d14ef63a58e)

src/viced/host.c

index d37cdb4427862b95f7c2cb1b37f3a3d3e437363f..41f20409213b0c41c928a48f32c8bf9b5c178282 100644 (file)
@@ -1795,7 +1795,7 @@ h_FindClient_r(struct rx_connection *tcon)
      * the RPC from the other client structure's rock.
      */
     oldClient = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
-    if (oldClient && oldClient->sid == rxr_CidOf(tcon)
+    if (oldClient && oldClient != client && oldClient->sid == rxr_CidOf(tcon)
        && oldClient->VenusEpoch == rxr_GetEpoch(tcon)) {
        char hoststr[16];
        if (!oldClient->deleted) {
@@ -1818,8 +1818,10 @@ h_FindClient_r(struct rx_connection *tcon)
                FreeCE(client);
                created = 0;
            } 
-           ObtainWriteLock(&oldClient->lock);
            oldClient->refCount++;
+           H_UNLOCK;
+           ObtainWriteLock(&oldClient->lock);
+           H_LOCK;
            client = oldClient;
        } else {
            ViceLog(0, ("FindClient: deleted client %x(%x) already had conn %x (host %s:%d), stolen by client %x(%x)\n",