From 194102b8319cf5d70f19f2b669f91e9b3f6ea49b Mon Sep 17 00:00:00 2001 From: Qian Yingjin Date: Thu, 6 Feb 2025 20:41:59 +0800 Subject: [PATCH] LU-18705 pcc: only reset file mapping for valid cached file It should only reset and revise file mapping for the valid cached file (@cached == true) in pcc_file_mapping_reset(). Otherwise, it will cause sanity-pcc test_97 panic as follows: (pcc.c:3077:pcc_vma_file_reset()) ASSERTION( vma->vm_file->f_mapping == inode->i_mapping ) failed: panic+0x114/0x2f6 lbug_with_loc.cold+0x30/0x69 [libcfs] pcc_mmap_io_init+0xafe/0xd60 [lustre] pcc_fault+0x170/0x3d0 [lustre] ll_fault+0x43/0x9a0 [lustre] __do_fault+0x3c/0x170 do_fault+0x24b/0x640 Test-Parameters: testlist=sanity-pcc env=ONLY=97,ONLY_REPEAT=50 Signed-off-by: Qian Yingjin Change-Id: I7e9cd0cba9d230160c90a32bef452139c23164b3 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57999 Reviewed-by: Andreas Dilger Reviewed-by: Li Xi Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- lustre/llite/pcc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lustre/llite/pcc.c b/lustre/llite/pcc.c index ac88db9..a07315d 100644 --- a/lustre/llite/pcc.c +++ b/lustre/llite/pcc.c @@ -2282,7 +2282,7 @@ pcc_file_mapping_reset(struct inode *inode, struct file *file, bool cached) pcc_file_fallback_set(ll_i2info(inode), pccf); } - if (pcc_file) { + if (pcc_file && cached) { struct inode *pcc_inode = file_inode(pcc_file); if (pcc_inode->i_mapping == &pcc_inode->i_data) -- 1.8.3.1