Whamcloud - gitweb
LU-11721 tests: wait for statfs to update on DNE 64/34164/2
authorAndreas Dilger <adilger@whamcloud.com>
Fri, 1 Feb 2019 21:07:01 +0000 (14:07 -0700)
committerAndreas Dilger <adilger@whamcloud.com>
Sat, 2 Feb 2019 23:08:45 +0000 (23:08 +0000)
Wait for the statfs to update properly when there are multiple
MDTs so that the test doesn't gratuitously fail.

Fixes: 757403191c3 ("LU-11721 utils: print used inodes ratio ...")
Test-Parameters: trivial testlist=sanity mdscount=2 mdtcount=4 ostcount=7
Test-Parameters: testlist=sanity fstype=zfs mdscount=2 mdtcount=4
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: Ia75f7bd4d3027c91f10ce990730b2bd7123ebbe5
Reviewed-on: https://review.whamcloud.com/34164
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
lustre/tests/sanity.sh

index 1fe5b64..a17303e 100755 (executable)
@@ -19417,31 +19417,45 @@ check_lfs_df() {
        local inodes
        local df_out
        local lfs_df_out
        local inodes
        local df_out
        local lfs_df_out
+       local tries=100
+       local count=0
+       local passed=false
 
        # blocks or inodes
        [ "$1" == "blocks" ] && inodes= || inodes="-i"
 
 
        # blocks or inodes
        [ "$1" == "blocks" ] && inodes= || inodes="-i"
 
-       # read the lines of interest
-       df_out=($(df $inodes $dir | tail -n +2)) ||
-               error "df $inodes $dir | tail -n +2 failed"
-       lfs_df_out=($($LFS df $inodes $dir | grep filesystem_summary:)) ||
-               error "lfs df $inodes $dir | grep filesystem_summary: failed"
-
-       # skip the first substrings of each command output as they are different
-       # <NID>:/<fsname for df, filesystem_summary: for lfs df
-       df_out=(${df_out[@]:1})
-       lfs_df_out=(${lfs_df_out[@]:1})
-
-       # compare the two outputs
-       for i in {0..4}; do
-               [ "${df_out[i]}" != "${lfs_df_out[i]}" ] &&
-                       error "df and lfs df output mismatch:" \
-                             "df${inodes}: ${df_out[*]}," \
-                             "lfs df${inodes}: ${lfs_df_out[*]}"
+       while (( count < tries )); do
+               cancel_lru_locks
+               sync; sleep 0.2
+
+               # read the lines of interest
+               df_out=($(df $inodes $dir | tail -n +2)) ||
+                       error "df $inodes $dir | tail -n +2 failed"
+               lfs_df_out=($($LFS df $inodes $dir | grep summary:)) ||
+                       error "lfs df $inodes $dir | grep summary: failed"
+
+               # skip first substrings of each output as they are different
+               # <NID>:/<fsname for df, filesystem_summary: for lfs df
+               df_out=(${df_out[@]:1})
+               lfs_df_out=(${lfs_df_out[@]:1})
+
+               # compare the two outputs
+               passed=true
+
+               for i in {0..4}; do
+                       [ "${df_out[i]}" != "${lfs_df_out[i]}" ] && passed=false
+               done
+               $passed && break
        done
        done
+
+       $passed || error "df and lfs df $1 output mismatch: "   \
+                        "df ${inodes}: ${df_out[*]}, "         \
+                        "lfs df ${inodes}: ${lfs_df_out[*]}"
 }
 
 test_418() {
 }
 
 test_418() {
+       [ $PARALLEL == "yes" ] && skip "skip parallel run"
+
        local dir=$DIR/$tdir
        local numfiles=$((RANDOM % 4096 + 2))
        local numblocks=$((RANDOM % 256 + 1))
        local dir=$DIR/$tdir
        local numfiles=$((RANDOM % 4096 + 2))
        local numblocks=$((RANDOM % 256 + 1))
@@ -19458,8 +19472,6 @@ test_418() {
        echo "Creating a single file and testing"
        createmany -o $dir/$tfile- 1 &>/dev/null ||
                error "creating 1 file in $dir failed"
        echo "Creating a single file and testing"
        createmany -o $dir/$tfile- 1 &>/dev/null ||
                error "creating 1 file in $dir failed"
-       cancel_lru_locks osc
-       sync; sleep 2
        check_lfs_df blocks $dir
        check_lfs_df inodes $dir
 
        check_lfs_df blocks $dir
        check_lfs_df inodes $dir
 
@@ -19475,8 +19487,6 @@ test_418() {
                error "dd to $dir/${tfile}-0 failed"
 
        # retest
                error "dd to $dir/${tfile}-0 failed"
 
        # retest
-       cancel_lru_locks osc
-       sync; sleep 10
        check_lfs_df blocks $dir
        check_lfs_df inodes $dir
 
        check_lfs_df blocks $dir
        check_lfs_df inodes $dir