From: Bruno Faccini Date: Wed, 19 Feb 2020 13:48:48 +0000 (+0100) Subject: LU-13262 ldlm: no current source if lu_ref_del not in same tsk X-Git-Tag: 2.13.54~21 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=419325a2c9a29e9b372d071992cef5ea9def8cc0 LU-13262 ldlm: no current source if lu_ref_del not in same tsk Running with USE_LU_REF ("configure --enable-lu_ref") configured triggers a LBUG (because "ref->lf_failed > 0" condition false) due to to using "current" as the lu_ref source, but in some cases lu_ref_del() occurs within a different task context. To avoid this, lu_ref source is changed to ldlm_lock address by this patch. Signed-off-by: Bruno Faccini Change-Id: Ia35e31c1a722c03f97672025e2abff40486b3f76 Reviewed-on: https://review.whamcloud.com/37624 Tested-by: jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Mike Pershin --- diff --git a/lustre/include/lustre_dlm.h b/lustre/include/lustre_dlm.h index 8cefd83..5ad6c70 100644 --- a/lustre/include/lustre_dlm.h +++ b/lustre/include/lustre_dlm.h @@ -1428,7 +1428,7 @@ static inline struct ldlm_lock *ldlm_handle2lock(const struct lustre_handle *h) } #define LDLM_LOCK_REF_DEL(lock) \ - lu_ref_del(&lock->l_reference, "handle", current) + lu_ref_del(&lock->l_reference, "handle", lock) static inline struct ldlm_lock * ldlm_handle2lock_long(const struct lustre_handle *h, __u64 flags) diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index 319713a..cf84a20 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_atomic(&lock->l_reference, "handle", current); + lu_ref_add_atomic(&lock->l_reference, "handle", lock); RETURN(lock); } @@ -625,7 +625,7 @@ struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *handle, LASSERT(lock->l_resource != NULL); - lu_ref_add_atomic(&lock->l_reference, "handle", current); + lu_ref_add_atomic(&lock->l_reference, "handle", lock); if (unlikely(ldlm_is_destroyed(lock))) { unlock_res_and_lock(lock); CDEBUG(D_INFO, "lock already destroyed: lock %p\n", lock);