#!/bin/sh SRCDIR="`dirname $0`" . $SRCDIR/common.sh . $SRCDIR/llmount.sh MNT="setup_mount" test_fail() { echo $1 > /proc/sys/lustre/fail_loc shift echo "Running '$*'" $* echo "Cleaning up and restarting MDS" umount /mnt/lustre || fail "unable to unmount" $OBDCTL <<- EOF name2dev MDSDEV cleanup detach quit EOF echo 0 > /proc/sys/lustre/fail_loc $OBDCTL <<- EOF newdev attach mds MDSDEV setup ${MDS} ${MDSFS} quit EOF $MNT } #set -vx 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/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/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/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/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."