Skip to content

Commit

Permalink
fuse: copy_file_range needs to strip setuid bits and update timestamps
Browse files Browse the repository at this point in the history
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: Amir Goldstein <amir73il@gmail.com>
Acked-by: Miklos Szeredi <miklos@szeredi.hu>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  • Loading branch information
amir73il authored and djwong committed Jun 9, 2019
1 parent 5dae222 commit fe0da9c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -3155,6 +3155,10 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in,

inode_lock(inode_out);

err = file_modified(file_out);
if (err)
goto out;

if (fc->writeback_cache) {
err = fuse_writeback_range(inode_out, pos_out, pos_out + len);
if (err)
Expand Down Expand Up @@ -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);

inode_unlock(inode_out);
file_accessed(file_in);

return err;
}
Expand Down

0 comments on commit fe0da9c

Please sign in to comment.