Whamcloud - gitweb
Branch HEAD
authorfanyong <fanyong>
Thu, 22 Oct 2009 02:38:49 +0000 (02:38 +0000)
committerfanyong <fanyong>
Thu, 22 Oct 2009 02:38:49 +0000 (02:38 +0000)
b=20811
i=tianzy
i=robert.read

Do not try to acquire quota from master repeatly if mismatched quota configure was found.

lustre/lvfs/fsfilt_ext3.c
lustre/lvfs/lustre_quota_fmt.c
lustre/quota/quota_context.c
lustre/quota/quota_interface.c
lustre/tests/sanity-quota.sh
lustre/tests/test-framework.sh

index 8cfbd00..36d126d 100644 (file)
@@ -2096,7 +2096,7 @@ static int fsfilt_ext3_quotainfo(struct lustre_quota_info *lqi, int type,
 
         if (lqi->qi_files[type] == NULL) {
                 CERROR("operate qinfo before it's enabled!\n");
-                RETURN(-EIO);
+                RETURN(-ESRCH);
         }
 
         switch (cmd) {
@@ -2139,7 +2139,7 @@ static int fsfilt_ext3_dquot(struct lustre_dquot *dquot, int cmd)
 
         if (dquot->dq_info->qi_files[dquot->dq_type] == NULL) {
                 CERROR("operate dquot before it's enabled!\n");
-                RETURN(-EIO);
+                RETURN(-ESRCH);
         }
 
         switch (cmd) {
index 0488c2c..937e496 100644 (file)
@@ -843,7 +843,7 @@ int lustre_read_dquot(struct lustre_dquot *dquot)
         /* Invalidated quota? */
         if (!dquot->dq_info || !(filp = dquot->dq_info->qi_files[type])) {
                 CDEBUG(D_ERROR, "VFS: Quota invalidated while reading!\n");
-                return -EIO;
+                return -ESRCH;
         }
 
         version = dquot->dq_info->qi_version;
index 440ddf8..e65bfaf 100644 (file)
@@ -830,6 +830,10 @@ static int dqacq_interpret(const struct lu_env *env,
                 rc = -EPROTO;
         }
 
+        if (unlikely(rc == -ESRCH))
+                CERROR("quota for %s has been enabled by master, but disabled "
+                       "by slave.\n", QDATA_IS_GRP(qdata) ? "group" : "user");
+
         rc = dqacq_completion(obd, qctxt, qdata, rc,
                               lustre_msg_get_opc(req->rq_reqmsg));
 
index 1a8076b..df2039a 100644 (file)
@@ -461,6 +461,13 @@ static int quota_chk_acq_common(struct obd_device *obd, const unsigned int id[],
                         break;
                 }
 
+                /* Related quota has been disabled by master, but enabled by
+                 * slave, do not try again. */
+                if (unlikely(rc == -ESRCH)) {
+                        CERROR("mismatched quota configuration, stop try.\n");
+                        break;
+                }
+
                 /* -EBUSY and others, wait a second and try again */
                 if (rc < 0) {
                         cfs_waitq_t        waitq;
index d752e97..fe14e19 100644 (file)
@@ -52,8 +52,6 @@ DIRECTIO=${DIRECTIO:-$LUSTRE/tests/directio}
 
 [ $MDSCOUNT -gt 1 ] && skip "CMD case" && exit 0
 
-unset ENABLE_QUOTA
-
 remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0
 remote_ost_nodsh && skip "remote OST with nodsh" && exit 0
 
@@ -66,11 +64,15 @@ QUOTALOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
 DIR=${DIR:-$MOUNT}
 DIR2=${DIR2:-$MOUNT2}
 
+QUOTA_AUTO_OLD=$QUOTA_AUTO
+export QUOTA_AUTO=0
+
 check_and_setup_lustre
 
 if [ x"$(som_check)" = x"enabled" ]; then
         echo "Som is enabled, Quota is temporary conflicts with it"
         check_and_cleanup_lustre
+        export QUOTA_AUTO=$QUOTA_AUTO_OLD
         exit 0
 fi
 
@@ -2135,5 +2137,6 @@ log "cleanup: ======================================================"
 cd $ORIG_PWD
 check_and_cleanup_lustre
 echo '=========================== finished ==============================='
+export QUOTA_AUTO=$QUOTA_AUTO_OLD
 [ -f "$QUOTALOG" ] && cat $QUOTALOG && grep -q FAIL $QUOTALOG && exit 1 || true
 echo "$0: completed"
index 3e49798..66aba36 100644 (file)
@@ -15,6 +15,7 @@ export GSS=false
 export GSS_KRB5=false
 export GSS_PIPEFS=false
 export IDENTITY_UPCALL=default
+export QUOTA_AUTO=1
 
 #export PDSH="pdsh -S -Rssh -w"
 
@@ -545,9 +546,7 @@ restore_quota_type () {
 setup_quota(){
     local mntpt=$1
 
-    # We need:
-    # 1. run quotacheck only if quota is off
-    # 2. save the original quota_type params, restore them after testing
+    # We need save the original quota_type params, and restore them after testing
 
     # Suppose that quota type the same on mds and ost
     local quota_type=$(quota_type | grep MDT | cut -d "=" -f2)
@@ -556,6 +555,9 @@ setup_quota(){
     if [ "$quota_type" != "$QUOTA_TYPE" ]; then
         export old_QUOTA_TYPE=$quota_type
         quota_save_version $QUOTA_TYPE
+    else
+        qtype=$(tr -c -d "ug" <<< $QUOTA_TYPE)
+        $LFS quotacheck -$qtype $mntpt || error "quotacheck has failed for $type"
     fi
 
     local quota_usrs=$QUOTA_USERS
@@ -1826,9 +1828,16 @@ init_param_vars () {
 
     if [ x"$(som_check)" = x"enabled" ]; then
         ENABLE_QUOTA=""
+        echo "disable quota temporary when SOM enabled"
     fi
-    if [ "$ENABLE_QUOTA" ]; then
-        setup_quota $MOUNT  || return 2
+    if [ $QUOTA_AUTO -ne 0 ]; then
+        if [ "$ENABLE_QUOTA" ]; then
+            echo "enable quota as required"
+            setup_quota $MOUNT || return 2
+        else
+            echo "disable quota as required"
+            $LFS quotaoff -ug $MOUNT > /dev/null 2>&1
+        fi
     fi
 }