From e467a421c7aa175b9316f4ee78f392050d2f587f Mon Sep 17 00:00:00 2001 From: Qian Yingjin Date: Wed, 4 Dec 2019 22:44:58 +0800 Subject: [PATCH] LU-13030 pcc: Init saved dataset flags properly When init a new inode, the saved flags is set wrongly with PCC_DATASET_NONE which means that the file is known in NONE of PCC dataset. This patch corrects it with PCC_DATASET_INVALID. Signed-off-by: Qian Yingjin Change-Id: Id775a20711cbc89979e81cbb2b0fe77dc5a850d5 Reviewed-on: https://review.whamcloud.com/36923 Reviewed-by: Andreas Dilger Reviewed-by: Li Xi Tested-by: jenkins Tested-by: Maloo --- lustre/llite/llite_lib.c | 2 +- lustre/llite/pcc.c | 13 +++++-------- lustre/tests/sanity-pcc.sh | 3 +++ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index cb92c40..933b77a 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1007,7 +1007,7 @@ void ll_lli_init(struct ll_inode_info *lli) mutex_init(&lli->lli_pcc_lock); lli->lli_pcc_state = PCC_STATE_FL_NONE; lli->lli_pcc_inode = NULL; - lli->lli_pcc_dsflags = PCC_DATASET_NONE; + lli->lli_pcc_dsflags = PCC_DATASET_INVALID; lli->lli_pcc_generation = 0; mutex_init(&lli->lli_group_mutex); lli->lli_group_users = 0; diff --git a/lustre/llite/pcc.c b/lustre/llite/pcc.c index 57585e0..f5e4cae 100644 --- a/lustre/llite/pcc.c +++ b/lustre/llite/pcc.c @@ -1338,21 +1338,18 @@ static int pcc_try_datasets_attach(struct inode *inode, enum pcc_io_type iot, * from icache later. * Set the saved dataset flags with PCC_DATASET_NONE. Then this * file will skip from the candidates to try auto attach until - * the file is attached ninto PCC again. + * the file is attached into PCC again. * * If the file was never attached into PCC, or once attached but * its inode was evicted from icache (lli_pcc_generation == 0), + * or the corresponding dataset was removed from the client, * set the saved dataset flags with PCC_DATASET_NONE. * - * If the file was once attached into PCC but the corresponding - * dataset was removed from the client, set the saved dataset - * flags with PCC_DATASET_NONE. - * * TODO: If the file was once attached into PCC but not try to * auto attach due to the change of the configuration parameters * for this dataset (i.e. change from auto attach enabled to * auto attach disabled for this dataset), update the saved - * dataset flags witha the found one. + * dataset flags with the found one. */ lli->lli_pcc_dsflags = PCC_DATASET_NONE; } @@ -1431,7 +1428,7 @@ static inline bool pcc_may_auto_attach(struct inode *inode, return false; /* - * lli_pcc_generation = 0 means that the file was never attached into + * lli_pcc_generation == 0 means that the file was never attached into * PCC, or may be once attached into PCC but detached as the inode is * evicted from icache (i.e. "echo 3 > /proc/sys/vm/drop_caches" or * icache shrinking due to the memory pressure), which will cause the @@ -1440,7 +1437,7 @@ static inline bool pcc_may_auto_attach(struct inode *inode, */ /* lli_pcc_generation == 0, or the PCC setting was changed, * or there is no PCC setup on the client and the try will return - * immediately in pcc_try_auto_attch(). + * immediately in pcc_try_auto_attach(). */ if (super->pccs_generation != lli->lli_pcc_generation) return true; diff --git a/lustre/tests/sanity-pcc.sh b/lustre/tests/sanity-pcc.sh index 16515b6..09a40ff 100644 --- a/lustre/tests/sanity-pcc.sh +++ b/lustre/tests/sanity-pcc.sh @@ -1463,6 +1463,9 @@ test_20() { error "Failed to attach $file" do_facet $SINGLEAGT "echo 3 > /proc/sys/vm/drop_caches" check_lpcc_state $file "readwrite" + do_facet $SINGLEAGT "echo 3 > /proc/sys/vm/drop_caches" + do_facet $SINGLEAGT "echo 3 > /proc/sys/vm/drop_caches" + check_lpcc_state $file "readwrite" do_facet $SINGLEAGT $LFS pcc detach $file || error "Failed to detach $file" } -- 1.8.3.1