From: Sergey Cheremencev Date: Thu, 22 Jul 2021 10:56:24 +0000 (+0300) Subject: LU-15048 quota: check that qti_lqes has been inited X-Git-Tag: 2.14.56~91 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=d1231c4d6adf6a2d39c62ed684535e86d9a40bc0;p=fs%2Flustre-release.git LU-15048 quota: check that qti_lqes has been inited qti_lqes_resotre_init/fini should check that qti_lqes has been inited before address qti_lqes_count. Fix helps against following panic: qti_lqes_restore_fini()) ASSERTION( qmt_info(env)->qti_lqes_rstr ) failed: HPE-bug-id: LUS-10239 Change-Id: Ic93d87535f615fe419b2c3a2453506c515837031 Reviewed-on: https://es-gerrit.dev.cray.com/159116 Reviewed-by: Alexander Boyko Reviewed-by: Shaun Tancheff Tested-by: Elena Gryaznova Signed-off-by: Sergey Cheremencev Reviewed-on: https://review.whamcloud.com/45102 Tested-by: Maloo Tested-by: jenkins Reviewed-by: Shaun Tancheff Reviewed-by: Oleg Drokin --- diff --git a/lustre/quota/qmt_entry.c b/lustre/quota/qmt_entry.c index c2bb927..03dc1d7 100644 --- a/lustre/quota/qmt_entry.c +++ b/lustre/quota/qmt_entry.c @@ -944,6 +944,7 @@ void qti_lqes_fini(const struct lu_env *env) qti->qti_lqes_num * sizeof(struct lquota_entry *)); qti->qti_lqes_num = 0; + qti->qti_lqes_cnt = 0; } int qti_lqes_min_qunit(const struct lu_env *env) @@ -975,7 +976,7 @@ int qti_lqes_restore_init(const struct lu_env *env) { int rc = 0; - if (qti_lqes_cnt(env) > QMT_MAX_POOL_NUM) { + if (qti_lqes_inited(env) && qti_lqes_cnt(env) > QMT_MAX_POOL_NUM) { OBD_ALLOC(qmt_info(env)->qti_lqes_rstr, qti_lqes_cnt(env) * sizeof(struct qmt_lqe_restore)); if (!qti_lqes_rstr(env)) @@ -987,7 +988,7 @@ int qti_lqes_restore_init(const struct lu_env *env) void qti_lqes_restore_fini(const struct lu_env *env) { - if (qti_lqes_cnt(env) > QMT_MAX_POOL_NUM) + if (qti_lqes_inited(env) && qti_lqes_cnt(env) > QMT_MAX_POOL_NUM) OBD_FREE(qmt_info(env)->qti_lqes_rstr, qti_lqes_cnt(env) * sizeof(struct qmt_lqe_restore)); } diff --git a/lustre/quota/qmt_handler.c b/lustre/quota/qmt_handler.c index 166dc30..28b860e 100644 --- a/lustre/quota/qmt_handler.c +++ b/lustre/quota/qmt_handler.c @@ -260,9 +260,11 @@ out: lqe_write_unlock(lqe); out_nolock: - qti_lqes_restore_fini(env); - if (th != NULL && !IS_ERR(th)) - dt_trans_stop(env, qmt->qmt_child, th); + if (!is_updated) { + if (th != NULL && !IS_ERR(th)) + dt_trans_stop(env, qmt->qmt_child, th); + qti_lqes_restore_fini(env); + } if (rc == 0 && dirtied) { qmt_glb_lock_notify(env, lqe, ver);