From e609d30003560ba534e3da42d3240a081b00143e Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Sat, 3 Feb 2018 01:27:42 -0700 Subject: [PATCH] LU-5761 tests: fix test_89 to use fs_log_size() 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 Change-Id: Id55175fc7f25fea52345d1c4443673b7efcec230 Reviewed-on: https://review.whamcloud.com/31120 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Nunez Reviewed-by: Hongchao Zhang Reviewed-by: Oleg Drokin --- lustre/tests/replay-single.sh | 16 ++++++++++------ lustre/tests/test-framework.sh | 6 ++++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index 3dfcd04..c9629b8 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -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" diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 18245f9..88b2f1c 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -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 -- 1.8.3.1