#!/bin/bash
+# -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*-
+# vim:shiftwidth=4:softtabstop=4:tabstop=4:
set -e
SETUP=${SETUP:-""}
CLEANUP=${CLEANUP:-""}
MOUNT_2=${MOUNT_2:-"yes"}
+export MULTIOP=${MULTIOP:-multiop}
. $LUSTRE/tests/test-framework.sh
-if [ "$FAILURE_MODE" = "HARD" ] && mixed_ost_devs; then
- CONFIG_EXCEPTIONS="17"
- echo -n "Several ost services on one ost node are used with FAILURE_MODE=$FAILURE_MODE. "
- echo "Except the tests: $CONFIG_EXCEPTIONS"
- ALWAYS_EXCEPT="$ALWAYS_EXCEPT $CONFIG_EXCEPTIONS"
-fi
-
init_test_env $@
. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
init_logging
check_and_setup_lustre
MOUNTED=$(mounted_lustre_filesystems)
-if ! $(echo $MOUNTED | grep -w -q $MOUNT2); then
+if ! $(echo $MOUNTED' ' | grep -w -q $MOUNT2' '); then
zconf_mount $HOSTNAME $MOUNT2
MOUNTED2=yes
fi
[ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
+# LU-482 Avert LVM and VM inability to flush caches in pre .33 kernels
+if [ $LINUX_VERSION_CODE -lt $(version_code 2.6.33) ]; then
+ sync
+ do_facet $SINGLEMDS "sync; sleep 10; sync; sleep 10; sync"
+fi
+
+LU482_FAILED=$(mktemp -u $TMP/$TESTSUITE.lu482.XXXXXX)
+test_0a() {
+ echo "Check file is LU482_FAILED=$LU482_FAILED"
+ touch $MOUNT2/$tfile-A # force sync FLD/SEQ update before barrier
+ replay_barrier $SINGLEMDS
+#define OBD_FAIL_PTLRPC_FINISH_REPLAY | OBD_FAIL_ONCE
+ touch $MOUNT2/$tfile
+ createmany -o $MOUNT1/$tfile- 50
+ $LCTL set_param fail_loc=0x80000514
+ facet_failover $SINGLEMDS
+ [ -f "$LU482_FAILED" ] && skip "LU-482 failure" && return 0
+ client_up || return 1
+ umount -f $MOUNT2
+ client_up || return 1
+ zconf_mount `hostname` $MOUNT2 || error "mount2 fais"
+ unlinkmany $MOUNT1/$tfile- 50 || return 2
+ rm $MOUNT2/$tfile || return 3
+ rm $MOUNT2/$tfile-A || return 4
+}
+run_test 0a "expired recovery with lost client"
+
+if [ -f "$LU482_FAILED" ]; then
+ log "Found check file $LU482_FAILED, aborting test script"
+ rm -vf "$LU482_FAILED"
+ complete $(basename $0) $SECONDS
+ do_nodes $CLIENTS umount -f $MOUNT2 || true
+ do_nodes $CLIENTS umount -f $MOUNT || true
+ # copied from stopall, but avoid the MDS recovery
+ for num in `seq $OSTCOUNT`; do
+ stop ost$num -f
+ rm -f $TMP/ost${num}active
+ done
+ if ! combined_mgs_mds ; then
+ stop mgs
+ fi
+
+ exit_status
+fi
+
+test_0b() {
+ replay_barrier $SINGLEMDS
+ touch $MOUNT2/$tfile
+ touch $MOUNT1/$tfile-2
+ umount $MOUNT2
+ facet_failover $SINGLEMDS
+ umount -f $MOUNT1
+ zconf_mount `hostname` $MOUNT1 || error "mount1 fais"
+ zconf_mount `hostname` $MOUNT2 || error "mount2 fais"
+ checkstat $MOUNT1/$tfile-2 && return 1
+ checkstat $MOUNT2/$tfile && return 2
+ return 0
+}
+run_test 0b "lost client during waiting for next transno"
+
test_1() {
touch $MOUNT1/a
replay_barrier $SINGLEMDS
}
run_test 13 "close resend timeout"
-test_14a() {
- replay_barrier $SINGLEMDS
- createmany -o $MOUNT1/$tfile- 25
- createmany -o $MOUNT2/$tfile-2- 1
- createmany -o $MOUNT1/$tfile-3- 25
- umount $MOUNT2
-
- facet_failover $SINGLEMDS
- # expect failover to fail due to missing client 2
- client_evicted || return 1
- sleep 1
-
- # first 25 files should have been replayed
- unlinkmany $MOUNT1/$tfile- 25 || return 2
-
- zconf_mount `hostname` $MOUNT2 || error "mount $MOUNT2 fail"
- return 0
-}
-run_test 14a "timeouts waiting for lost client during replay"
+# test 14a removed after 18143 because it shouldn't fail anymore and do the same
+# as test_15a
test_14b() {
+ wait_mds_ost_sync
+ wait_destroy_complete
BEFOREUSED=`df -P $DIR | tail -1 | awk '{ print $3 }'`
mkdir -p $MOUNT1/$tdir
+ $SETSTRIPE -i 0 $MOUNT1/$tdir
replay_barrier $SINGLEMDS
- createmany -o $MOUNT1/$tfile- 5
- echo "data" > $MOUNT2/$tdir/$tfile-2
- createmany -o $MOUNT1/$tfile-3- 5
+ createmany -o $MOUNT1/$tdir/$tfile- 5
+
+ $SETSTRIPE -i 0 $MOUNT2/f14b-3
+ echo "data" > $MOUNT2/f14b-3
+ createmany -o $MOUNT1/$tdir/$tfile-3- 5
umount $MOUNT2
fail $SINGLEMDS
wait_recovery_complete $SINGLEMDS || error "MDS recovery not done"
# first 25 files should have been replayed
- unlinkmany $MOUNT1/$tfile- 5 || return 2
- unlinkmany $MOUNT1/$tfile-3- 5 || return 3
+ unlinkmany $MOUNT1/$tdir/$tfile- 5 || return 2
+ unlinkmany $MOUNT1/$tdir/$tfile-3- 5 || return 3
zconf_mount `hostname` $MOUNT2 || error "mount $MOUNT2 fail"
COS=0
do_facet mds$num lctl set_param mdt.*.commit_on_sharing=$COS
- test_21b_sub mds$num && error "Not all renames are replayed. COS=$COS"
-
+ # there is still a window when transactions may be written to disk before
+ # the mds device is set R/O. To avoid such a rare test failure, the check
+ # is repeated several times.
+ local n_attempts=1
+ while true; do
+ test_21b_sub mds$num || break;
+ let n_attempts=n_attempts+1
+ [ $n_attempts -gt 3 ] &&
+ error "The test cannot check whether COS works or not: all renames are replied w/o COS"
+ done
restore_lustre_params < $param_file
rm -f $param_file
return 0
# end commit on sharing tests
-equals_msg `basename $0`: test complete, cleaning up
+complete $(basename $0) $SECONDS
SLEEP=$((`date +%s` - $NOW))
[ $SLEEP -lt $TIMEOUT ] && sleep $SLEEP
[ "$MOUNTED2" = yes ] && zconf_umount $HOSTNAME $MOUNT2 || true
check_and_cleanup_lustre
-[ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true
+exit_status