This is a note to let you know that I've just added the patch titled nfs: can_coalesce_requests must enforce contiguity 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-can_coalesce_requests-must-enforce-contiguity.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:50:10 2014 From: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx> Date: Mon, 15 Sep 2014 14:14:45 -0400 Subject: nfs: can_coalesce_requests must enforce contiguity To: stable@xxxxxxxxxxxxxxx Cc: Weston Andros Adamson <dros@xxxxxxxxxxxxxxx>, linux-nfs@xxxxxxxxxxxxxxx Message-ID: <1410804885-17228-15-git-send-email-trond.myklebust@xxxxxxxxxxxxxxx> From: Weston Andros Adamson <dros@xxxxxxxxxxxxxxx> commit 78270e8fbc2916bfc8305b8f58f33474cce1ec0e upstream. Commit 6094f83864c1d1296566a282cba05ba613f151ee "nfs: allow coalescing of subpage requests" got rid of the requirement that requests cover whole pages, but it made some incorrect assumptions. It turns out that callers of this interface can map adjacent requests (by file position as seen by req_offset + req->wb_bytes) to different pages, even when they could share a page. An example is the direct I/O interface - iov_iter_get_pages_alloc may return one segment with a partial page filled and the next segment (which is adjacent in the file position) starts with a new page. Reported-by: Toralf Förster <toralf.foerster@xxxxxx> 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 | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -833,6 +833,14 @@ static bool nfs_can_coalesce_requests(st return false; if (req_offset(req) != req_offset(prev) + prev->wb_bytes) return false; + if (req->wb_page == prev->wb_page) { + if (req->wb_pgbase != prev->wb_pgbase + prev->wb_bytes) + return false; + } else { + if (req->wb_pgbase != 0 || + prev->wb_pgbase + prev->wb_bytes != PAGE_CACHE_SIZE) + return false; + } } size = pgio->pg_ops->pg_test(pgio, prev, req); WARN_ON_ONCE(size > req->wb_bytes); 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