SRCDIR="`dirname $0`"
. $SRCDIR/common.sh
-export DEBUG_WAIT=yes
-. $SRCDIR/llsetup.sh $SRCDIR/net-local.cfg $SRCDIR/mds.cfg \
- $SRCDIR/obdfilter.cfg $SRCDIR/client-mount.cfg $SRCDIR/ldlm.cfg || exit 2
+setup_opts "$@"
+
+set -vx
test_fail() {
echo $1 > /proc/sys/lustre/fail_loc
shift
echo "Running '$*'"
- $*
-
- echo "Cleaning up and restarting MDS"
- umount /mnt/lustre || fail "unable to unmount"
- $OBDCTL <<- EOF
- name2dev MDSDEV
- cleanup
- detach
- quit
- EOF
-
- echo 0 > /proc/sys/lustre/fail_loc
-
- $OBDCTL <<- EOF
- newdev
- attach mds MDSDEV
- setup ${MDS} ${MDSFS}
- quit
- EOF
- $MNT
-}
+ $* &
+ sleep 1
+ kill -9 $!
-set -vx
+ echo 0 > /proc/sys/lustre/fail_loc
+ umount /mnt/lustre || fail "cannot unmount /mnt/lustre"
+ setup_mount || fail "cannot remount /mnt/lustre"
+}
-touch /mnt/lustre/foo
-chmod a+x /mnt/lustre/foo
-sync
+[ "`mount | grep /mnt/lustre`" ] || . llsetup.sh "$@" || exit -1
# OBD_FAIL_OST_OPEN_NET: OST will discard open request packet
-cp /etc/issue /mnt/lustre/foo
+touch /mnt/lustre/foo
test_fail 0x208 cat /mnt/lustre/foo
+# OBD_FAIL_OST_CLOSE_NET: OST will discard close request packet
+test_fail 0x209 cat /mnt/lustre/foo
+
+# OBD_FAIL_OST_CREATE_NET: OST will discard create request packet
+test_fail 0x204 touch /mnt/lustre/bar
+
+# OBD_FAIL_OST_DESTROY_NET: OST will discard destroy request packet
+test_fail 0x205 rm /mnt/lustre/foo
+
+# OBD_FAIL_OST_BRW_NET: OST will discard read request packet
+echo foo >> /mnt/lustre/foo
+test_fail 0x20a cat /mnt/lustre/foo
+
+# OBD_FAIL_OST_BRW_NET: OST will discard write request packet
+test_fail 0x20a "echo bar >> /mnt/lustre/foo"
+
+# OBD_FAIL_OST_PUNCH_NET: OST will discard truncate request packet
+test_fail 0x208 "echo bar > /mnt/lustre/foo"
+
+# OBD_FAIL_OST_STATFS_NET: OST will discard statfs request packet
+test_fail 0x208 df /mnt/lustre
+
echo "Done."