Whamcloud - gitweb
This has a kernel patch for handle validation. All that is missing
[fs/lustre-release.git] / lustre / tests / runfailure-mds
index 0174b0b..0f473ff 100755 (executable)
@@ -8,8 +8,8 @@ LOCALHOST=localhost
 SERVER=localhost
 PORT=1234
 
-setup
 setup_portals
+setup_lustre
 
 new_fs ext2 /tmp/ost 10000
 OST=$LOOPDEV
@@ -20,22 +20,26 @@ MDS=$LOOPDEV
 echo 0xffffffff > /proc/sys/portals/debug
 
 $OBDCTL <<EOF
-device 0
-attach mds
+newdev
+attach mds MDSDEV
 setup ${MDS} ${MDSFS}
-device 1
-attach obdext2
+newdev
+attach obdext2 OBDDEV
 setup ${OST}
-device 2
-attach ost
-setup 1
-device 3
-attach osc
+newdev
+attach ost OSTDEV
+setup \$OBDDEV
+newdev
+attach ldlm LDLMDEV
+setup
+newdev
+attach osc OSCDEV
 setup -1
 quit
 EOF
 
-mount -t lustre_light -o device=3 none /mnt/obd
+MNT="mount -t lustre_lite -o device=`$OBDCTL name2dev OSCDEV` none /mnt/lustre"
+$MNT
 
 test_fail() {
        echo $1 > /proc/sys/lustre/fail_loc
@@ -44,41 +48,50 @@ test_fail() {
        $* 
 
        echo "Cleaning up and restarting MDS"
-       umount /mnt/obd
+       umount /mnt/lustre || fail "unable to unmount"
        $OBDCTL <<- EOF
-       device 0
+       name2dev MDSDEV
        cleanup
        detach
+       quit
        EOF
 
        echo 0 > /proc/sys/lustre/fail_loc
 
        $OBDCTL <<- EOF
-       attach mds
+       newdev
+       attach mds MDSDEV
        setup ${MDS} ${MDSFS}
+       quit
        EOF
-       mount -t lustre_light -o device=3 none /mnt/obd
+       $MNT
 }
 
-set -vx
+#set -vx
 
-touch /mnt/obd/foo
+touch /mnt/lustre/foo
+chmod a+x /mnt/lustre/foo
 sync
 
 # OBD_FAIL_MDS_REINT_SETATTR_WRITE - MDS will discard data from setattr
-test_fail 0x10a chmod 000 /mnt/obd/foo
-ls -l /mnt/obd/foo
+test_fail 0x10a chmod 000 /mnt/lustre/foo
+ls -l /mnt/lustre/foo
+[ ! -x /mnt/lustre/foo ] && fail "/mnt/lustre/foo is not executable!"
 
 # OBD_FAIL_MDS_REINT_CREATE_WRITE - MDS will not create the file
-test_fail 0x10c touch /mnt/obd/bar
-ls /mnt/obd
+test_fail 0x10c touch /mnt/lustre/bar
+ls /mnt/lustre/bar
+[ $? -eq 0 ] && fail "/mnt/lustre/bar was created!"
 
 # OBD_FAIL_MDS_REINT_UNLINK_WRITE - MDS will discard data from unlink
-test_fail 0x10e rm /mnt/obd/foo
-ls /mnt/obd
+test_fail 0x10e rm /mnt/lustre/foo
+ls /mnt/lustre/foo
+[ $? -eq 1 ] && fail "/mnt/lustre/foo has been removed!"
 
 # OBD_FAIL_MDS_REINT_RENAME_WRITE - MDS will discard data from rename
-test_fail 0x112 mv /mnt/obd/foo /mnt/obd/bar
-ls /mnt/obd
+test_fail 0x112 mv /mnt/lustre/foo /mnt/lustre/bar
+ls /mnt/lustre/foo /mnt/lustre/bar
+[ ! -f /mnt/lustre/foo -o -f /mnt/lustre/bar ] && \
+       fail "/mnt/lustre/foo has been renamed to bar!"
 
 echo "Done."