Patch "nfs: fix nonblocking calls to nfs_page_group_lock" has been added to the 3.16-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    nfs: fix nonblocking calls to nfs_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-fix-nonblocking-calls-to-nfs_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:49:33 2014
From: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
Date: Mon, 15 Sep 2014 14:14:40 -0400
Subject: nfs: fix nonblocking calls to nfs_page_group_lock
To: stable@xxxxxxxxxxxxxxx
Cc: Weston Andros Adamson <dros@xxxxxxxxxxxxxxx>, linux-nfs@xxxxxxxxxxxxxxx
Message-ID: <1410804885-17228-10-git-send-email-trond.myklebust@xxxxxxxxxxxxxxx>


From: Weston Andros Adamson <dros@xxxxxxxxxxxxxxx>

commit bc8a309e88a86205fc3e17f06e42a2e56fc6f807 upstream.

nfs_page_group_lock was calling wait_on_bit_lock even when told not to
block. Fix by first trying test_and_set_bit, followed by wait_on_bit_lock
if and only if blocking is allowed.  Return -EAGAIN if nonblocking and the
test_and_set of the bit was already locked.

Signed-off-by: Weston Andros Adamson <dros@xxxxxxxxxxxxxxx>
Reviewed-by: Peng Tao <tao.peng@xxxxxxxxxxxxxxx>
Signed-off-by: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 fs/nfs/pagelist.c |   23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -149,24 +149,29 @@ static int nfs_wait_bit_uninterruptible(
  *
  * this lock must be held if modifying the page group list
  *
- * returns result from wait_on_bit_lock: 0 on success, < 0 on error
+ * return 0 on success, < 0 on error: -EDELAY if nonblocking or the
+ * result from wait_on_bit_lock
+ *
+ * NOTE: calling with nonblock=false should always have set the
+ *       lock bit (see fs/buffer.c and other uses of wait_on_bit_lock
+ *       with TASK_UNINTERRUPTIBLE), so there is no need to check the result.
  */
 int
 nfs_page_group_lock(struct nfs_page *req, bool nonblock)
 {
 	struct nfs_page *head = req->wb_head;
-	int ret;
 
 	WARN_ON_ONCE(head != head->wb_head);
 
-	do {
-		ret = wait_on_bit_lock(&head->wb_flags, PG_HEADLOCK,
-			nfs_wait_bit_uninterruptible,
-			TASK_UNINTERRUPTIBLE);
-	} while (!nonblock && ret != 0);
+	if (!test_and_set_bit(PG_HEADLOCK, &head->wb_flags))
+		return 0;
+
+	if (!nonblock)
+		return wait_on_bit_lock(&head->wb_flags, PG_HEADLOCK,
+				nfs_wait_bit_uninterruptible,
+				TASK_UNINTERRUPTIBLE);
 
-	WARN_ON_ONCE(ret > 0);
-	return ret;
+	return -EAGAIN;
 }
 
 /*


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




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]