Whamcloud - gitweb
LU-5761 tests: fix test_89 to use fs_log_size() 20/31120/6
authorAndreas Dilger <andreas.dilger@intel.com>
Sat, 3 Feb 2018 08:27:42 +0000 (01:27 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 17 Mar 2018 05:13:30 +0000 (05:13 +0000)
The test_89 checks should use fs_log_size() to determine how much
space might be leaked "normally" (due to log files, etc), and how
much data should be written to ensure that we do not misinterpret
this as the leak of block.

Also, fix up fs_log_size() to use the correct grant_block_size
units, which are in bytes, but fs_log_size() returns size in KB.
Allow a margin of 2 large blocks to be allocated for ZFS.

Test-Parameters: trivial ostfilesystemtype=zfs mdtfilesystemtype=zfs testlist=replay-single,replay-single,replay-single
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: Id55175fc7f25fea52345d1c4443673b7efcec230
Reviewed-on: https://review.whamcloud.com/31120
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Reviewed-by: Hongchao Zhang <hongchao.zhang@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/replay-single.sh
lustre/tests/test-framework.sh

index 3dfcd04..c9629b8 100755 (executable)
@@ -499,7 +499,7 @@ test_20b() { # bug 10480
                (( $beforeused + $extra >= $afterused )) && break
                n_attempts=$((n_attempts + 1))
                [ $n_attempts -gt 3 ] &&
-                       error "after $afterused > before $beforeused"
+                       error "after $afterused > before $beforeused + $extra"
 
                wait_zfs_commit $SINGLEMDS 5
                sync_all_data
@@ -3299,9 +3299,12 @@ test_89() {
        rm -f $DIR/$tdir/$tfile
        wait_mds_ost_sync || error "initial MDS-OST sync timed out"
        wait_delete_completed || error "initial wait delete timed out"
-       BLOCKS1=$(df -P $MOUNT | tail -n 1 | awk '{ print $3 }')
+       local blocks1=$(df -P $MOUNT | tail -n 1 | awk '{ print $3 }')
+       local write_size=$(fs_log_size)
+
        $SETSTRIPE -i 0 -c 1 $DIR/$tdir/$tfile
-       dd if=/dev/zero bs=1M count=10 of=$DIR/$tdir/$tfile
+       [ $write_size -lt 1024 ] && write_size=1024
+       dd if=/dev/zero bs=${write_size}k count=10 of=$DIR/$tdir/$tfile
        sync
        stop ost1
        facet_failover $SINGLEMDS
@@ -3312,9 +3315,10 @@ test_89() {
        client_up || error "client_up failed"
        wait_mds_ost_sync || error "MDS-OST sync timed out"
        wait_delete_completed || error "wait delete timed out"
-       BLOCKS2=$(df -P $MOUNT | tail -n 1 | awk '{ print $3 }')
-       [ $((BLOCKS2 - BLOCKS1)) -le 4  ] ||
-               error $((BLOCKS2 - BLOCKS1)) blocks leaked
+       local blocks2=$(df -P $MOUNT | tail -n 1 | awk '{ print $3 }')
+
+       [ $((blocks2 - blocks1)) -le $(fs_log_size)  ] ||
+               error $((blocks2 - blocks1)) blocks leaked
 }
 run_test 89 "no disk space leak on late ost connection"
 
index 18245f9..88b2f1c 100755 (executable)
@@ -756,8 +756,10 @@ fs_log_size() {
 
        case $(facet_fstype $facet) in
                ldiskfs) size=50;; # largest seen is 44, leave some headroom
-               zfs)     size=$(lctl get_param osc.$FSNAME-OST*.import |
-                       awk '/grant_block_size:/ { print $2 * 2; exit; }');;
+               # grant_block_size is in bytes, allow at least 2x max blocksize
+               zfs)     size=$(lctl get_param osc.$FSNAME*.import |
+                               awk '/grant_block_size:/ {print $2/512; exit;}')
+                         ;;
        esac
 
        echo -n $size