]> git.itanic.dy.fi Git - linux-stable/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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2017 21:17:30 +0000 (14:17 -0700)
commit3307d5f5099c186d1ae43205eb23c29fabc6f5b8
tree7c43f6e9c13570c468db436ebd1ccde406589e46
parent6f50e3a1b8c3c08c6c45522c30a0f16f37b8efb8
NFS: Sync the correct byte range during synchronous writes

commit e973b1a5999e57da677ab50da5f5479fdc0f0c31 upstream.

Since commit 18290650b1c8 ("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: 18290650b1c8 ("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>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/file.c