Whamcloud - gitweb
LU-16913 quota: notify newest lqe in qmt_set_id_notify 37/53637/2
authorSergey Cheremencev <scherementsev@ddn.com>
Wed, 10 Jan 2024 18:56:03 +0000 (21:56 +0300)
committerOleg Drokin <green@whamcloud.com>
Thu, 15 Feb 2024 07:09:00 +0000 (07:09 +0000)
It is possible that lqe_locate may call lqe_find inside
qmt_pool_lqes_lookup_spec and insert the 2nd lqe into
lqs_hash during processing the previous one. Do not add the
1st lqe to be processed by qmt_reba_thread in qmt_id_lock_notify,
as this lqe will be freed in the end of lqe_locate_find due
to the race with the 2nd that is already exist in lqs_hash.
This fix should potentially fix the following assertion:

  (qmt_lock.c:950:qmt_id_lock_glimpse()) ASSERTION( lqe->lqe_gl ) failed:
  (qmt_lock.c:950:qmt_id_lock_glimpse()) LBUG

Fixes: 09f9fb3211 ("LU-11023 quota: quota pools for OSTs")
Signed-off-by: Sergey Cheremencev <scherementsev@ddn.com>
Change-Id: I3a3114d880077c87e61fccf4f32e3845bd42d842
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53637
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/quota/qmt_handler.c

index f6f830c..2d38a8d 100644 (file)
@@ -110,17 +110,18 @@ static void qmt_set_id_notify(const struct lu_env *env, struct qmt_device *qmt,
        struct lquota_entry *lqe_gl;
        int rc;
 
-       lqe_gl = lqe->lqe_is_global ? lqe : NULL;
+       if (lqe->lqe_is_global && !lqe->lqe_enforced)
+               RETURN_EXIT;
+
        rc = qmt_pool_lqes_lookup_spec(env, qmt, lqe_rtype(lqe),
                                       lqe_qtype(lqe), &lqe->lqe_id);
        if (rc)
                GOTO(lqes_fini, rc);
 
-       if (!lqe_gl && qti_lqes_glbl(env)->lqe_is_global)
-               lqe_gl = qti_lqes_glbl(env);
-
-       if (!lqe_gl)
-               GOTO(lqes_fini, rc);
+       lqe_gl = qti_lqes_glbl(env);
+       /* If global lqe is not enforced, it is not added to qti_lqes array */
+       if (!lqe_gl->lqe_is_global)
+               GOTO(lqes_fini, 0);
 
        mutex_lock(&lqe_gl->lqe_glbl_data_lock);
        if (lqe_gl->lqe_glbl_data)