nfs: fix error handling in lock_and_join_requests
authorWeston Andros Adamson <dros@primarydata.com>
Fri, 8 Aug 2014 15:00:56 +0000 (11:00 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Fri, 22 Aug 2014 22:04:43 +0000 (18:04 -0400)
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

index 27715306f24bbf3f400bfeee7376a2e929fb214d..e056f617adf2f927bcc86b8cda118479a9588bee 100644 (file)
@@ -480,8 +480,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 {
                /*