This is a note to let you know that I've just added the patch titled nfs: check wait_on_bit_lock err in page_group_lock to the 3.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: nfs-check-wait_on_bit_lock-err-in-page_group_lock.patch and it can be found in the queue-3.16 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From trond.myklebust@xxxxxxxxxxxxxxx Thu Oct 2 16:48:54 2014 From: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx> Date: Mon, 15 Sep 2014 14:14:36 -0400 Subject: nfs: check wait_on_bit_lock err in page_group_lock To: stable@xxxxxxxxxxxxxxx Cc: Weston Andros Adamson <dros@xxxxxxxxxxxxxxx>, linux-nfs@xxxxxxxxxxxxxxx Message-ID: <1410804885-17228-6-git-send-email-trond.myklebust@xxxxxxxxxxxxxxx> From: Weston Andros Adamson <dros@xxxxxxxxxxxxxxx> commit e7029206ff43f6cf7d6fcb741adb126f47200516 upstream. Return errors from wait_on_bit_lock from nfs_page_group_lock. Add a bool argument @wait to nfs_page_group_lock. If true, loop over wait_on_bit_lock until it returns cleanly. If false, return the error from wait_on_bit_lock. Signed-off-by: Weston Andros Adamson <dros@xxxxxxxxxxxxxxx> Signed-off-by: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/nfs/pagelist.c | 29 +++++++++++++++++++++++------ fs/nfs/write.c | 6 ++++-- include/linux/nfs_page.h | 2 +- 3 files changed, 28 insertions(+), 9 deletions(-) --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -147,17 +147,25 @@ static int nfs_wait_bit_uninterruptible( * @req - request in group that is to be locked * * this lock must be held if modifying the page group list + * + * returns result from wait_on_bit_lock: 0 on success, < 0 on error */ -void -nfs_page_group_lock(struct nfs_page *req) +int +nfs_page_group_lock(struct nfs_page *req, bool wait) { struct nfs_page *head = req->wb_head; + int ret; WARN_ON_ONCE(head != head->wb_head); - wait_on_bit_lock(&head->wb_flags, PG_HEADLOCK, + do { + ret = wait_on_bit_lock(&head->wb_flags, PG_HEADLOCK, nfs_wait_bit_uninterruptible, TASK_UNINTERRUPTIBLE); + } while (wait && ret != 0); + + WARN_ON_ONCE(ret > 0); + return ret; } /* @@ -218,7 +226,7 @@ bool nfs_page_group_sync_on_bit(struct n { bool ret; - nfs_page_group_lock(req); + nfs_page_group_lock(req, true); ret = nfs_page_group_sync_on_bit_locked(req, bit); nfs_page_group_unlock(req); @@ -859,8 +867,13 @@ static int __nfs_pageio_add_request(stru struct nfs_page *subreq; unsigned int bytes_left = 0; unsigned int offset, pgbase; + int ret; - nfs_page_group_lock(req); + ret = nfs_page_group_lock(req, false); + if (ret < 0) { + desc->pg_error = ret; + return 0; + } subreq = req; bytes_left = subreq->wb_bytes; @@ -882,7 +895,11 @@ static int __nfs_pageio_add_request(stru if (desc->pg_recoalesce) return 0; /* retry add_request for this subreq */ - nfs_page_group_lock(req); + ret = nfs_page_group_lock(req, false); + if (ret < 0) { + desc->pg_error = ret; + return 0; + } continue; } --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -216,7 +216,7 @@ static bool nfs_page_group_covers_page(s unsigned int pos = 0; unsigned int len = nfs_page_length(req->wb_page); - nfs_page_group_lock(req); + nfs_page_group_lock(req, true); do { tmp = nfs_page_group_search_locked(req->wb_head, pos); @@ -456,7 +456,9 @@ try_again: } /* lock each request in the page group */ - nfs_page_group_lock(head); + ret = nfs_page_group_lock(head, false); + if (ret < 0) + return ERR_PTR(ret); subreq = head; do { /* --- a/include/linux/nfs_page.h +++ b/include/linux/nfs_page.h @@ -120,7 +120,7 @@ extern size_t nfs_generic_pg_test(struct extern int nfs_wait_on_request(struct nfs_page *); extern void nfs_unlock_request(struct nfs_page *req); extern void nfs_unlock_and_release_request(struct nfs_page *); -extern void nfs_page_group_lock(struct nfs_page *); +extern int nfs_page_group_lock(struct nfs_page *, bool); extern void nfs_page_group_unlock(struct nfs_page *); extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int); Patches currently in stable-queue which might be from trond.myklebust@xxxxxxxxxxxxxxx are queue-3.16/nfs-move-nfs_pgio_data-and-remove-nfs_rw_header.patch queue-3.16/nfs-use-blocking-page_group_lock-in-add_request.patch queue-3.16/nfs-remove-pgio_header-refcount-related-cleanup.patch queue-3.16/pnfs-add-pnfs_put_lseg_async.patch queue-3.16/nfs-can_coalesce_requests-must-enforce-contiguity.patch queue-3.16/nfs-disallow-duplicate-pages-in-pgio-page-vectors.patch queue-3.16/nfs-fix-error-handling-in-lock_and_join_requests.patch queue-3.16/nfs-change-nfs_page_group_lock-argument.patch queue-3.16/nfsv4-nfs4_state_manager-vs.-nfs_server_remove_lists.patch queue-3.16/nfsv4-fix-another-bug-in-the-close-open_downgrade-code.patch queue-3.16/nfs-check-wait_on_bit_lock-err-in-page_group_lock.patch queue-3.16/nfs-don-t-sleep-with-inode-lock-in-lock_and_join_requests.patch queue-3.16/nfs-rename-members-of-nfs_pgio_data.patch queue-3.16/nfs-fix-nonblocking-calls-to-nfs_page_group_lock.patch queue-3.16/nfs-merge-nfs_pgio_data-into-_header.patch queue-3.16/nfs-clear_request_commit-while-holding-i_lock.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html