Whamcloud - gitweb
Branch HEAD
authortianzy <tianzy>
Tue, 24 Feb 2009 07:07:52 +0000 (07:07 +0000)
committertianzy <tianzy>
Tue, 24 Feb 2009 07:07:52 +0000 (07:07 +0000)
add a test for 18491
b=18491
i=johann
i=panda

lustre/include/obd_support.h
lustre/quota/quota_context.c
lustre/quota/quota_interface.c
lustre/tests/sanity-quota.sh

index ff1b2d5..5ac5ee7 100644 (file)
@@ -335,6 +335,7 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type,
 #define OBD_FAIL_MGS_PAUSE_TARGET_REG    0x905
 
 #define OBD_FAIL_QUOTA_RET_QDATA         0xA02
+#define OBD_FAIL_QUOTA_DELAY_REL         0xA03
 
 #define OBD_FAIL_LPROC_REMOVE            0xB00
 
index 56ec970..6bcbcc5 100644 (file)
@@ -541,6 +541,10 @@ dqacq_completion(struct obd_device *obd, struct lustre_quota_ctxt *qctxt,
         QDATA_DEBUG(qdata, "obd(%s): complete %s quota req\n",
                     obd->obd_name, (opc == QUOTA_DQACQ) ? "acq" : "rel");
 
+        /* do it only when a releasing quota req more than 5MB b=18491 */
+        if (opc == QUOTA_DQREL && qdata->qd_count >= 5242880)
+                OBD_FAIL_TIMEOUT(OBD_FAIL_QUOTA_DELAY_REL, 5);
+
         /* update local operational quota file */
         if (rc == 0) {
                 __u64 count = QUSG(qdata->qd_count, QDATA_IS_BLK(qdata));
@@ -667,7 +671,11 @@ out:
                  RETURN(rc1);
          }
          if (err || (rc < 0 && rc != -EBUSY && rc1 == 0) || is_master(qctxt))
-                RETURN(err);
+                 RETURN(err);
+
+         if (opc == QUOTA_DQREL && qdata->qd_count >= 5242880 &&
+             OBD_FAIL_CHECK(OBD_FAIL_QUOTA_DELAY_REL))
+                 RETURN(err);
 
         /* reschedule another dqacq/dqrel if needed */
         qdata->qd_count = 0;
index e7e72d1..59c6e70 100644 (file)
@@ -334,6 +334,11 @@ static int quota_check_common(struct obd_device *obd, unsigned int uid,
 
                 spin_unlock(&lqs->lqs_lock);
 
+                if (lqs->lqs_blk_rec  < 0 &&
+                    qdata[i].qd_count <
+                    lqs->lqs_bwrite_pending - lqs->lqs_blk_rec - mb)
+                        OBD_FAIL_TIMEOUT(OBD_FAIL_QUOTA_DELAY_REL, 5);
+
                 /* When cycle is zero, lqs_*_pending will be changed. We will
                  * get reference of the lqs here and put reference of lqs in
                  * quota_pending_commit b=14784 */
index e928e14..05bd52c 100644 (file)
@@ -1925,6 +1925,51 @@ test_25() {
 }
 run_test_with_stat 25 "test whether quota usage is transfered when chown/chgrp (18081) ==========="
 
+test_26() {
+       mkdir -p $DIR/$tdir
+       chmod 0777 $DIR/$tdir
+       TESTFILE="$DIR/$tdir/$tfile-0"
+       TESTFILE2="$DIR/$tdir/$tfile-1"
+       set_blk_tunesz 512
+       set_blk_unitsz 1024
+
+       wait_delete_completed
+
+       # every quota slave gets 20MB
+       b_limit=$((OSTCOUNT * 20 * 1024))
+       log "limit: ${b_limit}KB"
+       $LFS setquota -u $TSTUSR -b 0 -B $b_limit -i 0 -I 0 $DIR
+       sleep 3
+       quota_show_check b u $TSTUSR
+
+       $LFS setstripe $TESTFILE  -c 1 -i 0
+       $LFS setstripe $TESTFILE2 -c 1 -i 0
+       chown $TSTUSR.$TSTUSR $TESTFILE
+       chown $TSTUSR.$TSTUSR $TESTFILE2
+
+       #define OBD_FAIL_QUOTA_DELAY_REL         0xA03
+       lustre_fail ost 0xA03
+
+       log "    Write the first file..."
+       $RUNAS $DIRECTIO write $TESTFILE 0 10 $((BLK_SZ * 1024)) || quota_error u $TSTUSR "write failure, but expect success"
+       log "    Delete the first file..."
+       rm -f $TESTFILE
+
+
+       wait_delete_completed
+
+       log "    Write the second file..."
+       $RUNAS $DIRECTIO write $TESTFILE2 0 10 $((BLK_SZ * 1024)) || quota_error u $TSTUSR "write failure, but expect success"
+       log "    Delete the second file..."
+       rm -f $TESTFILE2
+
+       lustre_fail ost 0
+       set_blk_unitsz $((128 * 1024))
+       set_blk_tunesz $((128 * 1024 / 2))
+       resetquota -u $TSTUSR
+}
+run_test_with_stat 26 "test for false quota error(bz18491) ======================================"
+
 # turn off quota
 test_99()
 {