diff options
author | Jeff Layton <jlayton@primarydata.com> | 2014-07-08 14:02:50 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-07-10 13:41:00 -0400 |
commit | d6c249b4d4cfef894cbda224a7a063d17aacb60a (patch) | |
tree | b1b1463323ecb7bcbad5238ba7bdefa9a90a1572 /fs/nfsd/nfs4state.c | |
parent | dff1399f8addf7129c49bb2227469da79cc30b47 (diff) | |
download | lwn-d6c249b4d4cfef894cbda224a7a063d17aacb60a.tar.gz lwn-d6c249b4d4cfef894cbda224a7a063d17aacb60a.zip |
nfsd: reduce some spinlocking in put_client_renew
No need to take the lock unless the count goes to 0.
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 63c142059137..3704789ca4b7 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -193,8 +193,10 @@ static void put_client_renew(struct nfs4_client *clp) { struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); - spin_lock(&nn->client_lock); - put_client_renew_locked(clp); + if (!atomic_dec_and_lock(&clp->cl_refcount, &nn->client_lock)) + return; + if (!is_client_expired(clp)) + renew_client_locked(clp); spin_unlock(&nn->client_lock); } |