Thread (4 messages) 4 messages, 2 authors, 2017-09-26

Re: [SECOND RESEND] vfs: Return -ENXIO for negative SEEK_HOLE / SEEK_DATA offsets

From: Andreas Gruenbacher <agruenba@redhat.com>
Date: 2017-09-26 18:48:36
Also in: linux-fsdevel

On Tue, Sep 26, 2017 at 7:12 PM, Linus Torvalds
[off-list ref] wrote:
On Mon, Sep 25, 2017 at 3:23 AM, Andreas Gruenbacher
[off-list ref] wrote:
quoted
could you please merge the following VFS fix, sent to Al etc. on August
30 and resent on September 14, with no reaction?
This fix seems wrong, or at least misleading.

We already error out for negative offsets in vfs_setpos(), except for
the special case of /proc/<pid>/mem, /dev/mem and /dev/kmem (which
have that FMODE_UNSIGNED_OFFSET special case).

Sure, the error is different (-EINVAL), but that doesn't seem wrong.

So my gut feel is that if xfstest generic/448 cares about EINVAL vs
ENXIO, then that test is just garbage. Because let's face it, EINVAL
is the *normal* error return for negative offsets.
Returning -EINVAL instead of -ENXIO for negative offsets sounds reasonable. But:
Am I missing something?
When whence == SEEK_HOLE and offset < 0, generic_file_llseek_size will
return the
file size instead of -EINVAL. That's at least very weird, and should be fixed.

In addition, on ext4 and xfs, SEEK_HOLE / SEEK_DATA with a negative offset
will currently return -ENXIO. For consistency, do we want to change the ext4 and
xfs behavior to return -EINVAL? Do we want generic_file_llseek_size to behave
like ext4 and xfs?

Thanks,
Andreas
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help