NFS: nfs41_walk_client_list(): re-lock before iterating
authorChuck Lever <chuck.lever@oracle.com>
Tue, 2 Oct 2012 16:18:12 +0000 (09:18 -0700)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Tue, 2 Oct 2012 16:25:02 +0000 (09:25 -0700)
Sparse identified an execution path in nfs41_walk_client_list()
where the nfs_client_lock is not re-acquired before taking the next
loop iteration.

fs/nfs/nfs4client.c:437:9: sparse: context imbalance in
 'nfs41_walk_client_list' - different lock contexts for basic block

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/nfs4client.c

index 8466e6046ff555d3c9a58f1bef900f5ef7eb7f3e..6bacfde1319a76945a9ab9634e453f8a61def8ce 100644 (file)
@@ -450,6 +450,7 @@ int nfs41_walk_client_list(struct nfs_client *new,
                        error = nfs_wait_client_init_complete(pos);
                        if (error < 0) {
                                nfs_put_client(pos);
+                               spin_lock(&nn->nfs_client_lock);
                                continue;
                        }