From d2839dc31896728d9f2c24611eb91e741a66f248 Mon Sep 17 00:00:00 2001 From: Sergey Cheremencev Date: Thu, 17 Jun 2021 13:45:42 +0300 Subject: [PATCH] LU-15049 quota: fix a panic with pool number > 16 Fix a panic that may occur when there are more than 16 pools in a system: qti_pools_add()) ASSERTION(qti->qti_pools_num >= QMT_MAX_POOL_NUM) Forgot init? ffff91a5f9625800 Lustre-change: https://review.whamcloud.com/45105 Lustre-commit: d2e8208e22f21bb7354a9207f381217c222d3df3 HPE-bug-id: LUS-10116 Change-Id: I4f73b74d2fd3e85a51cf3c30e2eec29645f164be Reviewed-by: Petros Koutoupis Reviewed-by: Shaun Tancheff Tested-by: Elena Gryaznova Signed-off-by: Sergey Cheremencev Reviewed-by: Petros Koutoupis Reviewed-by: Andreas Dilger Reviewed-on: https://review.whamcloud.com/46789 Tested-by: jenkins Tested-by: Maloo --- lustre/quota/qmt_entry.c | 2 +- lustre/quota/qmt_pool.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lustre/quota/qmt_entry.c b/lustre/quota/qmt_entry.c index 007ac78..8392c64 100644 --- a/lustre/quota/qmt_entry.c +++ b/lustre/quota/qmt_entry.c @@ -884,7 +884,7 @@ int qti_lqes_add(const struct lu_env *env, struct lquota_entry *lqe) { struct qmt_thread_info *qti = qmt_info(env); - if (qti->qti_lqes_cnt > qti->qti_lqes_num) { + if (qti->qti_lqes_cnt >= qti->qti_lqes_num) { struct lquota_entry **lqes; lqes = qti->qti_lqes; OBD_ALLOC(lqes, sizeof(lqe) * qti->qti_lqes_num * 2); diff --git a/lustre/quota/qmt_pool.c b/lustre/quota/qmt_pool.c index 0806d75..9ecf28d 100644 --- a/lustre/quota/qmt_pool.c +++ b/lustre/quota/qmt_pool.c @@ -312,7 +312,7 @@ static inline int qti_pools_add(const struct lu_env *env, LASSERTF(qti->qti_pools_num >= QMT_MAX_POOL_NUM, "Forgot init? %p\n", qti); - if (qti->qti_pools_cnt > qti->qti_pools_num) { + if (qti->qti_pools_cnt >= qti->qti_pools_num) { OBD_ALLOC(pools, sizeof(qpi) * qti->qti_pools_num * 2); if (!pools) return -ENOMEM; -- 1.8.3.1