]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
NFS: Fix O_DIRECT accounting of number of bytes read/written
authorTrond Myklebust <trondmy@gmail.com>
Mon, 30 Sep 2019 18:02:56 +0000 (14:02 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Wed, 9 Oct 2019 15:45:59 +0000 (11:45 -0400)
commit031d73ed768a40684f3ca21992265ffdb6a270bf
tree1ed200371be586b6290180285569bec68a2c632b
parent33ea5aaa87cdae0f9af4d6b7ee4f650a1a36fd1d
NFS: Fix O_DIRECT accounting of number of bytes read/written

When a series of O_DIRECT reads or writes are truncated, either due to
eof or due to an error, then we should return the number of contiguous
bytes that were received/sent starting at the offset specified by the
application.

Currently, we are failing to correctly check contiguity, and so we're
failing the generic/465 in xfstests when the race between the read
and write RPCs causes the file to get extended while the 2 reads are
outstanding. If the first read RPC call wins the race and returns with
eof set, we should treat the second read RPC as being truncated.

Reported-by: Su Yanjun <suyj.fnst@cn.fujitsu.com>
Fixes: 1ccbad9f9f9bd ("nfs: fix DIO good bytes calculation")
Cc: stable@vger.kernel.org # 4.1+
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/direct.c