Commit fe0da9c0 authored by Amir Goldstein's avatar Amir Goldstein Committed by Darrick J. Wong

fuse: copy_file_range needs to strip setuid bits and update timestamps

Like ->write_iter(), we update mtime and strip setuid of dst file before
copy and like ->read_iter(), we update atime of src file after copy.
Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
Acked-by: default avatarMiklos Szeredi <miklos@szeredi.hu>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent 5dae222a
...@@ -3155,6 +3155,10 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in, ...@@ -3155,6 +3155,10 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in,
inode_lock(inode_out); inode_lock(inode_out);
err = file_modified(file_out);
if (err)
goto out;
if (fc->writeback_cache) { if (fc->writeback_cache) {
err = fuse_writeback_range(inode_out, pos_out, pos_out + len); err = fuse_writeback_range(inode_out, pos_out, pos_out + len);
if (err) if (err)
...@@ -3193,6 +3197,7 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in, ...@@ -3193,6 +3197,7 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in,
clear_bit(FUSE_I_SIZE_UNSTABLE, &fi_out->state); clear_bit(FUSE_I_SIZE_UNSTABLE, &fi_out->state);
inode_unlock(inode_out); inode_unlock(inode_out);
file_accessed(file_in);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment