Whamcloud - gitweb
b=24055 a patch to detect if quota is turned on properly
authorLanden <zhiyong.tian@oracle.com>
Fri, 10 Dec 2010 16:47:38 +0000 (00:47 +0800)
committerVitaly Fertman <vitaly.fertman@oracle.com>
Fri, 10 Dec 2010 23:55:45 +0000 (02:55 +0300)
i=johann
i=panda

lustre/quota/lproc_quota.c
lustre/quota/quota_context.c
lustre/quota/quota_ctl.c
lustre/quota/quota_master.c
lustre/tests/sanity-quota.sh

index d7aefe6..828a7c1 100644 (file)
@@ -259,6 +259,11 @@ int generic_quota_on(struct obd_device *obd, struct obd_quotactl *oqctl, int glo
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         cfs_up(&obt->obt_quotachecking);
 
+        CDEBUG(D_QUOTA, "%s: quotaon type:master:global:local:flags:rc "
+               "%u:%d:%d:%d:%lu:%d\n",
+               obd->obd_name, oqctl->qc_type, is_master, global, local,
+               obt->obt_qctxt.lqc_flags, rc);
+
         return rc;
 }
 
index ace8caa..4d56826 100644 (file)
@@ -1496,30 +1496,17 @@ exit:
         EXIT;
 }
 
-int quota_is_on(struct lustre_quota_ctxt *qctxt, struct obd_quotactl *oqctl)
+inline int quota_is_on(struct lustre_quota_ctxt *qctxt,
+                       struct obd_quotactl *oqctl)
 {
-        unsigned int type;
-
-        for (type = USRQUOTA; type < MAXQUOTAS; type++) {
-                if (!Q_TYPESET(oqctl, type))
-                        continue;
-                if (!(qctxt->lqc_flags & UGQUOTA2LQC(oqctl->qc_type)))
-                        return 0;
-        }
-        return 1;
+        return ((qctxt->lqc_flags & UGQUOTA2LQC(oqctl->qc_type)) ==
+                UGQUOTA2LQC(oqctl->qc_type));
 }
 
-int quota_is_off(struct lustre_quota_ctxt *qctxt, struct obd_quotactl *oqctl)
+inline int quota_is_off(struct lustre_quota_ctxt *qctxt,
+                        struct obd_quotactl *oqctl)
 {
-        unsigned int type;
-
-        for (type = USRQUOTA; type < MAXQUOTAS; type++) {
-                if (!Q_TYPESET(oqctl, type))
-                        continue;
-                if (qctxt->lqc_flags & UGQUOTA2LQC(oqctl->qc_type))
-                        return 0;
-        }
-        return 1;
+        return !(qctxt->lqc_flags & UGQUOTA2LQC(oqctl->qc_type));
 }
 
 /**
index 72d3955..3c761f4 100644 (file)
@@ -183,6 +183,9 @@ int filter_quota_ctl(struct obd_device *unused, struct obd_export *exp,
                                                 ~UGQUOTA2LQC(oqctl->qc_type);
                                 else if (quota_is_off(qctxt, oqctl))
                                                 rc = -EALREADY;
+                                CDEBUG(D_QUOTA, "%s: quotaoff type:flags:rc "
+                                       "%u:%lu:%d\n", obd->obd_name,
+                                       oqctl->qc_type, qctxt->lqc_flags, rc);
                         }
                         cfs_up(&obt->obt_quotachecking);
                 }
index 6397393..f675772 100644 (file)
@@ -938,6 +938,8 @@ int do_mds_quota_off(struct obd_device *obd, struct obd_quotactl *oqctl)
         EXIT;
 
 out:
+        CDEBUG(D_QUOTA, "%s: quotaoff type:flags:rc %u:%lu:%d\n",
+               obd->obd_name, oqctl->qc_type, qctxt->lqc_flags, rc);
         cfs_up_write(&mds->mds_qonoff_sem);
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         return rc ? : (rc1 ? : rc2);
index ef5def1..335df41 100644 (file)
@@ -295,12 +295,13 @@ quota_show_check() {
 
 # set quota
 quota_init() {
+       do_nodes $(comma_list $(nodes_list)) "lctl set_param debug=+quota"
+
+       log "do the quotacheck ..."
        $LFS quotacheck -ug $DIR
 
        resetquota -u $TSTUSR
        resetquota -g $TSTUSR
-
-        do_nodes $(comma_list $(nodes_list)) "lctl set_param debug=+quota"
 }
 quota_init