/* connect to the target device with given connection
* data. @ocd->ocd_connect_flags is modified to reflect flags actually
* granted by the target, which are guaranteed to be a subset of flags
- * asked for. If @ocd == NULL, use default parameters. */
+ * asked for. If @ocd == NULL, use default parameters.
+ * On the client, localdata is a struct cl_client_cache *.
+ * On the server, localdata is a struct lnet_nid *.
+ */
int (*o_connect)(const struct lu_env *env,
struct obd_export **exp, struct obd_device *src,
struct obd_uuid *cluuid, struct obd_connect_data *ocd,
bool new_mds_mds_conn = false;
struct obd_connect_data *data, *tmpdata;
int size, tmpsize;
- lnet_nid_t client_nid;
#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0)
int tmp_exp_old_falloc;
#endif
/* Tell the client if we support replayable requests. */
if (target->obd_replayable)
lustre_msg_add_op_flags(req->rq_repmsg, MSG_CONNECT_REPLAYABLE);
- client_nid = lnet_nid_to_nid4(&req->rq_peer.nid);
if (export == NULL) {
/* allow lightweight connections during recovery */
dont_check_exports:
rc = obd_connect(req->rq_svc_thread->t_env,
&export, target, &cluuid, data,
- &client_nid);
+ &req->rq_peer.nid);
if (mds_conn && OBD_FAIL_CHECK(OBD_FAIL_TGT_RCVG_FLAG))
lustre_msg_add_op_flags(req->rq_repmsg,
MSG_CONNECT_RECOVERING);
class_export_put(export);
}
rc = obd_reconnect(req->rq_svc_thread->t_env,
- export, target, &cluuid, data, &client_nid);
+ export, target, &cluuid, data,
+ &req->rq_peer.nid);
if (rc == 0)
reconnected = true;
}
int mdt_export_stats_init(struct obd_device *obd, struct obd_export *exp,
void *localdata)
{
- lnet_nid_t *client_nid4 = localdata;
+ struct lnet_nid *client_nid = localdata;
struct nid_stat *stats;
int rc;
ENTRY;
- if (client_nid4) {
- struct lnet_nid client_nid;
+ rc = lprocfs_exp_setup(exp, client_nid);
- lnet_nid4_to_nid(*client_nid4, &client_nid);
- rc = lprocfs_exp_setup(exp, &client_nid);
- } else
- rc = lprocfs_exp_setup(exp, NULL);
if (rc != 0)
/* Mask error for already created /proc entries */
RETURN(rc == -EALREADY ? 0 : rc);
struct lustre_handle conn = { 0 };
struct mdt_device *mdt;
int rc;
- lnet_nid_t *client_nid = localdata;
+ struct lnet_nid *client_nid = localdata;
ENTRY;
LASSERT(env != NULL);
lexp = class_conn2export(&conn);
LASSERT(lexp != NULL);
- rc = nodemap_add_member(*client_nid, lexp);
- if (rc != 0 && rc != -EEXIST)
- GOTO(out, rc);
+ if (nid_is_nid4(client_nid)) {
+ rc = nodemap_add_member(lnet_nid_to_nid4(client_nid), lexp);
+ if (rc != 0 && rc != -EEXIST)
+ GOTO(out, rc);
+ }
rc = mdt_connect_internal(env, lexp, mdt, data, false);
if (rc == 0) {
struct obd_connect_data *data,
void *localdata)
{
- lnet_nid_t *client_nid = localdata;
- int rc;
+ struct lnet_nid *client_nid = localdata;
+ int rc;
ENTRY;
if (exp == NULL || obd == NULL || cluuid == NULL)
RETURN(-EINVAL);
- rc = nodemap_add_member(*client_nid, exp);
- if (rc != 0 && rc != -EEXIST)
- RETURN(rc);
+ if (nid_is_nid4(client_nid)) {
+ rc = nodemap_add_member(lnet_nid_to_nid4(client_nid), exp);
+ if (rc != 0 && rc != -EEXIST)
+ RETURN(rc);
+ }
rc = mdt_connect_internal(env, exp, mdt_dev(obd->obd_lu_dev), data,
true);
int mgs_export_stats_init(struct obd_device *obd, struct obd_export *exp,
void *localdata)
{
- lnet_nid_t *client_nid4 = localdata;
+ struct lnet_nid *client_nid = localdata;
struct nid_stat *stats;
int rc;
ENTRY;
- if (client_nid4) {
- struct lnet_nid client_nid;
-
- lnet_nid4_to_nid(*client_nid4, &client_nid);
- rc = lprocfs_exp_setup(exp, &client_nid);
- } else
- rc = lprocfs_exp_setup(exp, NULL);
+ rc = lprocfs_exp_setup(exp, client_nid);
if (rc != 0)
/* Mask error for already created /proc entries */
RETURN(rc == -EALREADY ? 0 : rc);
*/
static int ofd_export_stats_init(struct ofd_device *ofd,
struct obd_export *exp,
- lnet_nid_t *client_nid4)
+ struct lnet_nid *client_nid)
{
struct obd_device *obd = ofd_obd(ofd);
struct nid_stat *stats;
/* Self-export gets no proc entry */
RETURN(0);
- if (client_nid4) {
- struct lnet_nid client_nid;
-
- lnet_nid4_to_nid(*client_nid4, &client_nid);
- rc = lprocfs_exp_setup(exp, &client_nid);
- } else
- rc = lprocfs_exp_setup(exp, NULL);
+ rc = lprocfs_exp_setup(exp, client_nid);
if (rc != 0)
/* Mask error for already created /proc entries */
RETURN(rc == -EALREADY ? 0 : rc);
static int ofd_obd_reconnect(const struct lu_env *env, struct obd_export *exp,
struct obd_device *obd, struct obd_uuid *cluuid,
struct obd_connect_data *data,
- void *client_nid)
+ void *localdata)
{
struct ofd_device *ofd;
+ struct lnet_nid *client_nid = localdata;
int rc;
ENTRY;
if (!exp || !obd || !cluuid)
RETURN(-EINVAL);
- rc = nodemap_add_member(*(lnet_nid_t *)client_nid, exp);
- if (rc != 0 && rc != -EEXIST)
- RETURN(rc);
+ if (nid_is_nid4(client_nid)) {
+ rc = nodemap_add_member(lnet_nid_to_nid4(client_nid), exp);
+ if (rc != 0 && rc != -EEXIST)
+ RETURN(rc);
+ }
ofd = ofd_dev(obd->obd_lu_dev);
struct obd_export *exp;
struct ofd_device *ofd;
struct lustre_handle conn = { 0 };
+ struct lnet_nid *client_nid = localdata;
int rc;
ENTRY;
exp = class_conn2export(&conn);
LASSERT(exp != NULL);
- if (localdata) {
- rc = nodemap_add_member(*(lnet_nid_t *)localdata, exp);
+ if (client_nid && nid_is_nid4(client_nid)) {
+ rc = nodemap_add_member(lnet_nid_to_nid4(client_nid), exp);
if (rc != 0 && rc != -EEXIST)
GOTO(out, rc);
} else {
rc = tgt_client_new(env, exp);
if (rc != 0)
GOTO(out, rc);
- ofd_export_stats_init(ofd, exp, localdata);
+ ofd_export_stats_init(ofd, exp, client_nid);
}
CDEBUG(D_HA, "%s: get connection from MDS %d\n", obd->obd_name,