From 6703c05df0e60c5af46f59c4ff19d17a7d0a88fb Mon Sep 17 00:00:00 2001 From: Qian Yingjin Date: Wed, 4 Dec 2024 04:30:13 +0800 Subject: [PATCH] LU-18536 statahead: dec inuse count when waiting entry timeout It should dec inuse entry count when waiting for entry state timout: ->revalidate_statahead_dentry() ->!sa_ready(entry) ->wait_event_idle_timeout(sai->sai_waitq, sa_ready(entry), cfs_time_seconds(30)); if (rc == 0) { /* Timeout */ /* * entry may not be ready, so it may be used by * inflight statahead RPC, don't free it. */ entry = NULL; GOTO(out, rc = -EAGAIN); } Otherwise, it may casue the statahead thread waiting endless for the inuse count becomes zero. Fixes: d22c78fde8d (LU-14361 statahead: wait inuse entry finished during cleanup) Signed-off-by: Qian Yingjin Change-Id: I5a6cba998362e5580924711d2ac059f7fe3de261 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57382 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- lustre/llite/statahead.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lustre/llite/statahead.c b/lustre/llite/statahead.c index aa6e30b..0181374 100644 --- a/lustre/llite/statahead.c +++ b/lustre/llite/statahead.c @@ -314,13 +314,12 @@ static inline int sa_kill_try(struct ll_statahead_info *sai, } /* called by scanner after use, sa_entry will be killed */ -static void -sa_put(struct inode *dir, struct ll_statahead_info *sai, struct sa_entry *entry) +static void sa_put(struct inode *dir, struct ll_statahead_info *sai, + struct sa_entry *entry, bool inuse) { struct ll_inode_info *lli = ll_i2info(dir); struct sa_entry *tmp; bool wakeup = false; - bool inuse = false; if (entry && entry->se_state == SA_ENTRY_SUCC) { struct ll_sb_info *sbi = ll_i2sbi(sai->sai_dentry->d_inode); @@ -1958,6 +1957,7 @@ static int revalidate_statahead_dentry(struct inode *dir, struct ll_dentry_data *lld; struct ll_inode_info *lli = ll_i2info(dir); struct ll_statahead_info *info = NULL; + bool inuse = false; int rc = 0; ENTRY; @@ -2027,6 +2027,7 @@ static int revalidate_statahead_dentry(struct inode *dir, LASSERTF(sai != NULL, "pattern %#X entry %p se_sai %p %pd lli %p\n", lli->lli_sa_pattern, entry, entry->se_sai, *dentryp, lli); + inuse = true; if (!sa_ready(entry)) { spin_lock(&lli->lli_sa_lock); sai->sai_index_wait = entry->se_index; @@ -2105,7 +2106,7 @@ out: if (lld) lld->lld_sa_generation = lli->lli_sa_generation; rcu_read_unlock(); - sa_put(dir, sai, entry); + sa_put(dir, sai, entry, inuse); RETURN(rc); } -- 1.8.3.1