From: Hongchao Zhang Date: Sun, 29 Sep 2024 14:16:42 +0000 (+0800) Subject: LU-18024 quota: relate qmt_lvbo_free_wq and QMT X-Git-Tag: 2.16.0-RC3~1 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=846db2f7afb81e15e13fffdbcc86c5448e41768c;p=fs%2Flustre-release.git LU-18024 quota: relate qmt_lvbo_free_wq and QMT 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 Change-Id: I298382fa0eed6885e55991e26e4b36d435e99e26 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56661 Tested-by: Maloo Tested-by: jenkins Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Reviewed-by: Sergey Cheremencev --- diff --git a/lustre/quota/qmt_dev.c b/lustre/quota/qmt_dev.c index a814da6..77ba633 100644 --- a/lustre/quota/qmt_dev.c +++ b/lustre/quota/qmt_dev.c @@ -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); diff --git a/lustre/quota/qmt_internal.h b/lustre/quota/qmt_internal.h index 16de62c..a793a2c 100644 --- a/lustre/quota/qmt_internal.h +++ b/lustre/quota/qmt_internal.h @@ -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 */ }; diff --git a/lustre/quota/qmt_lock.c b/lustre/quota/qmt_lock.c index 3a5dfd6..139509d 100644 --- a/lustre/quota/qmt_lock.c +++ b/lustre/quota/qmt_lock.c @@ -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 */