#define IS_MGMT(data) ((data)->ldd_flags & LDD_F_SV_TYPE_MGMT)
#define MT_STR(data) mt_str((data)->ldd_mount_type)
+/* Make the mdt/ost server obd name based on the filesystem name */
+static inline void ldd_make_sv_name(struct lustre_disk_data *ldd)
+{
+ if (IS_MDT(ldd) || IS_OST(ldd)) {
+ sprintf(ldd->ldd_svname, "%.8s-%s%04x",
+ ldd->ldd_fsname,
+ IS_MDT(ldd) ? "MDT" : "OST",
+ ldd->ldd_svindex);
+ } else {
+ sprintf(ldd->ldd_svname, "MGMT");
+ }
+}
+
+
/****************** mount command *********************/
/* gleaned from the mount command - no persistent info here */
int mo_stripe_sz;
int mo_stripe_count;
int mo_stripe_pattern;
- __u16 mo_index; /* stripe index for osts, pool index
- for pooled mdts. index will be put
- in lr_server_data */
int mo_timeout; /* obd timeout */
};
/* obd_mount.c */
void lustre_register_client_fill_super(int (*cfs)(struct super_block *sb));
void lustre_common_put_super(struct super_block *sb);
-struct lustre_mount_info *lustre_get_mount(char *name);
-int lustre_put_mount(char *name, struct vfsmount *mnt);
+struct lustre_mount_info *server_get_mount(char *name);
+int server_put_mount(char *name, struct vfsmount *mnt);
int lustre_get_process_log(struct super_block *, char *,
struct config_llog_instance *cfg);
#define NAME_MAXLEN 64
#define UUID_MAXLEN NAME_MAXLEN + 5
-
-struct mgmt_ost_info {
- struct list_head moi_list;
- char moi_fullfsname[NAME_MAXLEN];
- char moi_ostname[NAME_MAXLEN];
- char moi_nodename[NAME_MAXLEN];
- char moi_ostuuid[UUID_MAXLEN];
- __u64 moi_nid; /* lnet_nid_t */
- __u32 moi_stripe_index;
- __u32 moi_flags;
-};
-
-extern void lustre_swab_mgmt_ost_info(struct mgmt_ost_info *oinfo);
-
-struct mgmt_mds_info {
- char mmi_fullfsname[64];
- char mmi_mds_name[64];
- char mmi_mds_nodename[64];
- __u64 mmi_nid;
- __u32 mmi_index;
- __u32 mmi_pattern; /* PATTERN_RAID0, PATTERN_RAID1 */
- __u64 mmi_stripe_size; /* in bytes */
- __u64 mmi_stripe_offset; /* in bytes */
+struct mgmt_target_info {
+ char mti_fsname[NAME_MAXLEN];
+ char mti_targetname[NAME_MAXLEN];
+ char mti_nodename[NAME_MAXLEN];
+ char mti_uuid[UUID_MAXLEN];
+ __u64 mti_nid; /* lnet_nid_t */ //nid list?
+ __u32 mti_config_ver;
+ __u32 mti_flags;
+ __u32 mti_stripe_index;
+ __u32 mti_stripe_pattern; /* PATTERN_RAID0, PATTERN_RAID1 */
+ __u64 mti_stripe_size; /* in bytes */
+ __u64 mti_stripe_offset; /* in bytes */
};
-extern void lustre_swab_mgmt_mds_info(struct mgmt_mds_info *oinfo);
+extern void lustre_swab_mgmt_target_info(struct mgmt_target_info *oinfo);
-struct mgmt_target_info{
- __u32 mti_flags;
- union {
- struct mgmt_ost_info moi;
- struct mgmt_mds_info mmi;
- } u;
-};
/*
* Opcodes for multiple servers.
*/
struct mdc_rpc_lock *cl_setattr_lock;
struct osc_creator cl_oscc;
/* mgc datastruct */
+ struct semaphore cl_mgc_sem;
struct mgc_rpc_lock *cl_mgc_rpc_lock;
struct vfsmount *cl_mgc_vfsmnt;
struct super_block *cl_mgc_sb;
}
sema_init(&cli->cl_sem, 1);
+ sema_init(&cli->cl_mgc_sem, 1);
cli->cl_conn_count = 0;
memcpy(server_uuid.uuid, lustre_cfg_buf(lcfg, 2),
min_t(unsigned int, LUSTRE_CFG_BUFLEN(lcfg, 2),
if (LUSTRE_CFG_BUFLEN(lcfg, 1) == 0 || LUSTRE_CFG_BUFLEN(lcfg, 2) == 0)
RETURN(rc = -EINVAL);
- lmi = lustre_get_mount(obd->obd_name);
+ lmi = server_get_mount(obd->obd_name);
if (lmi) {
/* We already mounted in lustre_fill_super.
lcfg bufs 1, 2, 4 (device, fstype, mount opts) are ignored.*/
fsfilt_put_ops(obd->obd_fsops);
err_put:
if (lmi) {
- lustre_put_mount(obd->obd_name, mds->mds_vfsmnt);
+ server_put_mount(obd->obd_name, mds->mds_vfsmnt);
} else {
/* old method */
unlock_kernel();
upcall_cache_cleanup(mds->mds_group_hash);
mds->mds_group_hash = NULL;
- must_put = lustre_put_mount(obd->obd_name, mds->mds_vfsmnt);
+ must_put = server_put_mount(obd->obd_name, mds->mds_vfsmnt);
/* must_put is for old method (l_p_m returns non-0 on err) */
/* We can only unlock kernel if we are in the context of sys_ioctl,
/* Get index and add to config llog, depending on flags */
-int mgc_target_add(struct obd_export *exp, struct mgmt_ost_info *moi)
+int mgc_target_add(struct obd_export *exp, struct mgmt_target_info *moi)
{
struct ptlrpc_request *req;
- struct mgmt_ost_info *req_moi, *rep_moi;
+ struct mgmt_target_info *req_moi, *rep_moi;
int size = sizeof(*req_moi);
int rep_size = sizeof(*moi);
int rc;
if (!rc) {
int index;
rep_moi = lustre_swab_repbuf(req, 0, sizeof(*rep_moi),
- lustre_swab_mgmt_ost_info);
+ lustre_swab_mgmt_target_info);
index = rep_moi->moi_stripe_index;
if (index != moi->moi_stripe_index) {
CERROR ("OST ADD failed. rc=%d\n", index);
EXPORT_SYMBOL(mgc_target_add);
/* Remove from config llog */
-int mgc_target_del(struct obd_export *exp, struct mgmt_ost_info *moi)
+int mgc_target_del(struct obd_export *exp, struct mgmt_target_info *moi)
{
struct ptlrpc_request *req;
- struct mgmt_ost_info *req_moi, *rep_moi;
+ struct mgmt_target_info *req_moi, *rep_moi;
int size = sizeof(*req_moi);
int rc;
ENTRY;
if (!rc) {
int index;
rep_moi = lustre_swab_repbuf(req, 0, sizeof(*rep_moi),
- lustre_swab_mgmt_ost_info);
+ lustre_swab_mgmt_target_info);
index = rep_moi->moi_stripe_index;
if (index != moi->moi_stripe_index) {
CERROR ("OST DEL failed. rc=%d\n", index);
int err = 0;
LASSERT(lsi);
+ LASSERT(lsi->lsi_srv_mnt == mnt);
+
+ /* The mgc fs exclusion sem. Only one fs can be setup at a time.
+ Maybe just overload the cl_sem? */
+ down(&cli->cl_mgc_sem);
obd->obd_fsops = fsfilt_get_ops(MT_STR(lsi->lsi_ldd));
if (IS_ERR(obd->obd_fsops)) {
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
}
- rc = lustre_put_mount(obd->obd_name, cli->cl_mgc_vfsmnt);
+ /* never got mount
+ rc = server_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);
+
+ up(&cli->cl_mgc_sem);
+
return(rc);
}
//lprocfs_obd_cleanup(obd);
- if (cli->cl_mgc_vfsmnt) {
- /* if we're a server, eg. something's mounted */
- mgc_fs_cleanup(obd);
- }
+ LASSERT(cli->cl_mgc_vfsmnt == NULL);
rc = obd_llog_finish(obd, 0);
if (rc != 0)
/* Hack alert */
if (keylen == strlen("register") &&
memcmp(key, "register", keylen) == 0) {
- struct mgmt_ost_info *moi;
- if (vallen != sizeof(struct mgmt_ost_info))
+ struct mgmt_target_info *moi;
+ if (vallen != sizeof(struct mgmt_target_info))
RETURN(-EINVAL);
- moi = (struct mgmt_ost_info *)val;
+ moi = (struct mgmt_target_info *)val;
CERROR("register %s %#x\n", moi->moi_ostname, moi->moi_flags);
rc = mgc_target_add(exp, moi);
RETURN(rc);
}
+ if (keylen == strlen("set_fs") &&
+ memcmp(key, "set_fs", keylen) == 0) {
+ struct super_block *sb = (struct super_block *)val;
+ struct lustre_sb_info *lsi;
+ if (vallen != sizeof(struct super_block))
+ RETURN(-EINVAL);
+ lsi = s2lsi(sb);
+ rc = mgc_fs_setup(exp->exp_obd, sb, lsi->lsi_srv_mnt);
+ if (rc) {
+ CERROR("set_fs got %d\n", rc);
+ }
+ RETURN(rc);
+ }
+ if (keylen == strlen("clear_fs") &&
+ memcmp(key, "clear_fs", keylen) == 0) {
+ if (vallen != 0)
+ RETURN(-EINVAL);
+ rc = mgc_fs_cleanup(exp->exp_obd);
+ if (rc) {
+ CERROR("clear_fs got %d\n", rc);
+ }
+ RETURN(rc);
+ }
+
RETURN(rc);
}
CDEBUG(D_CONFIG, "Starting MGS\n");
- lmi = lustre_get_mount(obd->obd_name);
+ lmi = server_get_mount(obd->obd_name);
if (!lmi)
RETURN(rc = -EINVAL);
err_ops:
fsfilt_put_ops(obd->obd_fsops);
err_put:
- lustre_put_mount(obd->obd_name, mgs->mgs_vfsmnt);
+ server_put_mount(obd->obd_name, mgs->mgs_vfsmnt);
mgs->mgs_sb = 0;
return rc;
}
//mgs_fs_cleanup(obd);
- lustre_put_mount(obd->obd_name, mgs->mgs_vfsmnt);
+ server_put_mount(obd->obd_name, mgs->mgs_vfsmnt);
mgs->mgs_sb = NULL;
ldlm_namespace_free(obd->obd_namespace, obd->obd_force);
RETURN(0);
}
-static int mgmt_handle_target_add(struct ptlrpc_request *req)
+static int mgs_handle_target_add(struct ptlrpc_request *req)
{
struct obd_device *obd = &req->rq_export->exp_obd;
struct mgs_obd *mgs = &obd->u.mgs;
- struct mgmt_ost_info *req_moi, *moi, *rep_moi;
- int rep_size = sizeof(*moi);
+ struct mgmt_target_info *req_mti, *mti, *rep_mti;
+ int rep_size = sizeof(*mti);
int index, rc;
- OBD_ALLOC(moi, sizeof(*moi));
- if (!moi)
+ OBD_ALLOC(mti, sizeof(*mti));
+ if (!mti)
GOTO(out, rc = -ENOMEM);
- req_moi = lustre_swab_reqbuf(req, 0, sizeof(*moi),
- lustre_swab_mgmt_ost_info);
- memcpy(moi, req_moi, sizeof(*moi));
+ req_mti = lustre_swab_reqbuf(req, 0, sizeof(*mti),
+ lustre_swab_mgmt_target_info);
+ memcpy(mti, req_mti, sizeof(*mti));
- /* NEED_INDEX implies FIRST_START, but not vice-versa */
- if (moi->moi_flags & LDD_F_NEED_INDEX) {
- rc = mgs_get_index(moi);
+ /* NEED_INDEX implies NEED_REGISTER, but not vice-versa */
+ if (mti->mti_flags & LDD_F_NEED_INDEX) {
+ rc = mgs_get_index(mti);
// rc = mgmt_handle_first_connect(req);
}
- if (moi->moi_flags & LDD_F_SV_TYPE_MDT) {
- rc = llog_add_mds(obd, moi);
+ if (mti->mti_flags & LDD_F_SV_TYPE_MDT) {
+ rc = llog_add_mds(obd, mti);
}
out:
lustre_pack_reply(req, 1, &rep_size, NULL);
- rep_moi = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*rep_moi));
- memcpy(rep_moi, moi, sizeof(*rep_moi));
+ rep_mti = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*rep_mti));
+ memcpy(rep_mti, mti, sizeof(*rep_mti));
if (rc)
- rep_moi->moi_stripe_index = rc;
+ rep_mti->mti_stripe_index = rc;
return rc;
}
int mgs_handle(struct ptlrpc_request *req)
{
- struct mgs_obd *mgs = NULL; /* quell gcc overwarning */
- struct obd_device *obd = NULL;
int fail = OBD_FAIL_MGMT_ALL_REPLY_NET;
int rc = 0;
ENTRY;
OBD_FAIL_RETURN(OBD_FAIL_MGMT_ALL_REQUEST_NET | OBD_FAIL_ONCE, 0);
LASSERT(current->journal_info == NULL);
- /* XXX identical to MDS */
if (req->rq_reqmsg->opc != MGMT_CONNECT) {
if (req->rq_export == NULL) {
CERROR("lustre_mgs: operation %d on unconnected MGS\n",
req->rq_status = -ENOTCONN;
GOTO(out, rc = -ENOTCONN);
}
- obd = req->rq_export->exp_obd;
- mgs = &obd->u.mgs;
}
switch (req->rq_reqmsg->opc) {
DEBUG_REQ(D_INODE, req, "connect");
OBD_FAIL_RETURN(OBD_FAIL_MGMT_CONNECT_NET, 0);
rc = target_handle_connect(req, mgs_handle);
- if (!rc) {
- /* Now that we have an export, set mgs. */
- obd = req->rq_export->exp_obd;
- mgs = mgs_req2mgs(req);
- }
break;
-
case MGMT_DISCONNECT:
DEBUG_REQ(D_INODE, req, "disconnect");
OBD_FAIL_RETURN(OBD_FAIL_MGMT_DISCONNECT_NET, 0);
req->rq_status = rc; /* superfluous? */
break;
+ case MGMT_TARGET_ADD:
+ CDEBUG(D_INODE, "target add\n");
+ rc = mgs_handle_target_add(req);
+ break;
+ case MGMT_TARGET_DEL:
+ CDEBUG(D_INODE, "target del\n");
+ //rc = mgs_handle_target_del(req);
+ break;
+
case LDLM_ENQUEUE:
DEBUG_REQ(D_INODE, req, "enqueue");
OBD_FAIL_RETURN(OBD_FAIL_LDLM_ENQUEUE, 0);
OBD_FAIL_RETURN(OBD_FAIL_OBD_LOG_CANCEL_NET, 0);
rc = -ENOTSUPP; /* la la la */
break;
- // case MGMT_FIRST_CONNECT:
- // CDEBUG(D_INODE, "server connect at first time\n");
- // OBD_FAIL_RETURN(OBD_FAIL_MGMT_FIRST_CONNECT, 0);
- // rc = mgmt_handle_first_connect(req);
-// break;
- case MGMT_TARGET_ADD:
- CDEBUG(D_INODE, "target add\n");
- rc = mgmt_handle_target_add(req);
- break;
- case MGMT_TARGET_DEL:
- CDEBUG(D_INODE, "target del\n");
-// rc = mgmt_handle_target_del(req);
- break;
-// case MGMT_MDS_ADD:
-// CDEBUG(D_INODE, "mds add\n");
-// rc = mgmt_handle_mds_add(req);
-// break;
+
case LLOG_ORIGIN_HANDLE_CREATE:
DEBUG_REQ(D_INODE, req, "llog_init");
OBD_FAIL_RETURN(OBD_FAIL_OBD_LOGD_NET, 0);
extern struct lvfs_callback_ops mgs_lvfs_ops;
-static inline struct mgs_obd *mgs_req2mgs(struct ptlrpc_request *req)
-{
- return &req->rq_export->exp_obd->u.mgs;
-}
+int mgs_get_index(struct obd_device *obd, mgmt_target_info *mti);
-extern int mgmt_handle_first_connect(struct ptlrpc_request *req);
-extern int mgmt_handle_mds_add(struct ptlrpc_request *req);
-extern int mgmt_handle_ost_add(struct ptlrpc_request *req);
-extern int mgmt_handle_ost_del(struct ptlrpc_request *req);
#endif
return num;
}
-int mgs_get_index(struct obd_device *obd, char *full_fsname,
- int disk_type, int *new_index)
+int mgs_get_index(struct obd_device *obd, mgmt_target_info *mti)
{
struct mgs_obd *mgs = &obd->u.mgs;
struct system_db *db;
list_for_each(tmp, &mgs->mgs_system_db_list) {
db = list_entry(tmp, struct system_db, db_list);
- if (!strcmp(db->fsname, full_fsname)) {
- if (disk_type & LDD_F_SV_TYPE_OST)
+ if (strcmp(db->fsname, mti->mti_fsname) == 0) {
+ if (mti->mti_flags & LDD_F_SV_TYPE_OST)
*new_index = next_ost_index(db->index_map, 4096);
else
*new_index = 1; /*FIXME*/
OBD_ALLOC(db, sizeof(*db));
if (!db)
return -ENOMEM;
- strcpy(db->fsname, full_fsname);
+ strcpy(db->fsname, mti->mti_fsname);
INIT_LIST_HEAD(&db->db_list);
INIT_LIST_HEAD(&db->ost_infos);
- rc = get_index_map_from_llog(obd, full_fsname, db->index_map);
+ rc = get_index_map_from_llog(obd, mti->mti_fsname, db->index_map);
if (rc)
GOTO(clean, rc);
spin_lock(&mgs->mgs_system_db_lock);
OBD_FREE(db, sizeof(*db));
goto out;
}
-EXPORT_SYMBOL(mgs_get_index);
static int mgs_do_record(struct obd_device *obd, struct llog_handle *llh,
void *cfg_buf)
}
static int mgs_write_basic_llog(struct obd_device *obd,
- struct mgmt_mds_info *mmi)
+ struct mgmt_target_info *mti)
{
int rc = 0;
CERROR("New basic LLOG.\n"); /*FIXME: add soon*/
return rc;
}
-static int mgs_write_mds_llog(struct obd_device *obd, struct mgmt_mds_info *mmi)
+
+static int mgs_write_target_llog(struct obd_device *obd,
+ struct mgmt_target_info *mti)
{
struct mgs_open_llog *mol;
struct llog_handle *llh;
struct list_head *tmp;
- char *name = mmi->mmi_fullfsname;
+ char *name = mti->mti_fsname;
struct lov_desc *lovdesc;
char lov_name[64];
char uuid[64];
OBD_ALLOC(lovdesc, sizeof(*lovdesc));
if (lovdesc == NULL)
GOTO(cleanup, rc = -ENOMEM);
- lovdesc->ld_pattern = mmi->mmi_pattern;
- lovdesc->ld_default_stripe_size = mmi->mmi_stripe_size;
- lovdesc->ld_default_stripe_offset = mmi->mmi_stripe_offset;
+ lovdesc->ld_pattern = mti->mti_stripe_pattern;
+ lovdesc->ld_default_stripe_size = mti->mti_stripe_size;
+ lovdesc->ld_default_stripe_offset = mti->mti_stripe_offset;
rc = mgs_clear_record(obd, llh, name);
if (rc) {
}
/* the same uuid for lov and osc */
- sprintf(uuid, "%s_lov_UUID", mmi->mmi_mds_name);
- sprintf(lov_name, "lov_%s", mmi->mmi_mds_name);
+ sprintf(uuid, "%s_lov_UUID", mti->mti_fsname);
+ sprintf(lov_name, "lov_%s", mti->mti_fsname);
sprintf((char*)lovdesc->ld_uuid.uuid, "%s_UUID", lov_name);
rc = record_attach(obd, llh, lov_name, "lov", uuid);
char osc_name[64];
char index[16];
char *setup_argv[2];
- struct mgmt_ost_info *oinfo;
+ struct mgmt_target_info *oinfo;
- oinfo = list_entry(tmp, struct mgmt_ost_info, moi_list);
+ oinfo = list_entry(tmp, struct mgmt_target_info, mti_list);
- sprintf(ost_node_uuid, "%s_UUID", oinfo->moi_nodename);
+ sprintf(ost_node_uuid, "%s_UUID", oinfo->mti_nodename);
sprintf(osc_name,"OSC_%s_%s_%s",
- db->mds_nodename, oinfo->moi_ostname, db->mds_name);
+ db->mds_nodename, oinfo->mti_ostname, db->mds_name);
- rc = record_add_uuid(obd, llh, oinfo->moi_nid, ost_node_uuid);
+ rc = record_add_uuid(obd, llh, oinfo->mti_nid, ost_node_uuid);
if (rc) {
CERROR("failed to record log(add_uuid) %s: %d\n",
name, rc);
RETURN(rc);
}
- setup_argv[0] = oinfo->moi_ostuuid;
+ setup_argv[0] = oinfo->mti_ostuuid;
setup_argv[1] = ost_node_uuid;
rc = record_setup(obd, llh, osc_name, 2, setup_argv);
if (rc) {
RETURN(rc);
}
- sprintf(index, "%d", oinfo->moi_stripe_index);
+ sprintf(index, "%d", oinfo->mti_stripe_index);
rc = record_lov_modify_tgts(obd, llh, lov_name, "add",
- oinfo->moi_ostuuid, index, "1");
+ oinfo->mti_ostuuid, index, "1");
if (rc) {
CERROR("failed to record log(lov_modify_tgts) %s: %d\n",
name, rc);
}
}
#endif
- rc = record_mount_point(obd, llh, mmi->mmi_mds_name, lov_name, NULL);
+ rc = record_mount_point(obd, llh, mti->mti_target_name, lov_name, NULL);
if (rc) {
CERROR("failed to record log(lov_modify_tgts) %s: %d\n",
name, rc);
char ost_node_uuid[64];
char osc_name[64];
char index[16];
- struct mgmt_ost_info *oinfo;
+ struct mgmt_target_info *oinfo;
- oinfo = list_entry(tmp, struct mgmt_ost_info, moi_list);
+ oinfo = list_entry(tmp, struct mgmt_target_info, mti_list);
- sprintf(ost_node_uuid, "%s_UUID", oinfo->moi_nodename);
+ sprintf(ost_node_uuid, "%s_UUID", oinfo->mti_nodename);
sprintf(osc_name, "OSC_%s_%s_MNT_client",
- db->mds_nodename, oinfo->moi_ostname);
+ db->mds_nodename, oinfo->mti_ostname);
- rc = record_add_uuid(obd, llh, oinfo->moi_nid, ost_node_uuid);
+ rc = record_add_uuid(obd, llh, oinfo->mti_nid, ost_node_uuid);
if (rc) {
CERROR("failed to record log(add_uuid) %s: %d\n",
name, rc);
RETURN(rc);
}
- setup_argv[0] = oinfo->moi_ostuuid;
+ setup_argv[0] = oinfo->mti_ostuuid;
setup_argv[1] = ost_node_uuid;
rc = record_setup(obd, llh, osc_name, 2, setup_argv);
if (rc) {
RETURN(rc);
}
- sprintf(index, "%d", oinfo->moi_stripe_index);
+ sprintf(index, "%d", oinfo->mti_stripe_index);
rc = record_lov_modify_tgts(obd, llh, lov_name, "add",
- oinfo->moi_ostuuid, index, "1");
+ oinfo->mti_ostuuid, index, "1");
if (rc) {
CERROR("failed to record log(lov_modify_tgts) %s: %d\n",
name, rc);
return rc;
}
-int mgmt_handle_first_connect(struct ptlrpc_request *req)
-{
- struct obd_export *exp = req->rq_export;
- struct obd_device *obd = exp->exp_obd;
- struct mgs_obd *mgs = &obd->u.mgs;
- __u32 *disk_type;
- char *full_fsname, *node_name;
- int rep_size = sizeof(int);
- int new_index, *rep_index;
- int rc;
-
- disk_type = lustre_swab_reqbuf(req, 0, sizeof(*disk_type),
- __swab32s);
- full_fsname = lustre_swab_reqbuf(req, 1, NAME_MAXLEN, NULL);
- node_name = lustre_swab_reqbuf(req, 2, NAME_MAXLEN, NULL);
-
- if (*disk_type & LDD_F_SV_TYPE_MDT) {
- CDEBUG(D_INODE,
- "New MDS Server belong to FILESYSTEM[/POOL]%s\n",
- full_fsname);
- }
- else if (*disk_type & LDD_F_SV_TYPE_OST) {
- CDEBUG(D_INODE,
- "New OST Server belong to FILESYSTEM[/POOL]%s\n",
- full_fsname);
- }
- else {
- CERROR("Wrong disk type register.\n");
- GOTO(out, rc = -EFAULT);
- }
-
- rc = build_llog_dir(obd, full_fsname);
- if (rc) {
- CERROR("Can not build llog dir.\n");
- GOTO(out, rc);
- }
-
- rc = mgs_get_index(obd, full_fsname, *disk_type, &new_index);
- if (rc) {
- CERROR("Can not get index for the new server.\n" );
- new_index = rc;
- }
-
-out:
- lustre_pack_reply(req, 1, &rep_size, NULL);
- rep_index = lustre_msg_buf(req->rq_repmsg, 0, sizeof(int));
- *rep_index = new_index;
-
- return rc;
-}
-
-int llog_add_ost(struct obd_device *obd, struct mgmt_ost_info *moi)
+int llog_add_ost(struct obd_device *obd, struct mgmt_target_info *mti)
{
struct mgs_obd *mgs = &obd->u.mgs;
struct llog_handle *llh;
list_for_each(tmp, &mgs->mgs_system_db_list) {
struct system_db *tmp_db;
tmp_db = list_entry(tmp, struct system_db, db_list);
- if (!strcmp(tmp_db->fsname, moi->moi_fullfsname)) {
+ if (!strcmp(tmp_db->fsname, mti->mti_fsname)) {
db = tmp_db;
break;
}
*/
/*First phase: writing mds log */
- sprintf(logname, "%s/mds1", moi->moi_fullfsname);
+ sprintf(logname, "%s/mds1", mti->mti_fullfsname);
rc = mgs_start_record(obd, llh, logname);
if (rc) {
CERROR("failed to record log %s: %d\n", logname, rc);
GOTO(out, rc);
}
- sprintf(ost_node_uuid, "%s_UUID", moi->moi_nodename);
+ sprintf(ost_node_uuid, "%s_UUID", mti->mti_nodename);
sprintf(osc_name, "OSC_%s_%s_MNT_client",
- db->fsname, moi->moi_ostname);
+ db->fsname, mti->mti_ostname);
- rc = record_add_uuid(obd, llh, moi->moi_nid, ost_node_uuid);
+ rc = record_add_uuid(obd, llh, mti->mti_nid, ost_node_uuid);
if (rc) {
CERROR("failed to record log(add_uuid) %s: %d\n",
logname, rc);
GOTO(out, rc);
}
- sprintf(uuid, "%s_lov_UUID", moi->moi_fullfsname);
+ sprintf(uuid, "%s_lov_UUID", mti->mti_fullfsname);
rc = record_attach(obd, llh, osc_name, "osc", uuid);
if (rc) {
GOTO(out, rc);
}
- setup_argv[0] = moi->moi_ostuuid;
+ setup_argv[0] = mti->mti_ostuuid;
setup_argv[1] = ost_node_uuid;
rc = record_setup(obd, llh, osc_name, 2, setup_argv);
if (rc) {
GOTO(out, rc);
}
- sprintf(index, "%d", moi->moi_stripe_index);
+ sprintf(index, "%d", mti->mti_stripe_index);
rc = record_lov_modify_tgts(obd, llh, lov_name, "add",
- moi->moi_ostuuid, index, "1");
+ mti->mti_ostuuid, index, "1");
if (rc) {
CERROR("failed to record log(lov_modify_tgts) %s: %d\n",
logname, rc);
}
/*Second Phase : writing client llog */
- sprintf(logname, "%s/client", moi->moi_fullfsname);
+ sprintf(logname, "%s/client", mti->mti_fullfsname);
rc = mgs_start_record(obd, llh, logname);
if (rc) {
GOTO(out, rc);
}
- sprintf(ost_node_uuid, "%s_UUID", moi->moi_nodename);
+ sprintf(ost_node_uuid, "%s_UUID", mti->mti_nodename);
sprintf(osc_name, "OSC_%s_%s_MNT_client",
- db->fsname, moi->moi_ostname);
+ db->fsname, mti->mti_ostname);
- rc = record_add_uuid(obd, llh, moi->moi_nid, ost_node_uuid);
+ rc = record_add_uuid(obd, llh, mti->mti_nid, ost_node_uuid);
if (rc) {
CERROR("failed to record log(add_uuid) %s: %d\n",
logname, rc);
GOTO(out, rc);
}
- setup_argv[0] = moi->moi_ostuuid;
+ setup_argv[0] = mti->mti_ostuuid;
setup_argv[1] = ost_node_uuid;
rc = record_setup(obd, llh, osc_name, 2, setup_argv);
if (rc) {
GOTO(out, rc);
}
- sprintf(index, "%d", moi->moi_stripe_index);
+ sprintf(index, "%d", mti->mti_stripe_index);
rc = record_lov_modify_tgts(obd, llh, lov_name, "add",
- moi->moi_ostuuid, index, "1");
+ mti->mti_ostuuid, index, "1");
if (rc) {
CERROR("failed to record log(lov_modify_tgts) %s: %d\n",
logname, rc);
}
EXPORT_SYMBOL(llog_add_ost);
-int llog_add_mds(struct obd_device *obd, struct mgmt_mds_info *mmi)
+int llog_add_mds(struct obd_device *obd, struct mgmt_target_info *mti)
{
struct mgs_obd *mgs = &obd->u.mgs;
struct llog_handle *llh;
list_for_each(tmp, &mgs->mgs_system_db_list) {
struct system_db *tmp_db;
tmp_db = list_entry(tmp, struct system_db, db_list);
- if (!strcmp(tmp_db->fsname, mmi->mmi_fullfsname)) {
+ if (!strcmp(tmp_db->fsname, mti->mti_fullfsname)) {
db = tmp_db;
break;
}
GOTO(out, rc = -ENOMEM);
ld->ld_tgt_count = get_ost_number(db->index_map, 4096);
- ld->ld_default_stripe_count = mmi->mmi_stripe_size;
- ld->ld_pattern = mmi->mmi_pattern;
- ld->ld_default_stripe_offset = mmi->mmi_stripe_offset;
+ ld->ld_default_stripe_count = mti->mti_stripe_size;
+ ld->ld_pattern = mti->mti_stripe_pattern;
+ ld->ld_default_stripe_offset = mti->mti_stripe_offset;
sprintf((char*)ld->ld_uuid.uuid, "lov1_UUID");
/* Two phases: 1. writing mds log.
*/
/*First phase: writing mds log */
- sprintf(logname, "%s/mds1", mmi->mmi_fullfsname);
+ sprintf(logname, "%s/mds1", mti->mti_fullfsname);
rc = mgs_start_record(obd, llh, logname);
if (rc) {
}
/* the same uuid for lov and osc */
- sprintf(uuid, "%s_lov_UUID", mmi->mmi_mds_name);
+ sprintf(uuid, "%s_lov_UUID", mti->mti_target_name);
sprintf(lov_name, "lov_client");
rc = record_attach(obd, llh, lov_name, "lov", uuid);
GOTO(out, rc);;
}
- rc = record_mount_point(obd, llh, mmi->mmi_mds_name, lov_name, NULL);
+ rc = record_mount_point(obd, llh, mti->mti_target_name, lov_name, NULL);
if (rc) {
CERROR("failed to record log(mount_point) %s: %d\n",
logname, rc);
}
/* the same uuid for lov and osc */
- sprintf(uuid, "%s_lov_UUID", mmi->mmi_mds_name);
+ sprintf(uuid, "%s_lov_UUID", mti->mti_target_name);
sprintf(lov_name, "lov_client");
rc = record_attach(obd, llh, lov_name, "lov", uuid);
GOTO(out, rc);;
}
- sprintf(mds_node_uuid, "%s_UUID", mmi->mmi_mds_nodename);
- rc = record_add_uuid(obd, llh, mmi->mmi_nid, mds_node_uuid);
+ sprintf(mds_node_uuid, "%s_UUID", mti->mti_target_nodename);
+ rc = record_add_uuid(obd, llh, mti->mti_nid, mds_node_uuid);
if (rc) {
CERROR("failed to record log(add uuid) %s: %d\n",
logname, rc);
}
sprintf(mdc_name, "MDC_%s_%s_MNT_client",
- mmi->mmi_mds_nodename, mmi->mmi_mds_name);
- sprintf(mdc_uuid, "MDC_%s_UUID", mmi->mmi_fullfsname);
+ mti->mti_target_nodename, mti->mti_target_name);
+ sprintf(mdc_uuid, "MDC_%s_UUID", mti->mti_fullfsname);
rc = record_attach(obd, llh, mdc_name, "mdc", mdc_uuid);
if (rc) {
RETURN(rc);
}
- sprintf(setup_argv[0],"%s_UUID", mmi->mmi_mds_name);
+ sprintf(setup_argv[0],"%s_UUID", mti->mti_mds_name);
setup_argv[1] = mds_node_uuid;
rc = record_setup(obd, llh, mdc_name, 2, setup_argv);
if (rc) {
}
EXPORT_SYMBOL(llog_add_mds);
-int mgmt_handle_mds_add(struct ptlrpc_request *req)
-{
- struct obd_device *obd = &req->rq_export->exp_obd;
- struct mgs_obd *mgs = &obd->u.mgs;
- struct mgmt_mds_info *req_mmi, *mmi, *rep_mmi;
- int rep_size = sizeof(*mmi);
- int index, rc;
-
- OBD_ALLOC(mmi, sizeof(*mmi));
- if (!mmi)
- GOTO(out, rc = -ENOMEM);
- req_mmi = lustre_swab_reqbuf(req, 0, sizeof(*mmi),
- lustre_swab_mgmt_mds_info);
- memcpy(mmi, req_mmi, sizeof(*mmi));
-
- rc = llog_add_mds(obd, mmi);
-out:
- lustre_pack_reply(req, 1, &rep_size, NULL);
- rep_mmi = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*rep_mmi));
- memcpy(rep_mmi, mmi, sizeof(*rep_mmi));
- if (rc)
- rep_mmi->mmi_index = rc;
- return rc;
-}
-EXPORT_SYMBOL(mgmt_handle_mds_add);
-
-
int mgs_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
void *karg, void *uarg)
{
RETURN(rc);
}
- case OBD_IOC_ABORT_RECOVERY:
- CERROR("aborting recovery for device %s\n", obd->obd_name);
- target_abort_recovery(obd);
- RETURN(0);
-
default:
CDEBUG(D_INFO, "unknown command %x\n", cmd);
RETURN(-EINVAL);
DECLARE_MUTEX(lustre_mount_info_lock);
struct list_head lustre_mount_info_list = LIST_HEAD_INIT(lustre_mount_info_list);
-static struct lustre_mount_info *lustre_find_mount(char *name)
+static struct lustre_mount_info *server_find_mount(char *name)
{
struct list_head *tmp;
struct lustre_mount_info *lmi;
return(NULL);
}
-/* obd's using a mount must register for it before they call
- their setup routine. They call lustre_get_mount to get the mnt struct
- by name, since we can't pass the pointer to setup. */
-int lustre_register_mount(char *name, struct super_block *sb,
+/* we must register an obd for a mount before we call the setup routine.
+ *_setup will call lustre_get_mount to get the mnt struct
+ by obd_name, since we can't pass the pointer to setup. */
+static int server_register_mount(char *name, struct super_block *sb,
struct vfsmount *mnt)
{
struct lustre_mount_info *lmi;
down(&lustre_mount_info_lock);
- if (lustre_find_mount(name)) {
+ if (server_find_mount(name)) {
up(&lustre_mount_info_lock);
OBD_FREE(lmi, sizeof(*lmi));
OBD_FREE(name_cp, strlen(name) + 1);
}
/* when an obd no longer needs a mount */
-static int lustre_deregister_mount(char *name)
+static int server_deregister_mount(char *name)
{
struct lustre_mount_info *lmi;
down(&lustre_mount_info_lock);
- lmi = lustre_find_mount(name);
+ lmi = server_find_mount(name);
if (!lmi) {
up(&lustre_mount_info_lock);
CERROR("%s not registered\n", name);
/* Deregister anyone referencing the mnt. Everyone should have
put_mount in *_cleanup, but this is a catch-all in case of err... */
-static void lustre_deregister_mount_all(struct vfsmount *mnt)
+static void server_deregister_mount_all(struct vfsmount *mnt)
{
struct list_head *tmp, *n;
struct lustre_mount_info *lmi;
/* obd's look up a registered mount using their name. This is just
for initial obd setup to find the mount struct. It should not be
called every time you want to mntget. */
-struct lustre_mount_info *lustre_get_mount(char *name)
+struct lustre_mount_info *server_get_mount(char *name)
{
struct lustre_mount_info *lmi;
struct lustre_sb_info *lsi;
down(&lustre_mount_info_lock);
- lmi = lustre_find_mount(name);
+ lmi = server_find_mount(name);
if (!lmi) {
up(&lustre_mount_info_lock);
CERROR("Can't find mount for %s\n", name);
}
/* to be called from obd_cleanup methods */
-int lustre_put_mount(char *name, struct vfsmount *mnt)
+int server_put_mount(char *name, struct vfsmount *mnt)
{
struct lustre_mount_info *lmi;
struct lustre_sb_info *lsi;
down(&lustre_mount_info_lock);
- lmi = lustre_find_mount(name);
+ lmi = server_find_mount(name);
if (!lmi) {
up(&lustre_mount_info_lock);
CERROR("Can't find mount for %s\n", name);
up(&lustre_mount_info_lock);
/* this obd should never need the mount again */
- lustre_deregister_mount(name);
+ server_deregister_mount(name);
return 0;
}
/******* mount helper utilities *********/
-static void print_ldd(struct lustre_disk_data *ldd)
+static void ldd_print(struct lustre_disk_data *ldd)
{
int i;
}
}
-static int parse_disk_data(struct lvfs_run_ctxt *mount_ctxt,
+static int ldd_parse(struct lvfs_run_ctxt *mount_ctxt,
struct lustre_disk_data *ldd)
{
struct lvfs_run_ctxt saved;
}
err = 0;
- print_ldd(ldd);
+ ldd_print(ldd);
out_close:
filp_close(file, 0);
return(err);
}
+static int ldd_write(struct lvfs_run_ctxt *mount_ctxt,
+ struct lustre_disk_data *ldd)
+{
+ struct lvfs_run_ctxt saved;
+ struct file *file;
+ loff_t off = 0;
+ unsigned long len = sizeof(struct lustre_disk_data);
+ int err;
+
+ LASSERT(ldd->ldd_magic != LDD_MAGIC);
+
+ push_ctxt(&saved, mount_ctxt, NULL);
+
+ file = filp_open(MOUNT_DATA_FILE, O_RDWR, 0644);
+ if (IS_ERR(file)) {
+ err = PTR_ERR(file);
+ CERROR("cannot open %s: err = %d\n", MOUNT_DATA_FILE, err);
+ goto out;
+ }
+
+ err = lustre_fwrite(file, ldd, len, &off);
+ if (err != len) {
+ CERROR("error writing %s: read %d of %lu\n",
+ MOUNT_DATA_FILE, err, len);
+ GOTO(out_close, err = -EINVAL);
+ }
+
+ err = 0;
+ ldd_print(ldd);
+
+out_close:
+ filp_close(file, 0);
+out:
+ pop_ctxt(&saved, mount_ctxt, NULL);
+ return(err);
+}
+
+#if 0
int parse_last_rcvd(struct obd_device *obd, char *uuid, int *first_mount)
{
struct lvfs_run_ctxt saved;
OBD_FREE(lsd, sizeof(*lsd));
return(err);
}
+#endif
/* Get a config log from the MGS and process it.
This func is called for both clients and servers. */
}
/* Set up a MGS to serve startup logs */
-static int lustre_start_mgs(struct super_block *sb)
+static int server_start_mgs(struct super_block *sb)
{
struct lustre_sb_info *lsi = s2lsi(sb);
struct vfsmount *mnt = lsi->lsi_srv_mnt;
/* It is impossible to have more than 1 MGS per node, since
MGC wouldn't know which to connect to */
- lmi = lustre_find_mount(mgsname);
+ lmi = server_find_mount(mgsname);
if (lmi) {
lsi = s2lsi(lmi->lmi_sb);
LCONSOLE_ERROR("The MGS service was already started from "
CDEBUG(D_CONFIG, "Start MGS service %s\n", mgsname);
- err = lustre_register_mount(mgsname, sb, mnt);
+ err = server_register_mount(mgsname, sb, mnt);
if (!err &&
((err = lustre_start_simple(mgsname, LUSTRE_MGS_NAME, 0, 0))))
- lustre_deregister_mount(mgsname);
+ server_deregister_mount(mgsname);
if (err)
LCONSOLE_ERROR("Failed to start MGS %s (%d). Is the 'mgs' "
return err;
}
-static void lustre_stop_mgs(struct super_block *sb)
+static void server_stop_mgs(struct super_block *sb)
{
struct obd_device *obd;
char mgsname[] = "MGS";
/* class_import_put will get rid of the additional connections */
}
+/* Since there's only one mgc per node, we have to change it's fs to get
+ access to the right disk. */
+static int server_mgc_set_fs(struct obd_device *mgc, struct super_block *sb)
+{
+ int err;
+
+ /* cl_mgc_sem in mgc insures we sleep if the mgc_fs is busy */
+ err = obd_set_info(mgc->obd_self_export,
+ strlen("set_fs"), "set_fs",
+ sizeof(*sb), sb);
+ if (err) {
+ CERROR("can't set_fs %d\n", err);
+ }
+
+ return err;
+}
+
+static int server_mgc_clear_fs(struct obd_device *mgc)
+{
+ int err;
+ err = obd_set_info(mgc->obd_self_export,
+ strlen("clear_fs"), "clear_fs", 0, NULL);
+ return err;
+}
+
/* Stop MDS/OSS if nobody is using them */
static void server_stop_servers(struct super_block *sb)
{
{
struct lustre_sb_info *lsi = s2lsi(sb);
struct obd_device *mgc = lsi->lsi_mgc;
+ struct lustre_disk_data *ldd = lsi->lsi_ldd;
struct lustre_handle mgc_conn = {0, };
struct obd_export *exp = NULL;
- struct mgmt_ost_info *moi = NULL;
+ struct mgmt_target_info *mti = NULL;
int rc;
LASSERT(mgc);
- /* send TARGET_INITIAL_CONNECT, MGS should reply with index number.
- In any case, T_I_C should send current index (usually FFFF)
- and MGS can reply with actual index. */
+ /* send MGMT_TARGET_ADD rpc via MGC, MGS should reply with an
+ index number. */
- OBD_ALLOC(moi, sizeof(*moi));
- if (!moi) {
+ OBD_ALLOC(mti, sizeof(*mti));
+ if (!mti) {
return -ENOMEM;
}
- strncpy(moi->moi_ostname, lsi->lsi_ldd->ldd_svname,
- sizeof(moi->moi_ostname));
- strncpy(moi->moi_fullfsname, lsi->lsi_ldd->ldd_fsname,
- sizeof(moi->moi_fullfsname));
- moi->moi_flags = lsi->lsi_ldd->ldd_flags;
- moi->moi_stripe_index = lsi->lsi_ldd->ldd_svindex;
+ strncpy(mti->mti_ostname, ldd->ldd_svname,
+ sizeof(mti->mti_ostname));
+ strncpy(mti->mti_fsname, ldd->ldd_fsname,
+ sizeof(mti->mti_fullfsname));
+ mti->mti_flags = ldd->ldd_flags;
+ mti->mti_stripe_index = ldd->ldd_svindex;
rc = obd_connect(&mgc_conn, mgc, &(mgc->obd_uuid), NULL);
if (rc) {
/* FIXME use ioctl instead? eg
struct obd_ioctl_data ioc_data = { 0 };
- ioc_data.ioc_inllen1 = strlen(lsi->lsi_ldd->ldd_svname) + 1;
- ioc_data.ioc_inlbuf1 = lsi->lsi_ldd->ldd_svname;
+ ioc_data.ioc_inllen1 = strlen(ldd->ldd_svname) + 1;
+ ioc_data.ioc_inlbuf1 = ldd->ldd_svname;
err = obd_iocontrol(OBD_IOC_START, obd->obd_self_export,
sizeof ioc_data, &ioc_data, NULL);
*/
rc = obd_set_info(exp,
strlen("add_target"), "add_target",
- sizeof(*moi), moi);
+ sizeof(*mti), mti);
obd_disconnect(exp);
if (rc) {
CERROR("add_target failed %d\n", rc);
goto out;
}
-
- /* FIXME rewrite last_rcvd, ldd (for new svname), drop
- NEED_REGISTER|INDEX flags, change disk label */
-
+ /* If this flag is still set, it means we need to change our on-disk
+ index to what the mgs assigned us. */
+ if (mti->mti_flags & LDD_F_NEED_INDEX) {
+ CERROR("Must change on-disk index from %#x to %#x\n",
+ ldd->ldd_svindex, mti->mti_stripe_index);
+ ldd->ldd_flags &= ~(LDD_F_NEED_INDEX | LDD_F_FIRST_START);
+ ldd->ldd_config_ver = 666; // FIXME
+ ldd->ldd_svindex = mti->mti_stripe_index;
+ ldd_make_sv_name(ldd);
+ ldd_write(&mgc->obd_lvfs_ctxt, ldd);
+ /* FIXME write last_rcvd?, disk label? */
+ }
out:
- if (moi)
- OBD_FREE(moi, sizeof(*moi));
+ if (mti)
+ OBD_FREE(mti, sizeof(*mti));
return rc;
}
}
}
+ /* Set the mgc fs to our server disk */
+ server_mgc_set_fs(lsi->lsi_mgc, sb);
+
/* Get a new index if needed */
if (lsi->lsi_ldd->ldd_flags & (LDD_F_NEED_INDEX | LDD_F_NEED_REGISTER)) {
/* FIXME Maybe need to change NEED_INDEX to NEVER_CONNECTED,
/* Register the mount for the target */
- err = lustre_register_mount(lsi->lsi_ldd->ldd_svname, sb, mnt);
+ err = server_register_mount(lsi->lsi_ldd->ldd_svname, sb, mnt);
if (err)
goto out;
if (err) {
CERROR("failed to start server %s: %d\n",
lsi->lsi_ldd->ldd_svname, err);
- lustre_deregister_mount(lsi->lsi_ldd->ldd_svname);
+ server_deregister_mount(lsi->lsi_ldd->ldd_svname);
goto out;
}
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);
+ server_deregister_mount(lsi->lsi_ldd->ldd_svname);
err = -ENXIO;
}
out:
+ /* Release the mgc fs for others to use */
+ server_mgc_clear_fs(lsi->lsi_mgc);
+
if (err)
server_stop_servers(sb);
return(err);
LASSERT(lsi->lsi_llsbi == NULL);
- lustre_deregister_mount_all(lsi->lsi_srv_mnt);
+ server_deregister_mount_all(lsi->lsi_srv_mnt);
OBD_FREE(lsi, sizeof(*lsi));
s2lsi_nocast(sb) = NULL;
/*************** server mount ******************/
/* Kernel mount using mount options in MOUNT_DATA_FILE */
-static struct vfsmount *lustre_kern_mount(struct super_block *sb)
+static struct vfsmount *server_kernel_mount(struct super_block *sb)
{
struct lvfs_run_ctxt mount_ctxt;
struct lustre_sb_info *lsi = s2lsi(sb);
mount_ctxt.pwd = mnt->mnt_root;
mount_ctxt.fs = get_ds();
- err = parse_disk_data(&mount_ctxt, ldd);
+ err = ldd_parse(&mount_ctxt, ldd);
unlock_mntput(mnt);
if (err) {
/* If they wanted the mgs to stop separately from the mdt, they
should have put it on a different device. */
if (lsi->lsi_ldd->ldd_flags & LDD_F_SV_TYPE_MGMT)
- lustre_stop_mgs(sb);
+ server_stop_mgs(sb);
/* clean the mgc and sb */
lustre_common_put_super(sb);
ENTRY;
/* the One True Mount */
- mnt = lustre_kern_mount(sb);
+ mnt = server_kernel_mount(sb);
if (IS_ERR(mnt)) {
err = PTR_ERR(mnt);
CERROR("Unable to mount device %s: %d\n",
/* start MGS before MGC */
if (lsi->lsi_ldd->ldd_flags & LDD_F_SV_TYPE_MGMT) {
- err = lustre_start_mgs(sb);
+ err = server_start_mgs(sb);
if (err) {
CERROR("ignoring Failed MGS start!!\n");
//GOTO(out_mnt, err);
out_mnt:
if (mgs_service)
- lustre_stop_mgs(sb);
+ server_stop_mgs(sb);
/* mgc is stopped in lustre_fill_super */
unlock_mntput(mnt);
out:
lustre_free_lsi(sb);
}
-static void print_lmd(struct lustre_mount_data *lmd)
+static void lmd_print(struct lustre_mount_data *lmd)
{
int i;
CDEBUG(D_MOUNT, "options: %s\n", lmd->lmd_opts);
}
-static int parse_lmd(char *options, struct lustre_mount_data *lmd)
+static int lmd_parse(char *options, struct lustre_mount_data *lmd)
{
char *s1, *s2, *devname = NULL;
struct lustre_mount_data *raw = (struct lustre_mount_data *)options;
lmd->lmd_magic = LMD_MAGIC;
- print_lmd(lmd);
+ lmd_print(lmd);
RETURN(0);
invalid:
lmd = lsi->lsi_lmd;
/* Figure out the lmd from the mount options */
- if (parse_lmd((char *)data, lmd)) {
+ if (lmd_parse((char *)data, lmd)) {
lustre_free_lsi(sb);
RETURN(-EINVAL);
}
EXPORT_SYMBOL(lustre_register_client_fill_super);
EXPORT_SYMBOL(lustre_common_put_super);
EXPORT_SYMBOL(lustre_get_process_log);
-EXPORT_SYMBOL(lustre_get_mount);
-EXPORT_SYMBOL(lustre_put_mount);
+EXPORT_SYMBOL(server_get_mount);
+EXPORT_SYMBOL(server_put_mount);
LUSTRE_CFG_BUFLEN(lcfg, 2) < 1)
RETURN(-EINVAL);
- lmi = lustre_get_mount(obd->obd_name);
+ lmi = server_get_mount(obd->obd_name);
if (lmi) {
/* We already mounted in lustre_fill_super.
lcfg bufs 1, 2, 4 (device, fstype, mount opts) are ignored.*/
filter_iobuf_pool_done(filter);
err_mntput:
if (lmi) {
- lustre_put_mount(obd->obd_name, mnt);
+ server_put_mount(obd->obd_name, mnt);
} else {
/* old method */
unlock_kernel();
obd->obd_name, filter->fo_vfsmnt,
atomic_read(&filter->fo_vfsmnt->mnt_count));
- must_put = lustre_put_mount(obd->obd_name, filter->fo_vfsmnt);
+ must_put = server_put_mount(obd->obd_name, filter->fo_vfsmnt);
/* must_put is for old method (l_p_m returns non-0 on err) */
/* We can only unlock kernel if we are in the context of sys_ioctl,
CLASSERT(offsetof(typeof(*b), padding_4) != 0);
}
-void lustre_swab_mgmt_ost_info(struct mgmt_ost_info *oinfo)
+void lustre_swab_mgmt_target_info(struct mgmt_target_info *mti)
{
- __swab64s(&oinfo->moi_nid);
- __swab32s(&oinfo->moi_stripe_index);
- __swab32s(&oinfo->moi_flags);
-}
-
-void lustre_swab_mgmt_mds_info(struct mgmt_mds_info *minfo)
-{
- __swab64s(&minfo->mmi_nid);
- __swab32s(&minfo->mmi_index);
- __swab32s(&minfo->mmi_pattern);
- __swab64s(&minfo->mmi_stripe_size);
- __swab64s(&minfo->mmi_stripe_offset);
+ __swab64s(&mti->mti_nid);
+ __swab32s(&mti->mti_config_ver);
+ __swab32s(&mti->mti_flags);
+ __swab32s(&mti->mti_stripe_index);
+ __swab32s(&mti->mti_stripe_pattern);
+ __swab64s(&mti->mti_stripe_size);
+ __swab64s(&mti->mti_stripe_offset);
}
static void lustre_swab_obd_dqinfo (struct obd_dqinfo *i)
}
memset(&lsd, 0, sizeof(lsd));
strncpy(lsd.lsd_uuid, mop->mo_ldd.ldd_svname, sizeof(lsd.lsd_uuid));
- lsd.lsd_index = mop->mo_index;
+ // FIXME any need for the lsd_index?
+ lsd.lsd_index = mop->mo_ldd.ldd_svindex;
lsd.lsd_feature_compat |= cpu_to_le32(LR_COMPAT_COMMON_LR);
lsd.lsd_server_size = cpu_to_le32(LR_SERVER_SIZE);
lsd.lsd_client_start = cpu_to_le32(LR_CLIENT_START);
}
#endif
-/* Make the mdt/ost server obd name based on the filesystem name */
-static void make_sv_name(struct mkfs_opts *mop)
-{
- /* FIXME if we're not given an index, we have to change our name
- later -- can't have two servers with the same name.
- So rewrite ost log, last_rcvd, and disk label, or we need to talk
- to MGMT now to get index # */
-
- if (IS_MDT(&mop->mo_ldd) || IS_OST(&mop->mo_ldd)) {
- sprintf(mop->mo_ldd.ldd_svname, "%.8s-%s%04x",
- mop->mo_ldd.ldd_fsname,
- IS_MDT(&mop->mo_ldd) ? "MDT" : "OST",
- mop->mo_index);
- } else {
- sprintf(mop->mo_ldd.ldd_svname, "MGMT");
- }
- mop->mo_ldd.ldd_svindex = mop->mo_index;
- vprint("Server name: %s\n", mop->mo_ldd.ldd_svname);
-}
-
void set_defaults(struct mkfs_opts *mop)
{
mop->mo_ldd.ldd_magic = LDD_MAGIC;
else
mop->mo_ldd.ldd_mount_type = LDD_MT_LDISKFS;
+ mop->mo_ldd.ldd_svindex = -1;
mop->mo_stripe_count = 1;
- mop->mo_index = -1;
}
static inline void badopt(char opt, char *type)
exit(0);
case 'i':
if (IS_MDT(&mop.mo_ldd) || IS_OST(&mop.mo_ldd)) {
- mop.mo_index = atol(optarg);
+ mop.mo_ldd.ldd_svindex = atol(optarg);
mop.mo_ldd.ldd_flags &= ~LDD_F_NEED_INDEX;
} else {
badopt(opt, "MDT,OST");
(mop.mo_ldd.ldd_mount_type == LDD_MT_SMFS))
mop.mo_flags |= MO_IS_LOOP;
- make_sv_name(&mop);
+ ldd_make_sv_name(&(mop.mo_ldd));
/* Create the loopback file */
if (mop.mo_flags & MO_IS_LOOP) {