set -e
ONLY=${ONLY:-"$*"}
-# bug number for skipped test: 4900 4900 2108 9789 3637 9789 3561 5188/5749 10764
-ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"27o 27q 42a 42b 42c 42d 45 68 75"}
+# bug number for skipped test: 4900 4900 2108 9789 3637 9789 3561 13310 10764
+ALWAYS_EXCEPT=" 27o 27q 42a 42b 42c 42d 45 74b 75 $SANITY_EXCEPT"
# bug number for skipped test: 2108 9789 3637 9789 3561 5188/5749 1443
#ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"27m 42a 42b 42c 42d 45 68 76"}
# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
ACCEPTOR_PORT=${ACCEPTOR_PORT:-988}
UMOUNT=${UMOUNT:-"umount -d"}
STRIPES_PER_OBJ=-1
+CHECK_GRANT=${CHECK_GRANT:-"yes"}
+GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
if [ $UID -ne 0 ]; then
echo "Warning: running as non-root uid $UID"
SAVE_PWD=$PWD
+CLEANUP=${CLEANUP:-:}
+SETUP=${SETUP:-:}
+TRACE=${TRACE:-""}
LUSTRE=${LUSTRE:-`dirname $0`/..}
. $LUSTRE/tests/test-framework.sh
init_test_env $@
. ${CONFIG:=$LUSTRE/tests/cfg/local.sh}
-if [ ! -z "$USING_KRB5" ]; then
+if $GSS_KRB5; then
$RUNAS krb5_login.sh || exit 1
$RUNAS -u $(($RUNAS_ID + 1)) krb5_login.sh || exit 1
fi
echo -n "cln.."
cleanupall ${FORCE} $* || { echo "FAILed to clean up"; exit 20; }
}
-CLEANUP=${CLEANUP:-:}
-
setup() {
echo -n "mnt.."
load_modules
setupall || exit 10
echo "done"
}
-SETUP=${SETUP:-:}
-
-log() {
- echo "$*"
- $LCTL mark "$*" 2> /dev/null || true
-}
-
-trace() {
- log "STARTING: $*"
- strace -o $TMP/$1.strace -ttt $*
- RC=$?
- log "FINISHED: $*: rc $RC"
- return 1
-}
-TRACE=${TRACE:-""}
check_kernel_version() {
VERSION_FILE=$LPROC/version
return 1
}
-_basetest() {
- echo $*
-}
-
-basetest() {
- IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
-}
-
-run_one() {
- if ! grep -q $DIR /proc/mounts; then
- $SETUP
- fi
- testnum=$1
- message=$2
- BEFORE=`date +%s`
- log "== test $testnum: $message= `date +%H:%M:%S` ($BEFORE)"
- export TESTNAME=test_$testnum
- export tfile=f${testnum}
- export tdir=d${base}
- test_${testnum} || error "exit with rc=$?"
- unset TESTNAME
- pass "($((`date +%s` - $BEFORE))s)"
- cd $SAVE_PWD
- $CLEANUP
-}
-
-build_test_filter() {
- [ "$ALWAYS_EXCEPT$EXCEPT$SANITY_EXCEPT" ] && \
- echo "Skipping tests: `echo $ALWAYS_EXCEPT $EXCEPT $SANITY_EXCEPT`"
-
- for O in $ONLY; do
- eval ONLY_${O}=true
- done
- for E in $EXCEPT $ALWAYS_EXCEPT $SANITY_EXCEPT; do
- eval EXCEPT_${E}=true
- done
-}
-
-_basetest() {
- echo $*
-}
-
-basetest() {
- IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
-}
-
-run_test() {
- export base=`basetest $1`
- if [ "$ONLY" ]; then
- testname=ONLY_$1
- if [ ${!testname}x != x ]; then
- run_one $1 "$2"
- return $?
- fi
- testname=ONLY_$base
- if [ ${!testname}x != x ]; then
- run_one $1 "$2"
- return $?
- fi
- echo -n "."
- return 0
- fi
- testname=EXCEPT_$1
- if [ ${!testname}x != x ]; then
- TESTNAME=test_$1 skip "skipping excluded test $1"
- return 0
- fi
- testname=EXCEPT_$base
- if [ ${!testname}x != x ]; then
- TESTNAME=test_$1 skip "skipping excluded test $1 (base $base)"
- return 0
- fi
- run_one $1 "$2"
- return $?
-}
+if [ "$ONLY" == "cleanup" ]; then
+ sh llmountcleanup.sh
+ exit 0
+fi
[ "$SANITYLOG" ] && rm -f $SANITYLOG || true
-mounted_lustre_filesystems() {
- awk '($3 ~ "lustre" && $1 ~ ":") { print $2 }' /proc/mounts
-}
-
-MOUNTED="`mounted_lustre_filesystems`"
-if [ -z "$MOUNTED" ]; then
- formatall
- setupall
- MOUNTED="`mounted_lustre_filesystems`"
- [ -z "$MOUNTED" ] && error "NAME=$NAME not mounted"
- I_MOUNTED=yes
-fi
+check_and_setup_lustre
DIR=${DIR:-$MOUNT}
[ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
}
run_test 27t "check that utils parse path correctly"
-test_27x() { # bug 10997
- mkdir -p $DIR/d27w || error "mkdir failed"
- $LSTRIPE $DIR/d27w/f0 -s 65536 || error "lstripe failed"
- size=`$LSTRIPEINFO $DIR/d27w/f0 | awk {'print $1'}`
- [ $size -ne 65536 ] && error "stripe size $size != 65536" || true
-
- [ "$OSTCOUNT" -lt "2" ] && skip "skipping multiple stripe count/offset test" && return
- for i in `seq 1 $OSTCOUNT`; do
- offset=$(($i-1))
- $LSTRIPE $DIR/d27w/f$i -c $i -i $offset || error "lstripe -c $i -i $offset failed"
- count=`$LSTRIPEINFO $DIR/d27w/f$i | awk {'print $2'}`
- index=`$LSTRIPEINFO $DIR/d27w/f$i | awk {'print $3'}`
- [ $count -ne $i ] && error "stripe count $count != $i" || true
- [ $index -ne $offset ] && error "stripe offset $index != $offset" || true
- done
-}
-run_test 27x "check lfs setstripe -c -s -i options ============="
-
test_27u() { # bug 4900
[ "$OSTCOUNT" -lt "2" ] && skip "too few OSTs" && return
remote_mds && skip "remote MDS" && return
}
run_test 27v "skip object creation on slow OST ================="
+test_27w() { # bug 10997
+ mkdir -p $DIR/d27w || error "mkdir failed"
+ $LSTRIPE $DIR/d27w/f0 -s 65536 || error "lstripe failed"
+ size=`$LSTRIPEINFO $DIR/d27w/f0 | awk {'print $1'}`
+ [ $size -ne 65536 ] && error "stripe size $size != 65536" || true
+
+ [ "$OSTCOUNT" -lt "2" ] && skip "skipping multiple stripe count/offset test" && return
+ for i in `seq 1 $OSTCOUNT`; do
+ offset=$(($i-1))
+ $LSTRIPE $DIR/d27w/f$i -c $i -i $offset || error "lstripe -c $i -i $offset failed"
+ count=`$LSTRIPEINFO $DIR/d27w/f$i | awk {'print $2'}`
+ index=`$LSTRIPEINFO $DIR/d27w/f$i | awk {'print $3'}`
+ [ $count -ne $i ] && error "stripe count $count != $i" || true
+ [ $index -ne $offset ] && error "stripe offset $index != $offset" || true
+ done
+}
+run_test 27w "check lfs setstripe -c -s -i options ============="
+
test_28() {
mkdir $DIR/d28
$CREATETEST $DIR/d28/ct || error
test_44() {
[ "$OSTCOUNT" -lt "2" ] && skip "skipping 2-stripe test" && return
dd if=/dev/zero of=$DIR/f1 bs=4k count=1 seek=1023
- dd if=$DIR/f1 bs=4k count=1
+ dd if=$DIR/f1 bs=4k count=1 > /dev/null
}
run_test 44 "zero length read from a sparse stripe ============="
touch .foo || error "'touch .foo' failed after recreating cwd"
mkdir .bar || error "'mkdir .foo' failed after recreating cwd"
fi
- ls . || error "'ls .' failed after recreating cwd"
- ls .. || error "'ls ..' failed after removing cwd"
+ ls . > /dev/null || error "'ls .' failed after recreating cwd"
+ ls .. > /dev/null || error "'ls ..' failed after removing cwd"
cd . || error "'cd .' failed after recreating cwd"
mkdir . && error "'mkdir .' worked after recreating cwd"
rmdir . && error "'rmdir .' worked after recreating cwd"
touch .foo && error "'touch .foo' worked after removing cwd"
mkdir .foo && error "'mkdir .foo' worked after removing cwd"
fi
- ls . && error "'ls .' worked after removing cwd"
- ls .. || error "'ls ..' failed after removing cwd"
- cd . && error "'cd .' worked after removing cwd"
+ ls . > /dev/null && error "'ls .' worked after removing cwd"
+ ls .. > /dev/null || error "'ls ..' failed after removing cwd"
+ is_patchless || ( cd . && error "'cd .' worked after removing cwd" )
mkdir . && error "'mkdir .' worked after removing cwd"
rmdir . && error "'rmdir .' worked after removing cwd"
ln -s . foo && error "'ln -s .' worked after removing cwd"
fi
$TRACE ls . && error "'ls .' worked after removing cwd"
$TRACE ls .. || error "'ls ..' failed after removing cwd"
- $TRACE cd . && error "'cd .' worked after removing cwd"
+ is_patchless || ( $TRACE cd . && error "'cd .' worked after removing cwd" )
$TRACE mkdir . && error "'mkdir .' worked after removing cwd"
$TRACE rmdir . && error "'rmdir .' worked after removing cwd"
$TRACE ln -s . foo && error "'ln -s .' worked after removing cwd"
fi
$TRACE ls . && error "'ls .' worked after removing parent"
$TRACE ls .. && error "'ls ..' worked after removing parent"
- $TRACE cd . && error "'cd .' worked after recreate parent"
+ is_patchless || ( $TRACE cd . && error "'cd .' worked after recreate parent" )
$TRACE mkdir . && error "'mkdir .' worked after removing parent"
$TRACE rmdir . && error "'rmdir .' worked after removing parent"
$TRACE ln -s . foo && error "'ln -s .' worked after removing parent"
- $TRACE cd .. && error "'cd ..' worked after removing parent" || true
+ is_patchless || ( $TRACE cd .. && error "'cd ..' worked after removing parent" || true )
}
run_test 48d "Access removed parent subdir (should return errors)"
}
run_test 56h "check lfs find ! -name ============================="
+test_56i() {
+ tdir=${tdir}i
+ mkdir -p $DIR/$tdir
+ UUID=`$GETSTRIPE $DIR/$tdir | awk '/0: / { print $2 }'`
+ OUT="`$LFIND -ost $UUID $DIR/$tdir`"
+ [ "$OUT" ] && error "$LFIND returned directory '$OUT'" || true
+}
+run_test 56i "check 'lfs find -ost UUID' skips directories ======="
+
test_57a() {
# note test will not do anything if MDS is not local
remote_mds && skip "remote MDS" && return
# bug 2248 - async write errors didn't return to application on sync
# bug 3677 - async write errors left page locked
test_63b() {
- DBG_SAVE="`sysctl -n lnet.debug`"
+ debugsave
sysctl -w lnet.debug=-1
# ensure we have a grant to do async writes
#define OBD_FAIL_OSC_BRW_PREP_REQ 0x406
sysctl -w lustre.fail_loc=0x80000406
multiop $DIR/$tfile Owy && \
- $LCTL dk /tmp/test63b.debug && \
- sysctl -w lnet.debug="$DBG_SAVE" && \
error "sync didn't return ENOMEM"
sync; sleep 2; sync # do a real sync this time to flush page
grep locked $LPROC/llite/*/dump_page_cache && \
- $LCTL dk /tmp/test63b.debug && \
- sysctl -w lnet.debug="$DBG_SAVE" && \
error "locked page left in cache after async error" || true
- sysctl -w lnet.debug="$DBG_SAVE"
+ debugrestore
}
run_test 63b "async write errors should be returned to fsync ==="
}
run_test 65c "directory setstripe $(($STRIPESIZE * 4)) 1 $(($OSTCOUNT - 1))"
-if [ $STRIPECOUNT -eq 0 ]; then
- sc=1
-elif [ $STRIPECOUNT -gt 160 ]; then
-#LOV_MAX_STRIPE_COUNT is 160, 4294967295(-1) is included.
- [ $OSTCOUNT -gt 160 ] && sc=160 || sc=$(($OSTCOUNT - 1))
-else
- sc=$(($STRIPECOUNT - 1))
-fi
-
test_65d() {
mkdir -p $DIR/d65
+ if [ $STRIPECOUNT -le 0 ]; then
+ sc=1
+ elif [ $STRIPECOUNT -gt 160 ]; then
+#LOV_MAX_STRIPE_COUNT is 160
+ [ $OSTCOUNT -gt 160 ] && sc=160 || sc=$(($OSTCOUNT - 1))
+ else
+ sc=$(($STRIPECOUNT - 1))
+ fi
$SETSTRIPE $DIR/d65 $STRIPESIZE -1 $sc || error "setstripe"
touch $DIR/d65/f4 $DIR/d65/f5
$LVERIFY $DIR/d65 $DIR/d65/f4 $DIR/d65/f5 || error "lverify failed"
}
-run_test 65d "directory setstripe $STRIPESIZE -1 $sc =============="
+run_test 65d "directory setstripe $STRIPESIZE -1 stripe_count =============="
test_65e() {
mkdir -p $DIR/d65
}
run_test 67 "security test ====================================="
+LLOOP=
cleanup_68() {
trap 0
- if [ "$LOOPDEV" ]; then
- swapoff $LOOPDEV || error "swapoff failed"
- losetup -d $LOOPDEV || error "losetup -d failed"
- unset LOOPDEV LOOPNUM
+ if [ ! -z "$LLOOP" ]; then
+ swapoff $LLOOP || error "swapoff failed"
+ $LCTL blockdev_detach $LLOOP || error "detach failed"
+ rm -f $LLOOP
+ unset LLOOP
fi
rm -f $DIR/f68
}
swapon -s | awk '($1 == "'$1'") { print $4 }'
}
+
# excercise swapping to lustre by adding a high priority swapfile entry
# and then consuming memory until it is used.
test_68() {
grep -q obdfilter $LPROC/devices && \
skip "local OST" && return
- find_loop_dev
- dd if=/dev/zero of=$DIR/f68 bs=64k count=1024
+ grep -q llite_lloop /proc/modules
+ [ $? -ne 0 ] && skip "can't find module llite_lloop" && return
+
+ LLOOP=$TMP/lloop.`date +%s`.`date +%N`
+ dd if=/dev/zero of=$DIR/f68 bs=64k seek=2047 count=1
+ mkswap $DIR/f68
+
+ $LCTL blockdev_attach $DIR/f68 $LLOOP || error "attach failed"
trap cleanup_68 EXIT
- losetup $LOOPDEV $DIR/f68 || error "losetup $LOOPDEV failed"
- mkswap $LOOPDEV
- swapon -p 32767 $LOOPDEV || error "swapon $LOOPDEV failed"
+ swapon -p 32767 $LLOOP || error "swapon $LLOOP failed"
- echo "before: `swapon -s | grep $LOOPDEV`"
- KBFREE=`meminfo MemTotal`
- $MEMHOG $KBFREE || error "error allocating $KBFREE kB"
- echo "after: `swapon -s | grep $LOOPDEV`"
- SWAPUSED=`swap_used $LOOPDEV`
+ echo "before: `swapon -s | grep $LLOOP`"
+ MEMTOTAL=`meminfo MemTotal`
+ $MEMHOG $MEMTOTAL || error "error allocating $MEMTOTAL kB"
+ echo "after: `swapon -s | grep $LLOOP`"
+ SWAPUSED=`swap_used $LLOOP`
cleanup_68
test_69() {
[ $(grep -c obdfilter $LPROC/devices) -eq 0 ] && \
skip "skipping test for remote OST" && return
- [ ! -z "$USING_KRB5" ] && \
- skip "gss with bulk security will triger oops. re-enable this after b10091 get fixed" && return
+ $GSS && skip "gss with bulk security will triger oops. re-enable this after b10091 get fixed" && return
f="$DIR/$tfile"
touch $f
}
run_test 73 "multiple MDC requests (should not deadlock)"
-test_74() { # bug 6149, 6184
+test_74a() { # bug 6149, 6184
#define OBD_FAIL_LDLM_ENQUEUE_OLD_EXPORT 0x30e
#
# very important to OR with OBD_FAIL_ONCE (0x80000000) -- otherwise it
# will spin in a tight reconnection loop
+ touch $DIR/f74a
sysctl -w lustre.fail_loc=0x8000030e
- # get any lock
- touch $DIR/f74
+ # get any lock that won't be difficult - lookup works.
+ ls $DIR/f74a
sysctl -w lustre.fail_loc=0
true
}
-run_test 74 "ldlm_enqueue freed-export error path (shouldn't LBUG)"
+run_test 74a "ldlm_enqueue freed-export error path, ls (shouldn't LBUG)"
+
+test_74b() { # bug 13310
+ #define OBD_FAIL_LDLM_ENQUEUE_OLD_EXPORT 0x30e
+ #
+ # very important to OR with OBD_FAIL_ONCE (0x80000000) -- otherwise it
+ # will spin in a tight reconnection loop
+ sysctl -w lustre.fail_loc=0x8000030e
+ # get a "difficult" lock
+ touch $DIR/f74b
+ sysctl -w lustre.fail_loc=0
+ true
+}
+run_test 74b "ldlm_enqueue freed-export error path, touch (shouldn't LBUG)"
JOIN=${JOIN:-"lfs join"}
F75=$DIR/f75
}
run_test 78 "handle large O_DIRECT writes correctly ============"
+test_79() { # bug 12743
+ [ $(grep -c obdfilter $LPROC/devices) -eq 0 ] &&
+ skip "skipping test for remote OST" && return
+ BKTOTAL=`awk 'BEGIN{total=0}; {total+=$1}; END{print total}' \
+ $LPROC/obdfilter/*/kbytestotal`
+ BKFREE=`awk 'BEGIN{free=0}; {free+=$1}; END{print free}' \
+ $LPROC/obdfilter/*/kbytesfree`
+ BKAVAIL=`awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}' \
+ $LPROC/obdfilter/*/kbytesavail`
+ STRING=`df -P $MOUNT | tail -n 1 | awk '{print $2","$3","$4}'`
+ DFTOTAL=`echo $STRING | cut -d, -f1`
+ DFUSED=`echo $STRING | cut -d, -f2`
+ DFAVAIL=`echo $STRING | cut -d, -f3`
+ DFFREE=$(($DFTOTAL - $DFUSED))
+
+ ALLOWANCE=$((64 * $OSTCOUNT))
+
+ if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
+ [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
+ error "df total($DFTOTAL) mismatch OST total($BKTOTAL)"
+ fi
+ if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
+ [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
+ error "df free($DFFREE) mismatch OST free($BKFREE)"
+ fi
+ if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
+ [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
+ error "df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
+ fi
+}
+run_test 79 "df report consistency check ======================="
+
# on the LLNL clusters, runas will still pick up root's $TMP settings,
# which will not be writable for the runas user, and then you get a CVS
# error message with a corrupt path string (CVS bug) and panic.
}
cleanup_test102() {
- [ "SETUP_TEST102" = "YES" ] || return
+ [ "$SETUP_TEST102" = "yes" ] || return
trap 0
rm -f $TMP/f102.tar
rm -rf $DIR/$tdir
run_test 102b "getfattr/setfattr for trusted.lov EAs ============"
test_102c() {
- # b10930: get/set/list trusted.lov xattr
- echo "get/set/list trusted.lov xattr ..."
+ # b10930: get/set/list lustre.lov xattr
+ echo "get/set/list lustre.lov xattr ..."
[ "$OSTCOUNT" -lt "2" ] && skip "skipping 2-stripe test" && return
mkdir -p $DIR/$tdir
chown $RUNAS_ID $DIR/$tdir
local testfile=$DIR/$tdir/$tfile
$RUNAS $SETSTRIPE $testfile 65536 1 2
- $RUNAS getfattr -d -m "^trusted" $testfile 2> /dev/null | \
- grep "trusted.lov" || error "can't get trusted.lov from $testfile"
+ $RUNAS getfattr -d -m "^lustre" $testfile 2> /dev/null | \
+ grep "lustre.lov" || error "can't get lustre.lov from $testfile"
local testfile2=${testfile}2
- local value=`getfattr -n trusted.lov $testfile 2> /dev/null | \
- grep "trusted.lov" |sed -e 's/[^=]\+=//' `
+ local value=`getfattr -n lustre.lov $testfile 2> /dev/null | \
+ grep "lustre.lov" |sed -e 's/[^=]\+=//' `
$RUNAS $MCREATE $testfile2
- $RUNAS setfattr -n trusted.lov -v $value $testfile2
+ $RUNAS setfattr -n lustre.lov -v $value $testfile2
local tmp_file=${testfile}3
$RUNAS $GETSTRIPE -v $testfile2 > $tmp_file
local stripe_size=`grep "size" $tmp_file| awk '{print $2}'`
[ $stripe_size -eq 65536 ] || error "stripe size $stripe_size != 65536"
[ $stripe_count -eq 2 ] || error "stripe count $stripe_count != 2"
}
-run_test 102c "non-root getfattr/setfattr for trusted.lov EAs ==========="
+run_test 102c "non-root getfattr/setfattr for lustre.lov EAs ==========="
get_stripe_info() {
stripe_size=0
[ "$UID" != 0 ] && skip "must run as root" && return
[ -z "$(grep acl $LPROC/mdc/*-mdc-*/connect_flags)" ] && skip "must have acl enabled" && return
[ -z "$(which setfacl 2>/dev/null)" ] && skip "could not find setfacl" && return
- [ ! -z "$USING_KRB5" ] && skip "could not run under gss" && return
+ $GSS && skip "could not run under gss" && return
SAVE_UMASK=`umask`
umask 0022
}
run_test 119b "Sparse directIO read must return actual read amount"
-test_119a() {
+LDLM_POOL_CTL_RECALC=1
+LDLM_POOL_CTL_SHRINK=2
+
+disable_pool_recalc() {
+ for NSD in $LPROC/ldlm/namespaces/*$1*; do
+ if test -f $NSD/pool/control; then
+ CONTROL=`cat $NSD/pool/control`
+ CONTROL=$((CONTROL & ~LDLM_POOL_CTL_RECALC))
+ echo "$CONTROL" > $NSD/pool/control
+ fi
+ done
+}
+
+enable_pool_recalc() {
+ for NSD in $LPROC/ldlm/namespaces/*$1*; do
+ if test -f $NSD/pool/control; then
+ CONTROL=`cat $NSD/pool/control`
+ CONTROL=$((CONTROL | LDLM_POOL_CTL_RECALC))
+ echo "$CONTROL" > $NSD/pool/control
+ fi
+ done
+}
+
+disable_pool_shrink() {
+ for NSD in $LPROC/ldlm/namespaces/*$1*; do
+ if test -f $NSD/pool/control; then
+ CONTROL=`cat $NSD/pool/control`
+ CONTROL=$((CONTROL & ~LDLM_POOL_CTL_SHRINK))
+ echo "$CONTROL" > $NSD/pool/control
+ fi
+ done
+}
+
+enable_pool_shrink() {
+ for NSD in $LPROC/ldlm/namespaces/*$1*; do
+ if test -f $NSD/pool/control; then
+ CONTROL=`cat $NSD/pool/control`
+ CONTROL=$((CONTROL | LDLM_POOL_CTL_SHRINK))
+ echo "$CONTROL" > $NSD/pool/control
+ fi
+ done
+}
+
+disable_pool() {
+ disable_pool_shrink $1
+ disable_pool_recalc $1
+}
+
+enable_pool() {
+ enable_pool_shrink $1
+ enable_pool_recalc $1
+}
+
+lru_resize_enable()
+{
+ enable_pool osc
+ enable_pool "filter-$FSNAME"
+ enable_pool mdc
+ enable_pool "mds-$FSNAME"
+}
+
+lru_resize_disable()
+{
+ disable_pool osc
+ disable_pool "filter-$FSNAME"
+ disable_pool mdc
+ disable_pool "mds-$FSNAME"
+}
+
+test_120a() {
+ [ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \
+ skip "no early lock cancel on server" && return 0
+ lru_resize_disable
mkdir $DIR/$tdir
cancel_lru_locks mdc
stat $DIR/$tdir > /dev/null
blk2=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats`
[ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured."
[ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured."
+ lru_resize_enable
}
-run_test 119a "Early Lock Cancel: mkdir test"
+run_test 120a "Early Lock Cancel: mkdir test"
-test_119b() {
+test_120b() {
+ [ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \
+ skip "no early lock cancel on server" && return 0
+ lru_resize_disable
mkdir $DIR/$tdir
cancel_lru_locks mdc
stat $DIR/$tdir > /dev/null
can2=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats`
[ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured."
[ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured."
+ lru_resize_enable
}
-run_test 119b "Early Lock Cancel: create test"
+run_test 120b "Early Lock Cancel: create test"
-test_119c() {
+test_120c() {
+ [ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \
+ skip "no early lock cancel on server" && return 0
+ lru_resize_disable
mkdir -p $DIR/$tdir/d1 $DIR/$tdir/d2
touch $DIR/$tdir/d1/f1
cancel_lru_locks mdc
blk2=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats`
[ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured."
[ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured."
+ lru_resize_enable
}
-run_test 119c "Early Lock Cancel: link test"
+run_test 120c "Early Lock Cancel: link test"
-test_119d() {
+test_120d() {
+ [ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \
+ skip "no early lock cancel on server" && return 0
+ lru_resize_disable
touch $DIR/$tdir
cancel_lru_locks mdc
stat $DIR/$tdir > /dev/null
blk2=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats`
[ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured."
[ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured."
+ lru_resize_enable
}
-run_test 119d "Early Lock Cancel: setattr test"
+run_test 120d "Early Lock Cancel: setattr test"
-test_119e() {
+test_120e() {
+ [ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \
+ skip "no early lock cancel on server" && return 0
+ lru_resize_disable
mkdir $DIR/$tdir
dd if=/dev/zero of=$DIR/$tdir/f1 count=1
cancel_lru_locks mdc
blk2=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats`
[ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured."
[ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured."
+ lru_resize_enable
}
-run_test 119e "Early Lock Cancel: unlink test"
+run_test 120e "Early Lock Cancel: unlink test"
-test_119f() {
+test_120f() {
+ [ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \
+ skip "no early lock cancel on server" && return 0
+ lru_resize_disable
mkdir -p $DIR/$tdir/d1 $DIR/$tdir/d2
dd if=/dev/zero of=$DIR/$tdir/d1/f1 count=1
dd if=/dev/zero of=$DIR/$tdir/d2/f2 count=1
blk2=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats`
[ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured."
[ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured."
+ lru_resize_enable
}
-run_test 119f "Early Lock Cancel: rename test"
+run_test 120f "Early Lock Cancel: rename test"
-test_119g() {
+test_120g() {
+ [ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \
+ skip "no early lock cancel on server" && return 0
+ lru_resize_disable
count=10000
echo create $count files
- mkdir $DIR/$tdir
+ mkdir -p $DIR/$tdir
cancel_lru_locks mdc
cancel_lru_locks osc
t0=`date +%s`
echo total: $((can2-can1)) cancels, $((blk2-blk1)) blockings
sleep 2
# wait for commitment of removal
+ lru_resize_enable
+}
+run_test 120g "Early Lock Cancel: performance test"
+
+test_121() { #bug #10589
+ rm -rf $DIR/$tfile
+ writes=`dd if=/dev/zero of=$DIR/$tfile count=1 2>&1 | awk 'BEGIN { FS="+" } /out/ {print $1}'`
+#define OBD_FAIL_LDLM_CANCEL_RACE 0x310
+ sysctl -w lustre.fail_loc=0x310
+ cancel_lru_locks osc > /dev/null
+ reads=`dd if=$DIR/$tfile of=/dev/null 2>&1 | awk 'BEGIN { FS="+" } /in/ {print $1}'`
+ sysctl -w lustre.fail_loc=0
+ [ $reads -eq $writes ] || error "read" $reads "blocks, must be" $writes
}
-run_test 119g "Early Lock Cancel: performance test"
+run_test 121 "read cancel race ========="
+
+test_124() {
+ [ -z "`grep lru_resize $LPROC/mdc/*/connect_flags`" ] && \
+ skip "no lru resize on server" && return 0
+ cancel_lru_locks mdc
+ lru_resize_enable
+ NSDIR=`find $LPROC/ldlm/namespaces | grep mdc | head -1`
+
+ # we want to test main pool functionality, that is cancel based on SLV
+ # this is why shrinkers are disabled
+ disable_pool_shrink "mds-$FSNAME"
+ disable_pool_shrink mdc
+
+ NR=2000
+ mkdir -p $DIR/$tdir || error "failed to create $DIR/$tdir"
+
+ LRU_SIZE=`cat $NSDIR/lru_size`
+
+ # use touch to produce $NR new locks
+ log "create $NR files at $DIR/$tdir"
+ for ((i=0;i<$NR;i++)); do touch $DIR/$tdir/f$i; done
+
+ LRU_SIZE_B=`cat $NSDIR/lru_size`
+ if test $LRU_SIZE -ge $LRU_SIZE_B; then
+ skip "No cached locks created!"
+ cat $NSDIR/pool/state
+ return 0
+ fi
+ LRU_SIZE_B=$((LRU_SIZE_B-LRU_SIZE))
+ log "created $LRU_SIZE_B lock(s)"
+
+ # we want to sleep 30s to not make test too long
+ SLEEP=30
+ SLEEP_ADD=10
+
+ # we know that lru resize allows one client to hold $LIMIT locks for 10h
+ MAX_HRS=10
+
+ # get the pool limit
+ LIMIT=`cat $NSDIR/pool/limit`
+
+ # calculate lock volume factor taking into account sleep and data set
+ # use $LRU_SIZE_B here to take into account real number of locks created
+ # in the case of CMD, LRU_SIZE_B != $NR in most of cases
+ LVF=$(($LIMIT * $MAX_HRS * 60 * 60 / $LRU_SIZE_B / $SLEEP))
+
+ log "make client drop locks $LVF times faster so that ${SLEEP}s is enough to cancel $LRU_SIZE_B lock(s)"
+ OLD_LVF=`cat $NSDIR/pool/lock_volume_factor`
+ echo "$LVF" > $NSDIR/pool/lock_volume_factor
+ log "sleep for "$((SLEEP+SLEEP_ADD))"s"
+ sleep $((SLEEP+SLEEP_ADD))
+ echo "$OLD_LVF" > $NSDIR/pool/lock_volume_factor
+ LRU_SIZE_A=`cat $NSDIR/lru_size`
+
+ [ $LRU_SIZE_B -ge $LRU_SIZE_A ] || {
+ error "No locks dropped in "$((SLEEP+SLEEP_ADD))"s. LRU size: $LRU_SIZE_A"
+ lru_resize_enable
+ unlinkmany $DIR/$tdir/f $NR
+ return
+ }
+
+ log "Dropped "$((LRU_SIZE_B-LRU_SIZE_A))" locks in "$((SLEEP+SLEEP_ADD))"s"
+ lru_resize_enable
+ log "unlink $NR files at $DIR/$tdir"
+ unlinkmany $DIR/$tdir/f $NR
+}
+run_test 124 "lru resize ======================================="
+
+test_125() { # 13358
+ mkdir -p $DIR/d125 || error "mkdir failed"
+ $SETSTRIPE $DIR/d125 65536 -1 -1 || error "setstripe failed"
+ setfacl -R -m u:bin:rwx $DIR/d125 || error "setfacl $DIR/d125 failed"
+ ls -ld $DIR/d125 || error "cannot access $DIR/d125"
+}
+run_test 125 "don't return EPROTO when a dir has a non-default striping and ACLs"
TMPDIR=$OLDTMPDIR
TMP=$OLDTMP
HOME=$OLDHOME
log "cleanup: ======================================================"
-if [ "`mount | grep $MOUNT`" ]; then
- rm -rf $DIR/[Rdfs][1-9]*
+check_and_cleanup_lustre
+if [ "$I_MOUNTED" != "yes" ]; then
+ sysctl -w lnet.debug="$OLDDEBUG" 2> /dev/null || true
fi
-if [ "$I_MOUNTED" = "yes" ]; then
- cleanupall -f || error "cleanup failed"
-fi
-
echo '=========================== finished ==============================='
[ -f "$SANITYLOG" ] && cat $SANITYLOG && grep -q FAIL $SANITYLOG && exit 1 || true