* File join has been disabled in this release, refer to Bugzilla 16929.
Severity : normal
+Frequency : start MDS on uncleanly shutdowned MDS device
+Bugzilla : 16839
+Descriptoin: ll_sync thread stay in waiting mds<>ost recovery finished
+Details : stay in waiting mds<>ost recovery finished produce random bugs
+ due race between two ll_sync thread for one lov target. send
+ ACTIVATE event only if connect realy finished and import have
+ FULL state.
+
+Severity : normal
Frequency : rare, connect and disconnect target at same time
Bugzilla : 17310
Descriptoin: ASSERTION(atomic_read(&imp->imp_inflight) == 0
CERROR("target %s not set up\n", mdc->obd_name);
rc = -EINVAL;
} else {
- struct lustre_handle *conn = &desc->cl_conn;
struct obd_connect_data *ocd;
CDEBUG(D_CONFIG, "connect to %s(%s)\n",
OBD_CONNECT_MDS_MDS |
OBD_CONNECT_FID |
OBD_CONNECT_AT;
- rc = obd_connect(env, conn, mdc, &mdc->obd_uuid, ocd, NULL);
+ rc = obd_connect(env, &desc->cl_exp, mdc, &mdc->obd_uuid, ocd, NULL);
OBD_FREE_PTR(ocd);
if (rc) {
CERROR("target %s connect error %d\n",
mdc->obd_name, rc);
} else {
- desc->cl_exp = class_conn2export(conn);
/* set seq controller export for MDC0 if exists */
if (mc->mc_num == 0)
ms->ms_control_exp =
#include <md_object.h>
struct mdc_cli_desc {
- struct lustre_handle cl_conn;
/* uuid of remote MDT to connect */
struct obd_uuid cl_srv_uuid;
/* mdc uuid */
int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg);
int client_obd_cleanup(struct obd_device *obddev);
int client_connect_import(const struct lu_env *env,
- struct lustre_handle *conn, struct obd_device *obd,
+ struct obd_export **exp, struct obd_device *obd,
struct obd_uuid *cluuid, struct obd_connect_data *,
void *localdata);
int client_disconnect_export(struct obd_export *exp);
* Events signalled through obd_notify() upcall-chain.
*/
enum obd_notify_event {
+ /* Device connect start */
+ OBD_NOTIFY_CONNECT,
/* Device activated */
OBD_NOTIFY_ACTIVE,
/* Device deactivated */
* granted by the target, which are guaranteed to be a subset of flags
* asked for. If @ocd == NULL, use default parameters. */
int (*o_connect)(const struct lu_env *env,
- struct lustre_handle *conn, struct obd_device *src,
+ struct obd_export **exp, struct obd_device *src,
struct obd_uuid *cluuid, struct obd_connect_data *ocd,
void *localdata);
int (*o_reconnect)(const struct lu_env *env,
}
static inline int obd_connect(const struct lu_env *env,
- struct lustre_handle *conn,struct obd_device *obd,
+ struct obd_export **exp,struct obd_device *obd,
struct obd_uuid *cluuid,
struct obd_connect_data *d,
void *localdata)
OBD_CHECK_DT_OP(obd, connect, -EOPNOTSUPP);
OBD_COUNTER_INCREMENT(obd, connect);
- rc = OBP(obd, connect)(env, conn, obd, cluuid, d, localdata);
+ rc = OBP(obd, connect)(env, exp, obd, cluuid, d, localdata);
/* check that only subset is granted */
LASSERT(ergo(d != NULL,
(d->ocd_connect_flags & ocf) == d->ocd_connect_flags));
/* ->o_connect() method for client side (OSC and MDC and MGC) */
int client_connect_import(const struct lu_env *env,
- struct lustre_handle *dlm_handle,
+ struct obd_export **exp,
struct obd_device *obd, struct obd_uuid *cluuid,
struct obd_connect_data *data, void *localdata)
{
struct client_obd *cli = &obd->u.cli;
struct obd_import *imp = cli->cl_import;
- struct obd_export *exp;
struct obd_connect_data *ocd;
struct ldlm_namespace *to_be_freed = NULL;
+ struct lustre_handle conn = { 0 };
int rc;
ENTRY;
+ *exp = NULL;
down_write(&cli->cl_sem);
- rc = class_connect(dlm_handle, obd, cluuid);
+ rc = class_connect(&conn, obd, cluuid);
if (rc)
GOTO(out_sem, rc);
+ *exp = class_conn2export(&conn);
+
cli->cl_conn_count++;
if (cli->cl_conn_count > 1)
GOTO(out_sem, rc);
- exp = class_conn2export(dlm_handle);
if (obd->obd_namespace != NULL)
CERROR("already have namespace!\n");
if (obd->obd_namespace == NULL)
GOTO(out_disco, rc = -ENOMEM);
- imp->imp_dlm_handle = *dlm_handle;
+ imp->imp_dlm_handle = conn;
rc = ptlrpc_init_import(imp);
if (rc != 0)
GOTO(out_ldlm, rc);
LASSERT (imp->imp_state == LUSTRE_IMP_DISCON);
GOTO(out_ldlm, rc);
}
- LASSERT(exp->exp_connection);
+ LASSERT((*exp)->exp_connection);
if (data) {
LASSERTF((ocd->ocd_connect_flags & data->ocd_connect_flags) ==
obd->obd_namespace = NULL;
out_disco:
cli->cl_conn_count--;
- class_disconnect(exp);
- } else {
- class_export_put(exp);
+ class_disconnect(*exp);
+ *exp = NULL;
}
out_sem:
up_write(&cli->cl_sem);
} else {
dont_check_exports:
rc = obd_connect(req->rq_svc_thread->t_env,
- &conn, target, &cluuid, data,
+ &export, target, &cluuid, data,
client_nid);
+ if (rc == 0)
+ conn.cookie = export->exp_handle.h_cookie;
}
} else {
rc = obd_reconnect(req->rq_svc_thread->t_env,
export, target, &cluuid, data, client_nid);
+ if (rc == 0)
+ /* prevous done via class_conn2export */
+ class_export_get(export);
}
if (rc)
GOTO(out, rc);
lustre_msg_set_handle(req->rq_repmsg, &conn);
- /* ownership of this export ref transfers to the request AFTER we
- * drop any previous reference the request had, but we don't want
- * that to go to zero before we get our new export reference. */
- export = class_conn2export(&conn);
- if (!export) {
- DEBUG_REQ(D_ERROR, req, "Missing export!");
- GOTO(out, rc = -ENODEV);
- }
-
/* If the client and the server are the same node, we will already
* have an export that really points to the client's DLM export,
* because we have a shared handles table.
struct lustre_cfg *lcfg;
char *peer = "MGS_UUID";
struct obd_device *obd;
- struct lustre_handle mgc_conn = {0, };
struct obd_export *exp;
char *name = "mgc_dev";
class_uuid_t uuid;
#endif
ocd->ocd_version = LUSTRE_VERSION_CODE;
- rc = obd_connect(NULL, &mgc_conn, obd, &mgc_uuid, ocd, NULL);
+ rc = obd_connect(NULL, &exp, obd, &mgc_uuid, ocd, NULL);
if (rc) {
CERROR("cannot connect to %s at %s: rc = %d\n",
LUSTRE_MGS_OBDNAME, mgsnid, rc);
GOTO(out_cleanup, rc);
}
- exp = class_conn2export(&mgc_conn);
-
ctxt = llog_get_context(exp->exp_obd, LLOG_CONFIG_REPL_CTXT);
cfg->cfg_flags |= CFG_F_COMPAT146;
rc = class_config_parse_llog(ctxt, profile, cfg);
struct obd_statfs osfs;
static struct qstr noname = { NULL, 0, 0 };
struct ptlrpc_request *request = NULL;
- struct lustre_handle md_conn = {0, };
- struct lustre_handle dt_conn = {0, };
struct lustre_md md;
class_uuid_t uuid;
struct config_llog_instance cfg = {0, };
ocd.ocd_version = LUSTRE_VERSION_CODE;
/* setup mdc */
- err = obd_connect(NULL, &md_conn, obd, &sbi->ll_sb_uuid, &ocd, NULL);
+ err = obd_connect(NULL, &sbi->ll_md_exp, obd, &sbi->ll_sb_uuid, &ocd, NULL);
if (err) {
CERROR("cannot connect to %s: rc = %d\n", mdc, err);
GOTO(out_free, err);
}
- sbi->ll_md_exp = class_conn2export(&md_conn);
err = obd_statfs(obd, &osfs, 100000000, 0);
if (err)
OBD_CONNECT_VERSION | OBD_CONNECT_TRUNCLOCK |
OBD_CONNECT_FID | OBD_CONNECT_AT;
ocd.ocd_version = LUSTRE_VERSION_CODE;
- err = obd_connect(NULL, &dt_conn, obd, &sbi->ll_sb_uuid, &ocd, NULL);
+ err = obd_connect(NULL, &sbi->ll_dt_exp, obd, &sbi->ll_sb_uuid, &ocd, NULL);
if (err) {
CERROR("cannot connect to %s: rc = %d\n", osc, err);
GOTO(out_md, err);
}
- sbi->ll_dt_exp = class_conn2export(&dt_conn);
sbi->ll_lco.lco_flags = ocd.ocd_connect_flags;
sbi->ll_lco.lco_md_exp = sbi->ll_md_exp;
sbi->ll_lco.lco_dt_exp = sbi->ll_dt_exp;
struct obd_capa *oc = NULL;
struct obd_statfs osfs;
struct ptlrpc_request *request = NULL;
- struct lustre_handle dt_conn = {0, };
- struct lustre_handle md_conn = {0, };
struct obd_connect_data *data = NULL;
struct obd_uuid *uuid;
struct lustre_md lmd;
if (sbi->ll_flags & LL_SBI_RMT_CLIENT)
data->ocd_connect_flags |= OBD_CONNECT_RMT_CLIENT_FORCE;
- err = obd_connect(NULL, &md_conn, obd, &sbi->ll_sb_uuid, data, NULL);
+ err = obd_connect(NULL, &sbi->ll_md_exp, obd, &sbi->ll_sb_uuid, data, NULL);
if (err == -EBUSY) {
LCONSOLE_ERROR_MSG(0x14f, "An MDT (md %s) is performing "
"recovery, of which this client is not a "
CERROR("cannot connect to %s: rc = %d\n", md, err);
GOTO(out, err);
}
- sbi->ll_md_exp = class_conn2export(&md_conn);
err = obd_fid_init(sbi->ll_md_exp);
if (err) {
obd->obd_upcall.onu_upcall = cl_ocd_update;
data->ocd_brw_size = PTLRPC_MAX_BRW_PAGES << CFS_PAGE_SHIFT;
- err = obd_connect(NULL, &dt_conn, obd, &sbi->ll_sb_uuid, data, NULL);
+ err = obd_connect(NULL, &sbi->ll_dt_exp, obd, &sbi->ll_sb_uuid, data, NULL);
if (err == -EBUSY) {
LCONSOLE_ERROR_MSG(0x150, "An OST (dt %s) is performing "
"recovery, of which this client is not a "
GOTO(out_md_fid, err);
}
- sbi->ll_dt_exp = class_conn2export(&dt_conn);
-
err = obd_fid_init(sbi->ll_dt_exp);
if (err) {
CERROR("Can't init data layer FID infrastructure, "
* caller that everything is okay. Real connection will be performed later.
*/
static int lmv_connect(const struct lu_env *env,
- struct lustre_handle *conn, struct obd_device *obd,
+ struct obd_export **exp, struct obd_device *obd,
struct obd_uuid *cluuid, struct obd_connect_data *data,
void *localdata)
{
struct proc_dir_entry *lmv_proc_dir;
#endif
struct lmv_obd *lmv = &obd->u.lmv;
- struct obd_export *exp;
+ struct lustre_handle conn = { 0 };
int rc = 0;
ENTRY;
- rc = class_connect(conn, obd, cluuid);
- if (rc) {
- CERROR("class_connection() returned %d\n", rc);
- RETURN(rc);
- }
-
- exp = class_conn2export(conn);
-
/*
* We don't want to actually do the underlying connections more than
* once, so keep track.
*/
lmv->refcount++;
if (lmv->refcount > 1) {
- class_export_put(exp);
+ *exp = NULL;
RETURN(0);
}
- lmv->exp = exp;
+ rc = class_connect(&conn, obd, cluuid);
+ if (rc) {
+ CERROR("class_connection() returned %d\n", rc);
+ RETURN(rc);
+ }
+
+ *exp = class_conn2export(&conn);
+ class_export_get(*exp);
+
+ lmv->exp = *exp;
lmv->connected = 0;
lmv->cluuid = *cluuid;
struct obd_uuid *cluuid = &lmv->cluuid;
struct obd_connect_data *mdc_data = NULL;
struct obd_uuid lmv_mdc_uuid = { "LMV_MDC_UUID" };
- struct lustre_handle conn = {0, };
struct obd_device *mdc_obd;
struct obd_export *mdc_exp;
struct lu_fld_target target;
RETURN(-EINVAL);
}
- rc = obd_connect(NULL, &conn, mdc_obd, &lmv_mdc_uuid,
+ rc = obd_connect(NULL, &mdc_exp, mdc_obd, &lmv_mdc_uuid,
&lmv->conn_data, NULL);
if (rc) {
CERROR("target %s connect error %d\n", tgt->ltd_uuid.uuid, rc);
RETURN(rc);
}
- mdc_exp = class_conn2export(&conn);
-
/*
* Init fid sequence client for this mdc and add new fld target.
*/
struct obd_uuid tgt_uuid;
struct obd_device *tgt_obd;
struct obd_uuid lov_osc_uuid = { "LOV_OSC_UUID" };
- struct lustre_handle conn = {0, };
struct obd_import *imp;
#ifdef __KERNEL__
ptlrpc_activate_import(imp);
}
+ rc = obd_register_observer(tgt_obd, obd);
+ if (rc) {
+ CERROR("Target %s register_observer error %d\n",
+ obd_uuid2str(&tgt_uuid), rc);
+ RETURN(rc);
+ }
+
+
if (imp->imp_invalid) {
CERROR("not connecting OSC %s; administratively "
"disabled\n", obd_uuid2str(&tgt_uuid));
- rc = obd_register_observer(tgt_obd, obd);
- if (rc) {
- CERROR("Target %s register_observer error %d; "
- "will not be able to reactivate\n",
- obd_uuid2str(&tgt_uuid), rc);
- }
RETURN(0);
}
- rc = obd_connect(NULL, &conn, tgt_obd, &lov_osc_uuid, data, NULL);
- if (rc) {
+ rc = obd_connect(NULL, &lov->lov_tgts[index]->ltd_exp, tgt_obd,
+ &lov_osc_uuid, data, NULL);
+ if (rc || !lov->lov_tgts[index]->ltd_exp) {
CERROR("Target %s connect error %d\n",
obd_uuid2str(&tgt_uuid), rc);
- RETURN(rc);
- }
- lov->lov_tgts[index]->ltd_exp = class_conn2export(&conn);
- if (!lov->lov_tgts[index]->ltd_exp) {
- CERROR("Target %s: null export!\n", obd_uuid2str(&tgt_uuid));
RETURN(-ENODEV);
}
- rc = obd_register_observer(tgt_obd, obd);
- if (rc) {
- CERROR("Target %s register_observer error %d\n",
- obd_uuid2str(&tgt_uuid), rc);
- obd_disconnect(lov->lov_tgts[index]->ltd_exp);
- lov->lov_tgts[index]->ltd_exp = NULL;
- RETURN(rc);
- }
-
lov->lov_tgts[index]->ltd_reap = 0;
if (activate) {
lov->lov_tgts[index]->ltd_active = 1;
#ifdef __KERNEL__
lov_proc_dir = lprocfs_srch(obd->obd_proc_entry, "target_obds");
if (lov_proc_dir) {
- struct obd_device *osc_obd = class_conn2obd(&conn);
+ struct obd_device *osc_obd = lov->lov_tgts[index]->ltd_exp->exp_obd;
cfs_proc_dir_entry_t *osc_symlink;
char name[MAX_STRING_SIZE];
}
static int lov_connect(const struct lu_env *env,
- struct lustre_handle *conn, struct obd_device *obd,
+ struct obd_export **exp, struct obd_device *obd,
struct obd_uuid *cluuid, struct obd_connect_data *data,
void *localdata)
{
struct lov_obd *lov = &obd->u.lov;
struct lov_tgt_desc *tgt;
+ struct lustre_handle conn;
int i, rc;
ENTRY;
CDEBUG(D_CONFIG, "connect #%d\n", lov->lov_connects);
- rc = class_connect(conn, obd, cluuid);
+ rc = class_connect(&conn, obd, cluuid);
if (rc)
RETURN(rc);
+ *exp = class_conn2export(&conn);
+
/* Why should there ever be more than 1 connect? */
lov->lov_connects++;
LASSERT(lov->lov_connects == 1);
continue;
rc = lov_notify(obd, lov->lov_tgts[i]->ltd_exp->exp_obd,
- OBD_NOTIFY_ACTIVE, (void *)&i);
+ OBD_NOTIFY_CONNECT, (void *)&i);
if (rc) {
CERROR("%s error sending notify %d\n",
obd->obd_name, rc);
GOTO(out, rc = 0);
rc = lov_notify(obd, tgt->ltd_exp->exp_obd,
- active ? OBD_NOTIFY_ACTIVE : OBD_NOTIFY_INACTIVE,
+ active ? OBD_NOTIFY_CONNECT : OBD_NOTIFY_INACTIVE,
(void *)&index);
out:
}
static int mdc_connect(const struct lu_env *env,
- struct lustre_handle *dlm_handle,
+ struct obd_export **exp,
struct obd_device *obd, struct obd_uuid *cluuid,
struct obd_connect_data *data,
void *localdata)
obd->obd_name);
}
- return client_connect_import(env, dlm_handle, obd, cluuid, data, NULL);
+ return client_connect_import(env, exp, obd, cluuid, data, NULL);
}
struct obd_ops mdc_obd_ops = {
int mds_lov_connect(struct obd_device *obd, char * lov_name)
{
struct mds_obd *mds = &obd->u.mds;
- struct lustre_handle conn = {0,};
struct obd_connect_data *data;
int rc;
ENTRY;
/* send the list of supported checksum types */
data->ocd_cksum_types = OBD_CKSUM_ALL;
/* NB: lov_connect() needs to fill in .ocd_index for each OST */
- rc = obd_connect(NULL, &conn, mds->mds_osc_obd, &obd->obd_uuid, data, NULL);
+ rc = obd_connect(NULL, &mds->mds_osc_exp, mds->mds_osc_obd, &obd->obd_uuid, data, NULL);
OBD_FREE(data, sizeof(*data));
if (rc) {
CERROR("MDS cannot connect to LOV %s (%d)\n", lov_name, rc);
mds->mds_osc_obd = ERR_PTR(rc);
RETURN(rc);
}
- mds->mds_osc_exp = class_conn2export(&conn);
/* I want to see a callback happen when the OBD moves to a
* "For General Use" state, and that's when we'll call
/* mds_connect copy */
static int mdt_obd_connect(const struct lu_env *env,
- struct lustre_handle *conn, struct obd_device *obd,
+ struct obd_export **exp, struct obd_device *obd,
struct obd_uuid *cluuid,
struct obd_connect_data *data,
void *localdata)
{
struct mdt_thread_info *info;
struct lsd_client_data *lcd;
- struct obd_export *exp;
+ struct obd_export *lexp;
+ struct lustre_handle conn = { 0 };
struct mdt_device *mdt;
struct ptlrpc_request *req;
int rc;
ENTRY;
LASSERT(env != NULL);
- if (!conn || !obd || !cluuid)
+ if (!exp || !obd || !cluuid)
RETURN(-EINVAL);
info = lu_context_key_get(&env->le_ctx, &mdt_thread_key);
req = info->mti_pill->rc_req;
mdt = mdt_dev(obd->obd_lu_dev);
- rc = class_connect(conn, obd, cluuid);
+ rc = class_connect(&conn, obd, cluuid);
if (rc)
RETURN(rc);
- exp = class_conn2export(conn);
- LASSERT(exp != NULL);
+ lexp = class_conn2export(&conn);
+ LASSERT(lexp != NULL);
- rc = mdt_connect_check_sptlrpc(mdt, exp, req);
+ rc = mdt_connect_check_sptlrpc(mdt, lexp, req);
if (rc)
GOTO(out, rc);
- rc = mdt_connect_internal(exp, mdt, data);
+ rc = mdt_connect_internal(lexp, mdt, data);
if (rc == 0) {
OBD_ALLOC_PTR(lcd);
if (lcd != NULL) {
mti = lu_context_key_get(&env->le_ctx,
&mdt_thread_key);
LASSERT(mti != NULL);
- mti->mti_exp = exp;
+ mti->mti_exp = lexp;
memcpy(lcd->lcd_uuid, cluuid, sizeof lcd->lcd_uuid);
- exp->exp_mdt_data.med_lcd = lcd;
+ lexp->exp_mdt_data.med_lcd = lcd;
rc = mdt_client_new(env, mdt);
if (rc != 0) {
OBD_FREE_PTR(lcd);
- exp->exp_mdt_data.med_lcd = NULL;
+ lexp->exp_mdt_data.med_lcd = NULL;
} else {
- mdt_export_stats_init(obd, exp, localdata);
+ mdt_export_stats_init(obd, lexp, localdata);
}
} else
rc = -ENOMEM;
out:
if (rc != 0)
- class_disconnect(exp);
+ class_disconnect(lexp);
else
- class_export_put(exp);
+ *exp = lexp;
RETURN(rc);
}
/* Establish a connection to the MGS.*/
static int mgs_connect(const struct lu_env *env,
- struct lustre_handle *conn, struct obd_device *obd,
+ struct obd_export **exp, struct obd_device *obd,
struct obd_uuid *cluuid, struct obd_connect_data *data,
void *localdata)
{
- struct obd_export *exp;
+ struct obd_export *lexp;
+ struct lustre_handle conn = { 0 };
int rc;
ENTRY;
- if (!conn || !obd || !cluuid)
+ if (!exp || !obd || !cluuid)
RETURN(-EINVAL);
- rc = class_connect(conn, obd, cluuid);
+ rc = class_connect(&conn, obd, cluuid);
if (rc)
RETURN(rc);
- exp = class_conn2export(conn);
- LASSERT(exp);
- mgs_counter_incr(exp, LPROC_MGS_CONNECT);
+ lexp = class_conn2export(&conn);
+ LASSERT(lexp);
+
+ mgs_counter_incr(lexp, LPROC_MGS_CONNECT);
if (data != NULL) {
data->ocd_connect_flags &= MGS_CONNECT_SUPPORTED;
- exp->exp_connect_flags = data->ocd_connect_flags;
+ lexp->exp_connect_flags = data->ocd_connect_flags;
data->ocd_version = LUSTRE_VERSION_CODE;
}
- rc = mgs_client_add(obd, exp, localdata);
+ rc = mgs_client_add(obd, lexp, localdata);
if (rc) {
- class_disconnect(exp);
+ class_disconnect(lexp);
} else {
- class_export_put(exp);
+ *exp = lexp;
}
RETURN(rc);
struct obd_device *mgc_obd;
struct llog_ctxt *ctxt = llog_get_context(obd, LLOG_TEST_ORIG_CTXT);
struct obd_uuid *mgs_uuid = &ctxt->loc_exp->exp_obd->obd_uuid;
- struct lustre_handle exph = {0, };
struct obd_export *exp;
struct obd_uuid uuid = {"LLOG_TEST6_UUID"};
struct llog_handle *llh = NULL;
GOTO(ctxt_release, rc = -ENOENT);
}
- rc = obd_connect(NULL, &exph, mgc_obd, &uuid,
+ rc = obd_connect(NULL, &exp, mgc_obd, &uuid,
NULL /* obd_connect_data */, NULL);
if (rc) {
CERROR("6: failed to connect to MGC: %s\n", mgc_obd->obd_name);
GOTO(ctxt_release, rc);
}
- exp = class_conn2export(&exph);
+ LASSERTF(exp->exp_obd == mgc_obd, "%p - %p - %p\n", exp, exp->exp_obd, mgc_obd);
nctxt = llog_get_context(mgc_obd, LLOG_CONFIG_REPL_CTXT);
rc = llog_create(nctxt, &llh, NULL, name);
if (rc) {
CERROR("6: llog_close failed: rc = %d\n", rc);
}
+ CDEBUG(D_INFO, "obd %p - %p - %p - %p\n",
+ mgc_obd, exp, exp->exp_obd, exp->exp_obd->obd_type);
rc = obd_disconnect(exp);
ctxt_release:
llog_ctxt_put(ctxt);
*/
static int lustre_start_mgc(struct super_block *sb)
{
- struct lustre_handle mgc_conn = {0, };
struct obd_connect_data *data = NULL;
struct lustre_sb_info *lsi = s2lsi(sb);
struct obd_device *obd;
data->ocd_connect_flags = OBD_CONNECT_VERSION | OBD_CONNECT_FID |
OBD_CONNECT_AT;
data->ocd_version = LUSTRE_VERSION_CODE;
- rc = obd_connect(NULL, &mgc_conn, obd, &(obd->obd_uuid), data, NULL);
+ rc = obd_connect(NULL, &exp, obd, &(obd->obd_uuid), data, NULL);
OBD_FREE_PTR(data);
if (rc) {
CERROR("connect failed %d\n", rc);
GOTO(out, rc);
}
- exp = class_conn2export(&mgc_conn);
obd->u.cli.cl_mgc_mgsexp = exp;
out:
};
static int echo_connect(const struct lu_env *env,
- struct lustre_handle *conn, struct obd_device *obd,
+ struct obd_export **exp, struct obd_device *obd,
struct obd_uuid *cluuid, struct obd_connect_data *data,
void *localdata)
{
+ struct lustre_handle conn = { 0 };
+ int rc;
+
data->ocd_connect_flags &= ECHO_CONNECT_SUPPORTED;
- return class_connect(conn, obd, cluuid);
+ rc = class_connect(&conn, obd, cluuid);
+ if (rc) {
+ CERROR("can't connect %d\n", rc);
+ return rc;
+ }
+ *exp = class_conn2export(&conn);
+
+ return 0;
}
static int echo_disconnect(struct obd_export *exp)
{
struct echo_client_obd *ec = &obddev->u.echo_client;
struct obd_device *tgt;
- struct lustre_handle conn = {0, };
struct obd_uuid echo_uuid = { "ECHO_UUID" };
struct obd_connect_data *ocd = NULL;
int rc;
ocd->ocd_version = LUSTRE_VERSION_CODE;
ocd->ocd_group = FILTER_GROUP_ECHO;
- rc = obd_connect(NULL, &conn, tgt, &echo_uuid, ocd, NULL);
+ rc = obd_connect(NULL, &ec->ec_exp, tgt, &echo_uuid, ocd, NULL);
OBD_FREE(ocd, sizeof(*ocd));
lustre_cfg_string(lcfg, 1));
return (rc);
}
- ec->ec_exp = class_conn2export(&conn);
RETURN(rc);
}
}
static int echo_client_connect(const struct lu_env *env,
- struct lustre_handle *conn,
+ struct obd_export **exp,
struct obd_device *src, struct obd_uuid *cluuid,
struct obd_connect_data *data, void *localdata)
{
- struct obd_export *exp;
int rc;
+ struct lustre_handle conn = { 0 };
ENTRY;
- rc = class_connect(conn, src, cluuid);
+ rc = class_connect(&conn, src, cluuid);
if (rc == 0) {
- exp = class_conn2export(conn);
- class_export_put(exp);
+ *exp = class_conn2export(&conn);
}
RETURN (rc);
/* nearly identical to mds_connect */
static int filter_connect(const struct lu_env *env,
- struct lustre_handle *conn, struct obd_device *obd,
+ struct obd_export **exp, struct obd_device *obd,
struct obd_uuid *cluuid,
struct obd_connect_data *data, void *localdata)
{
struct lvfs_run_ctxt saved;
- struct obd_export *exp;
+ struct lustre_handle conn = { 0 };
+ struct obd_export *lexp;
struct filter_export_data *fed;
struct lsd_client_data *lcd = NULL;
__u32 group;
int rc;
ENTRY;
- if (conn == NULL || obd == NULL || cluuid == NULL)
+ if (exp == NULL || obd == NULL || cluuid == NULL)
RETURN(-EINVAL);
- rc = class_connect(conn, obd, cluuid);
+ rc = class_connect(&conn, obd, cluuid);
if (rc)
RETURN(rc);
- exp = class_conn2export(conn);
- LASSERT(exp != NULL);
+ lexp = class_conn2export(&conn);
+ LASSERT(lexp != NULL);
- fed = &exp->exp_filter_data;
+ fed = &lexp->exp_filter_data;
- rc = filter_connect_internal(exp, data);
+ rc = filter_connect_internal(lexp, data);
if (rc)
GOTO(cleanup, rc);
- filter_export_stats_init(obd, exp, localdata);
+ filter_export_stats_init(obd, lexp, localdata);
if (obd->obd_replayable) {
OBD_ALLOC(lcd, sizeof(*lcd));
if (!lcd) {
memcpy(lcd->lcd_uuid, cluuid, sizeof(lcd->lcd_uuid));
fed->fed_lcd = lcd;
- rc = filter_client_add(obd, exp, -1);
+ rc = filter_client_add(obd, lexp, -1);
if (rc)
GOTO(cleanup, rc);
}
group = data->ocd_group;
CWARN("%s: Received MDS connection ("LPX64"); group %d\n",
- obd->obd_name, exp->exp_handle.h_cookie, group);
+ obd->obd_name, lexp->exp_handle.h_cookie, group);
push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
rc = filter_read_groups(obd, group, 1);
OBD_FREE_PTR(lcd);
fed->fed_lcd = NULL;
}
- class_disconnect(exp);
+ class_disconnect(lexp);
+ *exp = NULL;
} else {
- class_export_put(exp);
+ *exp = lexp;
}
RETURN(rc);
IMPORT_SET_STATE(imp, LUSTRE_IMP_REPLAY_LOCKS);
} else {
IMPORT_SET_STATE(imp, LUSTRE_IMP_FULL);
- }
-
- spin_lock(&imp->imp_lock);
- if (imp->imp_invalid) {
- spin_unlock(&imp->imp_lock);
ptlrpc_activate_import(imp);
- } else {
- spin_unlock(&imp->imp_lock);
}
GOTO(finish, rc = 0);