}
run_test 51a "special situations: split htree with empty entry =="
-#export NUMTEST=70000
-# FIXME: I select a relatively small number to do basic test.
-# large number may give panic(). debugging on this is going on.
-export NUMTEST=70
+export NUMTEST=70000
test_51b() {
NUMFREE=`df -i -P $DIR | tail -n 1 | awk '{ print $4 }'`
[ $NUMFREE -lt 21000 ] && \
skip "not enough free inodes ($NUMFREE)" && \
return
- check_kernel_version 40 || NUMTEST=31000
[ $NUMFREE -lt $NUMTEST ] && NUMTEST=$(($NUMFREE - 50))
mkdir -p $DIR/d51b
}
run_test 51b "mkdir .../t-0 --- .../t-$NUMTEST ===================="
+test_51ba() { # LU-993
+ local BASE=$DIR/d51b
+ # unlink all but 100 subdirectories, then check it still works
+ local LEFT=100
+ local DELETE=$((NUMTEST - LEFT))
+
+ ! [ -d "${BASE}/t-$DELETE" ] && skip "test_51b() not run" && return 0
+
+ # for ldiskfs the nlink count should be 1, but this is OSD specific
+ # and so this is listed for informational purposes only
+ log "nlink before: $(stat -c %h $BASE)"
+ unlinkmany -d $BASE/t- $DELETE ||
+ error "unlink of first $DELETE subdirs failed"
+
+ log "nlink between: $(stat -c %h $BASE)"
+ local FOUND=$(ls -l ${BASE} | wc -l)
+ FOUND=$((FOUND - 1)) # trim the first line of ls output
+ [ $FOUND -ne $LEFT ] &&
+ error "can't find subdirs: found only $FOUND/$LEFT"
+
+ unlinkmany -d $BASE/t- $DELETE $LEFT ||
+ error "unlink of second $LEFT subdirs failed"
+ log "nlink after: $(stat -c %h $BASE)"
+}
+run_test 51ba "rmdir .../t-0 --- .../t-$NUMTEST"
+
test_51bb() {
[ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
mkdir -p $DIR/$tdir
UUID=$(ostuuid_from_index 0 $DIR/$tdir)
OUT=$($LFIND -obd $UUID $DIR/$tdir)
- [ "$OUT" ] && error "$LFIND returned directory '$OUT'" || true
+ [ "$OUT" ] && error "$LFIND -obd returned directory '$OUT'" || true
}
-run_test 56i "check 'lfs find -ost UUID' skips directories ======="
+run_test 56i "check 'lfs find -obd UUID' skips directories ======="
test_56j() {
setup_56_special $NUMFILES $NUMDIRS
run_test 56r "check lfs find -size works =========================="
+test_56v() {
+ local FIND_MDT_IDX=0
+
+ TDIR=${tdir}g
+ rm -rf $TDIR
+ setup_56 $NUMFILES $NUMDIRS
+
+ UUID=$(mdtuuid_from_index $FIND_MDT_IDX $DIR/$TDIR)
+ for file in $($LFIND -mdt $UUID $DIR/$TDIR); do
+ file_mdt_idx=$($GETSTRIPE -M $file)
+ [ $file_mdt_idx -eq $FIND_MDT_IDX ] ||
+ error "wrong lfind -m not match getstripe -M"
+ done
+}
+run_test 56v "check 'lfs find -mdt match with lfs getstripe -M' ======="
+
test_57a() {
# note test will not do anything if MDS is not local
remote_mds_nodsh && skip "remote MDS with nodsh" && return
rmdir ${testdir} || error "rmdir failed"
check_stats $SINGLEMDS "rmdir" 1
+ local testdir1=$DIR/${tdir}/stats_testdir1
+ mkdir -p ${testdir}
+ mkdir -p ${testdir1}
+ touch ${testdir1}/test1
+ mv ${testdir1}/test1 ${testdir} || error "file crossdir rename"
+ check_stats $SINGLEMDS "crossdir_rename" 1
+
+ mv ${testdir}/test1 ${testdir}/test0 || error "file samedir rename"
+ check_stats $SINGLEMDS "samedir_rename" 1
+
rm -rf $DIR/${tdir}
}
run_test 133a "Verifying MDT stats ========================================"
do_facet $SINGLEMDS $LCTL set_param mdt.*.md_stats=clear
do_facet ost1 $LCTL set_param obdfilter.*.stats=clear
- dd if=/dev/zero of=${testdir}/${tfile} conv=notrunc bs=1024k count=1 || error "dd failed"
+ dd if=/dev/zero of=${testdir}/${tfile} conv=notrunc bs=512k count=1 || error "dd failed"
sync
cancel_lru_locks osc
check_stats ost "write" 1
}
run_test 133c "Verifying OST stats ========================================"
+order_2() {
+ local value=$1
+ local orig=$value
+ local order=1
+
+ while [ $value -ge 2 ]; do
+ order=$((order*2))
+ value=$((value/2))
+ done
+
+ if [ $orig -gt $order ]; then
+ order=$((order*2))
+ fi
+ echo $order
+}
+
+size_in_KMGT() {
+ local value=$1
+ local size=('K' 'M' 'G' 'T');
+ local i=0
+ local size_string=$value
+
+ while [ $value -ge 1024 ]; do
+ if [ $i -gt 3 ]; then
+ #T is the biggest unit we get here, if that is bigger,
+ #just return XXXT
+ size_string=${value}T
+ break
+ fi
+ value=$((value >> 10))
+ if [ $value -lt 1024 ]; then
+ size_string=${value}${size[$i]}
+ break
+ fi
+ i=$((i + 1))
+ done
+
+ echo $size_string
+}
+
+get_rename_size() {
+ local size=$1
+ local sample=$(do_facet $SINGLEMDS $LCTL get_param mdt.*.rename_stats | \
+ awk '/ '${size}'/ {print $4}' | sed -e "s/,//g")
+ echo $sample
+}
+
+test_133d() {
+ remote_ost_nodsh && skip "remote OST with nodsh" && return
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
+ local testdir1=$DIR/${tdir}/stats_testdir1
+ local testdir2=$DIR/${tdir}/stats_testdir2
+
+ do_facet $SINGLEMDS $LCTL set_param mdt.*.rename_stats=clear
+
+ mkdir -p ${testdir1} || error "mkdir failed"
+ mkdir -p ${testdir2} || error "mkdir failed"
+
+ createmany -o $testdir1/test 512 || error "createmany failed"
+ local testdir1_size=$(ls -l $DIR/${tdir} | \
+ awk '/stats_testdir1/ {print $5}')
+ local testdir2_size=$(ls -l $DIR/${tdir} | \
+ awk '/stats_testdir2/ {print $5}')
+
+ testdir1_size=$(order_2 $testdir1_size)
+ testdir2_size=$(order_2 $testdir2_size)
+
+ testdir1_size=$(size_in_KMGT $testdir1_size)
+ testdir2_size=$(size_in_KMGT $testdir2_size)
+
+ # check samedir rename size
+ mv ${testdir1}/test0 ${testdir1}/test_0
+ local samedir=$(do_facet $SINGLEMDS $LCTL get_param mdt.*.rename_stats | \
+ grep 'same_dir')
+ local same_sample=$(get_rename_size $testdir1_size)
+ [ -z "$samedir" ] && error "samedir_rename_size count error"
+ [ $same_sample -eq 1 ] || error "samedir_rename_size count error"
+ echo "Check same dir rename stats success"
+
+ # check crossdir rename size
+ do_facet $SINGLEMDS $LCTL set_param mdt.*.rename_stats=clear
+ mv ${testdir1}/test_0 ${testdir2}/test_0
+ local crossdir=$(do_facet $SINGLEMDS $LCTL get_param mdt.*.rename_stats | \
+ grep 'crossdir')
+ local src_sample=$(get_rename_size $testdir1_size)
+ local tgt_sample=$(get_rename_size $testdir2_size)
+ [ -z "$crossdir" ] && error "crossdir_rename_size count error"
+ [ $src_sample -eq 1 ] || error "crossdir_rename_size count error"
+ [ $tgt_sample -eq 1 ] || error "crossdir_rename_size count error"
+ echo "Check cross dir rename stats success"
+
+ rm -rf $DIR/${tdir}
+}
+run_test 133d "Verifying rename_stats ========================================"
+
test_140() { #bug-17379
mkdir -p $DIR/$tdir || error "Creating dir $DIR/$tdir"
cd $DIR/$tdir || error "Changing to $DIR/$tdir"
}
run_test 221 "make sure fault and truncate race to not cause OOM"
+test_222a () {
+ rm -rf $DIR/$tdir
+ mkdir -p $DIR/$tdir
+ $LFS setstripe -c 1 -i 0 $DIR/$tdir
+ createmany -o $DIR/$tdir/$tfile 10
+ cancel_lru_locks mdc
+ cancel_lru_locks osc
+ #define OBD_FAIL_LDLM_AGL_DELAY 0x31a
+ $LCTL set_param fail_loc=0x31a
+ ls -l $DIR/$tdir > /dev/null || error "AGL for ls failed"
+ $LCTL set_param fail_loc=0
+ rm -r $DIR/$tdir
+}
+run_test 222a "AGL for ls should not trigger CLIO lock failure ================"
+
+test_222b () {
+ rm -rf $DIR/$tdir
+ mkdir -p $DIR/$tdir
+ $LFS setstripe -c 1 -i 0 $DIR/$tdir
+ createmany -o $DIR/$tdir/$tfile 10
+ cancel_lru_locks mdc
+ cancel_lru_locks osc
+ #define OBD_FAIL_LDLM_AGL_DELAY 0x31a
+ $LCTL set_param fail_loc=0x31a
+ rm -r $DIR/$tdir || "AGL for rmdir failed"
+ $LCTL set_param fail_loc=0
+}
+run_test 222b "AGL for rmdir should not trigger CLIO lock failure ============="
+
+test_223 () {
+ rm -rf $DIR/$tdir
+ mkdir -p $DIR/$tdir
+ $LFS setstripe -c 1 -i 0 $DIR/$tdir
+ createmany -o $DIR/$tdir/$tfile 10
+ cancel_lru_locks mdc
+ cancel_lru_locks osc
+ #define OBD_FAIL_LDLM_AGL_NOLOCK 0x31b
+ $LCTL set_param fail_loc=0x31b
+ ls -l $DIR/$tdir > /dev/null || error "reenqueue failed"
+ $LCTL set_param fail_loc=0
+ rm -r $DIR/$tdir
+}
+run_test 223 "osc reenqueue if without AGL lock granted ======================="
+
#
# tests that do cleanup/setup should be run at the end
#