From 1e2e7ae8386883dedb1bcb1d1e5690c9735daf2e Mon Sep 17 00:00:00 2001 From: Serguei Smirnov Date: Mon, 30 Oct 2023 12:13:45 -0700 Subject: [PATCH] LU-17235 o2iblnd: adding alias ib interface causes crash Commit 09c6e2b872 (LU-16836) causes o2iblnd startup routine to crash when alias ib interface is used: ifconfig ib0:0 10.1.0.52 up modprobe lnet lnetctl lnet configure lnetctl net add --net o2ib --if ib0:0 Fix the code which attempts to set the NI status on startup to deal with the case when corresponding net_device is not found gracefully. Lustre-change: https://review.whamcloud.com/52894/ Lustre-commit: TBD (from 26a00e20fad0cd7871c30fe65653415566b498dc) Test-Parameters: trivial testlist=sanity-lnet Fixes: 09c6e2b872 ("LU-16836 lnet: ensure dev notification") Signed-off-by: Serguei Smirnov Change-Id: Iaef9280a10f27ac28b872d9f4bc119c4d459ef40 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52910 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Frank Sehr Reviewed-by: Andreas Dilger --- lnet/klnds/o2iblnd/o2iblnd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lnet/klnds/o2iblnd/o2iblnd.c b/lnet/klnds/o2iblnd/o2iblnd.c index ce4b41a..30c25ad 100644 --- a/lnet/klnds/o2iblnd/o2iblnd.c +++ b/lnet/klnds/o2iblnd/o2iblnd.c @@ -3609,9 +3609,10 @@ kiblnd_startup(struct lnet_ni *ni) rcu_read_lock(); netdev = dev_get_by_name_rcu(ni->ni_net_ns, net->ibn_dev->ibd_ifname); - if (((netdev->reg_state == NETREG_UNREGISTERING) || - (netdev->operstate != IF_OPER_UP)) || - (lnet_get_link_status(netdev) == 0)) { + if (netdev && + ((netdev->reg_state == NETREG_UNREGISTERING) || + (netdev->operstate != IF_OPER_UP) || + (lnet_get_link_status(netdev) == 0))) { kiblnd_set_ni_fatal_on(ibdev->ibd_hdev, 1); } rcu_read_unlock(); -- 1.8.3.1