#!/bin/sh
-set -vx
+fail() {
+ echo "ERROR: $1" 1>&2
+ [ $2 ] && RC=$2 || RC=1
+ exit $RC
+}
-run() {
+test_fail() {
+ oldtimeout=`cat /proc/sys/lustre/timeout`
+ echo $TIMEOUT > /proc/sys/lustre/timeout
echo $1 > /proc/sys/lustre/fail_loc
shift
$* &
- sleep 1
- kill $!
+ sleep $TIMEOUT
+ sleep 2 # fudge
+ kill -9 $!
+
+ echo $oldtimeout > /proc/sys/lustre/timeout
+ echo 0 > /proc/sys/lustre/fail_loc
+ umount -f /mnt/lustre || fail "cannot unmount /mnt/lustre"
+ mount -t lustre_lite -o "osc=$OSC,mdc=$MDC" none /mnt/lustre || \
+ fail "cannot remount $OSC/$MDC on /mnt/lustre"
}
+set -vx
+
+LCTL=../utils/lctl
+OSC=OSC_`hostname`_UUID
+MDC=MDC_client1_UUID
+TIMEOUT=5 # complete in finite time
+
+[ "`mount | grep /mnt/lustre`" ] || echo | sh llmount.sh || exit -1
+
# GETATTR_NET - ls will hang on the getattr
-run 0x102 ls /mnt/obd/lost+found
+# test_fail 0x102 ls -l /mnt/lustre
# READPAGE_NET - ls will hang reading in new pages (lost+found is not in cache)
-run 0x104 ls /mnt/obd/lost+found
+test_fail 0x104 ls /mnt/lustre
+
+sleep 1
# REINT_NET - touch will hang on setattr
-run 0x107 touch /mnt/obd
+test_fail 0x107 touch /mnt/lustre
# REINT_NET - touch will hang on create
-run 0x107 touch /mnt/obd/tt
+test_fail 0x107 touch /mnt/lustre/tt
# REINT_NET - mv will hang on rename
-run 0x107 mv /mnt/obd/lost+found /mnt/obd/lost
+touch /mnt/lustre/foo
+test_fail 0x107 mv /mnt/lustre/foo /mnt/lustre/bar
# REINT_NET - rm will hang on unlink
-run 0x107 rmdir /mnt/obd/lost+found
+touch /mnt/lustre/salmon
+test_fail 0x107 rm /mnt/lustre/salmon
-# OPEN_NET - ls will hang on open
-run 0x107 ls /mnt/obd/lost+found
+# OPEN_NET - touch will hang on open
+touch /mnt/lustre/foo
+test_fail 0x113 cat /mnt/lustre/foo
# CLOSE_NET - ls will hang on close
-run 0x107 ls /mnt/obd/lost+found
+test_fail 0x115 ./testreq --close junk_file_handle
+
+echo 0 > /proc/sys/lustre/fail_loc
-run 0 ls -a /mnt/obd/lost+found
+echo "Done."