]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
viced: Transfer host ref in h_FindClient_r
authorAndrew Deason <adeason@sinenomine.net>
Wed, 27 Apr 2011 18:51:23 +0000 (13:51 -0500)
committerDerrick Brashear <shadow@dementia.org>
Thu, 28 Apr 2011 17:12:57 +0000 (10:12 -0700)
In h_FindClient_r, we can change which client structure we're dealing
with if we find a different client struct in the Rx conn-specific
data. We adjust the refcounts for the client structures themselves,
but not the associated hosts. While the host structures should be the
same most of the time, we are not guaranteed that, so adjust their
refcounts as well.

Change-Id: I01f447da3dd2dd4306525b99049c4cd7e27f5181
Reviewed-on: http://gerrit.openafs.org/4580
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/viced/host.c

index 7cf9b76f3d29a375d5ffa59e34c1016e59627560..b1b7d88854b53d1b1856bbab23e2b455cdb20f39 100644 (file)
@@ -2563,10 +2563,15 @@ h_FindClient_r(struct rx_connection *tcon)
                created = 0;
            }
            oldClient->refCount++;
+
+           h_Hold_r(oldClient->host);
+           h_Release_r(client->host);
+
            H_UNLOCK;
            ObtainWriteLock(&oldClient->lock);
            H_LOCK;
            client = oldClient;
+           host = oldClient->host;
        } else {
            ViceLog(0, ("FindClient: deleted client %p(%x) already had "
                        "conn %p (host %s:%d), stolen by client %p(%x)\n",