Whamcloud - gitweb
b=21919 Do not resend quota_ctl requests
[fs/lustre-release.git] / lustre / tests / sanity-quota.sh
index 0492c79..7d362c3 100644 (file)
@@ -48,12 +48,13 @@ LUSTRE=${LUSTRE:-`dirname $0`/..}
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
+init_logging
 DIRECTIO=${DIRECTIO:-$LUSTRE/tests/directio}
 
 [ $MDSCOUNT -gt 1 ] && skip "CMD case" && exit 0
 
-remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0
-remote_ost_nodsh && skip "remote OST with nodsh" && exit 0
+require_dsh_mds || exit 0
+require_dsh_ost || exit 0
 
 [ "$SLOW" = "no" ] && EXCEPT_SLOW="9 10 11 18b 21"
 
@@ -69,13 +70,6 @@ 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
-
 LOVNAME=`lctl get_param -n llite.*.lov.common_name | tail -n 1`
 OSTCOUNT=`lctl get_param -n lov.$LOVNAME.numobd`
 
@@ -1583,7 +1577,7 @@ test_18b() {
        # check if watchdog is triggered
        do_facet ost1 dmesg > $TMP/lustre-log-${TESTNAME}.log
        watchdog=`awk '/test 18b/ {start = 1;}
-                      /Watchdog triggered/ {
+                      /Service thread pid/ && /was inactive/ {
                               if (start) {
                                       print;
                               }
@@ -2067,7 +2061,6 @@ test_29()
         local BLK_LIMIT=$((100 * 1024 * 1024)) # 100G
         local timeout
         local pid
-        local origin_resends
 
         if at_is_enabled; then
                 timeout=$(at_max_get client)
@@ -2077,9 +2070,6 @@ test_29()
                 lctl set_param timeout=10
         fi
 
-        origin_resends=$(lctl get_param -n mdc.${FSNAME}-*.quota_resend_count | head -1)
-        lctl set_param -n mdc.${FSNAME}-*.quota_resend_count 0
-
         #define OBD_FAIL_MDS_QUOTACTL_NET 0x12e
         lustre_fail mds 0x12e
 
@@ -2098,7 +2088,6 @@ test_29()
                 lctl set_param timeout=$timeout
         fi
 
-        lctl set_param -n mdc.${FSNAME}-*.quota_resend_count $origin_resends
         resetquota -u $TSTUSR
 }
 run_test_with_stat 29 "unhandled quotactls must not hang lustre client (19778) ========"
@@ -2128,6 +2117,54 @@ test_30()
 }
 run_test_with_stat 30 "hard limit updates should not reset grace times ================"
 
+# test duplicate quota releases b=18630
+test_31() {
+        mkdir -p $DIR/$tdir
+        chmod 0777 $DIR/$tdir
+
+        LIMIT=$(( $BUNIT_SZ * $(($OSTCOUNT + 1)) * 10)) # 10 bunits each sever
+        TESTFILE="$DIR/$tdir/$tfile-0"
+        TESTFILE2="$DIR/$tdir/$tfile-1"
+
+        wait_delete_completed
+
+        log "   User quota (limit: $LIMIT kbytes)"
+        $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR
+
+        $LFS setstripe $TESTFILE -i 0 -c 1
+        chown $TSTUSR.$TSTUSR $TESTFILE
+        $LFS setstripe $TESTFILE2 -i 0 -c 1
+        chown $TSTUSR.$TSTUSR $TESTFILE2
+
+        log "   step1: write out of block quota ..."
+        $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=5120
+        $RUNAS dd if=/dev/zero of=$TESTFILE2 bs=$BLK_SZ count=5120
+
+        #define OBD_FAIL_QUOTA_DELAY_SD      0xA04
+        #define OBD_FAIL_SOME        0x10000000 /* fail N times */
+        lustre_fail ost $((0x00000A04 | 0x10000000)) 1
+
+        log "   step2: delete two files so that triggering duplicate quota release ..."
+        rm -f $TESTFILE $TESTFILE2
+        sync; sleep 5; sync      #  OBD_FAIL_QUOTA_DELAY_SD will delay for 5 seconds
+        wait_delete_completed
+
+        log "   step3: verify if the ost failed"
+        do_facet ost1 dmesg > $TMP/lustre-log-${TESTNAME}.log
+        watchdog=`awk '/test 31/ {start = 1;}
+                       /release quota error/ {
+                               if (start) {
+                                       print;
+                               }
+                       }' $TMP/lustre-log-${TESTNAME}.log`
+        [ "$watchdog" ] && error "$watchdog"
+        rm -f $TMP/lustre-log-${TESTNAME}.log
+
+        lustre_fail ost 0
+        resetquota -u $TSTUSR
+}
+run_test_with_stat 31 "test duplicate quota releases ==="
+
 # turn off quota
 quota_fini()
 {