NFS: Fix a reference and lock leak in nfs_lock_and_join_requests()
authorTrond Myklebust <trond.myklebust@primarydata.com>
Mon, 17 Jul 2017 14:11:11 +0000 (10:11 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 15 Aug 2017 15:54:46 +0000 (11:54 -0400)
Yes, this is a situation that should never happen (hence the WARN_ON)
but we should still ensure that we free up the locks and references to
the faulty pages.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/write.c

index bb019096c331ab28bff4d2cbb8687ef7f44eeb95..1ca75971942962163426d8eb7d23aed65b2d5222 100644 (file)
@@ -526,8 +526,7 @@ try_again:
                } else if (WARN_ON_ONCE(subreq->wb_offset < head->wb_offset ||
                            ((subreq->wb_offset + subreq->wb_bytes) >
                             (head->wb_offset + total_bytes)))) {
-                       nfs_page_group_unlock(head);
-                       spin_unlock(&inode->i_lock);
+                       nfs_unroll_locks_and_wait(inode, head, subreq);
                        return ERR_PTR(-EIO);
                }