viced-deadlock-20060620

FIXES 34073

* checks for client == oldClient

* drops the H_LOCK prior to obtaining the WriteLock on oldClient
  in order to prevent a deadlock
This commit is contained in:
Rainer Toebbicke 2006-06-20 15:50:17 +00:00 committed by Jeffrey Altman
parent 1833072cc8
commit efd74baa95

View File

@ -1796,7 +1796,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) {
@ -1819,8 +1819,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",