NFSv4: Add missing nfs_put_lock_context()
authorNeilBrown <neilb@suse.com>
Tue, 6 Dec 2016 20:50:06 +0000 (15:50 -0500)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 7 Dec 2016 18:41:58 +0000 (13:41 -0500)
Otherwise the lock context won't be freed when we're done with it.

From: NeilBrown <neilb@suse.com>
Fixes: 5bd3f817 ("NFSv4: change nfs4_select_rw_stateid to take a lock_context inplace of lock_owner")
Signed-off-by: Anna Schumaker <Anna.Schumaker@netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/nfs4proc.c

index 4fd0e2b7b08e1d1c52916bfa791c95e774ca1253..d3431ff326620cca2580d62bc88c756e2b39d29e 100644 (file)
@@ -2955,8 +2955,10 @@ static int _nfs4_do_setattr(struct inode *inode,
                l_ctx = nfs_get_lock_context(ctx);
                if (IS_ERR(l_ctx))
                        return PTR_ERR(l_ctx);
-               if (nfs4_select_rw_stateid(ctx->state, FMODE_WRITE, l_ctx,
-                               &arg->stateid, &delegation_cred) == -EIO)
+               status = nfs4_select_rw_stateid(ctx->state, FMODE_WRITE, l_ctx,
+                                               &arg->stateid, &delegation_cred);
+               nfs_put_lock_context(l_ctx);
+               if (status == -EIO)
                        return -EBADF;
        } else
                nfs4_stateid_copy(&arg->stateid, &zero_stateid);