Whamcloud - gitweb
LU-7994 statahead: add smp_mb() to serialize ops 40/23040/3
authorLai Siyao <lai.siyao@intel.com>
Mon, 10 Oct 2016 08:44:12 +0000 (16:44 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 9 Mar 2017 06:11:56 +0000 (06:11 +0000)
In ll_deauthorize_statahead(), it set thread stop flag, and then
wake up thread, however wakeup is called inside spinlock in case
ll_statahead_info is released, then we need to call smp_mb() to
serialize setting and wakeup.

Signed-off-by: Lai Siyao <lai.siyao@intel.com>
Change-Id: I500bdf325aa0bd122b17bea448c3b9eec809a2a7
Reviewed-on: https://review.whamcloud.com/23040
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/statahead.c

index 3063a4e..5724ac4 100644 (file)
@@ -1233,8 +1233,12 @@ void ll_deauthorize_statahead(struct inode *dir, void *key)
                /*
                 * statahead thread may not quit yet because it needs to cache
                 * entries, now it's time to tell it to quit.
+                *
+                * In case sai is released, wake_up() is called inside spinlock,
+                * so we have to call smp_mb() explicitely to serialize ops.
                 */
                thread_set_flags(&sai->sai_thread, SVC_STOPPING);
+               smp_mb();
                wake_up(&sai->sai_thread.t_ctl_waitq);
        }
        spin_unlock(&lli->lli_sa_lock);