From 16ee9ecdb0725e1158650533241dfa259b1e458b Mon Sep 17 00:00:00 2001 From: Sergey Cheremencev Date: Tue, 11 Jul 2023 18:28:12 +0400 Subject: [PATCH] LU-16913 quota: fix ASSERTION(lqe->lqe_gl) It is possible to add in a 2nd time lqe into qmt_reba_list while handling of the 1st from the 1st time is not finished. There is a small window in qmt_id_lock_glimpse when lqe_link is empty but lqe_gl is not set. Lustre-change: https://review.whamcloud.com/51629 Lustre-commit: 5df0459712fe1af2bc9459b4ce1b5a1220682c26 Signed-off-by: Sergey Cheremencev Change-Id: I1168903bff88df7e5106186b082e8065a6480367 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51685 Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo --- lustre/quota/qmt_lock.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lustre/quota/qmt_lock.c b/lustre/quota/qmt_lock.c index 4da6aa5..a85cc99 100644 --- a/lustre/quota/qmt_lock.c +++ b/lustre/quota/qmt_lock.c @@ -913,6 +913,12 @@ static void qmt_id_lock_glimpse(const struct lu_env *env, } lqe_write_lock(lqe); + /* + * It is possible to add an lqe in a 2nd time while the same lqe + * from the 1st time is still sending glimpse + */ + if (lqe->lqe_gl) + GOTO(out, 0); /* The purpose of glimpse callback on per-ID lock is twofold: * - notify slaves of new qunit value and hope they will release some * spare quota space in return @@ -931,8 +937,6 @@ static void qmt_id_lock_glimpse(const struct lu_env *env, * replies if needed */ lqe->lqe_may_rel = 0; - /* The rebalance thread is the only thread which can issue glimpses */ - LASSERT(!lqe->lqe_gl); lqe->lqe_gl = true; lqe_write_unlock(lqe); @@ -949,8 +953,8 @@ static void qmt_id_lock_glimpse(const struct lu_env *env, } LASSERT(lqe->lqe_gl); lqe->lqe_gl = false; +out: lqe_write_unlock(lqe); - ldlm_resource_putref(res); EXIT; } -- 1.8.3.1