summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
fd8d448)
The "lfs getdirstripe -c" command will return stripes=0 for
unstriped directories. Handle this when calculating free_inodes
to avoid creating zero files for this test.
Speed cleanup of test_24v and other users of simple_cleanup_common()
by using unlinkmany to delete files if the file count is provided.
Use stack_trap consistently and don't do both manual and exit cleanup.
Test-Parameters: trivial testlist=sanity env=ONLY=24v
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I25105a5d0ab719d41bf41cff0aaea6d00a9c4059
Reviewed-on: https://review.whamcloud.com/45172
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
run_test 24u "create stripe file"
simple_cleanup_common() {
run_test 24u "create stripe file"
simple_cleanup_common() {
- trap 0
- [ -z "$DIR" ] || [ -z "$tdir" ] && return 0
+
+ [[ -z "$DIR" || -z "$tdir" || ! -d "$DIR/$tdir" ]] && return 0
+
+ [[ -n "$createmany" ]] && unlinkmany $DIR/$tdir/$tfile $createmany
+ rm -rf $DIR/$tdir || error "cleanup $DIR/$tdir failed"
rc=$?
wait_delete_completed
echo "cleanup time $((SECONDS - start))"
rc=$?
wait_delete_completed
echo "cleanup time $((SECONDS - start))"
test_mkdir "$(dirname $fname)"
# assume MDT0000 has the fewest inodes
local stripes=$($LFS getdirstripe -c $(dirname $fname))
test_mkdir "$(dirname $fname)"
# assume MDT0000 has the fewest inodes
local stripes=$($LFS getdirstripe -c $(dirname $fname))
- local free_inodes=$(($(mdt_free_inodes 0) * stripes))
+ local free_inodes=$(($(mdt_free_inodes 0) * ${stripes/#0/1}))
[[ $free_inodes -lt $nrfiles ]] && nrfiles=$free_inodes
[[ $free_inodes -lt $nrfiles ]] && nrfiles=$free_inodes
- trap simple_cleanup_common EXIT
+ stack_trap "simple_cleanup_common $nrfiles"
createmany -m "$fname" $nrfiles
createmany -m "$fname" $nrfiles
local rpc_pages=$(max_pages_per_rpc $mdt_idx)
local rpc_max=$((nrfiles / (page_entries * rpc_pages) + stripes))
local mds_readpage=$(calc_stats mdc.*.stats mds_readpage)
local rpc_pages=$(max_pages_per_rpc $mdt_idx)
local rpc_max=$((nrfiles / (page_entries * rpc_pages) + stripes))
local mds_readpage=$(calc_stats mdc.*.stats mds_readpage)
- echo "readpages: $mds_readpage rpc_max: $rpc_max"
- (( $mds_readpage < $rpc_max - 2 || $mds_readpage > $rpc_max + 1)) &&
+ echo "readpages: $mds_readpage rpc_max: $rpc_max-2/+1"
+ (( $mds_readpage >= $rpc_max - 2 && $mds_readpage <= $rpc_max + 1)) ||
error "large readdir doesn't take effect: " \
"$mds_readpage should be about $rpc_max"
error "large readdir doesn't take effect: " \
"$mds_readpage should be about $rpc_max"
-
- simple_cleanup_common
}
run_test 24v "list large directory (test hash collision, b=17560)"
}
run_test 24v "list large directory (test hash collision, b=17560)"
test_24A() { # LU-3182
local NFILES=5000
test_24A() { # LU-3182
local NFILES=5000
- trap simple_cleanup_common EXIT
+ stack_trap "simple_cleanup_common $NFILES"
createmany -m $DIR/$tdir/$tfile $NFILES
local t=$(ls $DIR/$tdir | wc -l)
local u=$(ls $DIR/$tdir | sort -u | wc -l)
local v=$(ls -ai $DIR/$tdir | sort -u | wc -l)
createmany -m $DIR/$tdir/$tfile $NFILES
local t=$(ls $DIR/$tdir | wc -l)
local u=$(ls $DIR/$tdir | sort -u | wc -l)
local v=$(ls -ai $DIR/$tdir | sort -u | wc -l)
- if [ $t -ne $NFILES ] || [ $u -ne $NFILES ] ||
- [ $v -ne $((NFILES + 2)) ] ; then
- error "Expected $NFILES files, got $t ($u unique $v .&..)"
- fi
- simple_cleanup_common || error "Can not delete directories"
+ (( $t == $NFILES && $u == $NFILES && $v == NFILES + 2 )) ||
+ error "Expected $NFILES files, got $t ($u unique $v .&..)"
}
run_test 24A "readdir() returns correct number of entries."
}
run_test 24A "readdir() returns correct number of entries."
if [[ $ORIGFREE -gt $MAXFREE ]]; then
skip "$ORIGFREE > $MAXFREE skipping out-of-space test on OST0"
fi
if [[ $ORIGFREE -gt $MAXFREE ]]; then
skip "$ORIGFREE > $MAXFREE skipping out-of-space test on OST0"
fi
- trap simple_cleanup_common EXIT
+ stack_trap simple_cleanup_common
test_mkdir $DIR/$tdir
$LFS setstripe -i 0 -c 1 $DIR/$tdir/$tfile.1
dd if=/dev/zero of=$DIR/$tdir/$tfile.1 bs=1024 count=$MAXFREE &&
test_mkdir $DIR/$tdir
$LFS setstripe -i 0 -c 1 $DIR/$tdir/$tfile.1
dd if=/dev/zero of=$DIR/$tdir/$tfile.1 bs=1024 count=$MAXFREE &&
touch $DIR/$tdir/$tfile.$i
[ $($LFS getstripe $DIR/$tdir/$tfile.$i | grep -A 10 obdidx |
awk '{print $1}'| grep -w "0") ] &&
touch $DIR/$tdir/$tfile.$i
[ $($LFS getstripe $DIR/$tdir/$tfile.$i | grep -A 10 obdidx |
awk '{print $1}'| grep -w "0") ] &&
- error "OST0 was full but new created file still use it"
- simple_cleanup_common
+ error "OST0 was full but new created file still use it" || true
}
run_test 27m "create file while OST0 was full"
}
run_test 27m "create file while OST0 was full"
#define OBD_FAIL_MDS_OSC_PRECREATE 0x139
do_nodes $list $LCTL set_param fail_loc=0x139
test_mkdir -p $DIR/$tdir
#define OBD_FAIL_MDS_OSC_PRECREATE 0x139
do_nodes $list $LCTL set_param fail_loc=0x139
test_mkdir -p $DIR/$tdir
- trap simple_cleanup_common EXIT
- createmany -o $DIR/$tdir/t- 1000
+ stack_trap "simple_cleanup_common 1000"
+ createmany -o $DIR/$tdir/$tfile 1000
do_nodes $list $LCTL set_param fail_loc=0
TLOG=$TMP/$tfile.getstripe
$LFS getstripe $DIR/$tdir > $TLOG
OBJS=$(awk -vobj=0 '($1 == 0) { obj += 1 } END { print obj; }' $TLOG)
do_nodes $list $LCTL set_param fail_loc=0
TLOG=$TMP/$tfile.getstripe
$LFS getstripe $DIR/$tdir > $TLOG
OBJS=$(awk -vobj=0 '($1 == 0) { obj += 1 } END { print obj; }' $TLOG)
- unlinkmany $DIR/$tdir/t- 1000
- trap 0
[[ $OBJS -gt 0 ]] &&
error "$OBJS objects created on OST-0. See $TLOG" ||
rm -f $TLOG
[[ $OBJS -gt 0 ]] &&
error "$OBJS objects created on OST-0. See $TLOG" ||
rm -f $TLOG
[ $MINV -eq 0 ] && skip "no free space in OST$MINI, skip"
[ $MINV -gt 10000000 ] && skip "too much free space in OST$MINI, skip"
[ $MINV -eq 0 ] && skip "no free space in OST$MINI, skip"
[ $MINV -gt 10000000 ] && skip "too much free space in OST$MINI, skip"
- trap simple_cleanup_common EXIT
+ stack_trap simple_cleanup_common
# Check if we need to generate uneven OSTs
test_mkdir -p $DIR/$tdir/OST${MINI}
# Check if we need to generate uneven OSTs
test_mkdir -p $DIR/$tdir/OST${MINI}
if [ $DIFF2 -gt $threshold ]; then
echo "ok"
else
if [ $DIFF2 -gt $threshold ]; then
echo "ok"
else
- echo "failed - QOS mode won't be used"
- simple_cleanup_common
skip "QOS imbalance criteria not met"
fi
skip "QOS imbalance criteria not met"
fi
fi
[[ $MAXC -gt $MINC ]] ||
error_ignore LU-9 "stripe QOS didn't balance free space"
fi
[[ $MAXC -gt $MINC ]] ||
error_ignore LU-9 "stripe QOS didn't balance free space"
}
run_test 116a "stripe QOS: free space balance ==================="
}
run_test 116a "stripe QOS: free space balance ==================="