Whamcloud - gitweb
Assigned mgc_obd in mgc_fs_setup
authorlincent <lincent>
Wed, 10 Aug 2005 18:58:15 +0000 (18:58 +0000)
committerlincent <lincent>
Wed, 10 Aug 2005 18:58:15 +0000 (18:58 +0000)
lustre/mgc/mgc_request.c
lustre/obdclass/llog_lvfs.c
lustre/obdclass/obd_config.c
lustre/obdclass/obd_mount.c
lustre/utils/rmmod_all.sh

index 8421b79..3f7d04e 100644 (file)
@@ -157,6 +157,7 @@ static int mgc_cleanup(struct obd_device *obd)
 static int mgc_setup(struct obd_device *obd, obd_count len, void *buf)
 {
         struct lustre_mount_info *lmi;
+        struct lustre_sb_info *sbi;
         struct mgc_obd *mgc = &obd->u.mgc;
         //struct lprocfs_static_vars lvars;
         int rc;
@@ -190,6 +191,9 @@ static int mgc_setup(struct obd_device *obd, obd_count len, void *buf)
                 RETURN(-ENOENT);
         }
 
+        sbi = s2sbi(lmi->lmi_sb);
+        sbi->lsi_mgc = obd; 
+
         rc = mgc_fs_setup(lmi->lmi_sb, lmi->lmi_mnt);
         if (rc) {
                 CERROR("fs setup failed %d\n", rc);
@@ -213,6 +217,7 @@ static int mgc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
         struct obd_device *obd = exp->exp_obd;
         struct obd_ioctl_data *data = karg;
         struct llog_ctxt *ctxt;
+        struct lvfs_run_ctxt saved;
         int rc;
         ENTRY;
 
@@ -265,10 +270,13 @@ static int mgc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                 }
                 sprintf(conf_prof, "%s-conf", name);
 
+                push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+
                 ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
                 rc = class_config_parse_llog(ctxt, conf_prof, NULL);
                 if (rc < 0)
                         CERROR("Unable to process log: %s\n", conf_prof);
+                pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
                 OBD_FREE(conf_prof, len);
 
                 RETURN(rc);
index bb66155..deaa93f 100644 (file)
@@ -432,14 +432,16 @@ static struct file *llog_filp_open(char* fsname, char *name,
         OBD_ALLOC(logname, PATH_MAX);
         if (logname == NULL)
                 return ERR_PTR(-ENOMEM); 
-        if (fsname)
-              len = snprintf(logname, PATH_MAX, "CONFIGS/%s/%s", fsname, name);
-        else
+//FIXME: Need to changing mkfs
+//        if (fsname)
+//              len = snprintf(logname, PATH_MAX, "CONFIGS/%s/%s", fsname, name);
+//        else
               len = snprintf(logname, PATH_MAX, "CONFIGS/%s", name);
 
         if (len >= PATH_MAX - 1) {
                 filp = ERR_PTR(-ENAMETOOLONG);
         } else {
+                printk("logname = %s\n", logname);
                 filp = l_filp_open(logname, flags, mode);
                 if (IS_ERR(filp))
                         CERROR("logfile creation %s: %ld\n", logname,
index f4835c6..084fa1f 100644 (file)
@@ -181,8 +181,10 @@ int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
         spin_unlock(&obd->obd_dev_lock);
 
         exp = class_new_export(obd);
-        if (exp == NULL)
-                RETURN(err);
+        if (!exp){
+                CERROR("Fail to build export.\n");
+                RETURN(-ENOMEM);
+        }
         memcpy(&exp->exp_client_uuid, &obd->obd_uuid,
                sizeof(exp->exp_client_uuid));
         obd->obd_self_export = exp;
index e09b20d..db37922 100644 (file)
@@ -71,6 +71,7 @@ int lustre_register_mount(char *name, struct super_block *sb,
                 OBD_FREE(lmi, sizeof(*lmi));
                 return -ENOMEM;
         }
+        memcpy(name_cp, name, strlen(name));
 
         down(&lustre_mount_info_lock);
         if (lustre_find_mount(name)) {
@@ -417,7 +418,7 @@ int lustre_process_logs(struct super_block *sb,
         obd = sbi->lsi_mgc;
         LASSERT(obd);
         mgcobd = &obd->u.mgc;
-                                                                                                                                                                              
+
         /* Find all the logs in the local CONFIGS directory */
         err = dentry_readdir(obd, mgcobd->mgc_configs_dir,
                        mgcobd->mgc_vfsmnt, &dentry_list);
@@ -447,6 +448,7 @@ int lustre_process_logs(struct super_block *sb,
                 CERROR("starting log %s\n", logname);
                 ioc_data.ioc_inllen1 = len + 1;
                 ioc_data.ioc_inlbuf1 = logname;
+
                 err = obd_iocontrol(OBD_IOC_START, obd->obd_self_export,
                                     sizeof ioc_data, &ioc_data, NULL);
                 if (err) {
@@ -502,34 +504,33 @@ static int do_lcfg(char *cfgname, ptl_nid_t nid, int cmd,
 }
 
 /* Set up a mgcobd to process startup logs */
-static int lustre_start_mgc(char *mcname, struct super_block *sb)
+static int lustre_start_mgc(char *mgcname, struct super_block *sb)
 {
         struct config_llog_instance cfg;
         struct lustre_sb_info *sbi = s2sbi(sb);
         struct obd_device *obd;
         int err = 0;
 
-        cfg.cfg_instance = mcname;
-        snprintf(cfg.cfg_uuid.uuid, sizeof(cfg.cfg_uuid.uuid), mcname);
+        cfg.cfg_instance = mgcname;
+        snprintf(cfg.cfg_uuid.uuid, sizeof(cfg.cfg_uuid.uuid), mgcname);
  
-        err = do_lcfg(mcname, 0, LCFG_ATTACH, LUSTRE_MGC_NAME, cfg.cfg_uuid.uuid, 0, 0);
+        err = do_lcfg(mgcname, 0, LCFG_ATTACH, LUSTRE_MGC_NAME, cfg.cfg_uuid.uuid, 0, 0);
         if (err)
                 goto out_free;
                                                                                        
-        err = do_lcfg(mcname, 0, LCFG_SETUP, 0, 0, 0, 0);
+        err = do_lcfg(mgcname, 0, LCFG_SETUP, 0, 0, 0, 0);
         if (err) {
                 CERROR("mgcobd setup error %d\n", err);
-                do_lcfg(mcname, 0, LCFG_DETACH, 0, 0, 0, 0);
+                do_lcfg(mgcname, 0, LCFG_DETACH, 0, 0, 0, 0);
                 goto out_free;
         }
-        
-        obd = class_name2obd(mcname);
+
+        obd = class_name2obd(mgcname);
         if (!obd) {
-                CERROR("Can't find mgcobd %s\n", mcname);
+                CERROR("Can't find mgcobd %s\n", mgcname);
                 err = -ENOTCONN;
                 goto out_free;
         }
-        sbi->lsi_mgc = obd;
         
 out_free:
         return err;
index c9d46ba..34dafce 100755 (executable)
@@ -8,6 +8,7 @@ rmmod obdfilter
 rmmod fsfilt_ext3
 rmmod fsfilt_ldiskfs
 rmmod ldiskfs
+rmmod mgc
 rmmod ost
 rmmod mds
 rmmod ptlrpc