author: Miklos Szeredi <mszeredi@redhat.com> 2019-05-28 13:22:50 +0200
committer: Miklos Szeredi <mszeredi@redhat.com> 2019-05-28 13:22:50 +0200
commit: a2bc92362941006830afa3dfad6caec1f99acbf5
parent: 4a2abf99f9c2877039006b8dfb3ec4e0d1278fe8
Commit Summary:
Diffstat:
1 file changed, 12 insertions, 0 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index c1064866c402..4141d94de4ff 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -3110,6 +3110,7 @@ static ssize_t fuse_copy_file_range(struct file *file_in, loff_t pos_in,
{
struct fuse_file *ff_in = file_in->private_data;
struct fuse_file *ff_out = file_out->private_data;
+ struct inode *inode_in = file_inode(file_in);
struct inode *inode_out = file_inode(file_out);
struct fuse_inode *fi_out = get_fuse_inode(inode_out);
struct fuse_conn *fc = ff_in->fc;
@@ -3133,6 +3134,17 @@ static ssize_t fuse_copy_file_range(struct file *file_in, loff_t pos_in,
if (fc->no_copy_file_range)
return -EOPNOTSUPP;
+ if (fc->writeback_cache) {
+ inode_lock(inode_in);
+ err = filemap_write_and_wait_range(inode_in->i_mapping,
+ pos_in, pos_in + len);
+ if (!err)
+ fuse_sync_writes(inode_in);
+ inode_unlock(inode_in);
+ if (err)
+ return err;
+ }
+
inode_lock(inode_out);
if (fc->writeback_cache) {