From: Hongchao Zhang Date: Tue, 18 Apr 2023 18:58:26 +0000 (+0800) Subject: LU-16529 test: verify the grant > 0 before test X-Git-Tag: 2.15.56~63 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F99%2F50799%2F2;p=fs%2Flustre-release.git LU-16529 test: verify the grant > 0 before test In the test 84 in sanity-quota, the grant should be larger than 0 after the dd complete, this patch adds check for it and forces the quota to be re-integrated during the check. Signed-off-by: Hongchao Zhang Change-Id: I9cddcf0c4afc12a11f3535792262ebb35a1e480e Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50799 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Sergey Cheremencev Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 65465a7..965b50b 100755 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -5816,9 +5816,31 @@ test_84() $RUNAS $DD of=$TESTFILE1 count=60 conv=nocreat oflag=direct || quota_error g $TSTUSR "write failed" - sync + sync_all_data || true sleep 3 $LFS quota -gv $TSTUSR $DIR + $LFS quota -gv --pool $qp $TSTUSR $DIR + + # the grant quota should be larger than 0 + waited=0 + while (( $waited < 60 )); do + grant=$(getquota -g $TSTUSR lustre-OST0000_UUID bhardlimit $qp) + grant2=$(getquota -g $TSTUSR lustre-OST0000_UUID bhardlimit) + (( ${grant} > 0 && ${grant2} > 0 )) && break + + do_facet ost1 $LCTL set_param \ + osd-*.*-OST0000.quota_slave.force_reint=1 + sleep 1 + waited=$((waited + 1)) + done + + (( $waited >= 60)) && { + $LFS quota -gv $TSTUSR $DIR + $LFS quota -gv --pool $qp $TSTUSR $DIR + } + + (( ${grant} > 0 )) || error "pool grant is not increased after dd" + (( ${grant2} > 0 )) || error "grant is not increased after dd" #define OBD_FAIL_QUOTA_GRANT 0xA08 lustre_fail mds 0xa08 @@ -5829,6 +5851,7 @@ test_84() $LFS setquota -g $TSTUSR -b 0 -B 0 $DIR || error "failed to clear the group quota for $TSTUSR" $LFS quota -gv $TSTUSR $DIR + $LFS quota -gv --pool $qp $TSTUSR $DIR # the grant quota should be set as insane value waited=0 @@ -5841,6 +5864,11 @@ test_84() waited=$((waited + 1)) done + (( $waited >= 60)) && { + $LFS quota -gv $TSTUSR $DIR + $LFS quota -gv --pool $qp $TSTUSR $DIR + } + (( ${#grant} == 20 )) || error "pool grant is not set as insane value" (( ${#grant2} == 20 )) || error "grant is not set as insane value" @@ -5853,6 +5881,7 @@ test_84() sleep 3 $LFS quota -gv $TSTUSR $DIR + $LFS quota -gv --pool $qp $TSTUSR $DIR # the grant quota should be reset grant=$(getquota -g $TSTUSR lustre-OST0000_UUID bhardlimit) @@ -5861,6 +5890,7 @@ test_84() (( ${#grant} == 20 )) && error "pool grant is not cleared" $LFS quota -gv $TSTUSR --pool $qp $DIR + $LFS quota -gv --pool $qp $TSTUSR $DIR local hlimit=$(getquota -g $TSTUSR global bhardlimit $qp) [ $hlimit -eq 5242880 ] || error "pool limit is changed"