ALWAYS_EXCEPT="14b 28 $SANITYN_EXCEPT"
# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
-[ "$SLOW" = "no" ] && EXCEPT="$EXCEPT 16"
+# bug number for skipped test: 12652 12652
+grep -q 'Enterprise Server 10' /etc/SuSE-release && ALWAYS_EXCEPT="$ALWAYS_EXCEPT 11 14" || true
# Tests that fail on uml
[ "$UML" = "true" ] && EXCEPT="$EXCEPT 7"
CHECK_GRANT=${CHECK_GRANT:-"yes"}
GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
-if [ $UID -ne 0 ]; then
- RUNAS_ID="$UID"
- RUNAS=""
-else
- RUNAS_ID=${RUNAS_ID:-500}
- RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
-fi
-
SAVE_PWD=$PWD
export NAME=${NAME:-local}
init_test_env $@
. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
+[ "$SLOW" = "no" ] && EXCEPT_SLOW="12 16"
+
SANITYLOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
FAIL_ON_ERROR=false
-if $GSS_KRB5; then
- $RUNAS krb5_login.sh || exit 1
-fi
-
SETUP=${SETUP:-:}
TRACE=${TRACE:-""}
check_and_setup_lustre
LPROC=/proc/fs/lustre
-LOVNAME=`cat $LPROC/llite/*/lov/common_name | tail -n 1`
-OSTCOUNT=`cat $LPROC/lov/$LOVNAME/numobd`
+LOVNAME=`lctl get_param -n llite.*.lov.common_name | tail -n 1`
+OSTCOUNT=`lctl get_param -n lov.$LOVNAME.numobd`
rm -rf $DIR1/[df][0-9]* $DIR1/lnk
+# $RUNAS_ID may get set incorrectly somewhere else
+[ $UID -eq 0 -a $RUNAS_ID -eq 0 ] && error "\$RUNAS_ID set to 0, but \$UID is also 0!"
+
check_runas_id $RUNAS_ID $RUNAS
build_test_filter
test_11() {
mkdir $DIR1/d11
- multiop $DIR1/d11/f O_c &
+ multiop_bg_pause $DIR1/d11/f O_c || return 1
MULTIPID=$!
- usleep 200
cp -p /bin/ls $DIR1/d11/f
$DIR2/d11/f
RC=$?
test_14a() {
mkdir -p $DIR1/d14
cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
- $DIR1/d14/multiop $TMP/test14.junk O_c &
- MULTIPID=$!
- sleep 1
+ MULTIOP_PROG=$DIR1/d14/multiop multiop_bg_pause $TMP/test14.junk O_c || return 1
+ MULTIOP_PID=$!
multiop $DIR2/d14/multiop Oc && error "expected error, got success"
- kill -USR1 $MULTIPID || return 2
- wait $MULTIPID || return 3
+ kill -USR1 $MULTIOP_PID || return 2
+ wait $MULTIOP_PID || return 3
rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
}
run_test 14a "open(RDWR) of executing file returns -ETXTBSY ===="
test_14b() { # bug 3192, 7040
mkdir -p $DIR1/d14
cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
- $DIR1/d14/multiop $TMP/test14.junk O_c &
- MULTIPID=$!
- sleep 1
- truncate $DIR2/d14/multiop 0 && kill -9 $MULTIPID && \
+ MULTIOP_PROG=$DIR1/d14/multiop multiop_bg_pause $TMP/test14.junk O_c || return 1
+ MULTIOP_PID=$!
+ truncate $DIR2/d14/multiop 0 && kill -9 $MULTIOP_PID && \
error "expected truncate error, got success"
- kill -USR1 $MULTIPID || return 2
- wait $MULTIPID || return 3
+ kill -USR1 $MULTIOP_PID || return 2
+ wait $MULTIOP_PID || return 3
cmp `which multiop` $DIR1/d14/multiop || error "binary changed"
rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
}
test_14c() { # bug 3430, 7040
mkdir -p $DIR1/d14
cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
- $DIR1/d14/multiop $TMP/test14.junk O_c &
- MULTIPID=$!
- sleep 1
+ MULTIOP_PROG=$DIR1/d14/multiop multiop_bg_pause $TMP/test14.junk O_c || return 1
+ MULTIOP_PID=$!
cp /etc/hosts $DIR2/d14/multiop && error "expected error, got success"
- kill -USR1 $MULTIPID || return 2
- wait $MULTIPID || return 3
+ kill -USR1 $MULTIOP_PID || return 2
+ wait $MULTIOP_PID || return 3
cmp `which multiop` $DIR1/d14/multiop || error "binary changed"
rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
}
test_14d() { # bug 10921
mkdir -p $DIR1/d14
cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
- $DIR1/d14/multiop $TMP/test14.junk O_c &
- MULTIPID=$!
- sleep 1
+ MULTIOP_PROG=$DIR1/d14/multiop multiop_bg_pause $TMP/test14.junk O_c || return 1
+ MULTIOP_PID=$!
log chmod
chmod 600 $DIR1/d14/multiop || error "chmod failed"
- kill -USR1 $MULTIPID || return 2
- wait $MULTIPID || return 3
+ kill -USR1 $MULTIOP_PID || return 2
+ wait $MULTIOP_PID || return 3
cmp `which multiop` $DIR1/d14/multiop || error "binary changed"
rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
}
test_16() {
rm -f $MOUNT1/fsxfile
- lfs setstripe $MOUNT1/fsxfile 0 -1 -1 # b=10919
+ lfs setstripe $MOUNT1/fsxfile -c -1 # b=10919
fsx -c 50 -p 100 -N 2500 -l $((SIZE * 256)) -S 0 $MOUNT1/fsxfile $MOUNT2/fsxfile
}
run_test 16 "2500 iterations of dual-mount fsx ================="
time1=`date +%s`
sleep 2
- multiop $DIR1/f23 or20_c &
+ multiop_bg_pause $DIR1/f23 or20_c || return 1
MULTIPID=$!
- sleep 2
time2=`stat -c "%X" $DIR2/f23`
if (( $time2 <= $time1 )); then
run_test 24 "lfs df [-ih] [path] test ========================="
test_25() {
- [ `cat $LPROC/mdc/*-mdc-*/connect_flags | grep -c acl` -lt 2 ] && \
+ [ `lctl get_param -n mdc.*-mdc-*.connect_flags | grep -c acl` -lt 2 ] && \
skip "must have acl, skipping" && return
touch $DIR1/$tdir/f1 || error "touch $DIR1/$tdir/f1"
sleep 1
dd if=/dev/zero of=$DIR1/$tfile bs=8k conv=notrunc count=1 seek=0
log "dd 3 finished"
- echo > $LPROC/ldlm/dump_namespaces
+ lctl set_param -n ldlm.dump_namespaces ""
wait $DD1_PID $DD2_PID
[ $? -ne 0 ] && lctl dk $TMP/debug || true
}
ECHO_UUID="ECHO_osc1_UUID"
tOST=`$LCTL dl | | awk '/-osc-|OSC.*MNT/ { print $4 }' | head -1`
- lfs setstripe $DIR1/$tfile 1048576 0 2
+ lfs setstripe $DIR1/$tfile -s 1048576 -i 0 -c 2
tOBJID=`lfs getstripe $DIR1/$tfile |grep "^[[:space:]]\+1" |awk '{print $2}'`
dd if=/dev/zero of=$DIR1/$tfile bs=1024k count=2
run_test 30 "recreate file race ========="
+test_31() {
+ mkdir -p $DIR1/$tdir || error "Creating dir $DIR1/$tdir"
+ writes=`LANG=C dd if=/dev/zero of=$DIR/$tdir/$tfile count=1 2>&1 |
+ awk 'BEGIN { FS="+" } /out/ {print $1}'`
+ #define OBD_FAIL_LDLM_CANCEL_BL_CB_RACE 0x314
+ sysctl -w lustre.fail_loc=0x314
+ reads=`LANG=C dd if=$DIR2/$tdir/$tfile of=/dev/null 2>&1 |
+ awk 'BEGIN { FS="+" } /in/ {print $1}'`
+ [ $reads -eq $writes ] || error "read" $reads "blocks, must be" $writes
+}
+run_test 31 "voluntary cancel / blocking ast race=============="
+
+# enable/disable lockless truncate feature, depending on the arg 0/1
+enable_lockless_truncate() {
+ lctl set_param -n llite.*.lockless_truncate $1
+}
+
+test_32a() { # bug 11270
+ local p="$TMP/sanityN-$TESTNAME.parameters"
+ save_lustre_params $HOSTNAME llite.*.lockless_truncate > $p
+ cancel_lru_locks osc
+ clear_llite_stats
+ enable_lockless_truncate 1
+ dd if=/dev/zero of=$DIR1/$tfile count=10 bs=1M > /dev/null 2>&1
+
+ log "checking cached lockless truncate"
+ $TRUNCATE $DIR1/$tfile 8000000
+ $CHECKSTAT -s 8000000 $DIR2/$tfile || error "wrong file size"
+ [ $(calc_llite_stats lockless_truncate) -eq 0 ] ||
+ error "lockless truncate doesn't use cached locks"
+
+ log "checking not cached lockless truncate"
+ $TRUNCATE $DIR2/$tfile 5000000
+ $CHECKSTAT -s 5000000 $DIR1/$tfile || error "wrong file size"
+ [ $(calc_llite_stats lockless_truncate) -ne 0 ] ||
+ error "not cached trancate isn't lockless"
+
+ log "disabled lockless truncate"
+ enable_lockless_truncate 0
+ clear_llite_stats
+ $TRUNCATE $DIR2/$tfile 3000000
+ $CHECKSTAT -s 3000000 $DIR1/$tfile || error "wrong file size"
+ [ $(calc_llite_stats lockless_truncate) -eq 0 ] ||
+ error "lockless truncate disabling failed"
+ rm $DIR1/$tfile
+ # restore lockless_truncate default values
+ restore_lustre_params < $p
+ rm -f $p
+}
+run_test 32a "lockless truncate"
+
+test_32b() { # bug 11270
+ local node
+ local p="$TMP/sanityN-$TESTNAME.parameters"
+ save_lustre_params $HOSTNAME "llite.*.contention_seconds" > $p
+ for node in $(osts_nodes); do
+ save_lustre_params $node "ldlm.namespaces.filter-*.max_nolock_bytes" >> $p
+ save_lustre_params $node "ldlm.namespaces.filter-*.contended_locks" >> $p
+ save_lustre_params $node "ldlm.namespaces.filter-*.contention_seconds" >> $p
+ done
+ clear_llite_stats
+ # agressive lockless i/o settings
+ for node in $(osts_nodes); do
+ do_node $node 'lctl set_param -n ldlm.namespaces.filter-*.max_nolock_bytes 2000000; lctl set_param -n ldlm.namespaces.filter-*.contended_locks 0; lctl set_param -n ldlm.namespaces.filter-*.contention_seconds 60'
+ done
+ lctl set_param -n llite.*.contention_seconds 60
+ for i in $(seq 5); do
+ dd if=/dev/zero of=$DIR1/$tfile bs=4k count=1 conv=notrunc > /dev/null 2>&1
+ dd if=/dev/zero of=$DIR2/$tfile bs=4k count=1 conv=notrunc > /dev/null 2>&1
+ done
+ [ $(calc_llite_stats lockless_write_bytes) -ne 0 ] || error "lockless i/o was not triggered"
+ # disable lockless i/o (it is disabled by default)
+ for node in $(osts_nodes); do
+ do_node $node 'lctl set_param -n ldlm.namespaces.filter-*.max_nolock_bytes 0; lctl set_param -n ldlm.namespaces.filter-*.contended_locks 32; lctl set_param -n ldlm.namespaces.filter-*.contention_seconds 0'
+ done
+ # set contention_seconds to 0 at client too, otherwise Lustre still
+ # remembers lock contention
+ lctl set_param -n llite.*.contention_seconds 0
+ clear_llite_stats
+ for i in $(seq 5); do
+ dd if=/dev/zero of=$DIR1/$tfile bs=4k count=1 conv=notrunc > /dev/null 2>&1
+ dd if=/dev/zero of=$DIR2/$tfile bs=4k count=1 conv=notrunc > /dev/null 2>&1
+ done
+ [ $(calc_llite_stats lockless_write_bytes) -eq 0 ] ||
+ error "lockless i/o works when disabled"
+ rm -f $DIR1/$tfile
+ restore_lustre_params <$p
+ rm -f $p
+}
+run_test 32b "lockless i/o"
+
log "cleanup: ======================================================"
check_and_cleanup_lustre