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");
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);
lock_kernel();
}
mds->mds_sb = 0;
-err_ops:
fsfilt_put_ops(obd->obd_fsops);
return rc;
}
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);
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);
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);
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;
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)
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);
}
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);
#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);
{
struct lustre_mount_info *lmi;
char *name_cp;
+ LASSERT(mnt);
+ LASSERT(sb);
CDEBUG(D_MOUNT, "register %s\n", name);
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);
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);
}
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);
/* 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);
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. */