Whamcloud - gitweb
- The log replay used by ll_fill_super uses a tag to create unique
authorrread <rread>
Mon, 6 Oct 2003 08:28:45 +0000 (08:28 +0000)
committerrread <rread>
Mon, 6 Oct 2003 08:28:45 +0000 (08:28 +0000)
names, and uses the sb_uuid as their common obd_uuid.  This allows
mount to be used several times to mount the same profile, and so we
can now (finally) mount an lov more than once on a client. (At least a
single node config, real clients coming very soon.) See replay-dual.sh
for a partial glimpse of the future.

- use copy_from_user correctly for lustre_cfg.

lustre/include/linux/lustre_cfg.h
lustre/obdclass/config.c
lustre/utils/llmount.c

index 5f1592c..5403244 100644 (file)
@@ -152,7 +152,7 @@ static inline int lustre_cfg_unpack(struct lustre_cfg *data, char *pbuf,
 
 #include <linux/obd_support.h>
 
-static inline int lustre_cfg_getdata(char **buf, int len, void *arg)
+static inline int lustre_cfg_getdata(char **buf, int len, void *arg, int kernel)
 {
         struct lustre_cfg *lcfg;
         int err;
@@ -171,19 +171,21 @@ static inline int lustre_cfg_getdata(char **buf, int len, void *arg)
 
         /* XXX allocate this more intelligently, using kmalloc when
          * appropriate */
-        OBD_VMALLOC(*buf, len);
+        OBD_ALLOC(*buf, len);
         if (*buf == NULL) {
                 CERROR("Cannot allocate control buffer of len %d\n", len);
                 RETURN(-EINVAL);
         }
-        lcfg = (struct lustre_cfg *)*buf;
 
-        err = copy_from_user(*buf, (void *)arg, len);
-        if ( err ) {
-                EXIT;
-                return err;
+        if (kernel) {
+                memcpy(*buf, (void *)arg, len);
+        } else {
+                err = copy_from_user(*buf, (void *)arg, len);
+                if (err) 
+                        RETURN(err);
         }
 
+        lcfg = (struct lustre_cfg *)*buf;
 
         if (lcfg->lcfg_version != LUSTRE_CFG_VERSION) {
                 CERROR("Version mismatch kernel vs application\n");
@@ -227,7 +229,7 @@ static inline void lustre_cfg_freedata(char *buf, int len)
 {
         ENTRY;
 
-        OBD_VFREE(buf, len);
+        OBD_FREE(buf, len);
         EXIT;
         return;
 }
index 3a97022..bf0800c 100644 (file)
@@ -96,8 +96,10 @@ int class_attach(struct lustre_cfg *lcfg)
         }
         
         obd = class_name2obd(name);
-        if (obd != NULL)
+        if (obd != NULL) {
+                CERROR("obd %s already attached\n", name);
                 RETURN(-EEXIST);
+        }
 
        obd = class_newdev(&dev);
        if (dev == -1)
@@ -388,15 +390,12 @@ void class_del_profile(char *prof)
         }
 }
 
-int class_process_config(int len, char *data)
+int class_process_config(struct lustre_cfg *lcfg)
 {
-        char *buf;
        struct obd_device *obd;
-        struct lustre_cfg *lcfg;
         int err;
 
-        lustre_cfg_getdata(&buf, len, data);
-        lcfg = (struct lustre_cfg* ) buf;
+        LASSERT(lcfg && !IS_ERR(lcfg));
 
         CDEBUG(D_IOCTL, "processing cmd: %x\n", lcfg->lcfg_command);
 
@@ -470,7 +469,6 @@ int class_process_config(int len, char *data)
         }
        }
 out:
-        lustre_cfg_freedata(buf, len);
         RETURN(err);
 }
            
index fd0ed24..1063886 100644 (file)
@@ -48,28 +48,17 @@ update_mtab_entry(char *spec, char *node, char *type, char *opts,
         mnt.mnt_freq = freq;
         mnt.mnt_passno = pass;
       
-        /* We get chatty now rather than after the update to mtab since the
-           mount succeeded, even if the write to /etc/mtab should fail.  */
-//        if (verbose)
-//                print_one (&mnt);
-
         if (!nomtab) {
-                if (flags & MS_REMOUNT) {
-//                        update_mtab (mnt.mnt_dir, &mnt);
-                        ;
+                fp = setmntent(MOUNTED, "a+");
+                if (fp == NULL) {
+                        fprintf(stderr, "setmntent(%s): %s:", MOUNTED, 
+                                strerror (errno));
                 } else {
-                        fp = setmntent(MOUNTED, "a+");
-                        if (fp == NULL) {
-                                fprintf(stderr, "setmntent(%s): %s:", 
-                                        MOUNTED,
+                        if ((addmntent (fp, &mnt)) == 1) {
+                                fprintf(stderr, "addmntent: %s:", 
                                         strerror (errno));
-                        } else {
-                                if ((addmntent (fp, &mnt)) == 1) {
-                                        fprintf(stderr, "addmntent: %s:", 
-                                                strerror (errno));
-                                }
-                                endmntent(fp);
                         }
+                        endmntent(fp);
                 }
         }
 }