From 18aafe97a6782f9c7c301125895d23c0dff9ad8d Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Sun, 18 Dec 2011 20:12:55 -0800 Subject: [PATCH] LU-935 quota: break early when b/i_unit_sz exceeded upper limit While expanding b/i_unit_sz in dquot_create_oqaq(), we'd break the loop early when the b/i_unit_sz exceeded upper limit, otherwise, qaq_b/iunit_sz could be overflow and result in endless loop. Signed-off-by: Niu Yawei Change-Id: I6046c8b86cad00c8c2fa2d24d0e21821a3c02209 Reviewed-on: http://review.whamcloud.com/1887 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Johann Lombardi --- lustre/quota/quota_master.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lustre/quota/quota_master.c b/lustre/quota/quota_master.c index 89175d9..43ee489 100644 --- a/lustre/quota/quota_master.c +++ b/lustre/quota/quota_master.c @@ -1062,6 +1062,8 @@ int dquot_create_oqaq(struct lustre_quota_ctxt *qctxt, oqaq->qaq_bunit_sz = QUSG(oqaq->qaq_bunit_sz * cqs_factor, 1) << QUOTABLOCK_BITS; + if (oqaq->qaq_bunit_sz >= qctxt->lqc_bunit_sz) + break; b_limitation = oqaq->qaq_bunit_sz * ost_num * shrink_qunit_limit; } @@ -1096,6 +1098,8 @@ int dquot_create_oqaq(struct lustre_quota_ctxt *qctxt, while (ilimit > dquot->dq_dqb.dqb_curinodes + 2 * i_limitation) { oqaq->qaq_iunit_sz = oqaq->qaq_iunit_sz * cqs_factor; + if (oqaq->qaq_iunit_sz >= qctxt->lqc_iunit_sz) + break; i_limitation = oqaq->qaq_iunit_sz * mdt_num * shrink_qunit_limit; } -- 1.8.3.1