Whamcloud - gitweb
LU-15048 quota: check that qti_lqes has been inited 02/45102/3
authorSergey Cheremencev <sergey.cheremencev@hpe.com>
Thu, 22 Jul 2021 10:56:24 +0000 (13:56 +0300)
committerOleg Drokin <green@whamcloud.com>
Sat, 20 Nov 2021 06:25:46 +0000 (06:25 +0000)
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 <alexander.boyko@hpe.com>
Reviewed-by: Shaun Tancheff <stancheff@cray.com>
Tested-by: Elena Gryaznova <c17455@cray.com>
Signed-off-by: Sergey Cheremencev <sergey.cheremencev@hpe.com>
Reviewed-on: https://review.whamcloud.com/45102
Tested-by: Maloo <maloo@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/quota/qmt_entry.c
lustre/quota/qmt_handler.c

index c2bb927..03dc1d7 100644 (file)
@@ -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));
 }
index 166dc30..28b860e 100644 (file)
@@ -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);