[lustre-devel] [PATCH 08/24] lnet: o2iblnd: treat cmid->device == NULL as an error
James Simmons
jsimmons at infradead.org
Thu Jan 13 17:37:47 PST 2022
From: Serguei Smirnov <ssmirnov at whamcloud.com>
Even if rdma_bind_addr is successful, kiblnd_dev_failover should
treat cmid->device == NULL as an error in order to later avoid
calling kiblnd_set_ni_fatal_on with possibly dev->ibd_hdev == NULL.
Fixes: 5e07562bc3 ("lnet: o2iblnd: clear fatal error on successful failover")
WC-bug-id: https://jira.whamcloud.com/browse/LU-15018
Lustre-commit: abd0ce62e96523193 ("LU-15018 o2iblnd: treat cmid->device == NULL as an error")
Signed-off-by: Serguei Smirnov <ssmirnov at whamcloud.com>
Reviewed-on: https://review.whamcloud.com/44981
Reviewed-by: Chris Horn <chris.horn at hpe.com>
Reviewed-by: Cyril Bordage <cbordage at whamcloud.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
net/lnet/klnds/o2iblnd/o2iblnd.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/net/lnet/klnds/o2iblnd/o2iblnd.c b/net/lnet/klnds/o2iblnd/o2iblnd.c
index 7d28acd..76f5e7f 100644
--- a/net/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/net/lnet/klnds/o2iblnd/o2iblnd.c
@@ -2365,6 +2365,7 @@ int kiblnd_dev_failover(struct kib_dev *dev, struct net *ns)
struct kib_net *net;
struct sockaddr_in addr;
struct net_device *netdev;
+ bool set_fatal = true;
unsigned long flags;
int rc = 0;
int i;
@@ -2416,6 +2417,8 @@ int kiblnd_dev_failover(struct kib_dev *dev, struct net *ns)
CERROR("Failed to bind %s:%pI4h to device(%p): %d\n",
dev->ibd_ifname, &dev->ibd_ifip,
cmid->device, rc);
+ if (!rc && !cmid->device)
+ set_fatal = false;
rdma_destroy_id(cmid);
goto out;
}
@@ -2490,11 +2493,13 @@ int kiblnd_dev_failover(struct kib_dev *dev, struct net *ns)
} else {
dev->ibd_failed_failover = 0;
- rcu_read_lock();
- netdev = dev_get_by_name_rcu(ns, dev->ibd_ifname);
- if (netdev && (kiblnd_get_link_status(netdev) == 1))
- kiblnd_set_ni_fatal_on(dev->ibd_hdev, 0);
- rcu_read_unlock();
+ if (set_fatal) {
+ rcu_read_lock();
+ netdev = dev_get_by_name_rcu(ns, dev->ibd_ifname);
+ if (netdev && (kiblnd_get_link_status(netdev) == 1))
+ kiblnd_set_ni_fatal_on(dev->ibd_hdev, 0);
+ rcu_read_unlock();
+ }
}
return rc;
--
1.8.3.1
More information about the lustre-devel
mailing list