From 450e46eeab21b3486e33d8897a4feb0448487384 Mon Sep 17 00:00:00 2001 From: Qian Yingjin Date: Tue, 4 Jan 2022 16:46:35 -0800 Subject: [PATCH] LU-15244 llite: set ra_pages of backing_dev_info with 0 The latest RHEL8.5 kernel sets initial @ra_pages of backing_dev_info with VM_READAHEAD_PAGES: struct backing_dev_info *bdi_alloc(int node_id) { ... bdi->ra_pages = VM_READAHEAD_PAGES; bdi->io_pages = VM_READAHEAD_PAGES; ... } This will cause that @ra_pages of file readahead state is set with @bdi->ra_pages, make the readahead is out of Lustre control and trigger the readahead logic in Linux kernel wrongly. And it results in the failure sanity 101j. In this patch, we force to set @ra_pages of backing_dev_info with 0 after setup the backing device info. By this way, it disables kernel readahead in the super block. This patch also cleanups the unnecessary setting of @ra_pages in llite "file.c" and "vvp_io.c". Lustre-change: https://review.whamcloud.com/45712 Lustre-commit: 878561880d2aba038db95e199f82b186f22daa45 Signed-off-by: Qian Yingjin Change-Id: If6468109620269c1e76abe3a1cd73c3b40a417a8 Reviewed-by: Patrick Farrell Reviewed-by: Andreas Dilger Reviewed-on: https://review.whamcloud.com/45971 Tested-by: jenkins Tested-by: Maloo Reviewed-by: John L. Hammond --- lustre/llite/file.c | 2 -- lustre/llite/llite_lib.c | 3 +++ lustre/llite/vvp_io.c | 6 ------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 2a51a3a..71251a4 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -745,8 +745,6 @@ static int ll_local_open(struct file *file, struct lookup_intent *it, file->private_data = fd; ll_readahead_init(inode, &fd->fd_ras); fd->fd_omode = it->it_flags & (FMODE_READ | FMODE_WRITE | FMODE_EXEC); - /* turn off the kernel's read-ahead */ - file->f_ra.ra_pages = 0; RETURN(0); } diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 816aff0..b64d502 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1183,6 +1183,9 @@ int ll_fill_super(struct super_block *sb) if (err) GOTO(out_free_cfg, err); + /* disable kernel readahead */ + sb->s_bdi->ra_pages = 0; + /* Call ll_debugfs_register_super() before lustre_process_log() * so that "llite.*.*" params can be processed correctly. */ diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c index 7d81659..5718d83 100644 --- a/lustre/llite/vvp_io.c +++ b/lustre/llite/vvp_io.c @@ -843,9 +843,6 @@ static int vvp_io_read_start(const struct lu_env *env, "Read ino %lu, %zu bytes, offset %lld, size %llu\n", inode->i_ino, cnt, pos, i_size_read(inode)); - /* turn off the kernel's read-ahead */ - vio->vui_fd->fd_file->f_ra.ra_pages = 0; - /* initialize read-ahead window once per syscall */ if (!vio->vui_ra_valid) { vio->vui_ra_valid = true; @@ -1427,9 +1424,6 @@ static int vvp_io_fault_start(const struct lu_env *env, RETURN(result); if (!ll_sbi_has_mmap_ra_logic(ll_i2sbi(inode))) { - /* turn off the kernel's read-ahead */ - vio->vui_fd->fd_file->f_ra.ra_pages = 0; - /* initialize read-ahead window once per syscall */ if (!vio->vui_ra_valid) { vio->vui_ra_valid = true; -- 1.8.3.1