From: Niu Yawei Date: Wed, 13 Jun 2012 02:42:01 +0000 (-0700) Subject: LU-1438 quota: quota active checking is missed on slave X-Git-Tag: 2.2.58~21 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=bc4c89e0608893ec8fe15012f9477de173ad41d3 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: Iaa48c7cca05daf595b6d3b7e4025c7650e460918 Reviewed-on: http://review.whamcloud.com/3097 Tested-by: Hudson Reviewed-by: Fan Yong Tested-by: Maloo Reviewed-by: Johann Lombardi --- diff --git a/lustre/quota/quota_context.c b/lustre/quota/quota_context.c index 511f0f5..50a14f1 100644 --- a/lustre/quota/quota_context.c +++ b/lustre/quota/quota_context.c @@ -244,7 +244,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); cfs_spin_lock(&qctxt->lqc_lock); @@ -374,9 +374,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 b14d29e..1e68ade 100644 --- a/lustre/quota/quota_interface.c +++ b/lustre/quota/quota_interface.c @@ -195,6 +195,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, const unsigned int id[], 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; @@ -396,6 +404,9 @@ int quota_is_set(struct obd_device *obd, const unsigned int id[], int flag) 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)) {