Skip to contentSkip to conversation

srp_daemon: Don't create async_ev_thread if only run once

PATCH In review Honggang LI 3 participants 3 messages Dec 19, 2017 – Jan 3, 2018 2 messages not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 srp_daemon: Don't create async_ev_thread if only run once

From: Honggang Li <[email protected]>

fd3005f0cd34 moves the signal handler setup from ibsrpdm path. So, default signal handler will be used when the main pthread send signal SIGINT to pthread async_ev_thread. ibsrpdm will exit with non-zero exit code as default signal handler killed it. ibsrpdm should return with exit code zero, if no error emerged.

We should not create async_ev_thread for ibsrpdm.

Fixes fd3005f0cd34 ("srp_daemon: Move the setup of the wakeup_pipe after openlog")
---
 srp_daemon/srp_daemon.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
srp_daemon/srp_daemon.c +5 -5
index cec36db2..4012a7db 100644
@@ -1945,12 +1945,12 @@ static struct resources *alloc_res(void)
 				     run_thread_get_trap_notices, &res->res);
 		if (ret)
 			goto err;
-	}
 
-	ret = pthread_create(&res->res.async_ev_thread, NULL,
-			     run_thread_listen_to_events, &res->res);
-	if (ret)
-		goto err;
+		ret = pthread_create(&res->res.async_ev_thread, NULL,
+				     run_thread_listen_to_events, &res->res);
+		if (ret)
+			goto err;
+	}
 
 	if (config->retry_timeout && !config->once) {
 		ret = pthread_create(&res->res.reconnect_thread, NULL,
Signature · 6 lines
2.14.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20171219190958.3189-1-honli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#2 lore raw

Le 19/12/2017 à 20:09, Honggang LI a écrit :

Quoted 29 lines

From: Honggang Li <[email protected]>

fd3005f0cd34 moves the signal handler setup from ibsrpdm path. So, default signal handler will be used when the main pthread send signal SIGINT to pthread async_ev_thread. ibsrpdm will exit with non-zero exit code as default signal handler killed it. ibsrpdm should return with exit code zero, if no error emerged.

We should not create async_ev_thread for ibsrpdm.

Fixes fd3005f0cd34 ("srp_daemon: Move the setup of the wakeup_pipe after openlog")
---
 srp_daemon/srp_daemon.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
srp_daemon/srp_daemon.c +0 -3
index cec36db2..4012a7db 100644
@@ -1945,12 +1945,12 @@ static struct resources *alloc_res(void)
 				     run_thread_get_trap_notices, &res->res);
 		if (ret)
 			goto err;
-	}
 
-	ret = pthread_create(&res->res.async_ev_thread, NULL,
-			     run_thread_listen_to_events, &res->res);

srp_daemon/srp_daemon.c static struct resources *alloc_res(void) · line 1956

Quoted 10 lines
srp_daemon/srp_daemon.c +5 -2
-	if (ret)
-		goto err;
+		ret = pthread_create(&res->res.async_ev_thread, NULL,
+				     run_thread_listen_to_events, &res->res);
+		if (ret)
+			goto err;
+	}
 
 	if (config->retry_timeout && !config->once) {
 		ret = pthread_create(&res->res.reconnect_thread, NULL,

Note: I will backport this to stable-v1[56] branches once its in master --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): ea3fe465-cc3b-1db3-e274-8c13f976953c-l3A5Bk7waGM@public.gmane.org

#4 lore raw
Quoted 40 lines · Nicolas Morey-Chaisemartin

Le 19/12/2017 à 20:09, Honggang LI a écrit :

Quoted 37 lines

From: Honggang Li <[email protected]>

fd3005f0cd34 moves the signal handler setup from ibsrpdm path. So, default signal handler will be used when the main pthread send signal SIGINT to pthread async_ev_thread. ibsrpdm will exit with non-zero exit code as default signal handler killed it. ibsrpdm should return with exit code zero, if no error emerged.

We should not create async_ev_thread for ibsrpdm.

Fixes fd3005f0cd34 ("srp_daemon: Move the setup of the wakeup_pipe after openlog")
---
 srp_daemon/srp_daemon.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
srp_daemon/srp_daemon.c +5 -5
index cec36db2..4012a7db 100644
@@ -1945,12 +1945,12 @@ static struct resources *alloc_res(void)
 				     run_thread_get_trap_notices, &res->res);
 		if (ret)
 			goto err;
-	}
 
-	ret = pthread_create(&res->res.async_ev_thread, NULL,
-			     run_thread_listen_to_events, &res->res);
-	if (ret)
-		goto err;
+		ret = pthread_create(&res->res.async_ev_thread, NULL,
+				     run_thread_listen_to_events, &res->res);
+		if (ret)
+			goto err;
+	}
 
Quoted 4 lines

srp_daemon/srp_daemon.c static struct resources *alloc_res(void) · line 1956

Quoted 2 lines
srp_daemon/srp_daemon.c +0 -0
 	if (config->retry_timeout && !config->once) {
 		ret = pthread_create(&res->res.reconnect_thread, NULL,

Note: I will backport this to stable-v1[56] branches once its in master

I merged it two weeks before :)
https://github.com/linux-rdma/rdma-core/commit/3f58c9237533ed9d92f3d08cad56527299781862

Thanks

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html