From c1189104dde05cab312c674f6fe641fab41d2d1a Mon Sep 17 00:00:00 2001 From: Li Dongyang Date: Thu, 26 Mar 2015 09:33:54 +1100 Subject: [PATCH] LU-6403 quota: fix soft lockup in qmt_adjust_qunit If the user sets the quota limits >= ULLONG_MAX using lfs setquota, we will set the limits to ULLONG_MAX and stuck in the infinite loop when trying to increase qunit. Break the loop when that happens and set qunit to limit / (2 * slv_cnt) instead. Signed-off-by: Li Dongyang Change-Id: I6fb842c62ad46d8765f6c4c41187cf0dcd543c53 Reviewed-on: http://review.whamcloud.com/14187 Tested-by: Jenkins Reviewed-by: Niu Yawei Reviewed-by: Fan Yong Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/quota/qmt_entry.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lustre/quota/qmt_entry.c b/lustre/quota/qmt_entry.c index 47a1ccf..8997dec 100644 --- a/lustre/quota/qmt_entry.c +++ b/lustre/quota/qmt_entry.c @@ -641,8 +641,14 @@ void qmt_adjust_qunit(const struct lu_env *env, struct lquota_entry *lqe) /* current qunit value still fits, let's see if we can afford to * increase qunit now ... * To increase qunit again, we have to be under 25% */ - while (limit >= lqe->lqe_granted + 6 * qunit * slv_cnt) + while (qunit && limit >= lqe->lqe_granted + 6 * qunit * slv_cnt) qunit <<= 2; + + if (!qunit) { + qunit = limit; + do_div(qunit, 2 * slv_cnt); + } + } else { /* shrink qunit until we find a suitable value */ while (qunit > pool->qpi_least_qunit && -- 1.8.3.1