ENTRY;
if (opcode != MDT_IT_LAYOUT) {
- CERROR("%s: Unknown intent (%d)\n",
- info->mti_exp->exp_obd->obd_name, opcode);
+ CERROR("%s: Unknown intent (%d)\n", mdt_obd_name(info->mti_mdt),
+ opcode);
RETURN(-EINVAL);
}
RETURN(0);
CERROR("%s: Unsupported layout intent (%d)\n",
- info->mti_exp->exp_obd->obd_name, layout->li_opc);
+ mdt_obd_name(info->mti_mdt), layout->li_opc);
RETURN(-EINVAL);
}
* objects (some of them are pinned by osd, for example *
* the proper solution should be a model where object used
* by osd only doesn't have mdt/mdd slices -bzzz */
- lustre_cfg_bufs_reset(bufs, obd->obd_name);
+ lustre_cfg_bufs_reset(bufs, mdt_obd_name(m));
lustre_cfg_bufs_set_string(bufs, 1, NULL);
lcfg = lustre_cfg_new(LCFG_PRE_CLEANUP, bufs);
if (!lcfg) {
}
static void mdt_stack_fini(const struct lu_env *env,
- struct mdt_device *m, struct lu_device *top)
+ struct mdt_device *m, struct lu_device *top)
{
- struct obd_device *obd = mdt2obd_dev(m);
- struct lustre_cfg_bufs *bufs;
- struct lustre_cfg *lcfg;
- struct mdt_thread_info *info;
- char flags[3]="";
- ENTRY;
+ struct obd_device *obd = mdt2obd_dev(m);
+ struct lustre_cfg_bufs *bufs;
+ struct lustre_cfg *lcfg;
+ struct mdt_thread_info *info;
+ char flags[3] = "";
+ ENTRY;
- info = lu_context_key_get(&env->le_ctx, &mdt_thread_key);
- LASSERT(info != NULL);
+ info = lu_context_key_get(&env->le_ctx, &mdt_thread_key);
+ LASSERT(info != NULL);
lu_dev_del_linkage(top->ld_site, top);
lu_site_purge(env, top->ld_site, -1);
- bufs = &info->mti_u.bufs;
- /* process cleanup, pass mdt obd name to get obd umount flags */
+ bufs = &info->mti_u.bufs;
+ /* process cleanup, pass mdt obd name to get obd umount flags */
/* another purpose is to let all layers to release their objects */
- lustre_cfg_bufs_reset(bufs, obd->obd_name);
- if (obd->obd_force)
- strcat(flags, "F");
- if (obd->obd_fail)
- strcat(flags, "A");
- lustre_cfg_bufs_set_string(bufs, 1, flags);
- lcfg = lustre_cfg_new(LCFG_CLEANUP, bufs);
- if (!lcfg) {
- CERROR("Cannot alloc lcfg!\n");
- return;
- }
- LASSERT(top);
- top->ld_ops->ldo_process_config(env, top, lcfg);
- lustre_cfg_free(lcfg);
+ lustre_cfg_bufs_reset(bufs, mdt_obd_name(m));
+ if (obd->obd_force)
+ strcat(flags, "F");
+ if (obd->obd_fail)
+ strcat(flags, "A");
+ lustre_cfg_bufs_set_string(bufs, 1, flags);
+ lcfg = lustre_cfg_new(LCFG_CLEANUP, bufs);
+ if (!lcfg) {
+ CERROR("Cannot alloc lcfg!\n");
+ return;
+ }
+ LASSERT(top);
+ top->ld_ops->ldo_process_config(env, top, lcfg);
+ lustre_cfg_free(lcfg);
lu_site_purge(env, top->ld_site, -1);
- m->mdt_child = NULL;
- m->mdt_bottom = NULL;
+ m->mdt_child = NULL;
+ m->mdt_bottom = NULL;
obd_disconnect(m->mdt_child_exp);
m->mdt_child_exp = NULL;
obd = class_name2obd(next);
if (obd == NULL) {
CERROR("%s: can't locate next device: %s\n",
- m->mdt_md_dev.md_lu_dev.ld_obd->obd_name, next);
+ mdt_obd_name(m), next);
GOTO(out, rc = -ENOTCONN);
}
rc = obd_connect(NULL, exp, obd, &obd->obd_uuid, data, NULL);
if (rc) {
CERROR("%s: cannot connect to next dev %s (%d)\n",
- m->mdt_md_dev.md_lu_dev.ld_obd->obd_name, next, rc);
+ mdt_obd_name(m), next, rc);
GOTO(out, rc);
}
site = mdt->mdt_child_exp->exp_obd->obd_lu_dev->ld_site;
LASSERT(site);
- LASSERT(mdt->mdt_md_dev.md_lu_dev.ld_site == NULL);
+ LASSERT(mdt_lu_site(mdt) == NULL);
mdt->mdt_md_dev.md_lu_dev.ld_site = site;
site->ls_top_dev = &mdt->mdt_md_dev.md_lu_dev;
mdt->mdt_child = lu2md_dev(mdt->mdt_child_exp->exp_obd->obd_lu_dev);
cfs_timer_disarm(&m->mdt_ck_timer);
mdt_ck_thread_stop(m);
- /*
- * Finish the stack
- */
- mdt_stack_fini(env, m, md2lu_dev(m->mdt_child));
+ /*
+ * Finish the stack
+ */
+ mdt_stack_fini(env, m, md2lu_dev(m->mdt_child));
- LASSERT(cfs_atomic_read(&d->ld_ref) == 0);
+ LASSERT(cfs_atomic_read(&d->ld_ref) == 0);
- server_put_mount(mdt2obd_dev(m)->obd_name, NULL);
+ server_put_mount(mdt_obd_name(m), NULL);
- EXIT;
+ EXIT;
}
static int mdt_adapt_sptlrpc_conf(struct obd_device *obd, int initial)
{
- struct mdt_device *m = mdt_dev(obd->obd_lu_dev);
- struct sptlrpc_rule_set tmp_rset;
- int rc;
+ struct mdt_device *m = mdt_dev(obd->obd_lu_dev);
+ struct sptlrpc_rule_set tmp_rset;
+ int rc;
- sptlrpc_rule_set_init(&tmp_rset);
- rc = sptlrpc_conf_target_get_rules(obd, &tmp_rset, initial);
- if (rc) {
- CERROR("mdt %s: failed get sptlrpc rules: %d\n",
- obd->obd_name, rc);
- return rc;
- }
+ sptlrpc_rule_set_init(&tmp_rset);
+ rc = sptlrpc_conf_target_get_rules(obd, &tmp_rset, initial);
+ if (rc) {
+ CERROR("mdt %s: failed get sptlrpc rules: %d\n",
+ mdt_obd_name(m), rc);
+ return rc;
+ }
- sptlrpc_target_update_exp_flavor(obd, &tmp_rset);
+ sptlrpc_target_update_exp_flavor(obd, &tmp_rset);
write_lock(&m->mdt_sptlrpc_lock);
- sptlrpc_rule_set_free(&m->mdt_sptlrpc_rset);
- m->mdt_sptlrpc_rset = tmp_rset;
+ sptlrpc_rule_set_free(&m->mdt_sptlrpc_rset);
+ m->mdt_sptlrpc_rset = tmp_rset;
write_unlock(&m->mdt_sptlrpc_lock);
- return 0;
+ return 0;
}
int mdt_postrecov(const struct lu_env *, struct mdt_device *);
/* init the stack */
rc = mdt_stack_init((struct lu_env *)env, m, cfg);
if (rc) {
- CERROR("Can't init device stack, rc %d\n", rc);
+ CERROR("%s: Can't init device stack, rc %d\n",
+ mdt_obd_name(m), rc);
GOTO(err_lmi, rc);
}
- s = m->mdt_md_dev.md_lu_dev.ld_site;
- ss_site = &m->mdt_seq_site;
+ s = mdt_lu_site(m);
+ ss_site = mdt_seq_site(m);
s->ld_seq_site = ss_site;
ss_site->ss_lu = s;
/* No connection accepted until configurations will finish */
obd->obd_no_conn = 1;
- if (cfg->lcfg_bufcount > 4 && LUSTRE_CFG_BUFLEN(cfg, 4) > 0) {
- char *str = lustre_cfg_string(cfg, 4);
- if (strchr(str, 'n')) {
- CWARN("%s: recovery disabled\n", obd->obd_name);
- obd->obd_replayable = 0;
- }
- }
+ if (cfg->lcfg_bufcount > 4 && LUSTRE_CFG_BUFLEN(cfg, 4) > 0) {
+ char *str = lustre_cfg_string(cfg, 4);
+ if (strchr(str, 'n')) {
+ CWARN("%s: recovery disabled\n", mdt_obd_name(m));
+ obd->obd_replayable = 0;
+ }
+ }
rc = tgt_init(env, &m->mdt_lut, obd, m->mdt_bottom);
if (rc)
GOTO(err_fini_stack, rc);
- rc = mdt_fld_init(env, obd->obd_name, m);
+ rc = mdt_fld_init(env, mdt_obd_name(m), m);
if (rc)
GOTO(err_lut, rc);
- rc = mdt_seq_init(env, obd->obd_name, m);
+ rc = mdt_seq_init(env, mdt_obd_name(m), m);
if (rc)
GOTO(err_fini_fld, rc);
else
m->mdt_opts.mo_acl = 0;
- /* XXX: to support suppgid for ACL, we enable identity_upcall
- * by default, otherwise, maybe got unexpected -EACCESS. */
- if (m->mdt_opts.mo_acl)
- identity_upcall = MDT_IDENTITY_UPCALL_PATH;
-
- m->mdt_identity_cache = upcall_cache_init(obd->obd_name,identity_upcall,
- &mdt_identity_upcall_cache_ops);
- if (IS_ERR(m->mdt_identity_cache)) {
- rc = PTR_ERR(m->mdt_identity_cache);
- m->mdt_identity_cache = NULL;
+ /* XXX: to support suppgid for ACL, we enable identity_upcall
+ * by default, otherwise, maybe got unexpected -EACCESS. */
+ if (m->mdt_opts.mo_acl)
+ identity_upcall = MDT_IDENTITY_UPCALL_PATH;
+
+ m->mdt_identity_cache = upcall_cache_init(mdt_obd_name(m),
+ identity_upcall,
+ &mdt_identity_upcall_cache_ops);
+ if (IS_ERR(m->mdt_identity_cache)) {
+ rc = PTR_ERR(m->mdt_identity_cache);
+ m->mdt_identity_cache = NULL;
GOTO(err_llog_cleanup, rc);
- }
+ }
rc = mdt_procfs_init(m, dev);
if (rc) {
"unexpectedly zero, network data "
"corruption? Refusing connection of this"
" client\n",
- exp->exp_obd->obd_name,
+ mdt_obd_name(mdt),
exp->exp_client_uuid.uuid,
exp, data->ocd_connect_flags, data->ocd_version,
data->ocd_grant, data->ocd_index);
if ((data->ocd_connect_flags & OBD_CONNECT_FID) == 0) {
CWARN("%s: MDS requires FID support, but client not\n",
- mdt->mdt_md_dev.md_lu_dev.ld_obd->obd_name);
+ mdt_obd_name(mdt));
return -EBADE;
}
OBD_CONNECT_MDS_MDS |
OBD_CONNECT_SOM))) {
CWARN("%s: MDS has SOM enabled, but client does not support "
- "it\n", mdt->mdt_md_dev.md_lu_dev.ld_obd->obd_name);
+ "it\n", mdt_obd_name(mdt));
return -EBADE;
}
struct getinfo_fid2path *fp)
{
struct mdt_device *mdt = info->mti_mdt;
- struct obd_device *obd = mdt2obd_dev(mdt);
struct mdt_object *obj;
int rc;
ENTRY;
if (!fid_is_namespace_visible(&fp->gf_fid)) {
CWARN("%s: "DFID" is invalid, sequence should be "
- ">= "LPX64"\n", obd->obd_name,
- PFID(&fp->gf_fid), (__u64)FID_SEQ_NORMAL);
+ ">= "LPX64"\n", mdt_obd_name(mdt),
+ PFID(&fp->gf_fid), (__u64)FID_SEQ_NORMAL);
RETURN(-EINVAL);
}
obj = mdt_object_find(info->mti_env, mdt, &fp->gf_fid);
if (obj == NULL || IS_ERR(obj)) {
CDEBUG(D_IOCTL, "no object "DFID": %ld\n", PFID(&fp->gf_fid),
- PTR_ERR(obj));
+ PTR_ERR(obj));
RETURN(-EINVAL);
}
if (rc < 0) {
mdt_object_put(info->mti_env, obj);
CDEBUG(D_IOCTL, "nonlocal object "DFID": %d\n",
- PFID(&fp->gf_fid), rc);
+ PFID(&fp->gf_fid), rc);
RETURN(rc);
}
case OBD_IOC_SET_READONLY:
rc = dt->dd_ops->dt_ro(&env, dt);
break;
- case OBD_IOC_ABORT_RECOVERY:
- CERROR("Aborting recovery for device %s\n", obd->obd_name);
- target_stop_recovery_thread(obd);
- rc = 0;
- break;
+ case OBD_IOC_ABORT_RECOVERY:
+ CERROR("%s: Aborting recovery for device\n", mdt_obd_name(mdt));
+ target_stop_recovery_thread(obd);
+ rc = 0;
+ break;
case OBD_IOC_CHANGELOG_REG:
case OBD_IOC_CHANGELOG_DEREG:
case OBD_IOC_CHANGELOG_CLEAR:
rc = mdt_ioc_version_get(mti, karg);
break;
}
- default:
- CERROR("Not supported cmd = %d for device %s\n",
- cmd, obd->obd_name);
- rc = -EOPNOTSUPP;
- }
+ default:
+ rc = -EOPNOTSUPP;
+ CERROR("%s: Not supported cmd = %d, rc = %d\n",
+ mdt_obd_name(mdt), cmd, rc);
+ }
lu_env_fini(&env);
RETURN(rc);
hal->hal_version = HAL_VERSION;
hal->hal_archive_id = 0;
hal->hal_flags = 0;
- obd_uuid2fsname(hal->hal_fsname, mdt2obd_dev(info->mti_mdt)->obd_name,
+ obd_uuid2fsname(hal->hal_fsname, mdt_obd_name(info->mti_mdt),
MTI_NAME_MAXLEN);
hal->hal_count = 1;
hai = hai_zero(hal);
default:
hca->hca_action = HUA_NONE;
CERROR("%s: Unknown hsm action: %d on "DFID"\n",
- mdt2obd_dev(info->mti_mdt)->obd_name,
+ mdt_obd_name(info->mti_mdt),
hai->hai_action, PFID(&hai->hai_fid));
break;
}
hal->hal_version = HAL_VERSION;
hal->hal_archive_id = hr->hr_archive_id;
hal->hal_flags = hr->hr_flags;
- obd_uuid2fsname(hal->hal_fsname, mdt2obd_dev(info->mti_mdt)->obd_name,
+ obd_uuid2fsname(hal->hal_fsname, mdt_obd_name(info->mti_mdt),
MTI_NAME_MAXLEN);
hal->hal_count = hr->hr_itemcount;
int mdt_init_sec_level(struct mdt_thread_info *info)
{
- struct mdt_device *mdt = info->mti_mdt;
- struct ptlrpc_request *req = mdt_info_req(info);
- char *client = libcfs_nid2str(req->rq_peer.nid);
- struct obd_export *exp = req->rq_export;
- struct obd_device *obd = exp->exp_obd;
- struct obd_connect_data *data, *reply;
- int rc = 0, remote;
- ENTRY;
-
- data = req_capsule_client_get(info->mti_pill, &RMF_CONNECT_DATA);
- reply = req_capsule_server_get(info->mti_pill, &RMF_CONNECT_DATA);
- if (data == NULL || reply == NULL)
- RETURN(-EFAULT);
-
- /* connection from MDT is always trusted */
- if (req->rq_auth_usr_mdt) {
- mdt_init_sec_none(reply, exp);
- RETURN(0);
- }
-
- /* no GSS support case */
- if (!req->rq_auth_gss) {
- if (mdt->mdt_sec_level > LUSTRE_SEC_NONE) {
- CWARN("client %s -> target %s does not user GSS, "
- "can not run under security level %d.\n",
- client, obd->obd_name, mdt->mdt_sec_level);
- RETURN(-EACCES);
- } else {
- mdt_init_sec_none(reply, exp);
- RETURN(0);
- }
- }
-
- /* old version case */
- if (unlikely(!(data->ocd_connect_flags & OBD_CONNECT_RMT_CLIENT) ||
- !(data->ocd_connect_flags & OBD_CONNECT_MDS_CAPA) ||
- !(data->ocd_connect_flags & OBD_CONNECT_OSS_CAPA))) {
- if (mdt->mdt_sec_level > LUSTRE_SEC_NONE) {
- CWARN("client %s -> target %s uses old version, "
- "can not run under security level %d.\n",
- client, obd->obd_name, mdt->mdt_sec_level);
- RETURN(-EACCES);
- } else {
- CWARN("client %s -> target %s uses old version, "
- "run under security level %d.\n",
- client, obd->obd_name, mdt->mdt_sec_level);
- mdt_init_sec_none(reply, exp);
- RETURN(0);
- }
- }
-
- remote = data->ocd_connect_flags & OBD_CONNECT_RMT_CLIENT_FORCE;
- if (remote) {
- if (!req->rq_auth_remote)
- CDEBUG(D_SEC, "client (local realm) %s -> target %s "
- "asked to be remote.\n", client, obd->obd_name);
- } else if (req->rq_auth_remote) {
- remote = 1;
- CDEBUG(D_SEC, "client (remote realm) %s -> target %s is set "
- "as remote by default.\n", client, obd->obd_name);
- }
-
- if (remote) {
- if (!mdt->mdt_opts.mo_oss_capa) {
- CDEBUG(D_SEC, "client %s -> target %s is set as remote,"
- " but OSS capabilities are not enabled: %d.\n",
- client, obd->obd_name, mdt->mdt_opts.mo_oss_capa);
- RETURN(-EACCES);
- }
- } else {
- if (req->rq_auth_uid == INVALID_UID) {
- CDEBUG(D_SEC, "client %s -> target %s: user is not "
- "authenticated!\n", client, obd->obd_name);
- RETURN(-EACCES);
- }
- }
-
- switch (mdt->mdt_sec_level) {
- case LUSTRE_SEC_NONE:
- if (!remote) {
- mdt_init_sec_none(reply, exp);
- break;
- } else {
- CDEBUG(D_SEC, "client %s -> target %s is set as remote, "
- "can not run under security level %d.\n",
- client, obd->obd_name, mdt->mdt_sec_level);
- RETURN(-EACCES);
- }
+ struct mdt_device *mdt = info->mti_mdt;
+ struct ptlrpc_request *req = mdt_info_req(info);
+ char *client = libcfs_nid2str(req->rq_peer.nid);
+ struct obd_connect_data *data, *reply;
+ int rc = 0, remote;
+ ENTRY;
+
+ data = req_capsule_client_get(info->mti_pill, &RMF_CONNECT_DATA);
+ reply = req_capsule_server_get(info->mti_pill, &RMF_CONNECT_DATA);
+ if (data == NULL || reply == NULL)
+ RETURN(-EFAULT);
+
+ /* connection from MDT is always trusted */
+ if (req->rq_auth_usr_mdt) {
+ mdt_init_sec_none(reply, exp);
+ RETURN(0);
+ }
+
+ /* no GSS support case */
+ if (!req->rq_auth_gss) {
+ if (mdt->mdt_sec_level > LUSTRE_SEC_NONE) {
+ CWARN("%s: client %s -> target %s does not user GSS, "
+ "can not run under security level %d.\n",
+ mdt_obd_name(mdt), client, mdt_obd_name(mdt),
+ mdt->mdt_sec_level);
+ RETURN(-EACCES);
+ } else {
+ mdt_init_sec_none(reply, exp);
+ RETURN(0);
+ }
+ }
+
+ /* old version case */
+ if (unlikely(!(data->ocd_connect_flags & OBD_CONNECT_RMT_CLIENT) ||
+ !(data->ocd_connect_flags & OBD_CONNECT_MDS_CAPA) ||
+ !(data->ocd_connect_flags & OBD_CONNECT_OSS_CAPA))) {
+ if (mdt->mdt_sec_level > LUSTRE_SEC_NONE) {
+ CWARN("%s: client %s -> target %s uses old version, "
+ "can not run under security level %d.\n",
+ mdt_obd_name(mdt), client, mdt_obd_name(mdt),
+ mdt->mdt_sec_level);
+ RETURN(-EACCES);
+ } else {
+ CWARN("%s: client %s -> target %s uses old version, "
+ "run under security level %d.\n",
+ mdt_obd_name(mdt), client, mdt_obd_name(mdt),
+ mdt->mdt_sec_level);
+ mdt_init_sec_none(reply, exp);
+ RETURN(0);
+ }
+ }
+
+ remote = data->ocd_connect_flags & OBD_CONNECT_RMT_CLIENT_FORCE;
+ if (remote) {
+ if (!req->rq_auth_remote)
+ CDEBUG(D_SEC, "%s: client (local realm) %s -> "
+ "target %s asked to be remote.\n",
+ mdt_obd_name(mdt), client, mdt_obd_name(mdt));
+ } else if (req->rq_auth_remote) {
+ remote = 1;
+ CDEBUG(D_SEC, "%s: client (remote realm) %s -> "
+ "target %s is set as remote by default.\n",
+ mdt_obd_name(mdt), client, mdt_obd_name(mdt));
+ }
+
+ if (remote) {
+ if (!mdt->mdt_opts.mo_oss_capa) {
+ CDEBUG(D_SEC, "%s: client %s -> target %s is set as "
+ "remote,but OSS capabilities are not enabled: "
+ "%d.\n",
+ mdt_obd_name(mdt), client, mdt_obd_name(mdt),
+ mdt->mdt_opts.mo_oss_capa);
+ RETURN(-EACCES);
+ }
+ } else {
+ if (req->rq_auth_uid == INVALID_UID) {
+ CDEBUG(D_SEC, "%s: client %s -> target %s: user is not "
+ "authenticated!\n",
+ mdt_obd_name(mdt), client, mdt_obd_name(mdt));
+ RETURN(-EACCES);
+ }
+ }
+
+ switch (mdt->mdt_sec_level) {
+ case LUSTRE_SEC_NONE:
+ if (!remote) {
+ mdt_init_sec_none(reply, exp);
+ break;
+ } else {
+ CDEBUG(D_SEC, "%s: client %s -> target %s is set as "
+ "remote, can not run under security level %d.\n",
+ mdt_obd_name(mdt), client, mdt_obd_name(mdt),
+ mdt->mdt_sec_level);
+ RETURN(-EACCES);
+ }
case LUSTRE_SEC_REMOTE:
if (!remote)
mdt_init_sec_none(reply, exp);
int mdt_init_idmap(struct mdt_thread_info *info)
{
- struct ptlrpc_request *req = mdt_info_req(info);
- struct mdt_export_data *med = mdt_req2med(req);
- struct obd_export *exp = req->rq_export;
- char *client = libcfs_nid2str(req->rq_peer.nid);
- struct obd_device *obd = exp->exp_obd;
- int rc = 0;
- ENTRY;
-
- if (exp_connect_rmtclient(exp)) {
+ struct ptlrpc_request *req = mdt_info_req(info);
+ struct mdt_export_data *med = mdt_req2med(req);
+ struct obd_export *exp = req->rq_export;
+ char *client = libcfs_nid2str(req->rq_peer.nid);
+ int rc = 0;
+ ENTRY;
+
+ if (exp_connect_rmtclient(exp)) {
mutex_lock(&med->med_idmap_mutex);
- if (!med->med_idmap)
- med->med_idmap = lustre_idmap_init();
+ if (!med->med_idmap)
+ med->med_idmap = lustre_idmap_init();
mutex_unlock(&med->med_idmap_mutex);
- if (IS_ERR(med->med_idmap)) {
- long err = PTR_ERR(med->med_idmap);
-
- med->med_idmap = NULL;
- CERROR("client %s -> target %s "
- "failed to init idmap [%ld]!\n",
- client, obd->obd_name, err);
- RETURN(err);
- } else if (!med->med_idmap) {
- CERROR("client %s -> target %s "
- "failed to init(2) idmap!\n",
- client, obd->obd_name);
- RETURN(-ENOMEM);
- }
-
- CDEBUG(D_SEC, "client %s -> target %s is remote.\n",
- client, obd->obd_name);
- /* NB, MDS_CONNECT establish root idmap too! */
- rc = mdt_handle_idmap(info);
- }
- RETURN(rc);
+ if (IS_ERR(med->med_idmap)) {
+ long err = PTR_ERR(med->med_idmap);
+
+ med->med_idmap = NULL;
+ CERROR("%s: client %s -> target %s "
+ "failed to init idmap [%ld]!\n",
+ mdt_obd_name(info->mti_mdt), client,
+ mdt_obd_name(info->mti_mdt), err);
+ RETURN(err);
+ } else if (!med->med_idmap) {
+ CERROR("%s: client %s -> target %s "
+ "failed to init(2) idmap!\n",
+ mdt_obd_name(info->mti_mdt), client,
+ mdt_obd_name(info->mti_mdt));
+ RETURN(-ENOMEM);
+ }
+
+ CDEBUG(D_SEC, "%s: client %s -> target %s is remote.\n",
+ mdt_obd_name(info->mti_mdt), client,
+ mdt_obd_name(info->mti_mdt));
+ /* NB, MDS_CONNECT establish root idmap too! */
+ rc = mdt_handle_idmap(info);
+ }
+ RETURN(rc);
}
void mdt_cleanup_idmap(struct mdt_export_data *med)
static int lproc_mdt_attach_rename_seqstat(struct mdt_device *mdt)
{
- struct lu_device *ld = &mdt->mdt_md_dev.md_lu_dev;
- struct obd_device *obd = ld->ld_obd;
int i;
for (i = 0; i < RENAME_LAST; i++)
spin_lock_init(&mdt->mdt_rename_stats.hist[i].oh_lock);
- return lprocfs_obd_seq_create(obd, "rename_stats", 0644,
+ return lprocfs_obd_seq_create(mdt2obd_dev(mdt), "rename_stats", 0644,
&mdt_rename_stats_fops, mdt);
}
rc = mo_attr_get(info->mti_env, mdt_object_child(src), ma);
if (rc) {
CERROR("%s: "DFID" attr_get, rc = %d\n",
- req->rq_export->exp_obd->obd_name,
- PFID(mdt_object_fid(src)), rc);
+ mdt_obd_name(mdt), PFID(mdt_object_fid(src)), rc);
return;
}
rc = mo_attr_get(info->mti_env, mdt_object_child(tgt), ma);
if (rc) {
CERROR("%s: "DFID" attr_get, rc = %d\n",
- req->rq_export->exp_obd->obd_name,
- PFID(mdt_object_fid(tgt)), rc);
+ mdt_obd_name(mdt), PFID(mdt_object_fid(tgt)), rc);
return;
}
int mdt_procfs_init(struct mdt_device *mdt, const char *name)
{
- struct lu_device *ld = &mdt->mdt_md_dev.md_lu_dev;
- struct obd_device *obd = ld->ld_obd;
- struct lprocfs_static_vars lvars;
- int rc;
- ENTRY;
+ struct obd_device *obd = mdt2obd_dev(mdt);
+ struct lprocfs_static_vars lvars;
+ int rc;
+ ENTRY;
- LASSERT(name != NULL);
+ LASSERT(name != NULL);
- lprocfs_mdt_init_vars(&lvars);
- rc = lprocfs_obd_setup(obd, lvars.obd_vars);
- if (rc) {
- CERROR("Can't init lprocfs, rc %d\n", rc);
- return rc;
- }
- ptlrpc_lprocfs_register_obd(obd);
-
- obd->obd_proc_exports_entry = proc_mkdir("exports",
- obd->obd_proc_entry);
- if (obd->obd_proc_exports_entry)
- lprocfs_add_simple(obd->obd_proc_exports_entry,
- "clear", lprocfs_nid_stats_clear_read,
- lprocfs_nid_stats_clear_write, obd, NULL);
- rc = lprocfs_alloc_md_stats(obd, LPROC_MDT_LAST);
+ lprocfs_mdt_init_vars(&lvars);
+ rc = lprocfs_obd_setup(obd, lvars.obd_vars);
+ if (rc) {
+ CERROR("Can't init lprocfs, rc %d\n", rc);
+ return rc;
+ }
+ ptlrpc_lprocfs_register_obd(obd);
+
+ obd->obd_proc_exports_entry = proc_mkdir("exports",
+ obd->obd_proc_entry);
+ if (obd->obd_proc_exports_entry)
+ lprocfs_add_simple(obd->obd_proc_exports_entry,
+ "clear", lprocfs_nid_stats_clear_read,
+ lprocfs_nid_stats_clear_write, obd, NULL);
+ rc = lprocfs_alloc_md_stats(obd, LPROC_MDT_LAST);
if (rc)
return rc;
mdt_stats_counter_init(obd->md_stats);
rc = lprocfs_job_stats_init(obd, LPROC_MDT_LAST,
mdt_stats_counter_init);
- rc = lproc_mdt_attach_rename_seqstat(mdt);
- if (rc)
- CERROR("%s: MDT can not create rename stats rc = %d\n",
- obd->obd_name, rc);
+ rc = lproc_mdt_attach_rename_seqstat(mdt);
+ if (rc)
+ CERROR("%s: MDT can not create rename stats rc = %d\n",
+ mdt_obd_name(mdt), rc);
- RETURN(rc);
+ RETURN(rc);
}
void mdt_procfs_fini(struct mdt_device *mdt)
{
- struct lu_device *ld = &mdt->mdt_md_dev.md_lu_dev;
- struct obd_device *obd = ld->ld_obd;
+ struct obd_device *obd = mdt2obd_dev(mdt);
if (obd->obd_proc_exports_entry) {
lprocfs_remove_proc_entry("clear", obd->obd_proc_exports_entry);
}
static int lprocfs_wr_identity_upcall(struct file *file, const char *buffer,
- unsigned long count, void *data)
+ unsigned long count, void *data)
{
- struct obd_device *obd = data;
- struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
- struct upcall_cache *hash = mdt->mdt_identity_cache;
- int rc;
- char *kernbuf;
-
- if (count >= UC_CACHE_UPCALL_MAXPATH) {
- CERROR("%s: identity upcall too long\n", obd->obd_name);
- return -EINVAL;
- }
- OBD_ALLOC(kernbuf, count + 1);
- if (kernbuf == NULL)
- GOTO(failed, rc = -ENOMEM);
- if (cfs_copy_from_user(kernbuf, buffer, count))
- GOTO(failed, rc = -EFAULT);
-
- /* Remove any extraneous bits from the upcall (e.g. linefeeds) */
+ struct obd_device *obd = data;
+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+ struct upcall_cache *hash = mdt->mdt_identity_cache;
+ int rc;
+ char *kernbuf;
+
+ if (count >= UC_CACHE_UPCALL_MAXPATH) {
+ CERROR("%s: identity upcall too long\n", mdt_obd_name(mdt));
+ return -EINVAL;
+ }
+ OBD_ALLOC(kernbuf, count + 1);
+ if (kernbuf == NULL)
+ GOTO(failed, rc = -ENOMEM);
+ if (cfs_copy_from_user(kernbuf, buffer, count))
+ GOTO(failed, rc = -EFAULT);
+
+ /* Remove any extraneous bits from the upcall (e.g. linefeeds) */
write_lock(&hash->uc_upcall_rwlock);
sscanf(kernbuf, "%s", hash->uc_upcall);
write_unlock(&hash->uc_upcall_rwlock);
- if (strcmp(hash->uc_name, obd->obd_name) != 0)
- CWARN("%s: write to upcall name %s\n",
- obd->obd_name, hash->uc_upcall);
+ if (strcmp(hash->uc_name, mdt_obd_name(mdt)) != 0)
+ CWARN("%s: write to upcall name %s\n",
+ mdt_obd_name(mdt), hash->uc_upcall);
- if (strcmp(hash->uc_upcall, "NONE") == 0 && mdt->mdt_opts.mo_acl)
- CWARN("%s: disable \"identity_upcall\" with ACL enabled maybe "
- "cause unexpected \"EACCESS\"\n", obd->obd_name);
+ if (strcmp(hash->uc_upcall, "NONE") == 0 && mdt->mdt_opts.mo_acl)
+ CWARN("%s: disable \"identity_upcall\" with ACL enabled maybe "
+ "cause unexpected \"EACCESS\"\n", mdt_obd_name(mdt));
- CWARN("%s: identity upcall set to %s\n", obd->obd_name, hash->uc_upcall);
- OBD_FREE(kernbuf, count + 1);
- RETURN(count);
+ CWARN("%s: identity upcall set to %s\n", mdt_obd_name(mdt),
+ hash->uc_upcall);
+ OBD_FREE(kernbuf, count + 1);
+ RETURN(count);
failed:
- if (kernbuf)
- OBD_FREE(kernbuf, count + 1);
- RETURN(rc);
+ if (kernbuf)
+ OBD_FREE(kernbuf, count + 1);
+ RETURN(rc);
}
static int lprocfs_wr_identity_flush(struct file *file, const char *buffer,
}
static int lprocfs_wr_identity_info(struct file *file, const char *buffer,
- unsigned long count, void *data)
+ unsigned long count, void *data)
{
- struct obd_device *obd = data;
- struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
- struct identity_downcall_data *param;
- int size = sizeof(*param), rc, checked = 0;
+ struct obd_device *obd = data;
+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+ struct identity_downcall_data *param;
+ int size = sizeof(*param), rc, checked = 0;
again:
- if (count < size) {
- CERROR("%s: invalid data count = %lu, size = %d\n",
- obd->obd_name, count, size);
- return -EINVAL;
- }
-
- OBD_ALLOC(param, size);
- if (param == NULL)
- return -ENOMEM;
-
- if (cfs_copy_from_user(param, buffer, size)) {
- CERROR("%s: bad identity data\n", obd->obd_name);
- GOTO(out, rc = -EFAULT);
- }
-
- if (checked == 0) {
- checked = 1;
- if (param->idd_magic != IDENTITY_DOWNCALL_MAGIC) {
- CERROR("%s: MDS identity downcall bad params\n",
- obd->obd_name);
- GOTO(out, rc = -EINVAL);
- }
-
- if (param->idd_nperms > N_PERMS_MAX) {
- CERROR("%s: perm count %d more than maximum %d\n",
- obd->obd_name, param->idd_nperms, N_PERMS_MAX);
- GOTO(out, rc = -EINVAL);
- }
-
- if (param->idd_ngroups > NGROUPS_MAX) {
- CERROR("%s: group count %d more than maximum %d\n",
- obd->obd_name, param->idd_ngroups, NGROUPS_MAX);
- GOTO(out, rc = -EINVAL);
- }
-
- if (param->idd_ngroups) {
- rc = param->idd_ngroups; /* save idd_ngroups */
- OBD_FREE(param, size);
- size = offsetof(struct identity_downcall_data,
- idd_groups[rc]);
- goto again;
- }
- }
-
- rc = upcall_cache_downcall(mdt->mdt_identity_cache, param->idd_err,
- param->idd_uid, param);
+ if (count < size) {
+ CERROR("%s: invalid data count = %lu, size = %d\n",
+ mdt_obd_name(mdt), count, size);
+ return -EINVAL;
+ }
+
+ OBD_ALLOC(param, size);
+ if (param == NULL)
+ return -ENOMEM;
+
+ if (cfs_copy_from_user(param, buffer, size)) {
+ CERROR("%s: bad identity data\n", mdt_obd_name(mdt));
+ GOTO(out, rc = -EFAULT);
+ }
+
+ if (checked == 0) {
+ checked = 1;
+ if (param->idd_magic != IDENTITY_DOWNCALL_MAGIC) {
+ CERROR("%s: MDS identity downcall bad params\n",
+ mdt_obd_name(mdt));
+ GOTO(out, rc = -EINVAL);
+ }
+
+ if (param->idd_nperms > N_PERMS_MAX) {
+ CERROR("%s: perm count %d more than maximum %d\n",
+ mdt_obd_name(mdt), param->idd_nperms,
+ N_PERMS_MAX);
+ GOTO(out, rc = -EINVAL);
+ }
+
+ if (param->idd_ngroups > NGROUPS_MAX) {
+ CERROR("%s: group count %d more than maximum %d\n",
+ mdt_obd_name(mdt), param->idd_ngroups,
+ NGROUPS_MAX);
+ GOTO(out, rc = -EINVAL);
+ }
+
+ if (param->idd_ngroups) {
+ rc = param->idd_ngroups; /* save idd_ngroups */
+ OBD_FREE(param, size);
+ size = offsetof(struct identity_downcall_data,
+ idd_groups[rc]);
+ goto again;
+ }
+ }
+
+ rc = upcall_cache_downcall(mdt->mdt_identity_cache, param->idd_err,
+ param->idd_uid, param);
out:
- if (param != NULL)
- OBD_FREE(param, size);
+ if (param != NULL)
+ OBD_FREE(param, size);
- return rc ? rc : count;
+ return rc ? rc : count;
}
/* for debug only */
}
static int lprocfs_wr_capa(struct file *file, const char *buffer,
- unsigned long count, void *data)
+ unsigned long count, void *data)
{
- struct obd_device *obd = data;
- struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
- int val, rc;
-
- rc = lprocfs_write_helper(buffer, count, &val);
- if (rc)
- return rc;
-
- if (val < 0 || val > 3) {
- CERROR("invalid capability mode, only 0/2/3 is accepted.\n"
- " 0: disable fid capability\n"
- " 2: enable MDS fid capability\n"
- " 3: enable both MDS and OSS fid capability\n");
- return -EINVAL;
- }
+ struct obd_device *obd = data;
+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+ int val, rc;
- /* OSS fid capability needs enable both MDS and OSS fid capability on
- * MDS */
- if (val == 1) {
- CERROR("can't enable OSS fid capability only, you should use "
- "'3' to enable both MDS and OSS fid capability.\n");
- return -EINVAL;
- }
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
- mdt->mdt_opts.mo_oss_capa = (val & 0x1);
- mdt->mdt_opts.mo_mds_capa = !!(val & 0x2);
- mdt->mdt_capa_conf = 1;
- LCONSOLE_INFO("MDS %s %s MDS fid capability.\n",
- obd->obd_name,
- mdt->mdt_opts.mo_mds_capa ? "enabled" : "disabled");
- LCONSOLE_INFO("MDS %s %s OSS fid capability.\n",
- obd->obd_name,
- mdt->mdt_opts.mo_oss_capa ? "enabled" : "disabled");
- return count;
+ if (val < 0 || val > 3) {
+ CERROR("invalid capability mode, only 0/2/3 is accepted.\n"
+ " 0: disable fid capability\n"
+ " 2: enable MDS fid capability\n"
+ " 3: enable both MDS and OSS fid capability\n");
+ return -EINVAL;
+ }
+
+ /* OSS fid capability needs enable both MDS and OSS fid capability on
+ * MDS */
+ if (val == 1) {
+ CERROR("can't enable OSS fid capability only, you should use "
+ "'3' to enable both MDS and OSS fid capability.\n");
+ return -EINVAL;
+ }
+
+ mdt->mdt_opts.mo_oss_capa = (val & 0x1);
+ mdt->mdt_opts.mo_mds_capa = !!(val & 0x2);
+ mdt->mdt_capa_conf = 1;
+ LCONSOLE_INFO("MDS %s %s MDS fid capability.\n",
+ mdt_obd_name(mdt),
+ mdt->mdt_opts.mo_mds_capa ? "enabled" : "disabled");
+ LCONSOLE_INFO("MDS %s %s OSS fid capability.\n",
+ mdt_obd_name(mdt),
+ mdt->mdt_opts.mo_oss_capa ? "enabled" : "disabled");
+ return count;
}
static int lprocfs_rd_capa_count(char *page, char **start, off_t off,
}
static int lprocfs_wr_root_squash(struct file *file, const char *buffer,
- unsigned long count, void *data)
+ unsigned long count, void *data)
{
- struct obd_device *obd = data;
- struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
- int rc;
- char kernbuf[50], *tmp, *end, *errmsg;
- unsigned long uid, gid;
- int nouid, nogid;
- ENTRY;
-
- if (count >= sizeof(kernbuf)) {
- errmsg = "string too long";
- GOTO(failed, rc = -EINVAL);
- }
- if (cfs_copy_from_user(kernbuf, buffer, count)) {
- errmsg = "bad address";
- GOTO(failed, rc = -EFAULT);
- }
- kernbuf[count] = '\0';
-
- nouid = nogid = 0;
- if (safe_strtoul(buffer, &tmp, &uid)) {
- uid = mdt->mdt_squash_uid;
- nouid = 1;
- }
-
- /* skip ':' */
- if (*tmp == ':') {
- tmp++;
- if (safe_strtoul(tmp, &end, &gid)) {
- gid = mdt->mdt_squash_gid;
- nogid = 1;
- }
- } else {
- gid = mdt->mdt_squash_gid;
- nogid = 1;
- }
-
- mdt->mdt_squash_uid = uid;
- mdt->mdt_squash_gid = gid;
-
- if (nouid && nogid) {
- errmsg = "needs uid:gid format";
- GOTO(failed, rc = -EINVAL);
- }
-
- LCONSOLE_INFO("%s: root_squash is set to %u:%u\n",
- obd->obd_name,
- mdt->mdt_squash_uid, mdt->mdt_squash_gid);
- RETURN(count);
-
- failed:
- CWARN("%s: failed to set root_squash to \"%s\", %s: rc %d\n",
- obd->obd_name, buffer, errmsg, rc);
- RETURN(rc);
+ struct obd_device *obd = data;
+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+ int rc;
+ char kernbuf[50], *tmp, *end, *errmsg;
+ unsigned long uid, gid;
+ int nouid, nogid;
+ ENTRY;
+
+ if (count >= sizeof(kernbuf)) {
+ errmsg = "string too long";
+ GOTO(failed, rc = -EINVAL);
+ }
+ if (cfs_copy_from_user(kernbuf, buffer, count)) {
+ errmsg = "bad address";
+ GOTO(failed, rc = -EFAULT);
+ }
+ kernbuf[count] = '\0';
+
+ nouid = nogid = 0;
+ if (safe_strtoul(buffer, &tmp, &uid)) {
+ uid = mdt->mdt_squash_uid;
+ nouid = 1;
+ }
+
+ /* skip ':' */
+ if (*tmp == ':') {
+ tmp++;
+ if (safe_strtoul(tmp, &end, &gid)) {
+ gid = mdt->mdt_squash_gid;
+ nogid = 1;
+ }
+ } else {
+ gid = mdt->mdt_squash_gid;
+ nogid = 1;
+ }
+
+ mdt->mdt_squash_uid = uid;
+ mdt->mdt_squash_gid = gid;
+
+ if (nouid && nogid) {
+ errmsg = "needs uid:gid format";
+ GOTO(failed, rc = -EINVAL);
+ }
+
+ LCONSOLE_INFO("%s: root_squash is set to %u:%u\n",
+ mdt_obd_name(mdt),
+ mdt->mdt_squash_uid, mdt->mdt_squash_gid);
+ RETURN(count);
+
+failed:
+ CWARN("%s: failed to set root_squash to \"%s\", %s: rc %d\n",
+ mdt_obd_name(mdt), buffer, errmsg, rc);
+ RETURN(rc);
}
static int lprocfs_rd_nosquash_nids(char *page, char **start, off_t off,
}
static int lprocfs_wr_nosquash_nids(struct file *file, const char *buffer,
- unsigned long count, void *data)
+ unsigned long count, void *data)
{
- struct obd_device *obd = data;
- struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
- int rc;
- char *kernbuf, *errmsg;
- cfs_list_t tmp;
- ENTRY;
-
- OBD_ALLOC(kernbuf, count + 1);
- if (kernbuf == NULL) {
- errmsg = "no memory";
- GOTO(failed, rc = -ENOMEM);
- }
- if (cfs_copy_from_user(kernbuf, buffer, count)) {
- errmsg = "bad address";
- GOTO(failed, rc = -EFAULT);
- }
- kernbuf[count] = '\0';
-
- if (!strcmp(kernbuf, "NONE") || !strcmp(kernbuf, "clear")) {
- /* empty string is special case */
+ struct obd_device *obd = data;
+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+ int rc;
+ char *kernbuf, *errmsg;
+ cfs_list_t tmp;
+ ENTRY;
+
+ OBD_ALLOC(kernbuf, count + 1);
+ if (kernbuf == NULL) {
+ errmsg = "no memory";
+ GOTO(failed, rc = -ENOMEM);
+ }
+ if (cfs_copy_from_user(kernbuf, buffer, count)) {
+ errmsg = "bad address";
+ GOTO(failed, rc = -EFAULT);
+ }
+ kernbuf[count] = '\0';
+
+ if (!strcmp(kernbuf, "NONE") || !strcmp(kernbuf, "clear")) {
+ /* empty string is special case */
down_write(&mdt->mdt_squash_sem);
- if (!cfs_list_empty(&mdt->mdt_nosquash_nids)) {
- cfs_free_nidlist(&mdt->mdt_nosquash_nids);
- OBD_FREE(mdt->mdt_nosquash_str,
- mdt->mdt_nosquash_strlen);
- mdt->mdt_nosquash_str = NULL;
- mdt->mdt_nosquash_strlen = 0;
- }
+ if (!cfs_list_empty(&mdt->mdt_nosquash_nids)) {
+ cfs_free_nidlist(&mdt->mdt_nosquash_nids);
+ OBD_FREE(mdt->mdt_nosquash_str,
+ mdt->mdt_nosquash_strlen);
+ mdt->mdt_nosquash_str = NULL;
+ mdt->mdt_nosquash_strlen = 0;
+ }
up_write(&mdt->mdt_squash_sem);
- LCONSOLE_INFO("%s: nosquash_nids is cleared\n",
- obd->obd_name);
- OBD_FREE(kernbuf, count + 1);
- RETURN(count);
- }
-
- CFS_INIT_LIST_HEAD(&tmp);
- if (cfs_parse_nidlist(kernbuf, count, &tmp) <= 0) {
- errmsg = "can't parse";
- GOTO(failed, rc = -EINVAL);
- }
+ LCONSOLE_INFO("%s: nosquash_nids is cleared\n",
+ mdt_obd_name(mdt));
+ OBD_FREE(kernbuf, count + 1);
+ RETURN(count);
+ }
+
+ CFS_INIT_LIST_HEAD(&tmp);
+ if (cfs_parse_nidlist(kernbuf, count, &tmp) <= 0) {
+ errmsg = "can't parse";
+ GOTO(failed, rc = -EINVAL);
+ }
down_write(&mdt->mdt_squash_sem);
- if (!cfs_list_empty(&mdt->mdt_nosquash_nids)) {
- cfs_free_nidlist(&mdt->mdt_nosquash_nids);
- OBD_FREE(mdt->mdt_nosquash_str, mdt->mdt_nosquash_strlen);
- }
- mdt->mdt_nosquash_str = kernbuf;
- mdt->mdt_nosquash_strlen = count + 1;
- cfs_list_splice(&tmp, &mdt->mdt_nosquash_nids);
-
- LCONSOLE_INFO("%s: nosquash_nids is set to %s\n",
- obd->obd_name, kernbuf);
+ if (!cfs_list_empty(&mdt->mdt_nosquash_nids)) {
+ cfs_free_nidlist(&mdt->mdt_nosquash_nids);
+ OBD_FREE(mdt->mdt_nosquash_str, mdt->mdt_nosquash_strlen);
+ }
+ mdt->mdt_nosquash_str = kernbuf;
+ mdt->mdt_nosquash_strlen = count + 1;
+ cfs_list_splice(&tmp, &mdt->mdt_nosquash_nids);
+
+ LCONSOLE_INFO("%s: nosquash_nids is set to %s\n",
+ mdt_obd_name(mdt), kernbuf);
up_write(&mdt->mdt_squash_sem);
- RETURN(count);
-
- failed:
- CWARN("%s: failed to set nosquash_nids to \"%s\", %s: rc %d\n",
- obd->obd_name, kernbuf, errmsg, rc);
- if (kernbuf)
- OBD_FREE(kernbuf, count + 1);
- RETURN(rc);
+ RETURN(count);
+
+failed:
+ CWARN("%s: failed to set nosquash_nids to \"%s\", %s: rc %d\n",
+ mdt_obd_name(mdt), kernbuf, errmsg, rc);
+ if (kernbuf)
+ OBD_FREE(kernbuf, count + 1);
+ RETURN(rc);
}
static int lprocfs_rd_mdt_som(char *page, char **start, off_t off,
/* Temporary; for testing purposes only */
static int lprocfs_mdt_wr_mdc(struct file *file, const char *buffer,
- unsigned long count, void *data)
+ unsigned long count, void *data)
{
- struct obd_device *obd = data;
- struct obd_export *exp = NULL;
- struct obd_uuid *uuid;
- char *kbuf;
- char *tmpbuf;
-
- OBD_ALLOC(kbuf, UUID_MAX);
- if (kbuf == NULL)
- return -ENOMEM;
-
- /*
- * OBD_ALLOC() will zero kbuf, but we only copy UUID_MAX - 1
- * bytes into kbuf, to ensure that the string is NUL-terminated.
- * UUID_MAX should include a trailing NUL already.
- */
- if (cfs_copy_from_user(kbuf, buffer,
- min_t(unsigned long, UUID_MAX - 1, count))) {
- count = -EFAULT;
- goto out;
- }
- tmpbuf = cfs_firststr(kbuf, min_t(unsigned long, UUID_MAX - 1, count));
-
- OBD_ALLOC(uuid, UUID_MAX);
- if (uuid == NULL) {
- count = -ENOMEM;
- goto out;
- }
-
- obd_str2uuid(uuid, tmpbuf);
- exp = cfs_hash_lookup(obd->obd_uuid_hash, uuid);
- if (exp == NULL) {
- CERROR("%s: no export %s found\n",
- obd->obd_name, obd_uuid2str(uuid));
- } else {
- mdt_hsm_copytool_send(exp);
- class_export_put(exp);
- }
-
- OBD_FREE(uuid, UUID_MAX);
+ struct obd_device *obd = data;
+ struct obd_export *exp = NULL;
+ struct obd_uuid *uuid;
+ char *kbuf;
+ char *tmpbuf;
+
+ OBD_ALLOC(kbuf, UUID_MAX);
+ if (kbuf == NULL)
+ return -ENOMEM;
+
+ /*
+ * OBD_ALLOC() will zero kbuf, but we only copy UUID_MAX - 1
+ * bytes into kbuf, to ensure that the string is NUL-terminated.
+ * UUID_MAX should include a trailing NUL already.
+ */
+ if (cfs_copy_from_user(kbuf, buffer,
+ min_t(unsigned long, UUID_MAX - 1, count))) {
+ count = -EFAULT;
+ goto out;
+ }
+ tmpbuf = cfs_firststr(kbuf, min_t(unsigned long, UUID_MAX - 1, count));
+
+ OBD_ALLOC(uuid, UUID_MAX);
+ if (uuid == NULL) {
+ count = -ENOMEM;
+ goto out;
+ }
+
+ obd_str2uuid(uuid, tmpbuf);
+ exp = cfs_hash_lookup(obd->obd_uuid_hash, uuid);
+ if (exp == NULL) {
+ CERROR("%s: no export %s found\n",
+ obd->obd_name, obd_uuid2str(uuid));
+ } else {
+ mdt_hsm_copytool_send(exp);
+ class_export_put(exp);
+ }
+
+ OBD_FREE(uuid, UUID_MAX);
out:
- OBD_FREE(kbuf, UUID_MAX);
- return count;
+ OBD_FREE(kbuf, UUID_MAX);
+ return count;
}
static int lprocfs_rd_enable_remote_dir(char *page, char **start, off_t off,
if (lvblen < rc) {
CERROR("%s: expected %d actual %d.\n",
- info->mti_exp->exp_obd->obd_name, rc, lvblen);
+ mdt_obd_name(mdt), rc, lvblen);
GOTO(out, rc = -ERANGE);
}
struct obd_export *exp = req->rq_export;
CERROR("%s: replay trans "LPU64" NID %s: rc = %d\n",
- mdt->mdt_md_dev.md_lu_dev.ld_obd->obd_name,
- info->mti_transno,
- libcfs_nid2str(exp->exp_connection->c_peer.nid),
- rc);
+ mdt_obd_name(mdt), info->mti_transno,
+ libcfs_nid2str(exp->exp_connection->c_peer.nid),
+ rc);
RETURN_EXIT;
}
} else if (info->mti_transno == 0) {
}
spin_unlock(&mdt->mdt_lut.lut_translock);
- CDEBUG(D_INODE, "transno = "LPU64", last_committed = "LPU64"\n",
- info->mti_transno,
- req->rq_export->exp_obd->obd_last_committed);
+ CDEBUG(D_INODE, "transno = "LPU64", last_committed = "LPU64"\n",
+ info->mti_transno,
+ req->rq_export->exp_obd->obd_last_committed);
- req->rq_transno = info->mti_transno;
- lustre_msg_set_transno(req->rq_repmsg, info->mti_transno);
+ req->rq_transno = info->mti_transno;
+ lustre_msg_set_transno(req->rq_repmsg, info->mti_transno);
- /* update lcd in memory only for resent cases */
- ted = &req->rq_export->exp_target_data;
- LASSERT(ted);
+ /* update lcd in memory only for resent cases */
+ ted = &req->rq_export->exp_target_data;
+ LASSERT(ted);
mutex_lock(&ted->ted_lcd_lock);
- lcd = ted->ted_lcd;
+ lcd = ted->ted_lcd;
if (info->mti_transno < lcd->lcd_last_transno &&
info->mti_transno != 0) {
/* This should happen during replay. Do not update
* be checked correctly by xid */
mutex_unlock(&ted->ted_lcd_lock);
CDEBUG(D_HA, "%s: transno = "LPU64" < last_transno = "LPU64"\n",
- mdt->mdt_md_dev.md_lu_dev.ld_obd->obd_name,
- info->mti_transno, lcd->lcd_last_transno);
+ mdt_obd_name(mdt), info->mti_transno,
+ lcd->lcd_last_transno);
RETURN_EXIT;
}
if (mdt_object_remote(o)) {
CDEBUG(D_INFO, "%s: "DFID" is on remote MDT.\n",
- info->mti_mdt->mdt_md_dev.md_lu_dev.ld_obd->obd_name,
+ mdt_obd_name(info->mti_mdt),
PFID(rr->rr_fid2));
GOTO(out, rc = -EREMOTE);
} else if (!mdt_object_exists(o)) {
CLASSERT(offsetof(struct lsd_client_data, lcd_padding) +
sizeof(lcd->lcd_padding) == LR_CLIENT_SIZE);
- rc = server_name2index(obd->obd_name, &index, NULL);
+ rc = server_name2index(mdt_obd_name(mdt), &index, NULL);
if (rc < 0) {
CERROR("%s: Can not get index from obd_name: rc = %d\n",
- obd->obd_name, rc);
+ mdt_obd_name(mdt), rc);
RETURN(rc);
}
if (rc)
RETURN(rc);
- last_rcvd_size = (unsigned long)la->la_size;
-
- if (last_rcvd_size == 0) {
- LCONSOLE_WARN("%s: new disk, initializing\n", obd->obd_name);
-
- memcpy(lsd->lsd_uuid, obd->obd_uuid.uuid,
- sizeof(lsd->lsd_uuid));
- lsd->lsd_last_transno = 0;
- lsd->lsd_mount_count = 0;
- lsd->lsd_server_size = LR_SERVER_SIZE;
- lsd->lsd_client_start = LR_CLIENT_START;
- lsd->lsd_client_size = LR_CLIENT_SIZE;
- lsd->lsd_feature_compat = OBD_COMPAT_MDT;
- lsd->lsd_feature_rocompat = OBD_ROCOMPAT_LOVOBJID;
+ last_rcvd_size = (unsigned long)la->la_size;
+
+ if (last_rcvd_size == 0) {
+ LCONSOLE_WARN("%s: new disk, initializing\n",
+ mdt_obd_name(mdt));
+
+ memcpy(lsd->lsd_uuid, obd->obd_uuid.uuid,
+ sizeof(lsd->lsd_uuid));
+ lsd->lsd_last_transno = 0;
+ lsd->lsd_mount_count = 0;
+ lsd->lsd_server_size = LR_SERVER_SIZE;
+ lsd->lsd_client_start = LR_CLIENT_START;
+ lsd->lsd_client_size = LR_CLIENT_SIZE;
+ lsd->lsd_feature_compat = OBD_COMPAT_MDT;
+ lsd->lsd_feature_rocompat = OBD_ROCOMPAT_LOVOBJID;
lsd->lsd_feature_incompat = OBD_INCOMPAT_MDT |
OBD_INCOMPAT_COMMON_LR |
OBD_INCOMPAT_MULTI_OI;
lsd->lsd_osd_index = index;
} else {
- LCONSOLE_WARN("%s: used disk, loading\n", obd->obd_name);
+ LCONSOLE_WARN("%s: used disk, loading\n", mdt_obd_name(mdt));
rc = tgt_server_data_read(env, &mdt->mdt_lut);
- if (rc) {
- CERROR("error reading MDS %s: rc %d\n", LAST_RCVD, rc);
- GOTO(out, rc);
- }
- if (strcmp(lsd->lsd_uuid, obd->obd_uuid.uuid) != 0) {
- LCONSOLE_ERROR_MSG(0x157, "Trying to start OBD %s using"
- "the wrong disk %s. Were the /dev/ "
- "assignments rearranged?\n",
- obd->obd_uuid.uuid, lsd->lsd_uuid);
- GOTO(out, rc = -EINVAL);
- }
- lsd->lsd_feature_compat |= OBD_COMPAT_MDT;
- lsd->lsd_feature_incompat |= OBD_INCOMPAT_MDT |
- OBD_INCOMPAT_COMMON_LR;
+ if (rc) {
+ CERROR("error reading MDS %s: rc %d\n", LAST_RCVD, rc);
+ GOTO(out, rc);
+ }
+ if (strcmp(lsd->lsd_uuid, obd->obd_uuid.uuid) != 0) {
+ LCONSOLE_ERROR_MSG(0x157, "Trying to start OBD %s using"
+ "the wrong disk %s. Were the /dev/ "
+ "assignments rearranged?\n",
+ obd->obd_uuid.uuid, lsd->lsd_uuid);
+ GOTO(out, rc = -EINVAL);
+ }
+ lsd->lsd_feature_compat |= OBD_COMPAT_MDT;
+ lsd->lsd_feature_incompat |= OBD_INCOMPAT_MDT |
+ OBD_INCOMPAT_COMMON_LR;
if (lsd->lsd_osd_index != index) {
LCONSOLE_ERROR_MSG(0x157, "%s: index %d in last rcvd is"
"different with the index %d in"
"config log, It might be disk"
- "corruption!\n", obd->obd_name,
+ "corruption!\n", mdt_obd_name(mdt),
lsd->lsd_osd_index, index);
GOTO(out, rc = -EINVAL);
}
}
- mount_count = lsd->lsd_mount_count;
+ mount_count = lsd->lsd_mount_count;
- if (lsd->lsd_feature_incompat & ~MDT_INCOMPAT_SUPP) {
- CERROR("%s: unsupported incompat filesystem feature(s) %x\n",
- obd->obd_name,
- lsd->lsd_feature_incompat & ~MDT_INCOMPAT_SUPP);
- GOTO(out, rc = -EINVAL);
- }
- if (lsd->lsd_feature_rocompat & ~MDT_ROCOMPAT_SUPP) {
- CERROR("%s: unsupported read-only filesystem feature(s) %x\n",
- obd->obd_name,
- lsd->lsd_feature_rocompat & ~MDT_ROCOMPAT_SUPP);
- /* XXX: Do something like remount filesystem read-only */
- GOTO(out, rc = -EINVAL);
- }
- /** Interop: evict all clients at first boot with 1.8 last_rcvd */
- if (!(lsd->lsd_feature_compat & OBD_COMPAT_20)) {
- if (last_rcvd_size > lsd->lsd_client_start) {
- LCONSOLE_WARN("Mounting %s at first time on 1.8 FS, "
- "remove all clients for interop needs\n",
- obd->obd_name);
+ if (lsd->lsd_feature_incompat & ~MDT_INCOMPAT_SUPP) {
+ CERROR("%s: unsupported incompat filesystem feature(s) %x\n",
+ mdt_obd_name(mdt),
+ lsd->lsd_feature_incompat & ~MDT_INCOMPAT_SUPP);
+ GOTO(out, rc = -EINVAL);
+ }
+ if (lsd->lsd_feature_rocompat & ~MDT_ROCOMPAT_SUPP) {
+ CERROR("%s: unsupported read-only filesystem feature(s) %x\n",
+ mdt_obd_name(mdt),
+ lsd->lsd_feature_rocompat & ~MDT_ROCOMPAT_SUPP);
+ /* XXX: Do something like remount filesystem read-only */
+ GOTO(out, rc = -EINVAL);
+ }
+ /** Interop: evict all clients at first boot with 1.8 last_rcvd */
+ if (!(lsd->lsd_feature_compat & OBD_COMPAT_20)) {
+ if (last_rcvd_size > lsd->lsd_client_start) {
+ LCONSOLE_WARN("Mounting %s at first time on 1.8 FS, "
+ "remove all clients for interop needs\n",
+ mdt_obd_name(mdt));
rc = tgt_truncate_last_rcvd(env, &mdt->mdt_lut,
lsd->lsd_client_start);
if (rc)
GOTO(out, rc);
- last_rcvd_size = lsd->lsd_client_start;
- }
- /** set 2.0 flag to upgrade/downgrade between 1.8 and 2.0 */
- lsd->lsd_feature_compat |= OBD_COMPAT_20;
- }
+ last_rcvd_size = lsd->lsd_client_start;
+ }
+ /** set 2.0 flag to upgrade/downgrade between 1.8 and 2.0 */
+ lsd->lsd_feature_compat |= OBD_COMPAT_20;
+ }
- lsd->lsd_feature_incompat |= OBD_INCOMPAT_FID;
+ lsd->lsd_feature_incompat |= OBD_INCOMPAT_FID;
spin_lock(&mdt->mdt_lut.lut_translock);
mdt->mdt_lut.lut_last_transno = lsd->lsd_last_transno;
spin_unlock(&mdt->mdt_lut.lut_translock);
- CDEBUG(D_INODE, "========BEGIN DUMPING LAST_RCVD========\n");
- CDEBUG(D_INODE, "%s: server last_transno: "LPU64"\n",
- obd->obd_name, mdt->mdt_lut.lut_last_transno);
- CDEBUG(D_INODE, "%s: server mount_count: "LPU64"\n",
- obd->obd_name, mount_count + 1);
- CDEBUG(D_INODE, "%s: server data size: %u\n",
- obd->obd_name, lsd->lsd_server_size);
- CDEBUG(D_INODE, "%s: per-client data start: %u\n",
- obd->obd_name, lsd->lsd_client_start);
- CDEBUG(D_INODE, "%s: per-client data size: %u\n",
- obd->obd_name, lsd->lsd_client_size);
- CDEBUG(D_INODE, "%s: last_rcvd size: %lu\n",
- obd->obd_name, last_rcvd_size);
- CDEBUG(D_INODE, "%s: last_rcvd clients: %lu\n", obd->obd_name,
- last_rcvd_size <= lsd->lsd_client_start ? 0 :
- (last_rcvd_size - lsd->lsd_client_start) /
- lsd->lsd_client_size);
- CDEBUG(D_INODE, "========END DUMPING LAST_RCVD========\n");
+ CDEBUG(D_INODE, "=======,=BEGIN DUMPING LAST_RCVD========\n");
+ CDEBUG(D_INODE, "%s: server last_transno: "LPU64"\n",
+ mdt_obd_name(mdt), mdt->mdt_lut.lut_last_transno);
+ CDEBUG(D_INODE, "%s: server mount_count: "LPU64"\n",
+ mdt_obd_name(mdt), mount_count + 1);
+ CDEBUG(D_INODE, "%s: server data size: %u\n",
+ mdt_obd_name(mdt), lsd->lsd_server_size);
+ CDEBUG(D_INODE, "%s: per-client data start: %u\n",
+ mdt_obd_name(mdt), lsd->lsd_client_start);
+ CDEBUG(D_INODE, "%s: per-client data size: %u\n",
+ mdt_obd_name(mdt), lsd->lsd_client_size);
+ CDEBUG(D_INODE, "%s: last_rcvd size: %lu\n",
+ mdt_obd_name(mdt), last_rcvd_size);
+ CDEBUG(D_INODE, "%s: last_rcvd clients: %lu\n", mdt_obd_name(mdt),
+ last_rcvd_size <= lsd->lsd_client_start ? 0 :
+ (last_rcvd_size - lsd->lsd_client_start) /
+ lsd->lsd_client_size);
+ CDEBUG(D_INODE, "========END DUMPING LAST_RCVD========\n");
if (!lsd->lsd_server_size || !lsd->lsd_client_start ||
!lsd->lsd_client_size) {
err = tgt_server_data_write(mti->mti_env, tg, th);
} else if (off <= 0) {
CERROR("%s: client idx %d has offset %lld\n",
- mdt2obd_dev(mdt)->obd_name, ted->ted_lr_idx, off);
+ mdt_obd_name(mdt), ted->ted_lr_idx, off);
mutex_unlock(&ted->ted_lcd_lock);
err = -EINVAL;
} else {
" permitted for administrator or"
" set mdt_enable_remote_dir_gid:"
" rc = %d\n",
- mdt2obd_dev(mdt)->obd_name,
- -EPERM);
+ mdt_obd_name(mdt), -EPERM);
GOTO(out_put_child, rc = -EPERM);
}
}
CERROR("%s: remote dir is only permitted on"
" MDT0 or set_param"
" mdt.*.enable_remote_dir=1\n",
- mdt2obd_dev(mdt)->obd_name);
+ mdt_obd_name(mdt));
GOTO(out_put_child, rc = -EPERM);
}
if (!mdt_is_dne_client(mdt_info_req(info)->rq_export)) {
break;
default:
CERROR("%s: Unsupported mode %o\n",
- mdt2obd_dev(info->mti_mdt)->obd_name,
+ mdt_obd_name(info->mti_mdt),
info->mti_attr.ma_attr.la_mode);
RETURN(err_serious(-EOPNOTSUPP));
}
if (!fid_is_zero(rr->rr_fid2)) {
CDEBUG(D_INFO, "%s: name %s can not find "DFID"\n",
- mdt2obd_dev(info->mti_mdt)->obd_name,
+ mdt_obd_name(info->mti_mdt),
(char *)rr->rr_name, PFID(mdt_object_fid(mc)));
GOTO(put_child, rc = -ENOENT);
}
CDEBUG(D_INFO, "%s: name %s: "DFID" is another MDT\n",
- mdt2obd_dev(info->mti_mdt)->obd_name,
+ mdt_obd_name(info->mti_mdt),
(char *)rr->rr_name, PFID(mdt_object_fid(mc)));
if (!mdt_is_dne_client(req->rq_export))
if (!md_capable(uc, CFS_CAP_SYS_ADMIN)) {
CERROR("%s: unlink remote entry is only "
"permitted for administrator: rc = %d\n",
- mdt2obd_dev(info->mti_mdt)->obd_name,
+ mdt_obd_name(info->mti_mdt),
-EPERM);
GOTO(put_child, rc = -EPERM);
}
GOTO(unlock_child, rc = -EREMOTE);
} else if (info->mti_spec.sp_rm_entry) {
CERROR("%s: lfs rmdir should not be used on local dir %s\n",
- mdt2obd_dev(info->mti_mdt)->obd_name,
+ mdt_obd_name(info->mti_mdt),
(char *)rr->rr_name);
GOTO(put_child, rc = -EPERM);
}
if (rc)
GOTO(out_unlock, rc);
- if (unlikely(!(valid & OBD_MD_FLCTIME))) {
- /* This isn't strictly an error, but all current clients
- * should set OBD_MD_FLCTIME when setting attributes. */
- CWARN("%s: client miss to set OBD_MD_FLCTIME when "
- "setxattr %s: [object "DFID"] [valid "LPU64"]\n",
- info->mti_exp->exp_obd->obd_name, xattr_name,
- PFID(rr->rr_fid1), valid);
- attr->la_ctime = cfs_time_current_sec();
- }
+ if (unlikely(!(valid & OBD_MD_FLCTIME))) {
+ /* This isn't strictly an error, but all current clients
+ * should set OBD_MD_FLCTIME when setting attributes. */
+ CWARN("%s: client miss to set OBD_MD_FLCTIME when "
+ "setxattr %s: [object "DFID"] [valid "LPU64"]\n",
+ mdt_obd_name(info->mti_mdt), xattr_name,
+ PFID(rr->rr_fid1), valid);
+ attr->la_ctime = cfs_time_current_sec();
+ }
attr->la_valid = LA_CTIME;
child = mdt_object_child(obj);
if (valid & OBD_MD_FLXATTR) {