]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nfs: fix error handling in lock_and_join_requests
authorWeston Andros Adamson <dros@primarydata.com>
Mon, 15 Sep 2014 18:14:42 +0000 (14:14 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 5 Oct 2014 20:41:01 +0000 (13:41 -0700)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/write.c

index c8eb14eb6659c576c5c6365b5b09c4a4453e1192..014d23c7d16e5419203bf91304dd483bb52f29ca 100644 (file)
@@ -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 {
                /*