From 0233e76f3f9830210ba7012554ee7cfc41e3ab37 Mon Sep 17 00:00:00 2001 From: Kit Westneat Date: Mon, 23 Feb 2015 11:23:17 -0500 Subject: [PATCH] LU-6247 tests: fix nodemap quota test to use correct blocksize The nodemap quota test needs to take into account indirect blocks and other overhead when deciding if the quota used is excessive. It's supposed to add the fs blocksize * 2, so 8k on ldiskfs and 256k on zfs, but it was using the osc block size instead of the osd blocksize. This patch modifies the test to use the fs_log_size helper to determine an appropriate fuzz size. Test-Parameters: mdtfilesystemtype=zfs mdsfilesystemtype=zfs ostfilesystemtype=zfs testlist=sanity-sec Signed-off-by: Kit Westneat Change-Id: I3bf6380fd0a0e6b3246343da8a139c6b4ea120ae Reviewed-on: http://review.whamcloud.com/13844 Reviewed-by: Andreas Dilger Tested-by: Jenkins Reviewed-by: Isaac Huang Tested-by: Maloo Reviewed-by: Nathaniel Clark Reviewed-by: Oleg Drokin --- lustre/tests/sanity-sec.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lustre/tests/sanity-sec.sh b/lustre/tests/sanity-sec.sh index b50bf96..30f81da 100644 --- a/lustre/tests/sanity-sec.sh +++ b/lustre/tests/sanity-sec.sh @@ -1314,28 +1314,29 @@ nodemap_check_quota() { do_fops_quota_test() { local run_u=$1 - # define fuzz as 2x ost block size in K - local quota_fuzz=$(($(lctl get_param -n \ - osc.$FSNAME-OST0000-*.blocksize | head -1) / 512)) + # fuzz quota used to account for possible indirect blocks, etc + local quota_fuzz=$(fs_log_size) local qused_orig=$(nodemap_check_quota "$run_u") - local qused_low=$((qused_orig - quota_fuzz)) local qused_high=$((qused_orig + quota_fuzz)) + local qused_low=$((qused_orig - quota_fuzz)) local testfile=$DIR/$tdir/$tfile chmod 777 $DIR/$tdir $run_u dd if=/dev/zero of=$testfile bs=1M count=1 >& /dev/null sync; sync_all_data || true local qused_new=$(nodemap_check_quota "$run_u") - [ $((qused_low + 1024)) -le $((qused_new)) \ - -a $((qused_high + 1024)) -ge $((qused_new)) ] || - error "$qused_new != $qused_orig + 1M after write" + [ $((qused_new)) -lt $((qused_low + 1024)) \ + -o $((qused_new)) -gt $((qused_high + 1024)) ] && + error "$qused_new != $qused_orig + 1M after write, \ + fuzz is $quota_fuzz" $run_u rm $testfile && d=1 $NODEMAP_TEST_QUOTA && wait_delete_completed_mds qused_new=$(nodemap_check_quota "$run_u") - [ $((qused_low)) -le $((qused_new)) \ - -a $((qused_high)) -ge $((qused_new)) ] || - error "quota not reclaimed, expect $qused_orig got $qused_new" + [ $((qused_new)) -lt $((qused_low)) \ + -o $((qused_new)) -gt $((qused_high)) ] && + error "quota not reclaimed, expect $qused_orig got $qused_new, \ + fuzz $quota_fuzz" } get_fops_mapped_user() { -- 1.8.3.1