[LTP] [PATCH] vfs: fix readahead(2) on block devices

Reuben Hawkins reubenhwk@gmail.com
Mon Sep 25 06:35:48 CEST 2023


On Sun, Sep 24, 2023 at 4:56 PM Matthew Wilcox <willy@infradead.org> wrote:

> On Sun, Sep 24, 2023 at 06:32:30PM +0300, Amir Goldstein wrote:
> > On Sun, Sep 24, 2023 at 5:27 PM Matthew Wilcox <willy@infradead.org>
> wrote:
> > >
> > > On Sun, Sep 24, 2023 at 02:47:42PM +0300, Amir Goldstein wrote:
> > > > Since you joined the discussion, you have the opportunity to agree or
> > > > disagree with our decision to change readahead() to ESPIPE.
> > > > Judging  by your citing of lseek and posix_fadvise standard,
> > > > I assume that you will be on board?
> > >
> > > I'm fine with returning ESPIPE (it's like ENOTTY in a sense).  but
> > > that's not what kbuild reported:
> >
> > kbuild report is from v1 patch that was posted to the list
> > this is not the patch (v2) that is applied to vfs.misc
> > and has been in linux-next for a few days.
>
> Ah!  I was confused.
>
> > > I think that should
> > > also return ESPIPE.  I think posix_fadvise() should return ESPIPE on a
> > > socket too, but reporting bugs to the Austin Group seems quite painful.
> > > Perhaps somebody has been through this process and can do that for us?
> >
> > This is Reuben's first kernel patch.
> > Let's agree that changing the standard of posix_fadvise() for socket is
> > beyond the scope of his contribution :)
>
> Thank you for shepherding his first contribution.  Unfortunately, this
> is rather the way of it when you start to pick at something ... you find
> more things that are broken.  It's rather unusual that this one turned
> out to be "The POSIX spec has a defect" ;-)
>
> But yes, I'm content with v2 if v2 does in fact return ESPIPE for
> readahead() on a socket.  Let's wait to find out.  We can address the
> POSIX defect later.
>

The v2 patch does NOT return ESPIPE on a socket.  It succeeds.

readahead01.c:54: TINFO: test_invalid_fd pipe
readahead01.c:56: TFAIL: readahead(fd[0], 0, getpagesize()) expected
EINVAL: ESPIPE (29)
readahead01.c:60: TINFO: test_invalid_fd socket
readahead01.c:62: TFAIL: readahead(fd[0], 0, getpagesize()) succeeded
<-------here


More information about the ltp mailing list