From: Trond Myklebust Date: Mon, 6 Jan 2020 20:25:14 +0000 (-0500) Subject: NFS: Fix nfs_direct_write_reschedule_io() X-Git-Tag: baikal/mips/sdk5.9~14322^2~27 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=8b00f7c1c07c6e6201d4c9488e21d37c5560b8e5;p=kernel.git 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 Signed-off-by: Anna Schumaker --- diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 29f00da8a0b7f..b768a0b42e82e 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); }