NFS: Count the bytes of skipped subrequests in nfs_lock_and_join_requests()
authorTrond Myklebust <trond.myklebust@primarydata.com>
Sat, 9 Sep 2017 20:43:09 +0000 (16:43 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Sat, 9 Sep 2017 20:43:09 +0000 (16:43 -0400)
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>
fs/nfs/write.c

index 36d34a4c86bd72447f6bfbe0b85a538508e8f0d2..f68083db63c8a7735b9eeff4606dc9a71bac55e3 100644 (file)
@@ -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()