@@ -340,6 +340,7 @@ struct obd_import {
struct imp_at imp_at; /* adaptive timeout data */
time64_t imp_last_reply_time; /* for health check */
+ u32 imp_conn_restricted_net;
};
/* import.c : adaptive timeout handling.
@@ -56,7 +56,7 @@ static int import_set_conn(struct obd_import *imp, struct obd_uuid *uuid,
{
struct ptlrpc_connection *ptlrpc_conn;
struct obd_import_conn *imp_conn = NULL, *item;
- u32 refnet = LNET_NET_ANY;
+ u32 refnet = imp->imp_conn_restricted_net;
int rc = 0;
if (!create && !priority) {
@@ -64,10 +64,11 @@ static int import_set_conn(struct obd_import *imp, struct obd_uuid *uuid,
return -EINVAL;
}
- if (imp->imp_connection &&
- imp->imp_connection->c_remote_uuid.uuid[0] == 0)
- /* refnet is used to restrict network connections */
- refnet = LNET_NID_NET(&imp->imp_connection->c_self);
+ /* refnet is used to restrict network connections */
+ if (refnet != LNET_NET_ANY)
+ CDEBUG(D_HA, "imp %s: restrict %s to %s net\n",
+ imp->imp_obd->obd_name, uuid->uuid,
+ libcfs_net2str(refnet));
ptlrpc_conn = ptlrpc_uuid_to_connection(uuid, refnet);
if (!ptlrpc_conn) {
@@ -296,10 +297,6 @@ int client_obd_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
int rq_portal, rp_portal, connect_op;
const char *name = obd->obd_type->typ_name;
enum ldlm_ns_type ns_type = LDLM_NS_TYPE_UNKNOWN;
- struct ptlrpc_connection fake_conn = {
- .c_self = {},
- .c_remote_uuid.uuid[0] = 0
- };
int rc;
/*
@@ -494,8 +491,9 @@ int client_obd_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
rc);
goto err_import;
}
- lnet_nid4_to_nid(LNET_MKNID(refnet, 0), &fake_conn.c_self);
- imp->imp_connection = &fake_conn;
+ imp->imp_conn_restricted_net = refnet;
+ } else {
+ imp->imp_conn_restricted_net = LNET_NET_ANY;
}
rc = client_import_add_conn(imp, &server_uuid, 1);
@@ -1331,23 +1331,6 @@ int class_config_llog_handler(const struct lu_env *env,
}
}
- /* Skip add_conn command if uuid is not on restricted net */
- if (clli && clli->cfg_sb && s2lsi(clli->cfg_sb)) {
- struct lustre_sb_info *lsi = s2lsi(clli->cfg_sb);
- char *uuid_str = lustre_cfg_string(lcfg, 1);
-
- if (lcfg->lcfg_command == LCFG_ADD_CONN &&
- lsi->lsi_lmd->lmd_nidnet &&
- LNET_NIDNET(libcfs_str2nid(uuid_str)) !=
- libcfs_str2net(lsi->lsi_lmd->lmd_nidnet)) {
- CDEBUG(D_CONFIG, "skipping add_conn for %s\n",
- uuid_str);
- rc = 0;
- /* No processing! */
- break;
- }
- }
-
lcfg_len = lustre_cfg_len(bufs.lcfg_bufcount, bufs.lcfg_buflen);
lcfg_new = kzalloc(lcfg_len, GFP_NOFS);
if (!lcfg_new) {