From: Derrick Brashear Date: Wed, 29 Mar 2006 06:26:49 +0000 (+0000) Subject: viced-client-keep-conn-ref-20060329 X-Git-Tag: openafs-devel-1_5_1~50 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=2c96a91ba42674e35ca7d54c0c20a1725b733e37;p=packages%2Fo%2Fopenafs.git viced-client-keep-conn-ref-20060329 FIXES 28966 keep a ref on the conn the client has a pointer to --- diff --git a/src/viced/host.c b/src/viced/host.c index 066036e27..bb1f172f4 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -751,6 +751,7 @@ h_TossStuff_r(register struct host *host) client->CPS.prlist_val = NULL; if (client->tcon) { rx_SetSpecific(client->tcon, rxcon_client_key, (void *)0); + rx_PutConnection(client->tcon); } CurrentConnections--; *cp = client->next; @@ -781,8 +782,10 @@ h_TossStuff_r(register struct host *host) * destroying the connection. */ client = rx_GetSpecific(rxconn, rxcon_client_key); - if (client && client->tcon == rxconn) + if (client && client->tcon == rxconn) { + rx_PutConnection(client->tcon); client->tcon = NULL; + } rx_SetSpecific(rxconn, rxcon_client_key, (void *)0); rx_DestroyConnection(rxconn); } @@ -851,8 +854,10 @@ h_FreeConnection(struct rx_connection *tcon) client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key); if (client) { H_LOCK; - if (client->tcon == tcon) + if (client->tcon == tcon) { + rx_PutConnection(client->tcon); client->tcon = NULL; + } H_UNLOCK; } return 0; @@ -1717,14 +1722,15 @@ h_FindClient_r(struct rx_connection *tcon) (struct client *)rx_GetSpecific(client->tcon, rxcon_client_key); if (oldClient) { - if (oldClient == client) + if (oldClient == client) { rx_SetSpecific(client->tcon, rxcon_client_key, NULL); - else + } else ViceLog(0, ("Client-conn mismatch: CL1=%x, CN=%x, CL2=%x\n", client, client->tcon, oldClient)); } + rx_PutConnection(client->tcon); client->tcon = (struct rx_connection *)0; } client->refCount++; @@ -1848,6 +1854,7 @@ h_FindClient_r(struct rx_connection *tcon) oldClient->refCount++; client = oldClient; } else { + rx_PutConnection(oldClient->tcon); oldClient->tcon = (struct rx_connection *)0; ViceLog(0, ("FindClient: deleted client %x(%x) already had conn %x (host %s:%d), stolen by client %x(%x)\n", oldClient, oldClient->sid, tcon, @@ -1865,6 +1872,7 @@ h_FindClient_r(struct rx_connection *tcon) h_Unlock_r(host); CurrentConnections++; /* increment number of connections */ } + rx_GetConnection(tcon); client->tcon = tcon; rx_SetSpecific(tcon, rxcon_client_key, client); ReleaseWriteLock(&client->lock);