Add new 'ni_net_ns' field to struct lnet_ni to hold a reference
to original net namespace in which ni is created.
In LNetDist(), check if ni was created in same net namespace as
current's one. If not, assign order above 0xffff0000, to make
this ni not a priority.
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: I5abde6e325983352b42c0eafe16aef22567e3e0e
Reviewed-on: http://review.whamcloud.com/21884
Tested-by: Jenkins
Reviewed-by: Olaf Weber <olaf@sgi.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
struct lnet_ioctl_config_lnd_tunables *ni_lnd_tunables;
/* equivalent interfaces to use */
char *ni_interfaces[LNET_MAX_INTERFACES];
struct lnet_ioctl_config_lnd_tunables *ni_lnd_tunables;
/* equivalent interfaces to use */
char *ni_interfaces[LNET_MAX_INTERFACES];
+ struct net *ni_net_ns; /* original net namespace */
} lnet_ni_t;
#define LNET_PROTO_PING_MATCHBITS 0x8000000000000000LL
} lnet_ni_t;
#define LNET_PROTO_PING_MATCHBITS 0x8000000000000000LL
*/
#define DEBUG_SUBSYSTEM S_LNET
*/
#define DEBUG_SUBSYSTEM S_LNET
+#include <linux/nsproxy.h>
+#include <net/net_namespace.h>
#include <lnet/lib-lnet.h>
/* tmp struct for parsing routes */
#include <lnet/lib-lnet.h>
/* tmp struct for parsing routes */
LIBCFS_FREE(ni->ni_interfaces[i],
strlen(ni->ni_interfaces[i]) + 1);
}
LIBCFS_FREE(ni->ni_interfaces[i],
strlen(ni->ni_interfaces[i]) + 1);
}
+
+ /* release reference to net namespace */
+ if (ni->ni_net_ns != NULL)
+ put_net(ni->ni_net_ns);
+
LIBCFS_FREE(ni, sizeof(*ni));
}
LIBCFS_FREE(ni, sizeof(*ni));
}
/* LND will fill in the address part of the NID */
ni->ni_nid = LNET_MKNID(net, 0);
/* LND will fill in the address part of the NID */
ni->ni_nid = LNET_MKNID(net, 0);
+
+ /* Store net namespace in which current ni is being created */
+ if (current->nsproxy->net_ns != NULL)
+ ni->ni_net_ns = get_net(current->nsproxy->net_ns);
+ else
+ ni->ni_net_ns = NULL;
+
ni->ni_last_alive = cfs_time_current_sec();
list_add_tail(&ni->ni_list, nilist);
return ni;
ni->ni_last_alive = cfs_time_current_sec();
list_add_tail(&ni->ni_list, nilist);
return ni;
#define DEBUG_SUBSYSTEM S_LNET
#include <lnet/lib-lnet.h>
#define DEBUG_SUBSYSTEM S_LNET
#include <lnet/lib-lnet.h>
+#include <linux/nsproxy.h>
+#include <net/net_namespace.h>
static int local_nid_dist_zero = 1;
module_param(local_nid_dist_zero, int, 0444);
static int local_nid_dist_zero = 1;
module_param(local_nid_dist_zero, int, 0444);
return local_nid_dist_zero ? 0 : 1;
}
return local_nid_dist_zero ? 0 : 1;
}
- if (LNET_NIDNET(ni->ni_nid) == dstnet) {
- if (srcnidp != NULL)
- *srcnidp = ni->ni_nid;
- if (orderp != NULL)
- *orderp = order;
+ if (LNET_NIDNET(ni->ni_nid) == dstnet) {
+ /* Check if ni was originally created in
+ * current net namespace.
+ * If not, assign order above 0xffff0000,
+ * to make this ni not a priority. */
+ if (!net_eq(ni->ni_net_ns, current->nsproxy->net_ns))
+ order += 0xffff0000;
+
+ if (srcnidp != NULL)
+ *srcnidp = ni->ni_nid;
+ if (orderp != NULL)
+ *orderp = order;
lnet_net_unlock(cpt);
return 1;
}
lnet_net_unlock(cpt);
return 1;
}