From: Reuben Hawkins <reubenhwk@gmail.com>
To: linux-fsdevel@vger.kernel.org
Cc: amir73il@gmail.com, mszeredi@redhat.com, willy@infradead.org,
viro@zeniv.linux.org.uk, brauner@kernel.org,
Reuben Hawkins <reubenhwk@gmail.com>
Subject: [PATCH] vfs: fix readahead(2) on block devices
Date: Fri, 8 Sep 2023 23:38:06 -0500 [thread overview]
Message-ID: <20230909043806.3539-1-reubenhwk@gmail.com> (raw)
Readahead was factored to call generic_fadvise. That refactor broke
readahead on block devices.
The fix is to check F_ISFIFO rather than F_ISREG. It would also work to
not check and let generic_fadvise to do the checking, but then the
generic_fadvise return value would have to be checked and changed from
-ESPIPE to -EINVAL to comply with the readahead(2) man-pages.
Fixes: 3d8f7615319b ("vfs: implement readahead(2) using POSIX_FADV_WILLNEED")
Signed-off-by: Reuben Hawkins <reubenhwk@gmail.com>
---
mm/readahead.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/readahead.c b/mm/readahead.c
index 47afbca1d122..877ddcb61c76 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -749,7 +749,7 @@ ssize_t ksys_readahead(int fd, loff_t offset, size_t count)
*/
ret = -EINVAL;
if (!f.file->f_mapping || !f.file->f_mapping->a_ops ||
- !S_ISREG(file_inode(f.file)->i_mode))
+ S_ISFIFO(file_inode(f.file)->i_mode))
goto out;
ret = vfs_fadvise(f.file, offset, count, POSIX_FADV_WILLNEED);
--
2.34.1
next reply other threads:[~2023-09-09 4:39 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-09 4:38 Reuben Hawkins [this message]
2023-09-09 6:36 ` [PATCH] vfs: fix readahead(2) on block devices Amir Goldstein
2023-09-10 10:02 ` Christian Brauner
2023-09-11 8:15 ` Amir Goldstein
2023-09-19 2:47 ` [LTP] " kernel test robot
2023-09-19 2:47 ` kernel test robot
2023-09-19 8:43 ` [LTP] " Amir Goldstein
2023-09-19 8:43 ` Amir Goldstein
2023-09-21 13:01 ` [LTP] " Reuben Hawkins
2023-09-21 14:44 ` Amir Goldstein
2023-09-21 14:44 ` Amir Goldstein
2023-09-22 9:10 ` [LTP] " Cyril Hrubis
2023-09-22 9:10 ` Cyril Hrubis
2023-09-22 20:29 ` Reuben Hawkins
2023-09-23 5:56 ` Amir Goldstein
2023-09-23 5:56 ` Amir Goldstein
2023-09-23 12:20 ` Reuben Hawkins
2023-09-23 12:28 ` Reuben Hawkins
2023-09-23 14:41 ` Matthew Wilcox
2023-09-23 14:41 ` Matthew Wilcox
2023-09-23 15:48 ` Amir Goldstein
2023-09-23 15:48 ` Amir Goldstein
2023-09-24 3:48 ` Reuben Hawkins
2023-09-24 6:46 ` Amir Goldstein
2023-09-24 6:46 ` Amir Goldstein
2023-09-24 11:47 ` Amir Goldstein
2023-09-24 11:47 ` Amir Goldstein
2023-09-24 14:27 ` Matthew Wilcox
2023-09-24 14:27 ` Matthew Wilcox
2023-09-24 15:32 ` Amir Goldstein
2023-09-24 15:32 ` Amir Goldstein
2023-09-24 21:56 ` Matthew Wilcox
2023-09-24 21:56 ` Matthew Wilcox
2023-09-25 4:35 ` Reuben Hawkins
2023-09-25 6:42 ` Matthew Wilcox
2023-09-25 6:42 ` Matthew Wilcox
2023-09-25 9:43 ` Amir Goldstein
2023-09-25 9:43 ` Amir Goldstein
2023-09-25 12:39 ` Christian Brauner
2023-09-25 12:39 ` Christian Brauner
2023-09-25 15:36 ` Reuben Hawkins
2023-09-25 16:51 ` Amir Goldstein
2023-09-25 16:51 ` Amir Goldstein
2023-09-26 10:08 ` Christian Brauner
2023-09-26 10:08 ` Christian Brauner
2023-09-26 1:56 ` Oliver Sang
2023-09-26 1:56 ` Oliver Sang
2023-09-26 5:34 ` Amir Goldstein
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=20230909043806.3539-1-reubenhwk@gmail.com \
--to=reubenhwk@gmail.com \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mszeredi@redhat.com \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.