From bd671c0e5f08e9c862f7d79e307f1173355ef463 Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Thu, 7 Jun 2012 21:55:40 -0700 Subject: [PATCH] LU-1438 quota: quota active checking is missed on slave On quota slave, we missed checking if quota is enabled in the quota_check_common() and several other places. Which could cause slave retry acquire quota in quota_chk_acq_common() infinitely when the quota is already turned off on master. Signed-off-by: Niu Yawei Change-Id: I707bc34684e95f2a0beec99548dc2d78a4ce8bbf Reviewed-on: http://review.whamcloud.com/3060 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Johann Lombardi --- lustre/quota/quota_context.c | 5 +---- lustre/quota/quota_interface.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lustre/quota/quota_context.c b/lustre/quota/quota_context.c index 12fb024..0df0344 100644 --- a/lustre/quota/quota_context.c +++ b/lustre/quota/quota_context.c @@ -238,7 +238,7 @@ check_cur_qunit(struct obd_device *obd, int ret = 0; ENTRY; - if (!ll_sb_any_quota_active(sb)) + if (!ll_sb_has_quota_active(sb, QDATA_IS_GRP(qdata))) RETURN(0); spin_lock(&qctxt->lqc_lock); @@ -366,9 +366,6 @@ int compute_remquota(struct obd_device *obd, struct lustre_quota_ctxt *qctxt, int ret = QUOTA_RET_OK; ENTRY; - if (!ll_sb_any_quota_active(sb)) - RETURN(QUOTA_RET_NOQUOTA); - /* ignore root user */ if (qdata->qd_id == 0 && QDATA_IS_GRP(qdata) == USRQUOTA) RETURN(QUOTA_RET_NOLIMIT); diff --git a/lustre/quota/quota_interface.c b/lustre/quota/quota_interface.c index f0ed393..2778008 100644 --- a/lustre/quota/quota_interface.c +++ b/lustre/quota/quota_interface.c @@ -193,6 +193,10 @@ static int filter_quota_getflag(struct obd_device *obd, struct obdo *oa) for (cnt = 0; cnt < MAXQUOTAS; cnt++) { struct lustre_qunit_size *lqs = NULL; + /* check if quota is enabled */ + if (!ll_sb_has_quota_active(obt->obt_sb, cnt)) + continue; + lqs = quota_search_lqs(LQS_KEY(cnt, GET_OA_ID(cnt, oa)), qctxt, 0); if (IS_ERR(lqs)) { @@ -289,6 +293,10 @@ static int quota_check_common(struct obd_device *obd, unsigned int uid, QDATA_SET_BLK(&qdata[i]); qdata[i].qd_count = 0; + /* check if quota is enabled */ + if (!ll_sb_has_quota_active(qctxt->lqc_sb, i)) + continue; + /* ignore root user */ if (qdata[i].qd_id == 0 && !QDATA_IS_GRP(&qdata[i])) continue; @@ -505,6 +513,9 @@ int quota_is_set(struct obd_device *obd, unsigned int uid, RETURN(0); for (i = 0; i < MAXQUOTAS; i++) { + /* check if quota is enabled */ + if (!ll_sb_has_quota_active(obd->u.obt.obt_qctxt.lqc_sb, i)) + continue; lqs = quota_search_lqs(LQS_KEY(i, id[i]), &obd->u.obt.obt_qctxt, 0); if (lqs && !IS_ERR(lqs)) { -- 1.8.3.1