Whamcloud - gitweb
- documentation update for MDS recovery
[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_portals
12 setup_lustre
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 newdev
24 attach mds MDSDEV
25 setup ${MDS} ${MDSFS}
26 newdev
27 attach obdext2 OBDDEV
28 setup ${OST}
29 newdev
30 attach ost OSTDEV
31 setup \$OBDDEV
32 newdev
33 attach ldlm LDLMDEV
34 setup
35 newdev
36 attach osc OSCDEV
37 setup -1
38 quit
39 EOF
40
41 MNT="mount -t lustre_lite -o device=`$OBDCTL name2dev OSCDEV` none /mnt/lustre"
42 $MNT
43
44 test_fail() {
45         echo $1 > /proc/sys/lustre/fail_loc
46         shift
47         echo "Running '$*'"
48         $* 
49
50         echo "Cleaning up and restarting MDS"
51         umount /mnt/lustre || fail "unable to unmount"
52         $OBDCTL <<- EOF
53         name2dev MDSDEV
54         cleanup
55         detach
56         quit
57         EOF
58
59         echo 0 > /proc/sys/lustre/fail_loc
60
61         $OBDCTL <<- EOF
62         newdev
63         attach mds MDSDEV
64         setup ${MDS} ${MDSFS}
65         quit
66         EOF
67         $MNT
68 }
69
70 #set -vx
71
72 touch /mnt/lustre/foo
73 chmod a+x /mnt/lustre/foo
74 sync
75
76 # OBD_FAIL_MDS_REINT_SETATTR_WRITE - MDS will discard data from setattr
77 test_fail 0x10a chmod 000 /mnt/lustre/foo
78 ls -l /mnt/lustre/foo
79 [ ! -x /mnt/lustre/foo ] && fail "/mnt/lustre/foo is not executable!"
80
81 # OBD_FAIL_MDS_REINT_CREATE_WRITE - MDS will not create the file
82 test_fail 0x10c touch /mnt/lustre/bar
83 ls /mnt/lustre/bar
84 [ $? -eq 0 ] && fail "/mnt/lustre/bar was created!"
85
86 # OBD_FAIL_MDS_REINT_UNLINK_WRITE - MDS will discard data from unlink
87 test_fail 0x10e rm /mnt/lustre/foo
88 ls /mnt/lustre/foo
89 [ $? -eq 1 ] && fail "/mnt/lustre/foo has been removed!"
90
91 # OBD_FAIL_MDS_REINT_RENAME_WRITE - MDS will discard data from rename
92 test_fail 0x112 mv /mnt/lustre/foo /mnt/lustre/bar
93 ls /mnt/lustre/foo /mnt/lustre/bar
94 [ ! -f /mnt/lustre/foo -o -f /mnt/lustre/bar ] && \
95         fail "/mnt/lustre/foo has been renamed to bar!"
96
97 echo "Done."