Skip to content

Commit

Permalink
NFS: Count the bytes of skipped subrequests in nfs_lock_and_join_requ…
Browse files Browse the repository at this point in the history
…ests()

If we skip a subrequest due to a zero refcount, we should still count
the byte range that it covered so that we accurately reconstruct the
original request size.

Signed-off-by: Trond Myklebust <[email protected]>
  • Loading branch information
trondmypd committed Sep 9, 2017
1 parent 8b77484 commit 1bd5d6d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fs/nfs/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,12 @@ nfs_lock_and_join_requests(struct page *page)
for (subreq = head->wb_this_page; subreq != head;
subreq = subreq->wb_this_page) {

if (!kref_get_unless_zero(&subreq->wb_kref))
if (!kref_get_unless_zero(&subreq->wb_kref)) {
if (subreq->wb_offset == head->wb_offset + total_bytes)
total_bytes += subreq->wb_bytes;
continue;
}

while (!nfs_lock_request(subreq)) {
/*
* Unlock page to allow nfs_page_group_sync_on_bit()
Expand Down

0 comments on commit 1bd5d6d

Please sign in to comment.