]> git.baikalelectronics.ru Git - kernel.git/commit
NFS: Sync the correct byte range during synchronous writes
authortarangg@amazon.com <tarangg@amazon.com>
Thu, 7 Sep 2017 13:29:23 +0000 (09:29 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 7 Sep 2017 15:07:13 +0000 (11:07 -0400)
commite77984f4c645a63560b72de4f989d6948497b2e2
treee6c6e1e64fd7149e6ba99f45ca01ee0e80e4847c
parent074c6d2845b9026d5d6d70f614f8ce7b94d6a75d
NFS: Sync the correct byte range during synchronous writes

Since commit e5e0a39af20b ("NFS: Move buffered I/O locking into
nfs_file_write()") nfs_file_write() has not flushed the correct byte
range during synchronous writes.  generic_write_sync() expects that
iocb->ki_pos points to the right edge of the range rather than the
left edge.

To replicate the problem, open a file with O_DSYNC, have the client
write at increasing offsets, and then print the successful offsets.
Block port 2049 partway through that sequence, and observe that the
client application indicates successful writes in advance of what the
server received.

Fixes: e5e0a39af20b ("NFS: Move buffered I/O locking into nfs_file_write()")
Signed-off-by: Jacob Strauss <jsstraus@amazon.com>
Signed-off-by: Tarang Gupta <tarangg@amazon.com>
Tested-by: Tarang Gupta <tarangg@amazon.com>
Cc: stable@vger.kernel.org # v4.8+
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/file.c