summaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2017-09-09 22:43:09 +0200
committerTrond Myklebust <trond.myklebust@primarydata.com>2017-09-09 22:43:09 +0200
commit1bd5d6d08ea7ed0794c8a3908383d6d6fc202cdd (patch)
tree964725f949b9f7ec7aa97d40921b7b588c8a7c80 /fs/nfs
parentNFS: Don't hold the group lock when calling nfs_release_request() (diff)
downloadlinux-1bd5d6d08ea7ed0794c8a3908383d6d6fc202cdd.tar.xz
linux-1bd5d6d08ea7ed0794c8a3908383d6d6fc202cdd.zip
NFS: Count the bytes of skipped subrequests in nfs_lock_and_join_requests()
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 <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/write.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 36d34a4c86bd..f68083db63c8 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -504,8 +504,12 @@ try_again:
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()