From fc0b0e3390aa16e8e5470ceb968b340128996e95 Mon Sep 17 00:00:00 2001 From: Qian Yingjin Date: Sun, 28 Apr 2024 22:49:57 -0400 Subject: [PATCH] LU-17789 pcc: dont auto PCCRO attach for write/setattr It is meaningless for a client to do auto PCCRO attach for write and setattr operations. Moreover, it may result in sanity-pcc/test_21d failure as follows: "FAIL: expected /mnt/lustre/f21d.sanity-pcc: write_mod_data, got: write_mod_dataa" This patch fixed it by disabling PCCRO auto attach for write and setattr operations. Change-Id: I894db1953a119d12e9337251c069c594fb40482a Test-Parameters: testlist=sanity-pcc env=ONLY=21d,ONLY_REPEAT=10 Signed-off-by: Qian Yingjin Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54946 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/llite/pcc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lustre/llite/pcc.c b/lustre/llite/pcc.c index cb0e390..3cf2443 100644 --- a/lustre/llite/pcc.c +++ b/lustre/llite/pcc.c @@ -2169,12 +2169,17 @@ static int pcc_try_auto_attach(struct inode *inode, bool *cached, RETURN(-EINVAL); } - if (clt.cl_is_released) + if (clt.cl_is_released) { rc = pcc_try_datasets_attach(inode, iot, clt.cl_layout_gen, LU_PCC_READWRITE, cached); - else if (clt.cl_is_rdonly) + } else if (clt.cl_is_rdonly) { + /* Not try read-only attach for data modification operations */ + if (iot == PIT_WRITE || iot == PIT_SETATTR) + RETURN(0); + rc = pcc_try_datasets_attach(inode, iot, clt.cl_layout_gen, LU_PCC_READONLY, cached); + } if (*cached && iot != PIT_VALID_CHECK) ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_PCC_AUTOAT, 1); -- 1.8.3.1