Whamcloud - gitweb
LU-13264 osc: ensure lu_ref work atomic from osc_lock_upcall() 29/37629/2
authorBruno Faccini <bruno.faccini@intel.com>
Wed, 19 Feb 2020 16:25:26 +0000 (17:25 +0100)
committerOleg Drokin <green@whamcloud.com>
Tue, 25 Feb 2020 05:52:14 +0000 (05:52 +0000)
Since osc_lock_upcall() uses per-cpu env via
cl_env_percpu_[get,put](), all undelying work must execute on the
same CPU, meaning that no sleep()/scheduling must occur.
This implies all lu_ref related work to no longer use lu_ref_add(),
which calls might_sleep() (likely to cause a
scheduling/cpu-switch...), but lu_ref_add_atomoc() instead.

Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Change-Id: Ide33d4c415e9e382f0bc344e2114182a1f122de6
Reviewed-on: https://review.whamcloud.com/37629
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alexandr Boyko <c17825@cray.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ldlm/ldlm_lock.c
lustre/osc/osc_lock.c

index 94445d3..11af749 100644 (file)
@@ -617,7 +617,7 @@ struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *handle,
        /* It's unlikely but possible that someone marked the lock as
         * destroyed after we did handle2object on it */
        if ((flags == 0) && !ldlm_is_destroyed(lock)) {
        /* It's unlikely but possible that someone marked the lock as
         * destroyed after we did handle2object on it */
        if ((flags == 0) && !ldlm_is_destroyed(lock)) {
-               lu_ref_add(&lock->l_reference, "handle", current);
+               lu_ref_add_atomic(&lock->l_reference, "handle", current);
                RETURN(lock);
        }
 
                RETURN(lock);
        }
 
index e02e46d..7365ad3 100644 (file)
@@ -214,7 +214,7 @@ static void osc_lock_granted(const struct lu_env *env, struct osc_lock *oscl,
        /* lock reference taken by ldlm_handle2lock_long() is
         * owned by osc_lock and released in osc_lock_detach()
         */
        /* lock reference taken by ldlm_handle2lock_long() is
         * owned by osc_lock and released in osc_lock_detach()
         */
-       lu_ref_add(&dlmlock->l_reference, "osc_lock", oscl);
+       lu_ref_add_atomic(&dlmlock->l_reference, "osc_lock", oscl);
        oscl->ols_has_ref = 1;
 
        LASSERT(oscl->ols_dlmlock == NULL);
        oscl->ols_has_ref = 1;
 
        LASSERT(oscl->ols_dlmlock == NULL);