From: Jeff Layton Date: Tue, 8 Jul 2014 18:02:50 +0000 (-0400) Subject: nfsd: reduce some spinlocking in put_client_renew X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d6c249b4d4cfef894cbda224a7a063d17aacb60a;p=linux-beck.git 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 Reviewed-by: Christoph Hellwig Signed-off-by: J. Bruce Fields --- 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); }