From a9caa85ad2e344ff7ea2a2f33367290600439a13 Mon Sep 17 00:00:00 2001 From: Hongchao Zhang Date: Sun, 29 Sep 2024 08:32:39 +0800 Subject: [PATCH] LU-18293 test: check to sync quota setting If some quota setting version is droped between QMT and QSD, the quota setting could not be transfered to QSD and cause the corresponding quota ID is not enforced properly. Test-Parameters: trivial testlist=sanity-quota Signed-off-by: Hongchao Zhang Change-Id: I8c34f5f045637e2f44f8cd6806b848ed93d8e784 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56628 Tested-by: Maloo Tested-by: jenkins Reviewed-by: Andreas Dilger Reviewed-by: Qian Yingjin Reviewed-by: Sergey Cheremencev Reviewed-by: Oleg Drokin --- lustre/tests/sanity-quota.sh | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index c86b8f8..b7e72df 100755 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -612,9 +612,11 @@ test_1a() { local used=$(getquota -u $TSTUSR global curspace) [ $used -ne 0 ] && error "Used space($used) for user $TSTUSR isn't 0." - $LFS setstripe $testfile -c 1 || error "setstripe $testfile failed" + $LFS setstripe $testfile -i 0 -c 1 || error "setstripe $testfile failed" chown $TSTUSR.$TSTUSR $testfile || error "chown $testfile failed" + wait_quota_synced ost1 OST0000 usr $TSTID hardlimit $((limit*1024)) + test_1_check_write $testfile "user" $limit rm -f $testfile @@ -636,9 +638,11 @@ test_1a() { used=$(getquota -g $TSTUSR global curspace) [ $used -ne 0 ] && error "Used space ($used) for group $TSTUSR isn't 0" - $LFS setstripe $testfile -c 1 || error "setstripe $testfile failed" + $LFS setstripe $testfile -i 0 -c 1 || error "setstripe $testfile failed" chown $TSTUSR.$TSTUSR $testfile || error "chown $testfile failed" + wait_quota_synced ost1 OST0000 grp $TSTID hardlimit $((limit*1024)) + test_1_check_write $testfile "group" $limit rm -f $testfile wait_delete_completed || error "wait_delete_completed failed" @@ -665,10 +669,12 @@ test_1a() { $LFS setquota -p $TSTPRJID -b 0 -B ${limit}M -i 0 -I 0 $DIR || error "set project quota failed" - $LFS setstripe $testfile -c 1 || error "setstripe $testfile failed" + $LFS setstripe $testfile -i 0 -c 1 || error "setstripe $testfile failed" chown $TSTUSR:$TSTUSR $testfile || error "chown $testfile failed" change_project -p $TSTPRJID $testfile + wait_quota_synced ost1 OST0000 prj $TSTPRJID hardlimit $((limit*1024)) + test_1_check_write $testfile "project" $limit # cleanup @@ -702,6 +708,9 @@ test_1b() { $LFS setquota -u $TSTUSR -b 0 -B ${global_limit}M -i 0 -I 0 $DIR || error "set user quota failed" + wait_quota_synced ost1 OST0000 usr $TSTID hardlimit \ + $((global_limit*1024)) + pool_add $qpool || error "pool_add failed" pool_add_targets $qpool 0 $(($OSTCOUNT - 1)) || error "pool_add_targets failed" @@ -722,7 +731,7 @@ test_1b() { used=$(getquota -u $TSTUSR global bhardlimit $qpool) - $LFS setstripe $testfile -c 1 || error "setstripe $testfile failed" + $LFS setstripe $testfile -i 0 -c 1 || error "setstripe $testfile failed" chown $TSTUSR.$TSTUSR $testfile || error "chown $testfile failed" test_1_check_write $testfile "user" $limit @@ -744,12 +753,15 @@ test_1b() { $LFS setquota -g $TSTUSR -b 0 -B ${limit}M --pool $qpool $DIR || error "set group quota failed" + wait_quota_synced ost1 OST0000 grp $TSTID hardlimit \ + $((global_limit*1024)) + testfile="$DIR/$tdir/$tfile-1" # make sure the system is clean used=$(getquota -g $TSTUSR global curspace $qpool) [ $used -ne 0 ] && error "Used space ($used) for group $TSTUSR isn't 0" - $LFS setstripe $testfile -c 1 || error "setstripe $testfile failed" + $LFS setstripe $testfile -i 0 -c 1 || error "setstripe $testfile failed" chown $TSTUSR.$TSTUSR $testfile || error "chown $testfile failed" test_1_check_write $testfile "group" $limit @@ -782,8 +794,10 @@ test_1b() { $LFS setquota -p $TSTPRJID -b 0 -B ${limit}M --pool $qpool $DIR || error "set project quota failed" + wait_quota_synced ost1 OST0000 prj $TSTPRJID hardlimit \ + $((global_limit*1024)) - $LFS setstripe $testfile -c 1 || error "setstripe $testfile failed" + $LFS setstripe $testfile -i 0 -c 1 || error "setstripe $testfile failed" chown $TSTUSR:$TSTUSR $testfile || error "chown $testfile failed" change_project -p $TSTPRJID $testfile @@ -815,6 +829,9 @@ test_1c() { $LFS setquota -u $TSTUSR -b 0 -B ${global_limit}M -i 0 -I 0 $DIR || error "set user quota failed" + wait_quota_synced ost1 OST0000 usr $TSTID hardlimit \ + $((global_limit*1024)) + pool_add $qpool1 || error "pool_add failed" pool_add_targets $qpool1 0 $(($OSTCOUNT - 1)) || error "pool_add_targets failed" @@ -838,6 +855,9 @@ test_1c() { used=$(getquota -u $TSTUSR global bhardlimit $qpool) + $LFS setstripe $testfile -i 0 -c 1 || error "setstripe $testfile failed" + chown $TSTUSR.$TSTUSR $testfile || error "chown $testfile failed" + test_1_check_write $testfile "user" $global_limit used=$(getquota -u $TSTUSR global curspace $qpool1) -- 1.8.3.1