Whamcloud - gitweb
Minor fixes to get setup to work again. Fix some brainos in obdclass to
authorbraam <braam>
Tue, 2 Jul 2002 23:17:36 +0000 (23:17 +0000)
committerbraam <braam>
Tue, 2 Jul 2002 23:17:36 +0000 (23:17 +0000)
provide robustness.

lustre/obdclass/class_obd.c
lustre/obdclass/genops.c
lustre/obdfilter/filter.c
lustre/tests/common.sh

index 92ccd51..4f145b0 100644 (file)
@@ -19,7 +19,6 @@
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/major.h>
-#include <linux/kmod.h>   /* for request_module() */
 #include <linux/sched.h>
 #include <linux/lp.h>
 #include <linux/slab.h>
@@ -144,11 +143,16 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
 
                 for (i = 0 ; i < MAX_OBD_DEVICES ; i++) {
                         int l;
+                        char *status;
                         struct obd_device *obd = &obd_dev[i];
                         if (!obd->obd_type) 
                                 continue;
-                        l = snprintf(buf2, remains, "%2d %s %s %s\n",
-                                     i, obd->obd_type->typ_name, 
+                        if (obd->obd_flags & OBD_SET_UP)
+                                status = "*";
+                        else 
+                                status = " ";
+                        l = snprintf(buf2, remains, "%2d %s %s %s %s\n",
+                                     i, status, obd->obd_type->typ_name, 
                                      obd->obd_name, obd->obd_uuid);
                         buf2 +=l;
                         remains -=l;
@@ -292,14 +296,14 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
                                obd->obd_minor, data->ioc_inlbuf1);
                         if (data->ioc_inlbuf2) {
                                 int len = strlen(data->ioc_inlbuf2) + 1;
-                                OBD_ALLOC(obd->obd_name, len + 1);
+                                OBD_ALLOC(obd->obd_name, len);
                                 if (!obd->obd_name) {
                                         CERROR("no memory\n");
                                         LBUG();
                                 }
-                                memcpy(obd->obd_name, data->ioc_inlbuf2, len + 1);
-                                obd->obd_proc_entry =
-                                        proc_lustre_register_obd_device(obd);
+                                memcpy(obd->obd_name, data->ioc_inlbuf2, len);
+                                //obd->obd_proc_entry =
+                                //        proc_lustre_register_obd_device(obd);
                         } else { 
                                 CERROR("WARNING: unnamed obd device\n");
                                 obd->obd_proc_entry = NULL;
@@ -341,12 +345,12 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
                 }
 
                 if (obd->obd_name) {
-                        OBD_FREE(obd->obd_name, strlen(obd->obd_name)+ 1);
+                        OBD_FREE(obd->obd_name, strlen(obd->obd_name)+1);
                         obd->obd_name = NULL;
                 }
 
-                if (obd->obd_proc_entry)
-                        proc_lustre_release_obd_device(obd);
+                //if (obd->obd_proc_entry)
+                  //      proc_lustre_release_obd_device(obd);
 
                 obd->obd_flags &= ~OBD_ATTACHED;
                 obd->obd_type->typ_refcnt--;
index 3a27245..509b2ef 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #define DEBUG_SUBSYSTEM S_CLASS
+#include <linux/kmod.h>   /* for request_module() */
 #include <linux/module.h>
 #include <linux/obd_class.h>
 #include <linux/random.h>
@@ -112,6 +113,9 @@ int class_name2dev(char *name)
         int res = -1;
         int i;
 
+       if (!name)
+           return -1;
+
         for (i=0; i < MAX_OBD_DEVICES; i++) {
                 struct obd_device *obd = &obd_dev[i];
                 if (obd->obd_name && strcmp(name, obd->obd_name) == 0) {
index b86e3d6..22fa20a 100644 (file)
@@ -356,26 +356,26 @@ static struct inode *filter_inode_from_obj(struct obd_device *obddev,
 static int filter_connect(struct lustre_handle *conn, struct obd_device *obd)
 {
         int rc;
-
+        ENTRY;
         MOD_INC_USE_COUNT;
         rc = class_connect(conn, obd);
 
         if (rc)
                 MOD_DEC_USE_COUNT;
-
-        return rc;
+        RETURN(rc);
 }
 
 static int filter_disconnect(struct lustre_handle *conn)
 {
         int rc;
+        ENTRY;
 
         rc = class_disconnect(conn);
         if (!rc)
                 MOD_DEC_USE_COUNT;
 
         /* XXX cleanup preallocated inodes */
-        return rc;
+        RETURN(rc);
 }
 
 /* mount the file system (secretly) */
index 5fb608c..33053a1 100644 (file)
@@ -374,7 +374,8 @@ setup_ost() {
 }
 
 setup_server() {
-       setup_mds $1 && setup_mds_lov $1 && setup_ost $1
+       #setup_mds $1 && setup_mds_lov $1 && setup_ost $1
+       setup_mds $1 && setup_ost $1
 }
 
 setup_osc() {
@@ -460,7 +461,8 @@ setup_mount() {
 }
 
 setup_client() {
-       setup_osc && setup_mdc && setup_lov  && setup_mount
+       # setup_osc && setup_mdc && setup_lov  && setup_mount
+       setup_osc && setup_mdc && setup_mount
 }
 
 DEBUG_ON="echo 0xffffffff > /proc/sys/portals/debug"