Whamcloud - gitweb
LU-18078 quota: check version to force_reint if needed 13/56513/6
authorHongchao Zhang <hongchao@whamcloud.com>
Thu, 3 Oct 2024 12:02:21 +0000 (20:02 +0800)
committerOleg Drokin <green@whamcloud.com>
Mon, 2 Dec 2024 05:50:52 +0000 (05:50 +0000)
If the quota setting's version between QMT and QSD is mismatched,
the new quota request will be deferred and won't be applied if
the missing update with the version had been dropped.
This patch will check the version during processing the incoming
quota LDLM glimpse request and inside the QSD writeback thread,
and will trigger the force_reint if the missed version has not
been arrived in time.

Signed-off-by: Hongchao Zhang <hongchao@whamcloud.com>
Change-Id: I1b33cfbb594e3f1595580d4190fd77efb55bc627
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56513
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Sergey Cheremencev <scherementsev@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/quota/qsd_internal.h
lustre/quota/qsd_reint.c
lustre/quota/qsd_writeback.c

index 64c5609..e9463e9 100644 (file)
@@ -161,6 +161,9 @@ struct qsd_qtype_info {
        __u64                   qqi_default_hardlimit;
        __u64                   qqi_default_softlimit;
        __u64                   qqi_default_gracetime;
+
+       /* the last time of updating quota index version */
+       time64_t                qqi_last_version_update_time;
 };
 
 /*
index 759c2aa..387971f 100644 (file)
@@ -198,6 +198,8 @@ static int qsd_reint_index(const struct lu_env *env, struct qsd_qtype_info *qqi,
                        GOTO(out, rc = -ENOMEM);
        }
 
+       qqi->qqi_last_version_update_time = ktime_get_seconds();
+
 repeat:
        /* initialize index_info request with FID of global index */
        memset(ii, 0, sizeof(*ii));
index 34cf466..71b09ee 100644 (file)
@@ -181,6 +181,7 @@ void qsd_bump_version(struct qsd_qtype_info *qqi, __u64 ver, bool global)
        list    = global ? &qqi->qqi_deferred_glb : &qqi->qqi_deferred_slv;
 
        write_lock(&qqi->qqi_qsd->qsd_lock);
+       qqi->qqi_last_version_update_time = ktime_get_seconds();
        *idx_ver = ver;
        if (global)
                qqi->qqi_glb_uptodate = 1;
@@ -207,6 +208,7 @@ void qsd_upd_schedule(struct qsd_qtype_info *qqi, struct lquota_entry *lqe,
        struct qsd_upd_rec      *upd;
        struct qsd_instance     *qsd = qqi->qqi_qsd;
        __u64                    cur_ver;
+       bool                     need_to_trigger_reint = false;
        ENTRY;
 
        CDEBUG(D_QUOTA, "%s: schedule update. global:%s, version:%llu\n",
@@ -244,17 +246,24 @@ void qsd_upd_schedule(struct qsd_qtype_info *qqi, struct lquota_entry *lqe,
                   qqi->qqi_slv_uptodate) {
                /* In order update, and reintegration has been done. */
                qsd_upd_add(qsd, upd);
-       } else {
+       } else if (qqi->qqi_last_version_update_time + QSD_WB_INTERVAL >=
+                  ktime_get_seconds()) {
                /* Out of order update (the one with smaller version hasn't
                 * reached slave or hasn't been flushed to disk yet), or
                 * the reintegration is in progress. Defer the update. */
                struct list_head *list = global ? &qqi->qqi_deferred_glb :
                                                  &qqi->qqi_deferred_slv;
                qsd_add_deferred(qsd, list, upd);
+       } else {
+               qsd_upd_free(upd);
+               need_to_trigger_reint = true;
        }
 
        write_unlock(&qsd->qsd_lock);
 
+       if (need_to_trigger_reint)
+               qsd_start_reint_thread(qqi);
+
        EXIT;
 }
 
@@ -472,6 +481,10 @@ static bool qsd_job_pending(struct qsd_instance *qsd, struct list_head *upd,
                if (!qsd_type_enabled(qsd, qtype))
                        continue;
 
+               if (qqi->qqi_last_version_update_time + QSD_WB_INTERVAL <
+                   ktime_get_seconds() && !list_empty(&qqi->qqi_deferred_glb))
+                       *uptodate = false;
+
                if ((!qqi->qqi_glb_uptodate || !qqi->qqi_slv_uptodate) &&
                     !qqi->qqi_reint)
                        /* global or slave index not up to date and reint