|
|
1d4303 |
From 12642839a58a1e6240b5c3376ee87f783c475f3d Mon Sep 17 00:00:00 2001
|
|
|
1d4303 |
From: Honggang Li <honli@redhat.com>
|
|
|
1d4303 |
Date: Tue, 16 Mar 2021 21:12:09 -0400
|
|
|
1d4303 |
Subject: [PATCH] rdma-ndd: fix udev racy issue for system with multiple
|
|
|
1d4303 |
InfiniBand HCAs
|
|
|
1d4303 |
|
|
|
1d4303 |
[ Upstream commit 649d6b8c58fcc8afa809cf874b65b03a5607143c ]
|
|
|
1d4303 |
|
|
|
1d4303 |
After read the system hostname, the function `monitor` calls function
|
|
|
1d4303 |
`set_rdma_node_desc` to initialize the node description for HCAs had
|
|
|
1d4303 |
been detected by kernel.
|
|
|
1d4303 |
|
|
|
1d4303 |
For system with multiple InfiniBand HCAs, only the first HCA is
|
|
|
1d4303 |
guaranteed to be detected by kernel at this point. The systemd udev
|
|
|
1d4303 |
"add" event for the rest HCAs may be emitted before rdma-ndd listen
|
|
|
1d4303 |
udev event via function `get_udev_fd`. That means the "add" event
|
|
|
1d4303 |
will never be sent to rdma-ndd service, as rdma-ndd not ready for udev
|
|
|
1d4303 |
even yet. So, the node description for those HCAs may not be updated
|
|
|
1d4303 |
by rdma-ndd during system boot.
|
|
|
1d4303 |
|
|
|
1d4303 |
With this patch, rdma-ndd will initialize the node description after
|
|
|
1d4303 |
it listen to udev. InfiniBand HCAs detected after the initialization
|
|
|
1d4303 |
will be handled by udev even.
|
|
|
1d4303 |
|
|
|
1d4303 |
Reported-by: Georg Sauthoff <georg.sauthoff@deutsche-boerse.com>
|
|
|
1d4303 |
Tested-by: Georg Sauthoff <georg.sauthoff@deutsche-boerse.com>
|
|
|
1d4303 |
Signed-off-by: Honggang Li <honli@redhat.com>
|
|
|
1d4303 |
Signed-off-by: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
|
|
|
1d4303 |
---
|
|
|
1d4303 |
rdma-ndd/rdma-ndd.c | 3 ++-
|
|
|
1d4303 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
1d4303 |
|
|
|
1d4303 |
diff --git a/rdma-ndd/rdma-ndd.c b/rdma-ndd/rdma-ndd.c
|
|
|
1d4303 |
index 418d1de9456b..03d0b79dd7f8 100644
|
|
|
1d4303 |
--- a/rdma-ndd/rdma-ndd.c
|
|
|
1d4303 |
+++ b/rdma-ndd/rdma-ndd.c
|
|
|
1d4303 |
@@ -254,7 +254,6 @@ static void monitor(bool systemd)
|
|
|
1d4303 |
}
|
|
|
1d4303 |
|
|
|
1d4303 |
read_hostname(hn_fd, hostname, sizeof(hostname));
|
|
|
1d4303 |
- set_rdma_node_desc((const char *)hostname, 1);
|
|
|
1d4303 |
|
|
|
1d4303 |
fds[0].fd = hn_fd;
|
|
|
1d4303 |
fds[0].events = 0;
|
|
|
1d4303 |
@@ -269,6 +268,8 @@ static void monitor(bool systemd)
|
|
|
1d4303 |
if (systemd)
|
|
|
1d4303 |
sd_notify(0, "READY=1");
|
|
|
1d4303 |
|
|
|
1d4303 |
+ set_rdma_node_desc((const char *)hostname, 1);
|
|
|
1d4303 |
+
|
|
|
1d4303 |
while (1) {
|
|
|
1d4303 |
if (poll(fds, numfds, -1) <= 0) {
|
|
|
1d4303 |
syslog(LOG_ERR, "Poll %s failed; exiting\n", SYS_HOSTNAME);
|
|
|
1d4303 |
--
|
|
|
1d4303 |
2.25.4
|
|
|
1d4303 |
|