Skip to content

Commit

Permalink
vfs: vfs_clone_file_prep_inodes should return EINVAL for a clone from…
Browse files Browse the repository at this point in the history
… beyond EOF

vfs_clone_file_prep_inodes cannot return 0 if it is asked to remap from
a zero byte file because that's what btrfs does.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
  • Loading branch information
Darrick J. Wong authored and Dave Chinner committed Oct 29, 2018
1 parent 84df952 commit 5b49f64
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions fs/read_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -1740,10 +1740,7 @@ int vfs_clone_file_prep_inodes(struct inode *inode_in, loff_t pos_in,
if (!S_ISREG(inode_in->i_mode) || !S_ISREG(inode_out->i_mode))
return -EINVAL;

/* Are we going all the way to the end? */
isize = i_size_read(inode_in);
if (isize == 0)
return 0;

/* Zero length dedupe exits immediately; reflink goes to EOF. */
if (*len == 0) {
Expand Down

0 comments on commit 5b49f64

Please sign in to comment.