From: Arshad Hussain Date: Thu, 9 Sep 2021 09:18:42 +0000 (-0400) Subject: LU-14997 tests: Register "stack_trap" for sanity/104c X-Git-Tag: 2.14.55~33 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=59b32113313c3566e5f3797bca404a5b19d5e305;p=fs%2Flustre-release.git LU-14997 tests: Register "stack_trap" for sanity/104c This patch is a minor improvement for calling cleanup through 'stack_trap' versus doing right at the end of the script. Fixes: 8ee6e1c8825c ("LU-14565 ofd: Do not rely on tgd_blockbit") Test-Parameters: trivial Signed-off-by: Arshad Hussain Change-Id: Iae2ca81091e0119f2117f4cd57b5cc2f6ac38c6c Reviewed-on: https://review.whamcloud.com/44882 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: James Nunez --- diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 3a9f141..112b8bb 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -11304,6 +11304,17 @@ test_104b() { } run_test 104b "$RUNAS lfs check servers test ====================" +cleanup_104c() { + local facets=$1 + local param=$2 + local saved_blocks=$3 + + for facet in ${facets//,/ }; do + osd=$(do_facet $facet $LCTL get_param -n $param.mntdev) + do_facet $facet zfs set recordsize=$saved_blocks $osd + done +} + # # Verify $1 is within range of $2. # Success when $1 is within range. That is, when $1 is >= 2% of $2 and @@ -11311,8 +11322,8 @@ run_test 104b "$RUNAS lfs check servers test ====================" # value_in_range() { # Strip all units (M, G, T) - actual=$(echo $1 | tr -d A-Z) - expect=$(echo $2 | tr -d A-Z) + actual=$(echo ${1/[a-zA-Z]*/}) + expect=$(echo ${2/[a-zA-Z]*/}) expect_lo=$(($expect * 98 / 100)) # 2% below expect_hi=$(($expect * 102 / 100)) # 2% above @@ -11361,6 +11372,11 @@ test_104c() { do_facet $facet zfs set recordsize=32768 $mdt done + # Restore OST recordize back to original + stack_trap "cleanup_104c $ofacets $ost_param $saved_ost_blocks" + # Restore MDT recordize back to original + stack_trap "cleanup_104c $mfacets $mdt_param $saved_mdt_blocks" + # Give new values chance to reflect change sleep 2 @@ -11388,18 +11404,6 @@ test_104c() { value_in_range ${df_after[3]%.*} ${df[3]%.*} || error "df avail: ${df_after[3]%.*} != ${df[3]%.*}" - # Restore MDT recordize back to original - for facet in ${mfacets//,/ }; do - mdt=$(do_facet $facet lctl get_param -n $mdt_param.mntdev) - do_facet $facet zfs set recordsize=$saved_mdt_blocks $mdt - done - - # Restore OST recordize back to original - for facet in ${ofacets//,/ }; do - ost=$(do_facet $facet lctl get_param -n $ost_param.mntdev) - do_facet $facet zfs set recordsize=$saved_ost_blocks $ost - done - return 0 } run_test 104c "Verify df vs lfs_df stays same after recordsize change"