summaryrefslogtreecommitdiffstats
path: root/fs/nfs/direct.c
diff options
context:
space:
mode:
authorTrond Myklebust <trondmy@gmail.com>2020-01-06 21:25:14 +0100
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2020-01-15 16:54:33 +0100
commit4daaeba938228f7c97e80817ccda1e091c7d3fb6 (patch)
treed291385160b694f2f3e0834fee154122891fe4a6 /fs/nfs/direct.c
parentNFS: When resending after a short write, reset the reply count to zero (diff)
downloadlinux-4daaeba938228f7c97e80817ccda1e091c7d3fb6.tar.xz
linux-4daaeba938228f7c97e80817ccda1e091c7d3fb6.zip
NFS: Fix nfs_direct_write_reschedule_io()
The 'hdr->good_bytes' is defined as the number of bytes we expect to read or write starting at offset hdr->io_start. In the case of a partial read/write we may end up adjusting hdr->args.offset and hdr->args.count to skip I/O for data that was already read/written, and so we must ensure the calculation takes that into account. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r--fs/nfs/direct.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 29f00da8a0b7..b768a0b42e82 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -824,7 +824,8 @@ static void nfs_direct_write_reschedule_io(struct nfs_pgio_header *hdr)
dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
/* fake unstable write to let common nfs resend pages */
hdr->verf.committed = NFS_UNSTABLE;
- hdr->good_bytes = hdr->args.count;
+ hdr->good_bytes = hdr->args.offset + hdr->args.count -
+ hdr->io_start;
}
spin_unlock(&dreq->lock);
}