Whamcloud - gitweb
- bring b_io up to b_devel
authorzab <zab>
Thu, 27 Feb 2003 21:28:34 +0000 (21:28 +0000)
committerzab <zab>
Thu, 27 Feb 2003 21:28:34 +0000 (21:28 +0000)
lustre/liblustre/Makefile.am
lustre/liblustre/libtest.c
lustre/tests/recovery-cleanup.sh [new file with mode: 0755]

index 2f2ec6b..584dea7 100644 (file)
@@ -7,7 +7,7 @@ KFLAGS:=
 CPPFLAGS = $(HAVE_LIBREADLINE)
 LIBS= 
 
-libtest_LDADD := $(LIBREADLINE) ../obdecho/libobdecho.a ../osc/libosc.a ../ldlm/libldlm.a \
+libtest_LDADD := $(LIBREADLINE) ../lov/liblov.a ../obdecho/libobdecho.a ../osc/libosc.a ../ldlm/libldlm.a \
                  ../ptlrpc/libptlrpc.a ../obdclass/liblustreclass.a  \
                  $(PORTALS)/user/procbridge/libprocbridge.a  $(PORTALS)/user/tcpnal/libtcpnal.a \
                 $(PORTALS)/user/util/libtcpnalutil.a $(PORTALS)/user/$(PORTALS)/api/libptlapi.a \
index 0f66a24..fd5bb20 100644 (file)
@@ -3,7 +3,10 @@
 #include <portals/api-support.h> /* needed for ptpctl.h */
 #include <portals/ptlctl.h>    /* needed for parse_dump */
 
+
 #include <liblustre.h>
+#include <linux/obd.h>
+#include <linux/obd_class.h>
 #include <../user/procbridge/procbridge.h>
 
 ptl_handle_ni_t         tcpnal_ni;
@@ -18,6 +21,8 @@ struct pingcli_args {
 
 struct task_struct *current;
 
+struct obd_class_user_state ocus;
+
 /* portals interfaces */
 inline const ptl_handle_ni_t *
 kportal_get_ni (int nal)
@@ -55,12 +60,15 @@ int init_lib_portals(struct pingcli_args *args)
         return rc;
 }
 
+extern int class_handle_ioctl(struct obd_class_user_state *ocus, unsigned int cmd, unsigned long arg);
+
+
 int lib_ioctl(int dev_id, int opc, void * ptr)
 {
+
        if (dev_id == OBD_DEV_ID) {
-               struct obd_ioctl_data *ioc = ptr;
-               /* call class_obd_ioctl function here */
-               /* class_obd_ioctl(inode, filp, opc, (unsigned long) ioc); */
+                struct obd_ioctl_data *ioc = ptr;
+               class_handle_ioctl(&ocus, opc, (unsigned long)ptr);
 
                /* you _may_ need to call obd_ioctl_unpack or some
                   other verification function if you want to use ioc
@@ -92,9 +100,10 @@ int main(int arc, char **argv)
         ldlm_init();
         osc_init();
         echo_client_init();
-        /* XXX  lov and mdc are next */
+        /* XXX  need mdc_getlovinfo before lov_init can work.. */
+        //        lov_init();
 
-       parse_dump("DUMP_FILE", lib_ioctl);
+       parse_dump("/tmp/DUMP_FILE", lib_ioctl);
 
         printf("Hello\n");
         return 0;
diff --git a/lustre/tests/recovery-cleanup.sh b/lustre/tests/recovery-cleanup.sh
new file mode 100755 (executable)
index 0000000..481ebaa
--- /dev/null
@@ -0,0 +1,134 @@
+#!/bin/sh
+
+set -ex
+
+LUSTRE=${LUSTRE:-`dirname $0`/..}
+PATH=$PATH:$LUSTRE/utils:$LUSTRE/tests
+
+. $LUSTRE/../ltest/functional/llite/common/common.sh
+
+PDSH='pdsh -S -w'
+
+# XXX I wish all this stuff was in some default-config.sh somewhere
+MDSNODE=${MDSNODE:-mdev6}
+OSTNODE=${OSTNODE:-mdev7}
+CLIENT=${CLIENTNODE:-mdev8}
+NETWORKTYPE=${NETWORKTYPE:-tcp}
+MOUNTPT=${MOUNTPT:-/mnt/lustre}
+CONFIG=recovery-small.xml
+MDSDEV=/tmp/mds
+OSTDEV=/tmp/ost
+MDSSIZE=100000
+OSTSIZE=100000
+
+do_mds() {
+    $PDSH $MDSNODE "PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests; cd $PWD; $@"
+}
+
+do_client() {
+    $PDSH $CLIENT "PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests; cd $PWD; $@"
+}
+
+do_ost() {
+    $PDSH $OSTNODE "PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests; cd $PWD; $@"
+}
+
+drop_request() {
+    do_mds "echo 0x121 > /proc/sys/lustre/fail_loc"
+    do_client "$1 & sleep ${TIMEOUT:-5}; sleep 2; kill \$!"
+    do_mds "echo 0 > /proc/sys/lustre/fail_loc"
+}
+
+make_config() {
+    rm -f $CONFIG
+    for NODE in $CLIENT $MDSNODE $OSTNODE; do
+       lmc -m $CONFIG --add net --node $NODE --nid `h2$NETWORKTYPE $NODE` \
+           --nettype $NETWORKTYPE || exit 4
+    done
+    lmc -m $CONFIG --add mds --node $MDSNODE --mds mds1 --dev $MDSDEV \
+        --size $MDSSIZE || exit 5
+    lmc -m $CONFIG --add ost --node $OSTNODE --ost ost1 --dev $OSTDEV \
+        --size $OSTSIZE || exit 6
+    lmc -m $CONFIG --add mtpt --node $CLIENT --path $MOUNTPT --mds mds1 \
+        --ost ost1 || exit 7
+}
+
+start_mds() {
+    do_mds "lconf $@ $CONFIG"
+}
+
+shutdown_mds() {
+    do_mds "lconf $@ --cleanup $CONFIG"
+}
+
+start_ost() {
+    do_ost "lconf $@ $CONFIG"
+}
+
+shutdown_ost() {
+    do_ost "lconf $@ --cleanup $CONFIG"
+}
+
+mount_client() {
+    do_client "lconf $@ $CONFIG"
+}
+
+unmount_client() {
+    do_client "lconf $@ --cleanup $CONFIG"
+}
+
+setup() {
+    make_config
+    start_mds ${REFORMAT:---reformat}
+    start_ost ${REFORMAT:---reformat}
+    mount_client --timeout=${TIMEOUT:-5} --recovery_upcall=/bin/true
+}
+
+cleanup() {
+    do_mds "echo 0 > /proc/sys/lustre/fail_loc"
+    unmount_client $@ || true
+    shutdown_mds $@ || true
+    shutdown_ost $@ || true
+}
+
+wait_for_timeout() {
+    # wait to make sure we enter recovery
+    # it'd be better if the upcall notified us somehow, I think
+    sleep $(( ${TIMEOUT:-5} + 2 ))
+}
+
+try_to_cleanup() {
+    kill -INT $!
+    unmount_client --force
+    mount_client --timeout=${TIMEOUT:-5} --recovery_upcall=/bin/true
+}
+
+if [ ! -z "$ONLY" ]; then
+    eval "$ONLY"
+    exit $?
+fi
+
+setup
+drop_request "mcreate /mnt/lustre/1" & wait_for_timeout
+try_to_cleanup
+
+drop_request "tchmod 111 /mnt/lustre/2" & wait_for_timeout
+try_to_cleanup
+
+drop_request "statone /mnt/lustre/2" & wait_for_timeout
+try_to_cleanup
+
+do_client "cp /etc/resolv.conf /mnt/lustre/resolv.conf"
+drop_request "cat /mnt/lustre/resolv.conf > /dev/null" & wait_for_timeout
+try_to_cleanup
+
+drop_request "mv /mnt/lustre/resolv.conf /mnt/lustre/renamed" & wait_for_timeout
+try_to_cleanup
+
+drop_request "mlink /mnt/lustre/renamed-again /mnt/lustre/link1" & wait_for_timeout
+try_to_cleanup
+
+drop_request "munlink /mnt/lustre/link1" & wait_for_timeout
+try_to_cleanup
+
+cleanup