From 1951f4dcd29dc7fac74b435c3fb84cb6a95328e7 Mon Sep 17 00:00:00 2001 From: Bruno Faccini Date: Wed, 19 Feb 2020 17:25:26 +0100 Subject: [PATCH] LU-13264 osc: ensure lu_ref work atomic from osc_lock_upcall() 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 Change-Id: Ide33d4c415e9e382f0bc344e2114182a1f122de6 Reviewed-on: https://review.whamcloud.com/37629 Tested-by: jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Alexandr Boyko Reviewed-by: Oleg Drokin --- lustre/ldlm/ldlm_lock.c | 2 +- lustre/osc/osc_lock.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index 94445d3..11af749 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -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)) { - lu_ref_add(&lock->l_reference, "handle", current); + lu_ref_add_atomic(&lock->l_reference, "handle", current); RETURN(lock); } diff --git a/lustre/osc/osc_lock.c b/lustre/osc/osc_lock.c index e02e46d..7365ad3 100644 --- a/lustre/osc/osc_lock.c +++ b/lustre/osc/osc_lock.c @@ -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() */ - 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); -- 1.8.3.1