Whamcloud - gitweb
b=3031
[fs/lustre-release.git] / lustre / tests / runfailure-ost
1 #!/bin/sh
2
3 SRCDIR="`dirname $0`"
4 . $SRCDIR/common.sh
5
6 setup_opts "$@"
7
8 set -vx
9
10 test_fail() {
11         echo $1 > /proc/sys/lustre/fail_loc
12         shift
13         echo "Running '$*'"
14         $* &
15         sleep 1
16         kill -9 $!
17
18         echo 0 > /proc/sys/lustre/fail_loc
19         umount /mnt/lustre || fail "cannot unmount /mnt/lustre"
20         setup_mount || fail "cannot remount /mnt/lustre"
21 }
22
23 [ "`mount | grep /mnt/lustre`" ] || . llsetup.sh "$@" || exit -1
24
25 # OBD_FAIL_OST_OPEN_NET: OST will discard open request packet
26 touch /mnt/lustre/foo
27 test_fail 0x208 cat /mnt/lustre/foo
28
29 # OBD_FAIL_OST_CLOSE_NET: OST will discard close request packet
30 test_fail 0x209 cat /mnt/lustre/foo
31
32 # OBD_FAIL_OST_CREATE_NET: OST will discard create request packet
33 test_fail 0x204 touch /mnt/lustre/bar
34
35 # OBD_FAIL_OST_DESTROY_NET: OST will discard destroy request packet
36 test_fail 0x205 rm /mnt/lustre/foo
37
38 # OBD_FAIL_OST_BRW_NET: OST will discard read request packet
39 echo foo >> /mnt/lustre/foo
40 test_fail 0x20a cat /mnt/lustre/foo
41
42 # OBD_FAIL_OST_BRW_NET: OST will discard write request packet
43 test_fail 0x20a "echo bar >> /mnt/lustre/foo"
44
45 # OBD_FAIL_OST_PUNCH_NET: OST will discard truncate request packet
46 test_fail 0x208 "echo bar > /mnt/lustre/foo"
47
48 # OBD_FAIL_OST_STATFS_NET: OST will discard statfs request packet
49 test_fail 0x208 df /mnt/lustre
50
51 echo "Done."