From: Bruno Faccini Date: Wed, 30 Aug 2017 09:37:03 +0000 (+0200) Subject: LU-9930 llite: only clear lli_sai if the setter X-Git-Tag: 2.10.54~38 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=f4a0ebe28e88cbdd79061fad275cb9494fdba225;p=fs%2Flustre-release.git LU-9930 llite: only clear lli_sai if the setter Previous to this patch, start_statahead_thread() was unconditionnally clearing lli->lli_sai upon error, leading to crash upon racy scenario where it has just been set in/by another thread context. Now, only clear lli_sai if current thread has set it. Signed-off-by: Bruno Faccini Change-Id: I555febfad3494c9dd90eeb72d6dd9157428179ea Reviewed-on: https://review.whamcloud.com/28794 Reviewed-by: Fan Yong Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/statahead.c b/lustre/llite/statahead.c index 3430f81..44cc9e6 100644 --- a/lustre/llite/statahead.c +++ b/lustre/llite/statahead.c @@ -1608,8 +1608,10 @@ 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); - lli->lli_sa_enabled = 0; - lli->lli_sai = NULL; + if (sai != NULL && lli->lli_sai == sai) { + lli->lli_sa_enabled = 0; + lli->lli_sai = NULL; + } spin_unlock(&lli->lli_sa_lock); if (sai != NULL)