Whamcloud - gitweb
LU-18024 quota: relate qmt_lvbo_free_wq and QMT 61/56661/3
authorHongchao Zhang <hongchao@whamcloud.com>
Sun, 29 Sep 2024 14:16:42 +0000 (22:16 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 18 Oct 2024 18:47:39 +0000 (18:47 +0000)
The global variable "qmt_lvbo_free_wq" could be affected if there
are more than one Lustre mount (for instance, using snapshot),
this patch moves it into "struct qmt_device" and it will only be
used by this QMT(MDT0000) and avoid conflict.

Fixes: 2cc18ece1e ("LU-14535 quota: free lvbo in a wq")
Signed-off-by: Hongchao Zhang <hongchao@whamcloud.com>
Change-Id: I298382fa0eed6885e55991e26e4b36d435e99e26
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56661
Tested-by: Maloo <maloo@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Sergey Cheremencev <scherementsev@ddn.com>
lustre/quota/qmt_dev.c
lustre/quota/qmt_internal.h
lustre/quota/qmt_lock.c

index a814da6..77ba633 100644 (file)
@@ -77,9 +77,9 @@ static struct lu_device *qmt_device_fini(const struct lu_env *env,
        CDEBUG(D_QUOTA, "%s: initiating QMT shutdown\n", qmt->qmt_svname);
        qmt->qmt_stopping = true;
 
-       if (qmt_lvbo_free_wq) {
-               destroy_workqueue(qmt_lvbo_free_wq);
-               qmt_lvbo_free_wq = NULL;
+       if (qmt->qmt_lvbo_free_wq) {
+               destroy_workqueue(qmt->qmt_lvbo_free_wq);
+               qmt->qmt_lvbo_free_wq = NULL;
        }
 
        /* kill pool instances, if any */
@@ -264,8 +264,8 @@ static int qmt_device_init0(const struct lu_env *env, struct qmt_device *qmt,
        if (rc)
                GOTO(out, rc);
 
-       qmt_lvbo_free_wq = alloc_workqueue("qmt_lvbo_free", WQ_UNBOUND, 0);
-       if (!qmt_lvbo_free_wq) {
+       qmt->qmt_lvbo_free_wq = alloc_workqueue("qmt_lvbo_free", WQ_UNBOUND, 0);
+       if (!qmt->qmt_lvbo_free_wq) {
                rc = -ENOMEM;
                CERROR("%s: failed to start qmt_lvbo_free workqueue: rc = %d\n",
                       qmt->qmt_svname, rc);
index 16de62c..a793a2c 100644 (file)
@@ -57,6 +57,8 @@ struct qmt_device {
        /* lock protecting rebalancing list */
        spinlock_t               qmt_reba_lock;
 
+       struct workqueue_struct *qmt_lvbo_free_wq;
+
        unsigned long            qmt_stopping:1; /* qmt is stopping */
 
 };
index 3a5dfd6..139509d 100644 (file)
@@ -21,8 +21,6 @@
 
 #include "qmt_internal.h"
 
-struct workqueue_struct *qmt_lvbo_free_wq;
-
 /* intent policy function called from mdt_intent_opc() when the intent is of
  * quota type */
 int qmt_intent_policy(const struct lu_env *env, struct lu_device *ld,
@@ -532,6 +530,8 @@ int qmt_lvbo_fill(struct lu_device *ld, struct ldlm_lock *lock, void *lvb,
  */
 int qmt_lvbo_free(struct lu_device *ld, struct ldlm_resource *res)
 {
+       struct qmt_device *qmt = lu2qmt_dev(ld);
+
        ENTRY;
 
        if (res->lr_lvb_data == NULL)
@@ -540,7 +540,7 @@ int qmt_lvbo_free(struct lu_device *ld, struct ldlm_resource *res)
        if (res->lr_name.name[LUSTRE_RES_ID_QUOTA_SEQ_OFF] != 0) {
                struct lquota_entry *lqe = res->lr_lvb_data;
 
-               queue_work(qmt_lvbo_free_wq, &lqe->lqe_work);
+               queue_work(qmt->qmt_lvbo_free_wq, &lqe->lqe_work);
        } else {
                struct dt_object *obj = res->lr_lvb_data;
                /* release object reference */