linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfs: fix readahead(2) on block devices
@ 2023-09-09  4:38 Reuben Hawkins
  2023-09-09  6:36 ` Amir Goldstein
  2023-09-19  2:47 ` kernel test robot
  0 siblings, 2 replies; 23+ messages in thread
From: Reuben Hawkins @ 2023-09-09  4:38 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: amir73il, mszeredi, willy, viro, brauner, Reuben Hawkins

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


^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2023-09-26 10:08 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).