linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Reuben Hawkins <reubenhwk@gmail.com>,
	Cyril Hrubis <chrubis@suse.cz>,
	mszeredi@redhat.com, brauner@kernel.org, lkp@intel.com,
	linux-fsdevel@vger.kernel.org,
	kernel test robot <oliver.sang@intel.com>,
	viro@zeniv.linux.org.uk, oe-lkp@lists.linux.dev,
	ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] vfs: fix readahead(2) on block devices
Date: Sat, 23 Sep 2023 15:41:43 +0100	[thread overview]
Message-ID: <ZQ75JynY8Y2DqaHD@casper.infradead.org> (raw)
In-Reply-To: <CAOQ4uxjnCdAeWe3W4mp=DwgL49Vwp_FVx4S_V33A3-JLtzJb-g@mail.gmail.com>

On Sat, Sep 23, 2023 at 08:56:28AM +0300, Amir Goldstein wrote:
> We decided to deliberately try the change of behavior
> from EINVAL to ESPIPE, to align with fadvise behavior,
> so eventually the LTP test should be changed to allow both.
> 
> It was the test failure on the socket that alarmed me.
> However, if we will have to special case socket in
> readahead() after all, we may as well also special case
> pipe with it and retain the EINVAL behavior - let's see
> what your findings are and decide.

If I read it correctly, LTP is reporting that readhaead() on a socket
returned success instead of an error.  Sockets do have a_ops, right?
It's set to empty_aops in inode_init_always, I think.

It would be nice if we documented somewhere which pointers should be
checked for NULL for which cases ... it doesn't really make sense for
a socket inode to have an i_mapping since it doesn't have pagecache.
But maybe we rely on i_mapping always being set.

Irritatingly, POSIX specifies ESPIPE for pipes, but does not specify
what to do with sockets.  It's kind of a meaningless syscall for
any kind of non-seekable fd.  lseek() returns ESPIPE for sockets
as well as pipes, so I'd see this as an oversight.
https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_fadvise.html
https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html

Of course readahead() is a Linux-specific syscall, so we can do whatever
we want here, but I'm really tempted to just allow readahead() for
regular files and block devices.  Hmm.  Can we check FMODE_LSEEK
instead of (S_ISFILE || S_ISBLK)?

  reply	other threads:[~2023-09-23 14:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-09  4:38 [PATCH] vfs: fix readahead(2) on block devices Reuben Hawkins
2023-09-09  6:36 ` Amir Goldstein
2023-09-10 10:02   ` Christian Brauner
2023-09-11  8:15     ` Amir Goldstein
2023-09-19  2:47 ` kernel test robot
2023-09-19  8:43   ` Amir Goldstein
     [not found]     ` <CAD_8n+TpZF2GoE1HUeBLs0vmpSna0yR9b+hsd-VC1ZurTe41LQ@mail.gmail.com>
2023-09-21 14:44       ` Amir Goldstein
2023-09-22  9:10       ` [LTP] " Cyril Hrubis
     [not found]         ` <CAD_8n+ShV=HJuk5v-JeYU1f+MAq1nDz9GqVmbfK9NpNThRjzSg@mail.gmail.com>
2023-09-23  5:56           ` Amir Goldstein
2023-09-23 14:41             ` Matthew Wilcox [this message]
2023-09-23 15:48               ` Amir Goldstein
     [not found]                 ` <CAD_8n+SNKww4VwLRsBdOg+aBc7pNzZhmW9TPcj9472_MjGhWyg@mail.gmail.com>
2023-09-24  6:46                   ` Amir Goldstein
2023-09-24 11:47                     ` Amir Goldstein
2023-09-24 14:27                       ` Matthew Wilcox
2023-09-24 15:32                         ` Amir Goldstein
2023-09-24 21:56                           ` Matthew Wilcox
     [not found]                             ` <CAD_8n+SBo4EaU4-u+DaEFq3Bgii+vX0JobsqJV-4m+JjY9wq8w@mail.gmail.com>
2023-09-25  6:42                               ` Matthew Wilcox
2023-09-25  9:43                                 ` Amir Goldstein
2023-09-25 12:39                                   ` Christian Brauner
     [not found]                                   ` <CAD_8n+QeGwf+CGNW_WnyRNQMu9G2_HJ4RSwJGq-b4CERpaA4uQ@mail.gmail.com>
2023-09-25 16:51                                     ` Amir Goldstein
2023-09-26 10:08                                       ` Christian Brauner
2023-09-26  1:56                           ` Oliver Sang
2023-09-26  5:34                             ` Amir Goldstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZQ75JynY8Y2DqaHD@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=chrubis@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=ltp@lists.linux.it \
    --cc=mszeredi@redhat.com \
    --cc=oe-lkp@lists.linux.dev \
    --cc=oliver.sang@intel.com \
    --cc=reubenhwk@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).