From: Qian Yingjin Date: Thu, 6 Feb 2025 12:41:59 +0000 (+0800) Subject: LU-18705 pcc: only reset file mapping for valid cached file X-Git-Tag: 2.16.53~71 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F99%2F57999%2F3;p=fs%2Flustre-release.git 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 --- 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)