Commit 309a1d65 authored by Weston Andros Adamson's avatar Weston Andros Adamson Committed by Tom Haynes

nfs: handle overlapping reqs in lock_and_join

This is needed for mirrored DS support, where multuple requests
cover the same range.
Signed-off-by: default avatarWeston Andros Adamson <dros@primarydata.com>
parent 180bb5ec
...@@ -473,13 +473,18 @@ nfs_lock_and_join_requests(struct page *page, bool nonblock) ...@@ -473,13 +473,18 @@ nfs_lock_and_join_requests(struct page *page, bool nonblock)
do { do {
/* /*
* Subrequests are always contiguous, non overlapping * Subrequests are always contiguous, non overlapping
* and in order. If not, it's a programming error. * and in order - but may be repeated (mirrored writes).
*/ */
WARN_ON_ONCE(subreq->wb_offset != if (subreq->wb_offset == (head->wb_offset + total_bytes)) {
(head->wb_offset + total_bytes)); /* keep track of how many bytes this group covers */
total_bytes += subreq->wb_bytes;
/* keep track of how many bytes this group covers */ } else if (WARN_ON_ONCE(subreq->wb_offset < head->wb_offset ||
total_bytes += subreq->wb_bytes; ((subreq->wb_offset + subreq->wb_bytes) >
(head->wb_offset + total_bytes)))) {
nfs_page_group_unlock(head);
spin_unlock(&inode->i_lock);
return ERR_PTR(-EIO);
}
if (!nfs_lock_request(subreq)) { if (!nfs_lock_request(subreq)) {
/* releases page group bit lock and /* releases page group bit lock and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment