Whamcloud - gitweb
LU-16913 quota: fix ASSERTION(lqe->lqe_gl) 29/51629/2
authorSergey Cheremencev <scherementsev@ddn.com>
Tue, 11 Jul 2023 14:28:12 +0000 (18:28 +0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 19 Jul 2023 16:45:47 +0000 (16:45 +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.

Signed-off-by: Sergey Cheremencev <scherementsev@ddn.com>
Change-Id: I1168903bff88df7e5106186b082e8065a6480367
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51629
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
Reviewed-by: Mikhail Pershin <mpershin@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/quota/qmt_lock.c

index b7fd0e7..9935897 100644 (file)
@@ -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;
 }