From: Hongchao Zhang Date: Thu, 3 Oct 2024 12:02:21 +0000 (+0800) Subject: LU-18078 quota: check version to force_reint if needed X-Git-Tag: 2.16.51~149 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=d06c56d2eb61f0eeee1eed9848101d5a9d6efcfd;p=fs%2Flustre-release.git LU-18078 quota: check version to force_reint if needed 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 Change-Id: I1b33cfbb594e3f1595580d4190fd77efb55bc627 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56513 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Sergey Cheremencev Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- diff --git a/lustre/quota/qsd_internal.h b/lustre/quota/qsd_internal.h index 64c5609..e9463e9 100644 --- a/lustre/quota/qsd_internal.h +++ b/lustre/quota/qsd_internal.h @@ -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; }; /* diff --git a/lustre/quota/qsd_reint.c b/lustre/quota/qsd_reint.c index 759c2aa..387971f 100644 --- a/lustre/quota/qsd_reint.c +++ b/lustre/quota/qsd_reint.c @@ -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)); diff --git a/lustre/quota/qsd_writeback.c b/lustre/quota/qsd_writeback.c index 34cf466..71b09ee 100644 --- a/lustre/quota/qsd_writeback.c +++ b/lustre/quota/qsd_writeback.c @@ -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