Whamcloud - gitweb
LU-6247 tests: fix nodemap quota test to use correct blocksize 44/13844/4
authorKit Westneat <kit.westneat@gmail.com>
Mon, 23 Feb 2015 16:23:17 +0000 (11:23 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 27 Mar 2015 15:29:34 +0000 (15:29 +0000)
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 <kit.westneat@gmail.com>
Change-Id: I3bf6380fd0a0e6b3246343da8a139c6b4ea120ae
Reviewed-on: http://review.whamcloud.com/13844
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Reviewed-by: Isaac Huang <he.huang@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanity-sec.sh

index b50bf96..30f81da 100644 (file)
@@ -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() {