obd->obd_fsops = fsfilt_get_ops(lustre_cfg_string(lcfg, 2));
}
if (IS_ERR(obd->obd_fsops))
- RETURN(rc = PTR_ERR(obd->obd_fsops));
+ GOTO(err_put, rc = PTR_ERR(obd->obd_fsops));
CDEBUG(D_SUPER, "%s: mnt = %p\n", lustre_cfg_string(lcfg, 1), mnt);
obd->obd_namespace = ldlm_namespace_new(ns_name, LDLM_NAMESPACE_SERVER);
if (obd->obd_namespace == NULL) {
mds_cleanup(obd);
- GOTO(err_put, rc = -ENOMEM);
+ GOTO(err_ops, rc = -ENOMEM);
}
ldlm_register_intent(obd->obd_namespace, mds_intent_policy);
strncpy(mds->mds_profile, lustre_cfg_string(lcfg, 3),
LUSTRE_CFG_BUFLEN(lcfg, 3));
-
}
ptlrpc_init_client(LDLM_CB_REQUEST_PORTAL, LDLM_CB_REPLY_PORTAL,
err_ns:
ldlm_namespace_free(obd->obd_namespace, 0);
obd->obd_namespace = NULL;
+err_ops:
+ fsfilt_put_ops(obd->obd_fsops);
err_put:
if (lmi) {
lustre_put_mount(obd->obd_name, mds->mds_vfsmnt);
lock_kernel();
}
mds->mds_sb = 0;
- fsfilt_put_ops(obd->obd_fsops);
return rc;
}
upcall_cache_cleanup(mds->mds_group_hash);
mds->mds_group_hash = NULL;
- /* 2 seems normal on mds, (may_umount() also expects 2
- fwiw), but we only see 1 at this point in obdfilter. */
- if (atomic_read(&obd->u.mds.mds_vfsmnt->mnt_count) > 2)
- CERROR("%s: mount busy, mnt_count %d != 2\n", obd->obd_name,
- atomic_read(&obd->u.mds.mds_vfsmnt->mnt_count));
-
must_put = lustre_put_mount(obd->obd_name, mds->mds_vfsmnt);
/* must_put is for old method (l_p_m returns non-0 on err) */
#include <linux/lprocfs_status.h>
#include <linux/lustre_fsfilt.h>
#include <linux/lustre_commit_confd.h>
+#include <linux/lustre_disk.h>
#include "mgs_internal.h"
static int mgs_postsetup(struct obd_device *obd);
RETURN(rc);
}
-/* mount the file system (secretly) */
+/* Start the MGS obd */
static int mgs_setup(struct obd_device *obd, obd_count len, void *buf)
{
struct lprocfs_static_vars lvars;
- struct lustre_cfg* lcfg = buf;
- char *options = NULL;
char *ns_name = "MGS";
struct mgs_obd *mgs = &obd->u.mgs;
+ struct lustre_mount_info *lmi;
+ struct lustre_sb_info *lsi;
struct vfsmount *mnt;
- unsigned long page;
int rc = 0;
ENTRY;
- /* setup 1:/dev/loop/0 2:ext3 3:mgs 4:errors=remount-ro,iopen_nopriv*/
+ CDEBUG(D_CONFIG, "Starting MGS\n");
- if (lcfg->lcfg_bufcount < 3)
+ lmi = lustre_get_mount(obd->obd_name);
+ if (!lmi)
RETURN(rc = -EINVAL);
- 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));
+ mnt = lmi->lmi_mnt;
+ lsi = s2lsi(lmi->lmi_sb);
+ obd->obd_fsops = fsfilt_get_ops(MT_STR(lsi->lsi_ldd));
if (IS_ERR(obd->obd_fsops))
- RETURN(rc = PTR_ERR(obd->obd_fsops));
-
- page = __get_free_page(GFP_KERNEL);
- if (!page)
- RETURN(-ENOMEM);
-
- options = (char *)page;
- memset(options, 0, PAGE_SIZE);
-
- if (LUSTRE_CFG_BUFLEN(lcfg, 4) > 0 && lustre_cfg_buf(lcfg, 4))
- sprintf(options , ",%s", lustre_cfg_string(lcfg, 4));
-
- //FIXME mount was already done in lustre_fill_super,
- //we just need to access it
- mnt = do_kern_mount(lustre_cfg_string(lcfg, 2), 0,
- lustre_cfg_string(lcfg, 1), (void *)options);
- free_page(page);
- if (IS_ERR(mnt)) {
- rc = PTR_ERR(mnt);
- CERROR("do_kern_mount failed: rc = %d\n", rc);
- GOTO(err_ops, rc);
- }
-
- CDEBUG(D_SUPER, "%s: mnt = %p\n", lustre_cfg_string(lcfg, 1), mnt);
+ GOTO(err_put, rc = PTR_ERR(obd->obd_fsops));
- /*namespace for mgs llog */
+ /* namespace for mgs llog */
obd->obd_namespace = ldlm_namespace_new(ns_name, LDLM_NAMESPACE_SERVER);
if (obd->obd_namespace == NULL) {
mgs_cleanup(obd);
- GOTO(err_put, rc = -ENOMEM);
+ GOTO(err_ops, rc = -ENOMEM);
}
LASSERT(!lvfs_check_rdonly(lvfs_sbdev(mnt->mnt_sb)));
lprocfs_init_vars(mgs, &lvars);
lprocfs_obd_setup(obd, lvars.obd_vars);
- if (obd->obd_recovering) {
- LCONSOLE_WARN("MGT %s now serving %s, but will be in recovery "
- "until %d %s reconnect, or if no clients "
- "reconnect for %d:%.02d; during that time new "
- "clients will not be allowed to connect. "
- "Recovery progress can be monitored by watching "
- "/proc/fs/lustre/mgs/%s/recovery_status.\n",
- obd->obd_name,
- lustre_cfg_string(lcfg, 1),
- obd->obd_recoverable_clients,
- (obd->obd_recoverable_clients == 1)
- ? "client" : "clients",
- (int)(OBD_RECOVERY_TIMEOUT / HZ) / 60,
- (int)(OBD_RECOVERY_TIMEOUT / HZ) % 60,
- obd->obd_name);
- } else {
- LCONSOLE_INFO("MGT %s now serving %s with recovery %s.\n",
- obd->obd_name,
- lustre_cfg_string(lcfg, 1),
- obd->obd_replayable ? "enabled" : "disabled");
- }
+ LCONSOLE_INFO("MGS %s started\n", obd->obd_name);
ldlm_timeout = 6;
ping_evictor_start();
err_ns:
ldlm_namespace_free(obd->obd_namespace, 0);
obd->obd_namespace = NULL;
-err_put:
- unlock_kernel();
- mntput(mgs->mgs_vfsmnt);
- mgs->mgs_sb = 0;
- lock_kernel();
err_ops:
fsfilt_put_ops(obd->obd_fsops);
+err_put:
+ lustre_put_mount(obd->obd_name, mgs->mgs_vfsmnt);
+ mgs->mgs_sb = 0;
return rc;
}
{
struct mgs_obd *mgs = &obd->u.mgs;
lvfs_sbdev_type save_dev;
- int must_relock = 0;
ENTRY;
ping_evictor_stop();
mgs_fs_cleanup(obd);
- if (atomic_read(&obd->u.mgs.mgs_vfsmnt->mnt_count) > 2)
- CERROR("%s: mount busy, mnt_count %d != 2\n", obd->obd_name,
- atomic_read(&obd->u.mgs.mgs_vfsmnt->mnt_count));
-
- /* We can only unlock kernel if we are in the context of sys_ioctl,
- otherwise we never called lock_kernel */
- if (kernel_locked()) {
- unlock_kernel();
- must_relock++;
- }
-
- mntput(mgs->mgs_vfsmnt);
+ lustre_put_mount(obd->obd_name, mgs->mgs_vfsmnt);
mgs->mgs_sb = NULL;
ldlm_namespace_free(obd->obd_namespace, obd->obd_force);
lvfs_clear_rdonly(save_dev);
- if (must_relock)
- lock_kernel();
-
fsfilt_put_ops(obd->obd_fsops);
- LCONSOLE_INFO("MGT %s has stopped.\n", obd->obd_name);
+ LCONSOLE_INFO("MGS %s has stopped.\n", obd->obd_name);
RETURN(0);
}
#define DEBUG_SUBSYSTEM S_MGMT
-#define D_MOUNT D_ERROR
+#define D_MOUNT D_SUPER|D_CONFIG|D_ERROR
#include <linux/obd.h>
#include <linux/lvfs.h>
CDEBUG(D_MOUNT, "Last put of mnt %p from %s, mount count %d\n",
lmi->lmi_mnt, name,
atomic_read(&lmi->lmi_mnt->mnt_count));
+ /* 2 seems normal on mds, (may_umount() also expects 2
+ fwiw), but we only see 1 at this point in obdfilter. */
+ if (atomic_read(&lmi->lmi_mnt->mnt_count) > 2)
+ CERROR("%s: mount busy, mnt_count %d != 2\n", name,
+ atomic_read(&lmi->lmi_mnt->mnt_count));
}
up(&lustre_mount_info_lock);
struct lustre_cfg * lcfg = NULL;
int err;
- CDEBUG(D_ERROR, "lcfg %s %#x %s %s %s %s\n", cfgname, cmd, s1, s2, s3, s4);
+ CDEBUG(D_TRACE, "lcfg %s %#x %s %s %s %s\n", cfgname,
+ cmd, s1, s2, s3, s4);
lustre_cfg_bufs_reset(&bufs, cfgname);
if (s1)
return (-ENOMEM);
sprintf(mgsname, "MGS_%p", sb);
- CDEBUG(D_MOUNT, "Start MGS service %s\n", mgsname);
+ CDEBUG(D_CONFIG, "Start MGS service %s\n", mgsname);
err = lustre_register_mount(mgsname, sb, mnt);
struct obd_ioctl_data ioc_data = { 0 };
struct obd_device *obd;
struct lustre_sb_info *lsi = s2lsi(sb);
- int err, mdsstart=0, oststart=0;
-
+ int err;
CDEBUG(D_MOUNT, "starting target %s\n", lsi->lsi_ldd->ldd_svname);
LUSTRE_CFG_BUFLEN(lcfg, 2) < 1)
RETURN(-EINVAL);
- obd->obd_fsops = fsfilt_get_ops(lustre_cfg_string(lcfg, 2));
- if (IS_ERR(obd->obd_fsops))
- RETURN(PTR_ERR(obd->obd_fsops));
-
- rc = filter_iobuf_pool_init(filter, OST_NUM_THREADS);
- if (rc != 0)
- GOTO(err_ops, rc);
-
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");
mnt = do_kern_mount(lustre_cfg_string(lcfg, 2),
MS_NOATIME|MS_NODIRATIME,
- lustre_cfg_string(lcfg, 1), option);
+ lustre_cfg_string(lcfg, 1), option);
+ if (IS_ERR(mnt)) {
+ rc = PTR_ERR(mnt);
+ LCONSOLE_ERROR("Can't mount disk %s (%d)\n",
+ lustre_cfg_string(lcfg, 1), rc);
+ RETURN(rc);
+ }
+
+ obd->obd_fsops = fsfilt_get_ops(lustre_cfg_string(lcfg, 2));
}
+ if (IS_ERR(obd->obd_fsops))
+ GOTO(err_mntput, rc = PTR_ERR(obd->obd_fsops));
- if (IS_ERR(mnt)) {
- rc = PTR_ERR(mnt);
- LCONSOLE_ERROR("Can't mount disk %s (%d)\n",
- lustre_cfg_string(lcfg, 1), rc);
+ rc = filter_iobuf_pool_init(filter, OST_NUM_THREADS);
+ if (rc != 0)
GOTO(err_ops, rc);
- }
LASSERT(!lvfs_check_rdonly(lvfs_sbdev(mnt->mnt_sb)));
rc = filter_prep(obd);
if (rc)
- GOTO(err_mntput, rc);
+ GOTO(err_ops, rc);
filter->fo_destroy_in_progress = 0;
sema_init(&filter->fo_create_lock, 1);
err_post:
filter_post(obd);
+err_ops:
+ fsfilt_put_ops(obd->obd_fsops);
+ filter_iobuf_pool_done(filter);
err_mntput:
if (lmi) {
lustre_put_mount(obd->obd_name, mnt);
lock_kernel();
}
filter->fo_sb = 0;
-err_ops:
- fsfilt_put_ops(obd->obd_fsops);
- filter_iobuf_pool_done(filter);
return rc;
}