static int lnet_add_net_common(struct lnet_net *net,
struct lnet_ioctl_config_lnd_tunables *tun)
{
- struct lnet_net *netl = NULL;
__u32 net_id;
lnet_ping_info_t *pinfo;
lnet_handle_md_t md_handle;
if (rnet) {
CERROR("Adding net %s will invalidate routing configuration\n",
libcfs_net2str(net->net_id));
- rc = -EUSERS;
- goto failed1;
+ lnet_net_free(net);
+ return -EUSERS;
}
/*
rc = lnet_ping_info_setup(&pinfo, &md_handle,
net_ni_count + lnet_get_ni_count(),
false);
- if (rc < 0)
- goto failed1;
+ if (rc < 0) {
+ lnet_net_free(net);
+ return rc;
+ }
if (tun)
memcpy(&net->net_tunables,
goto failed;
lnet_net_lock(LNET_LOCK_EX);
- netl = lnet_get_net_locked(net_id);
+ net = lnet_get_net_locked(net_id);
lnet_net_unlock(LNET_LOCK_EX);
- LASSERT(netl);
+ LASSERT(net);
/*
* Start the acceptor thread if this is the first network
* being added that requires the thread.
*/
- if (netl->net_lnd->lnd_accept &&
- num_acceptor_nets == 0)
- {
+ if (net->net_lnd->lnd_accept && num_acceptor_nets == 0) {
rc = lnet_acceptor_start();
if (rc < 0) {
/* shutdown the net that we just started */
}
lnet_net_lock(LNET_LOCK_EX);
- lnet_peer_net_added(netl);
+ lnet_peer_net_added(net);
lnet_net_unlock(LNET_LOCK_EX);
lnet_ping_target_update(pinfo, md_handle);
failed:
lnet_ping_md_unlink(pinfo, &md_handle);
lnet_ping_info_free(pinfo);
-failed1:
- lnet_net_free(net);
return rc;
}