From a9590542a8f48dcbb68172bbbb4ed1dee5f24e97 Mon Sep 17 00:00:00 2001 From: tianzy Date: Tue, 24 Feb 2009 07:08:00 +0000 Subject: [PATCH] Branch b1_8 add a test for 18491 b=18491 i=johann i=panda --- lustre/include/obd_support.h | 1 + lustre/quota/quota_context.c | 7 +++++++ lustre/quota/quota_interface.c | 5 +++++ lustre/tests/sanity-quota.sh | 45 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+) diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index e83076a..5e50da4 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -322,6 +322,7 @@ extern unsigned int obd_alloc_fail_rate; #endif #define OBD_FAIL_QUOTA_RET_QDATA 0xA02 +#define OBD_FAIL_QUOTA_DELAY_REL 0xA03 #define OBD_FAIL_LPROC_REMOVE 0xB00 diff --git a/lustre/quota/quota_context.c b/lustre/quota/quota_context.c index f14aa5b..0d3f33c 100644 --- a/lustre/quota/quota_context.c +++ b/lustre/quota/quota_context.c @@ -532,6 +532,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)); @@ -662,6 +666,9 @@ out: is_master(obd, qctxt, qdata->qd_id, QDATA_IS_GRP(qdata))) RETURN(err); + if (opc == QUOTA_DQREL && qdata->qd_count >= 5242880) + OBD_FAIL_RETURN(OBD_FAIL_QUOTA_DELAY_REL, err); + /* reschedule another dqacq/dqrel if needed */ qdata->qd_count = 0; qdata->qd_flags &= LQUOTA_QUNIT_FLAGS; diff --git a/lustre/quota/quota_interface.c b/lustre/quota/quota_interface.c index 5e8ac6e..e17b55e 100644 --- a/lustre/quota/quota_interface.c +++ b/lustre/quota/quota_interface.c @@ -340,6 +340,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 */ diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 5eba2af..4fdca91 100644 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -1979,6 +1979,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() { -- 1.8.3.1