diff mbox series

[09/27] lustre: llite: skip fast reads if layout is invalid

Message ID 20250321130711.3257092-10-jsimmons@infradead.org (mailing list archive)
State New
Headers show
Series lustre: sync to OpenSFS tree July 27, 2023 | expand

Commit Message

James Simmons March 21, 2025, 1:06 p.m. UTC
From: Alex Zhuravlev <bzzz@whamcloud.com>

don't let fast reads from the pagecache if the layout
is not valid.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15431
Lustre-commit: fe2fafa1af7edc251 ("LU-15431 llite: skip fast reads if layout is invalid")
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/46282
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/llite/file.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c
index 448aea7ceb12..c7f77295d3b3 100644
--- a/fs/lustre/llite/file.c
+++ b/fs/lustre/llite/file.c
@@ -1983,6 +1983,7 @@  ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
 static ssize_t
 ll_do_fast_read(struct kiocb *iocb, struct iov_iter *iter)
 {
+	struct ll_inode_info *lli = ll_i2info(file_inode(iocb->ki_filp));
 	ssize_t result;
 
 	if (!ll_sbi_has_fast_read(ll_i2sbi(file_inode(iocb->ki_filp))))
@@ -1995,6 +1996,9 @@  ll_do_fast_read(struct kiocb *iocb, struct iov_iter *iter)
 	if (iocb->ki_filp->f_flags & O_DIRECT)
 		return 0;
 
+	if (ll_layout_version_get(lli) == CL_LAYOUT_GEN_NONE)
+		return 0;
+
 	result = generic_file_read_iter(iocb, iter);
 
 	/* If the first page is not in cache, generic_file_aio_read() will be