From: Weston Andros Adamson Date: Mon, 15 Sep 2014 18:14:42 +0000 (-0400) Subject: nfs: fix error handling in lock_and_join_requests X-Git-Tag: v3.16.4~189 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae3f3485448578097a115f341733d938c357c46b;p=thirdparty%2Fkernel%2Fstable.git nfs: fix error handling in lock_and_join_requests 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 Signed-off-by: Weston Andros Adamson Reviewed-by: Peng Tao Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/nfs/write.c b/fs/nfs/write.c index c8eb14eb6659c..014d23c7d16e5 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 { /*