[LTP] [PATCH] syscalls/copy_file_range02.c: Compatible with new and old kernels
Li Wang
liwang@redhat.com
Fri May 31 14:46:16 CEST 2019
On Fri, May 31, 2019 at 8:26 PM Cyril Hrubis <chrubis@suse.cz> wrote:
> Hi!
> > I have no objection on this. But, is there really make sense to test some
> > more non regular files which not being mentioned by Linux Manual Page?
> >
> > The copy_file_range02 test errors are all extract from manual page, I
> > commented that in Christian's first patch version. And I don't think it's
> > necessary to test undefined behavior in syscall using, because how do we
> > know what error return is the expected?
>
> That's not undefined that's undocummented at best. The kernel code for
> vfs_copy_file_range does:
>
> if (S_ISDIR(inode_in->i_mode) || S_ISDIR(inode_out->i_mode))
> return -EISDIR;
> if (!S_ISREG(inode_in->i_mode) || !S_ISREG(inode_out->i_mode))
> return -EINVAL;
>
> Which means that directories are treated as special here and all other file
> descriptors that are not regular files are supposed to fail with EINVAL.
>
Yeah, Indeed true.
> So as far as I can tell it makes sense to pass a pipe fd for example and
> check
> for EINVAL. And we should do that both for in_fd and out_fd as well.
>
Sounds reasonable. Thanks for the explanation.
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190531/9c601a43/attachment.html>
More information about the ltp
mailing list