nfsd: Ensure CLONE persists data and metadata changes to the target file
authorTrond Myklebust <trondmy@gmail.com>
Wed, 27 Nov 2019 22:05:51 +0000 (17:05 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Dec 2019 07:49:11 +0000 (08:49 +0100)
commit43c9831fea79935c2f17bce3aa28e7e4d4e8855c
tree8899562e510d80fddb8c0786288e06efd09c5c96
parentecd1251d4be8cd336df1f0dfc537aa8d9fd8dec1
nfsd: Ensure CLONE persists data and metadata changes to the target file

commit a25e3726b32c746c0098125d4c7463bb84df72bb upstream.

The NFSv4.2 CLONE operation has implicit persistence requirements on the
target file, since there is no protocol requirement that the client issue
a separate operation to persist data.
For that reason, we should call vfs_fsync_range() on the destination file
after a successful call to vfs_clone_file_range().

Fixes: ffa0160a1039 ("nfsd: implement the NFSv4.2 CLONE operation")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: stable@vger.kernel.org # v4.5+
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfsd/nfs4proc.c
fs/nfsd/vfs.c
fs/nfsd/vfs.h