<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 31, 2019 at 8:26 PM Cyril Hrubis <<a href="mailto:chrubis@suse.cz">chrubis@suse.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi!<br>
> I have no objection on this. But, is there really make sense to test some<br>
> more non regular files which not being mentioned by Linux Manual Page?<br>
> <br>
> The copy_file_range02 test errors are all extract from manual page, I<br>
> commented that in Christian's first patch version. And I don't think it's<br>
> necessary to test undefined behavior in syscall using, because how do we<br>
> know what error return is the expected?<br>
<br>
That's not undefined that's undocummented at best. The kernel code for<br>
vfs_copy_file_range does:<br>
<br>
if (S_ISDIR(inode_in->i_mode) || S_ISDIR(inode_out->i_mode))<br>
return -EISDIR;<br>
if (!S_ISREG(inode_in->i_mode) || !S_ISREG(inode_out->i_mode))<br>
return -EINVAL;<br>
<br>
Which means that directories are treated as special here and all other file<br>
descriptors that are not regular files are supposed to fail with EINVAL.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Yeah, Indeed true. </div></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
So as far as I can tell it makes sense to pass a pipe fd for example and check<br>
for EINVAL. And we should do that both for in_fd and out_fd as well.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Sounds reasonable. Thanks for the explanation.</div></div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>