Re: [PATCH 01/11] vfs: copy_file_range source range over EOF should fail

Christoph Hellwig
2018-12-04T15:13:33Z

On Mon, Dec 03, 2018 at 02:46:20PM +0200, Amir Goldstein wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> >
> > The man page says:
> >
> > EINVAL Requested range extends beyond the end of the source file
> >
> > But the current behaviour is that copy_file_range does a short
> > copy up to the source file EOF. Fix the kernel behaviour to match
> > the behaviour described in the man page.

I think the behavior implemented is a lot more useful than the one
documented..

> > + /* If the source range crosses EOF, fail the copy */
> > + if (pos_in >= i_size(inode_in) || pos_in + len > i_size(inode_in))
> > + return -EINVAL;
> > +
>
> i_size_read()...
>
> Otherwise
> Reviewed-by: Amir Goldstein <amir73il@gmail.com>

Looks like this doesn't even compile?