Whamcloud - gitweb
LU-16913 quota: fix ASSERTION(lqe->lqe_gl)
authorSergey Cheremencev <scherementsev@ddn.com>
Tue, 11 Jul 2023 14:28:12 +0000 (18:28 +0400)
committerAndreas Dilger <adilger@whamcloud.com>
Sun, 23 Jul 2023 01:18:04 +0000 (01:18 +0000)
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 <scherementsev@ddn.com>
Change-Id: I1168903bff88df7e5106186b082e8065a6480367
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51685
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/quota/qmt_lock.c

index 4da6aa5..a85cc99 100644 (file)
@@ -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;
 }