Whamcloud - gitweb
- added test_3b which emulates recursive mount. Does not pass yet.
[fs/lustre-release.git] / lustre / tests / runfailure-net
1 #!/bin/sh
2
3 fail() { 
4         echo "ERROR: $1" 1>&2
5         [ $2 ] && RC=$2 || RC=1
6         exit $RC
7 }
8
9 test_fail() {
10         oldtimeout=`cat /proc/sys/lustre/timeout`
11         echo $TIMEOUT > /proc/sys/lustre/timeout
12         echo $1 > /proc/sys/lustre/fail_loc
13         shift
14         $* &
15         sleep $TIMEOUT
16         sleep 2 # fudge
17         kill -9 $!
18
19         echo $oldtimeout > /proc/sys/lustre/timeout
20         echo 0 > /proc/sys/lustre/fail_loc
21         umount -f /mnt/lustre || fail "cannot unmount /mnt/lustre"
22         mount -t lustre_lite -o "osc=$OSC,mdc=$MDC" none /mnt/lustre || \
23            fail "cannot remount $OSC/$MDC on /mnt/lustre"
24 }
25
26 set -vx
27
28 LCTL=../utils/lctl
29 OSC=OSC_localhost_UUID
30 MDC=MDC_client1_UUID
31 TIMEOUT=5 # complete in finite time
32
33 [ "`mount | grep /mnt/lustre`" ] || echo | sh llmount.sh || exit -1
34
35 # GETATTR_NET - ls will hang on the getattr
36 # test_fail 0x102 ls -l /mnt/lustre
37
38 # READPAGE_NET - ls will hang reading in new pages (lost+found is not in cache)
39 test_fail 0x104 ls /mnt/lustre
40
41 sleep 1
42
43 # REINT_NET - touch will hang on setattr
44 test_fail 0x107 touch /mnt/lustre
45
46 # REINT_NET - touch will hang on create
47 test_fail 0x107 touch /mnt/lustre/tt
48
49 # REINT_NET - mv will hang on rename
50 touch /mnt/lustre/foo
51 test_fail 0x107 mv /mnt/lustre/foo /mnt/lustre/bar
52
53 # REINT_NET - rm will hang on unlink
54 touch /mnt/lustre/salmon
55 test_fail 0x107 rm /mnt/lustre/salmon
56
57 # OPEN_NET - touch will hang on open
58 touch /mnt/lustre/foo
59 test_fail 0x113 cat /mnt/lustre/foo
60
61 # CLOSE_NET - ls will hang on close
62 test_fail 0x115 ./testreq --close junk_file_handle
63
64 echo 0 > /proc/sys/lustre/fail_loc
65
66 echo "Done."