diff mbox

[11/14] nfs: fix error handling in lock_and_join_requests

Message ID 1410804885-17228-12-git-send-email-trond.myklebust@primarydata.com (mailing list archive)
State New, archived
Headers show

Commit Message

Trond Myklebust Sept. 15, 2014, 6:14 p.m. UTC
From: Weston Andros Adamson <dros@primarydata.com>

commit 94970014c46223cbcdfbfc67b89596a412f9e3dd upstream.

This fixes handling of errors from nfs_page_group_lock in
nfs_lock_and_join_requests.  It now releases the inode lock and the
reference to the head request.

Reported-by: Peng Tao <tao.peng@primarydata.com>
Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
Reviewed-by: Peng Tao <tao.peng@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
 fs/nfs/write.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index c8eb14eb6659..014d23c7d16e 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -455,8 +455,11 @@  try_again:
 
 	/* lock each request in the page group */
 	ret = nfs_page_group_lock(head, true);
-	if (ret < 0)
+	if (ret < 0) {
+		spin_unlock(&inode->i_lock);
+		nfs_release_request(head);
 		return ERR_PTR(ret);
+	}
 	subreq = head;
 	do {
 		/*