Whamcloud - gitweb
LU-16529 test: verify the grant > 0 before test 99/50799/2
authorHongchao Zhang <hongchao@whamcloud.com>
Tue, 18 Apr 2023 18:58:26 +0000 (02:58 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 19 May 2023 07:08:36 +0000 (07:08 +0000)
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 <hongchao@whamcloud.com>
Change-Id: I9cddcf0c4afc12a11f3535792262ebb35a1e480e
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50799
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Sergey Cheremencev <scherementsev@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity-quota.sh

index 65465a7..965b50b 100755 (executable)
@@ -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"