From 98c97bf4858dc5777bfdbee3b8ca29816a2fd289 Mon Sep 17 00:00:00 2001 From: tianzy Date: Tue, 24 Feb 2009 07:07:52 +0000 Subject: [PATCH] Branch HEAD add a test for 18491 b=18491 i=johann i=panda --- lustre/include/obd_support.h | 1 + lustre/quota/quota_context.c | 10 +++++++++- lustre/quota/quota_interface.c | 5 +++++ lustre/tests/sanity-quota.sh | 45 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 1 deletion(-) diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index ff1b2d5..5ac5ee7 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -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 diff --git a/lustre/quota/quota_context.c b/lustre/quota/quota_context.c index 56ec970..6bcbcc5 100644 --- a/lustre/quota/quota_context.c +++ b/lustre/quota/quota_context.c @@ -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; diff --git a/lustre/quota/quota_interface.c b/lustre/quota/quota_interface.c index e7e72d1..59c6e70 100644 --- a/lustre/quota/quota_interface.c +++ b/lustre/quota/quota_interface.c @@ -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 */ diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index e928e14..05bd52c 100644 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -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() { -- 1.8.3.1