From: Qian Yingjin Date: Tue, 3 Dec 2024 20:30:13 +0000 (+0800) Subject: LU-18536 statahead: dec inuse count when waiting entry timeout X-Git-Tag: 2.16.52~31 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F82%2F57382%2F2;p=fs%2Flustre-release.git 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 --- 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); }