From f9473b9d8e9e4bf63b310f756c8d3f7e8dad4718 Mon Sep 17 00:00:00 2001 From: Shaun Tancheff Date: Mon, 4 May 2020 14:59:47 -0700 Subject: [PATCH] LU-12634 lnet: for_ifa removed. Use in_dev_for_each_ifa_rtnl Linux 5.3 removed for_ifa and replaced it with an _rntl and _rcu versions for use with their respective locking primitives. kernel-commit: ef11db3310e272d3d8dbe8739e0770820dd20e52 This patch is back-ported from the following one: Lustre-commit: 6e0d0146276353559c821916e193c90d167b14e0 Lustre-change: https://review.whamcloud.com/35744 Test-Parameters: trivial Cray-bug-id: LUS-7689 Signed-off-by: Shaun Tancheff Change-Id: Iea07222b9abb3f9c219d28fe2c660d9eaf21af80 Reviewed-on: https://review.whamcloud.com/38487 Reviewed-by: Petros Koutoupis Reviewed-by: James Simmons Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lnet/lnet/config.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lnet/lnet/config.c b/lnet/lnet/config.c index 4e2e13d..f0ba35b 100644 --- a/lnet/lnet/config.c +++ b/lnet/lnet/config.c @@ -1604,6 +1604,19 @@ lnet_match_networks (char **networksp, char *ip2nets, __u32 *ipaddrs, int nip) *networksp = networks; return count; } +/* + * kernel 5.3: commit ef11db3310e272d3d8dbe8739e0770820dd20e52 + * added in_dev_for_each_ifa_rtnl and in_dev_for_each_ifa_rcu + * and removed for_ifa and endfor_ifa. + * Use the _rntl variant as the current locking is rtnl. + */ +#ifdef in_dev_for_each_ifa_rtnl +#define DECLARE_CONST_IN_IFADDR(ifa) const struct in_ifaddr *ifa +#define endfor_ifa(in_dev) +#else +#define DECLARE_CONST_IN_IFADDR(ifa) +#define in_dev_for_each_ifa_rtnl(ifa, in_dev) for_ifa((in_dev)) +#endif int lnet_inet_enumerate(struct lnet_inetdev **dev_list, struct net *ns) { @@ -1611,6 +1624,7 @@ int lnet_inet_enumerate(struct lnet_inetdev **dev_list, struct net *ns) struct net_device *dev; int nalloc = 0; int nip = 0; + DECLARE_CONST_IN_IFADDR(ifa); rtnl_lock(); for_each_netdev(ns, dev) { @@ -1638,7 +1652,7 @@ int lnet_inet_enumerate(struct lnet_inetdev **dev_list, struct net *ns) node_id = dev_to_node(&dev->dev); cpt = cfs_cpt_of_node(lnet_cpt_table(), node_id); - for_ifa(in_dev) { + in_dev_for_each_ifa_rtnl(ifa, in_dev) { if (nip >= nalloc) { struct lnet_inetdev *tmp; -- 1.8.3.1