Skip to content

Commit

Permalink
NFS: Fix nfs_direct_write_reschedule_io()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
trondmy authored and amschuma-ntap committed Jan 15, 2020
1 parent 8c9cb71 commit 4daaeba
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/nfs/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 4daaeba

Please sign in to comment.