Whamcloud - gitweb
LU-15048 quota: check that qti_lqes has been inited
[fs/lustre-release.git] / lustre / quota / qmt_entry.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));
 }