Whamcloud - gitweb
Branch b1_4_mountconf
authornathan <nathan>
Fri, 11 Nov 2005 00:35:08 +0000 (00:35 +0000)
committernathan <nathan>
Fri, 11 Nov 2005 00:35:08 +0000 (00:35 +0000)
b=8008
use mgc for startup

lustre/mds/handler.c
lustre/mgc/mgc_request.c
lustre/obdclass/genops.c
lustre/obdclass/obd_mount.c

index dab146a..06a1fdd 100644 (file)
@@ -1418,14 +1418,13 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf)
         if (LUSTRE_CFG_BUFLEN(lcfg, 1) == 0 || LUSTRE_CFG_BUFLEN(lcfg, 2) == 0)
                 RETURN(rc = -EINVAL);
 
-        obd->obd_fsops = fsfilt_get_ops(lustre_cfg_string(lcfg, 2));
-        if (IS_ERR(obd->obd_fsops))
-                RETURN(rc = PTR_ERR(obd->obd_fsops));
-
         lmi = lustre_get_mount(obd->obd_name);
         if (lmi) {
-                /* We already mounted in lustre_fill_super */
+                /* We already mounted in lustre_fill_super.
+                   lcfg bufs 1, 2, 4 (device, fstype, mount opts) are ignored.*/
+                struct lustre_sb_info *lsi = s2lsi(lmi->lmi_sb);
                 mnt = lmi->lmi_mnt;
+                obd->obd_fsops = fsfilt_get_ops(MT_STR(lsi->lsi_ldd));
         } else {
                 /* old path - used by lctl */
                 CERROR("Using old MDS mount method\n");
@@ -1453,9 +1452,13 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf)
                         rc = PTR_ERR(mnt);
                         LCONSOLE_ERROR("Can't mount disk %s (%d)\n",
                                        lustre_cfg_string(lcfg, 1), rc);
-                        GOTO(err_ops, rc);
+                        RETURN(rc);
                 }
+
+                obd->obd_fsops = fsfilt_get_ops(lustre_cfg_string(lcfg, 2));
         }
+        if (IS_ERR(obd->obd_fsops))
+                RETURN(rc = PTR_ERR(obd->obd_fsops));
 
         CDEBUG(D_SUPER, "%s: mnt = %p\n", lustre_cfg_string(lcfg, 1), mnt);
 
@@ -1569,7 +1572,6 @@ err_put:
                 lock_kernel();
         }               
         mds->mds_sb = 0;
-err_ops:
         fsfilt_put_ops(obd->obd_fsops);
         return rc;
 }
@@ -1593,6 +1595,13 @@ static int mds_postsetup(struct obd_device *obd)
                 cfg.cfg_instance = NULL;
                 cfg.cfg_uuid = mds->mds_lov_uuid;
                 push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+                /* This will no longer be used.  mgc should have already
+                   parsed the mds setup log.  The last steps in the log must be
+                        attach mds mdsA mdsA_UUID
+                        setup /dev/loop2 ldiskfs mdsA errors=remount-ro,user_xattr
+                   or, better,
+                        setup mountconf mountconf mdsA
+                   then we can decide if we're using old or new methods. */
                 rc = class_config_parse_llog(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT),
                                              mds->mds_profile, &cfg);
                 pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
@@ -1613,6 +1622,10 @@ static int mds_postsetup(struct obd_device *obd)
                         break;
                 }
 
+                /* The profile defines which osc and mdc to connect to, for a 
+                   client.  We reuse that here, ignoring lprof->lp_mdc.
+                   The profile is set in the config log with 
+                   LCFG_MOUNTOPT profilenm oscnm mdcnm */
                 lprof = class_get_profile(mds->mds_profile);
                 if (lprof == NULL) {
                         CERROR("No profile found: %s\n", mds->mds_profile);
index f626fec..848c78f 100644 (file)
@@ -145,7 +145,7 @@ static int mgc_fs_setup(struct obd_device *obd, struct super_block *sb,
 
         cli->cl_mgc_vfsmnt = mnt;
         cli->cl_mgc_sb = mnt->mnt_root->d_inode->i_sb;
-        // FIXME which one? - filter_common_setup also 
+        // FIXME which is the right SB? - filter_common_setup also 
         CERROR("SB's: fill=%p mnt=%p root=%p\n", sb, mnt->mnt_sb, mnt->mnt_root->d_inode->i_sb);
         fsfilt_setup(obd, cli->cl_mgc_sb);
 
@@ -178,6 +178,7 @@ err_ops:
 static int mgc_fs_cleanup(struct obd_device *obd)
 {
         struct client_obd *cli = &obd->u.cli;
+        int rc;
 
         if (cli->cl_mgc_configs_dir != NULL) {
                 struct lvfs_run_ctxt saved;
@@ -187,12 +188,16 @@ static int mgc_fs_cleanup(struct obd_device *obd)
                 pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         }
 
+        rc = lustre_put_mount(obd->obd_name, cli->cl_mgc_vfsmnt);
+        if (rc)
+             CERROR("mount_put failed %d\n", rc);
+
         cli->cl_mgc_vfsmnt = NULL;
         cli->cl_mgc_sb = NULL;
         
         if (obd->obd_fsops) 
                 fsfilt_put_ops(obd->obd_fsops);
-        return(0);
+        return(rc);
 }
 
 static int mgc_cleanup(struct obd_device *obd)
@@ -205,8 +210,6 @@ static int mgc_cleanup(struct obd_device *obd)
         if (cli->cl_mgc_vfsmnt) {
                 /* if we're a server, eg. something's mounted */
                 mgc_fs_cleanup(obd);
-                if ((rc = lustre_put_mount(obd->obd_name, cli->cl_mgc_vfsmnt)))
-                     CERROR("mount_put failed %d\n", rc);
         }
 
         rc = obd_llog_finish(obd, 0);
@@ -318,7 +321,7 @@ static int mgc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
         }
         case OBD_IOC_START: {
                 char *name = data->ioc_inlbuf1;
-                CERROR("MGS starting config log %s\n", name);
+                CERROR("getting config log %s\n", name);
                 /* FIXME Get llog from MGS */
 
                 push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
index 001caf1..1d2e02c 100644 (file)
@@ -85,6 +85,8 @@ struct obd_type *class_get_type(char *name)
 
 #ifdef CONFIG_KMOD
         if (!type) {
+                if (strcmp(name, LUSTRE_MDT_NAME) == 0) 
+                        name = LUSTRE_MDS_NAME;
                 if (!request_module(name)) {
                         CDEBUG(D_INFO, "Loaded module '%s'\n", name);
                         type = class_search_type(name);
index 9aa5a35..4aeb655 100644 (file)
@@ -70,6 +70,8 @@ int lustre_register_mount(char *name, struct super_block *sb,
 {
         struct lustre_mount_info *lmi;
         char *name_cp;
+        LASSERT(mnt);
+        LASSERT(sb);
 
         CDEBUG(D_MOUNT, "register %s\n", name);
 
@@ -505,7 +507,7 @@ static int lustre_start_mgc(struct super_block *sb, struct vfsmount *mnt)
                 GOTO(out_dereg, err);
 
         /* Start the MGC */
-        if ((err = lustre_start_simple(mgcname, LUSTRE_MDC_NAME/*LUSTRE_MGC_NAME*/, "MGS", 
+        if ((err = lustre_start_simple(mgcname, LUSTRE_MGC_NAME, "MGS", 
                                        libcfs_nid2str(nid))))
                 GOTO(out_dereg, err);
         
@@ -611,6 +613,13 @@ static int server_start_targets(struct super_block *sb, struct vfsmount *mnt)
                 lustre_deregister_mount(lsi->lsi_ldd->ldd_svname);
         }
 
+        if (!class_name2obd(lsi->lsi_ldd->ldd_svname)) {
+                CERROR("no server named %s was started\n",
+                       lsi->lsi_ldd->ldd_svname);
+                lustre_deregister_mount(lsi->lsi_ldd->ldd_svname);
+                err = -ENXIO;
+        }
+        
         // FIXME stop MDS, OSS on err?
         return(err);
 }
@@ -842,7 +851,6 @@ static struct super_operations server_ops =
 static int server_fill_super_common(struct super_block *sb)
 {
         struct inode *root = 0;
-        //struct ll_sb_info *lsi = ll_s2lsi(sb);
         ENTRY;
                                                                                  
         CDEBUG(D_MOUNT, "Server sb, dev=%d\n", (int)sb->s_dev);
@@ -949,7 +957,7 @@ out:
 /* Common umount */
 void lustre_common_put_super(struct super_block *sb)
 {
-        CDEBUG(D_MOUNT, "common put super %p\n", sb);
+        CDEBUG(D_MOUNT, "dropping sb %p\n", sb);
         
         lustre_stop_mgc(sb);
         lustre_free_lsi(sb);
@@ -1142,10 +1150,12 @@ int lustre_fill_super(struct super_block *sb, void *data, int silent)
                 CERROR("Unable to mount %s\n", lmd->lmd_dev);
                 lustre_stop_mgc(sb);
                 lustre_free_lsi(sb);
+        } else {
+                CDEBUG(D_MOUNT, "Successfully mounted %s\n", lmd->lmd_dev);
         }
         RETURN(err);
 } 
-                                                                                
+                                                                               
 
 /* We can't call ll_fill_super by name because it lives in a module that
    must be loaded after this one. */