echo "error: no config file on command-line and no $DEF" 1>&2
exit -1
fi
+
+ [ -z "$MDS_RSH" ] && MDS_RSH="eval"
+ [ -z "$OST_RSH" ] && OST_RSH="eval"
+ [ -z "$OSC_RSH" ] && OSC_RSH="eval"
}
setup_portals() {
return -1
fi
- if [ "$1" != "new_fs" -a "$1" != "old_fs" ]; then
+ [ "$1" ] && DO_FS=$1
+ if [ "$DO_FS" != "new_fs" -a "$DO_FS" != "old_fs" ]; then
echo "usage: setup_mds {new_fs|old_fs}" 1>&2
return -1
fi
$OBDCTL <<- EOF
device ${OBD_DEVNO}
- attach ${OSTTYPE} OSTDEV
+ attach ${OSTTYPE} OBDDEV
setup ${OBD} ${OBDARG}
device ${OST_DEVNO}
attach ost OSTDEV
setup_osc() {
[ "$SETUP_OSC" != "y" ] && return 0
+ RPC_DEVNO=$DEVNO; DEVNO=`expr $DEVNO + 1`
OSC_DEVNO=$DEVNO; DEVNO=`expr $DEVNO + 1`
$OBDCTL <<- EOF || return $rc
+ device ${RPC_DEVNO}
+ attach ptlrpc RPCDEV
+ setup
device ${OSC_DEVNO}
attach osc OSCDEV
setup -1
DEBUG_OFF="echo 0 > /proc/sys/portals/debug"
debug_server_off() {
- if [ "$SERVER" != "$LOCALHOST" ]; then
- $RSH $SERVER "$DEBUG_OFF"
- else
- $DEBUG_OFF
- fi
+ [ "$MDS_RSH" ] && echo "Turn OFF debug on MDS" && $MDS_RSH "$DEBUG_OFF"
+ [ "$OST_RSH" ] && echo "Turn OFF debug on OST" && $OST_RSH "$DEBUG_OFF"
}
debug_server_on() {
- if [ "$SERVER" != "$LOCALHOST" ]; then
- $RSH $SERVER "$DEBUG_ON"
- else
- $DEBUG_ON
- fi
+ [ "$MDS_RSH" ] && echo "Turn ON debug on MDS" && $MDS_RSH "$DEBUG_ON"
+ [ "$OST_RSH" ] && echo "Turn ON debug on OST" && $OST_RSH "$DEBUG_ON"
}
debug_client_off() {
- $DEBUG_OFF
+ echo "Tuning OFF debug on client" && $OSC_RSH "$DEBUG_OFF"
}
debug_client_on() {
- $DEBUG_ON
+ echo "Tuning ON debug on client" && $OSC_RSH "$DEBUG_ON"
}
cleanup_portals() {
cleanup_lustre() {
killall acceptor
- $OBDCTL <<- EOF
- device 3
- cleanup
- detach
- device 2
- cleanup
- detach
- device 1
- cleanup
- detach
- device 0
- cleanup
- detach
- quit
- EOF
-
-
losetup -d ${LOOP}0
losetup -d ${LOOP}1
losetup -d ${LOOP}2
[ "$SETUP" ] || MDS_DEVNO=0
$OBDCTL <<- EOF
- device ${MDS_DEVNO}
+ name2dev MDSDEV
cleanup
detach
quit
cleanup_ost() {
[ "$SETUP" -a -z "$SETUP_OST" ] && return 0
- if [ -z "$SETUP" ]; then
- OST_DEVNO=2
- OBD_DEVNO=1
- fi
-
$OBDCTL <<- EOF
- device ${OST_DEVNO}
+ name2dev OSTDEV
cleanup
detach
- device ${OBD_DEVNO}
+ name2dev OBDDEV
cleanup
detach
quit
}
cleanup_server() {
- cleanup_mds && cleanup_ost
+ cleanup_ost && cleanup_mds
DEVNO=0
}
[ "$SETUP" -a -z "$SETUP_MOUNT" ] && return 0
[ "$OSCMT" ] || OSCMT=/mnt/lustre
- umount $OSCMT
+ umount $OSCMT || fail "unable to unmount $OSCMT"
}
cleanup_osc() {
[ "$SETUP" ] || OSC_DEVNO=3
$OBDCTL <<- EOF
- device ${OSC_DEVNO}
+ name2dev OSCDEV
cleanup
detach
quit
}
fail() {
- echo $1
- exit 1
+ echo "ERROR: $1" 1>&2
+ [ $2 ] && RC=$2 || RC=1
+ exit $RC
}
setup_portals
setup_lustre
+echo -n "Hit return to continue..."
+read
new_fs ext2 /tmp/ost 10000
OST=$LOOPDEV
attach ost OSTDEV
setup 1
device 3
-attach osc OSCDEV
-setup -1
-device 4
attach ptlrpc RPCDEV
setup
+device 4
+attach ldlm LDLMDEV
+setup
+device 5
+attach osc OSCDEV
+setup -1
quit
EOF
-mount -t lustre_lite -o device=3 none /mnt/lustre
+mount -t lustre_lite -o device=`$OBDCTL name2dev OSCDEV` none /mnt/lustre
attach mds MDSDEV
setup ${MDS} ${MDSFS}
device 1
-attach obdfilter FILTERDEV
+attach obdfilter OBDDEV
setup ${OST} ext2
device 2
attach ost OSTDEV
SRCDIR="`dirname $0`"
. $SRCDIR/common.sh
-umount /mnt/lustre || fail "cannot unmount"
+$DEBCTL get_debug > /tmp/debug
+
+if [ "`mount | grep '/mnt/lustre'`" ]; then
+ umount /mnt/lustre || fail "cannot unmount"
+fi
killall acceptor
rmmod llite
name2dev OSTDEV
cleanup
detach
-name2dev FILTERDEV
+name2dev OBDDEV
cleanup
detach
name2dev MDSDEV
attach mds MDSDEV
setup ${MDS} ${MDSFS}
device 1
-attach obdext2 OBDEXT2DEV
-setup ${OST}
+attach obdfilter OBDDEV
+setup ${OST} ext2
device 2
attach ost OSTDEV
setup 1
device 3
-attach osc OSCDEV
-setup -1
-device 4
attach ptlrpc RPCDEV
setup
+device 4
+attach ldlm LDLMDEV
+setup
+device 5
+attach osc OSCDEV
+setup -1
quit
EOF
-mount -t lustre_lite -o device=3 none /mnt/lustre
+mount -t lustre_lite -o device=`$OBDCTL name2dev OSCDEV` none /mnt/lustre
$OBDCTL <<EOF
device 0
-attach mds
+attach mds MDSDEV
setup ${MDS} ${MDSFS}
device 1
-attach obdext2
+attach obdfilter OBDDEV
setup ${OST}
device 2
-attach ost
+attach ost OSTDEV
setup 1
device 3
-attach osc
+attach ptlrpc RPCDEV
+setup
+device 4
+attach ldlm LDLMDEV
+setup
+device 5
+attach osc OSCDEV
setup -1
quit
EOF
-MOUNT='mount -t lustre_lite -o device=3 none /mnt/lustre'
-$MOUNT
+MNT='mount -t lustre_lite -o device=`$OBDCTL name2dev OSCDEV` none /mnt/lustre'
+$MNT
test_fail() {
echo $1 > /proc/sys/lustre/fail_loc
$*
echo "Cleaning up and restarting MDS"
- umount /mnt/lustre
+ umount /mnt/lustre || fail "unable to unmount"
$OBDCTL <<- EOF
device 0
cleanup
setup ${MDS} ${MDSFS}
quit
EOF
- $MOUNT
+ $MNT
}
#set -vx
# 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 ] && echo "/mnt/lustre/foo is not executable!" 1>&2 && exit -1
+[ ! -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 ] && echo "/mnt/lustre/bar was created!" 1>&2 && exit -1
+[ $? -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 ] && echo "/mnt/lustre/foo has been removed!" 1>&2 && exit -1
+[ $? -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 ] && \
- echo "/mnt/lustre/foo has been renamed to bar!" 1>&2 && exit -1
+ fail "/mnt/lustre/foo has been renamed to bar!"
echo "Done."
kill -9 $!
echo 0 > /proc/sys/lustre/fail_loc
- umount /mnt/lustre || exit 1
- mount -t lustre_lite -o device=`$OBDCTL name2dev OSCDEV` none /mnt/lustre || exit 1
+ umount /mnt/lustre || fail "cannot unmount /mnt/lustre"
+ mount -t lustre_lite -o device=`$OBDCTL name2dev OSCDEV` none /mnt/lustre || fail "cannot remount device '`$OBDCTL name2dev OSCDEV`' on /mnt/lustre"
}
[ -c /dev/request ] || mknod /dev/request c 10 244
-echo | sh llmount.sh || exit -1
+[ "`mount | grep /mnt/lustre`" ] || echo | sh llmount.sh || exit -1
# GETATTR_NET - ls will hang on the getattr
test_fail 0x102 ls -l /mnt/lustre