Whamcloud - gitweb
LU-17789 pcc: dont auto PCCRO attach for write/setattr
authorQian Yingjin <qian@ddn.com>
Mon, 29 Apr 2024 02:49:57 +0000 (22:49 -0400)
committerAndreas Dilger <adilger@whamcloud.com>
Wed, 8 May 2024 06:01:46 +0000 (06:01 +0000)
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 <qian@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54946
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/llite/pcc.c

index cb0e390..3cf2443 100644 (file)
@@ -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);