Whamcloud - gitweb
LU-18536 statahead: dec inuse count when waiting entry timeout 82/57382/2
authorQian Yingjin <qian@ddn.com>
Tue, 3 Dec 2024 20:30:13 +0000 (04:30 +0800)
committerOleg Drokin <green@whamcloud.com>
Sun, 2 Feb 2025 06:27:39 +0000 (06:27 +0000)
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 <qian@ddn.com>
Change-Id: I5a6cba998362e5580924711d2ac059f7fe3de261
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57382
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/statahead.c

index aa6e30b..0181374 100644 (file)
@@ -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);
 }