]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
viced-client-keep-conn-ref-20060329
authorDerrick Brashear <shadow@dementia.org>
Wed, 29 Mar 2006 06:26:49 +0000 (06:26 +0000)
committerDerrick Brashear <shadow@dementia.org>
Wed, 29 Mar 2006 06:26:49 +0000 (06:26 +0000)
FIXES 28966

keep a ref on the conn the client has a pointer to

src/viced/host.c

index 066036e2749b97150fdd0957107a6ff0ad1c7249..bb1f172f45eaf89b17021ca83c69ac34f9f7bf11 100644 (file)
@@ -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);