From 5df0459712fe1af2bc9459b4ce1b5a1220682c26 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. Signed-off-by: Sergey Cheremencev Change-Id: I1168903bff88df7e5106186b082e8065a6480367 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51629 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Hongchao Zhang Reviewed-by: Mikhail Pershin Reviewed-by: Oleg Drokin --- 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 b7fd0e7..9935897 100644 --- a/lustre/quota/qmt_lock.c +++ b/lustre/quota/qmt_lock.c @@ -907,6 +907,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 @@ -925,8 +931,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); @@ -943,8 +947,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