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

James Simmons jsimmons at infradead.org
Fri Mar 21 06:06:52 PDT 2025


From: Alex Zhuravlev <bzzz at 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 at whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/46282
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell at whamcloud.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
 fs/lustre/llite/file.c | 4 ++++
 1 file changed, 4 insertions(+)

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
-- 
2.39.3



More information about the lustre-devel mailing list