From: Lai Siyao Date: Fri, 27 Oct 2017 03:48:30 +0000 (+0800) Subject: LU-10165 llite: disable statahead if starting statahead fail X-Git-Tag: 2.10.5-RC1~7 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=2c9f7be02c6efa56251e754efff23c37dd045d2f;p=fs%2Flustre-release.git LU-10165 llite: disable statahead if starting statahead fail Once starting statahead thread fails, it should disable statahead. Current code only does this when "sai != NULL", instead it should check whether current process is opening this dir, so for cases like current file is not the first dirent, or sai allocation fail, it won't retry statahead. Lustre-change: https://review.whamcloud.com/29817 Lustre-commit: 8b1bd1b88ae915c89fcbdc83abebe217a681a9e7 Signed-off-by: Lai Siyao Change-Id: Iaedddd3659cdffeab51800f45b02f0b39c4a1ec1 Reviewed-by: Fan Yong Reviewed-by: Andreas Dilger Signed-off-by: Minh Diep Reviewed-on: https://review.whamcloud.com/32366 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: John L. Hammond --- diff --git a/lustre/llite/statahead.c b/lustre/llite/statahead.c index 061fcc8..69f701e 100644 --- a/lustre/llite/statahead.c +++ b/lustre/llite/statahead.c @@ -1587,6 +1587,9 @@ static int start_statahead_thread(struct inode *dir, struct dentry *dentry) lli->lli_opendir_pid); thread = &sai->sai_thread; if (IS_ERR(task)) { + spin_lock(&lli->lli_sa_lock); + lli->lli_sai = NULL; + spin_unlock(&lli->lli_sa_lock); rc = PTR_ERR(task); CERROR("can't start ll_sa thread, rc: %d\n", rc); GOTO(out, rc); @@ -1607,10 +1610,8 @@ out: /* once we start statahead thread failed, disable statahead so that * subsequent stat won't waste time to try it. */ spin_lock(&lli->lli_sa_lock); - if (sai != NULL && lli->lli_sai == sai) { + if (lli->lli_opendir_pid == current->pid) lli->lli_sa_enabled = 0; - lli->lli_sai = NULL; - } spin_unlock(&lli->lli_sa_lock); if (sai != NULL)