nfsd: reduce some spinlocking in put_client_renew
authorJeff Layton <jlayton@primarydata.com>
Tue, 8 Jul 2014 18:02:50 +0000 (14:02 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Thu, 10 Jul 2014 17:41:00 +0000 (13:41 -0400)
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>
fs/nfsd/nfs4state.c

index 63c1420..3704789 100644 (file)
@@ -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);
 }