Whamcloud - gitweb
LU-1438 quota: quota active checking is missed on slave
authorNiu Yawei <niu@whamcloud.com>
Wed, 13 Jun 2012 02:42:01 +0000 (19:42 -0700)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 22 Jun 2012 15:56:36 +0000 (11:56 -0400)
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 <niu@whamcloud.com>
Change-Id: Iaa48c7cca05daf595b6d3b7e4025c7650e460918
Reviewed-on: http://review.whamcloud.com/3097
Tested-by: Hudson
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
lustre/quota/quota_context.c
lustre/quota/quota_interface.c

index 511f0f5..50a14f1 100644 (file)
@@ -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);
index b14d29e..1e68ade 100644 (file)
@@ -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)) {