Whamcloud - gitweb
Re-enable writes only after MDS has been shut down.
[fs/lustre-release.git] / lustre / tests / runfailure-mds
1 #!/bin/sh
2
3 SRCDIR="`dirname $0`"
4 . $SRCDIR/common.sh
5
6 NETWORK=tcp
7 LOCALHOST=localhost
8 SERVER=localhost
9 PORT=1234
10
11 setup
12 setup_portals
13
14 new_fs ext2 /tmp/ost 10000
15 OST=$LOOPDEV
16 MDSFS=ext3
17 new_fs ${MDSFS} /tmp/mds 10000
18 MDS=$LOOPDEV
19
20 echo 0xffffffff > /proc/sys/portals/debug
21
22 $OBDCTL <<EOF
23 device 0
24 attach mds
25 setup ${MDS} ${MDSFS}
26 device 1
27 attach obdext2
28 setup ${OST}
29 device 2
30 attach ost
31 setup 1
32 device 3
33 attach osc
34 setup -1
35 quit
36 EOF
37
38 mount -t lustre_light -o device=3 none /mnt/obd
39
40 test_fail() {
41         echo $1 > /proc/sys/lustre/fail_loc
42         shift
43         echo "Running '$*'"
44         $* 
45
46         echo "Cleaning up and restarting MDS"
47         umount /mnt/obd
48         $OBDCTL <<- EOF
49         device 0
50         cleanup
51         detach
52         EOF
53
54         echo 0 > /proc/sys/lustre/fail_loc
55
56         $OBDCTL <<- EOF
57         attach mds
58         setup ${MDS} ${MDSFS}
59         EOF
60         mount -t lustre_light -o device=3 none /mnt/obd
61 }
62
63 set -vx
64
65 touch /mnt/obd/foo
66 sync
67
68 # OBD_FAIL_MDS_REINT_SETATTR_WRITE - MDS will discard data from setattr
69 test_fail 0x10a chmod 000 /mnt/obd/foo
70 ls -l /mnt/obd/foo
71
72 # OBD_FAIL_MDS_REINT_CREATE_WRITE - MDS will not create the file
73 test_fail 0x10c touch /mnt/obd/bar
74 ls /mnt/obd
75
76 # OBD_FAIL_MDS_REINT_UNLINK_WRITE - MDS will discard data from unlink
77 test_fail 0x10e rm /mnt/obd/foo
78 ls /mnt/obd
79
80 # OBD_FAIL_MDS_REINT_RENAME_WRITE - MDS will discard data from rename
81 test_fail 0x112 mv /mnt/obd/foo /mnt/obd/bar
82 ls /mnt/obd
83
84 echo "Done."