From fc4b46df111bbf9d2207265d18b3f0d72f49502c Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Mon, 19 Dec 2011 02:18:28 -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: I0bf069e9259627426d7a87ec42844eaed7a733b4 Reviewed-on: http://review.whamcloud.com/1890 Tested-by: Hudson Reviewed-by: Johann Lombardi Reviewed-by: Fan Yong Tested-by: Maloo --- 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 710f801..eac45d3 100644 --- a/lustre/quota/quota_master.c +++ b/lustre/quota/quota_master.c @@ -1054,6 +1054,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 + 1) * shrink_qunit_limit; } @@ -1088,6 +1090,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