Whamcloud - gitweb
LU-1438 quota: quota active checking is missed on slave
authorNiu Yawei <niu@whamcloud.com>
Fri, 8 Jun 2012 04:55:40 +0000 (21:55 -0700)
committerJohann Lombardi <johann@whamcloud.com>
Tue, 12 Jun 2012 20:03:31 +0000 (16:03 -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: I707bc34684e95f2a0beec99548dc2d78a4ce8bbf
Reviewed-on: http://review.whamcloud.com/3060
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
lustre/quota/quota_context.c
lustre/quota/quota_interface.c

index 12fb024..0df0344 100644 (file)
@@ -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);
index f0ed393..2778008 100644 (file)
@@ -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)) {