Skip to contentSkip to conversation

NFSv4: Add missing nfs_put_lock_context()

PATCH New [email protected] 1 participant 1 message Dec 6, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFSv4: Add missing nfs_put_lock_context()

From: NeilBrown <[email protected]>

Otherwise the lock context won't be freed when we're done with it.

From: NeilBrown <[email protected]>

Fixes 5bd3f817 ("NFSv4: change nfs4_select_rw_stateid to take a lock_context inplace of lock_owner")
---
 fs/nfs/nfs4proc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +4 -2
index f992281..21c861a 100644
@@ -2951,8 +2951,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);
Signature · 1 line
2.10.2