cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH dlm/next 1/6] fs: dlm: fix lowcomms_start error case
@ 2021-06-02 13:45 Alexander Aring
  2021-06-02 13:45 ` [Cluster-devel] [PATCH dlm/next 2/6] fs: dlm: fix memory leak when fenced Alexander Aring
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Alexander Aring @ 2021-06-02 13:45 UTC (permalink / raw)
  To: cluster-devel.redhat.com

This patch fixes the error path handling in lowcomms_start(). We need to
cleanup some static allocated data structure and cleanup possible
workqueue if these have started.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
 fs/dlm/lowcomms.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 36adccc4f849..b71f7eafb808 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1803,10 +1803,15 @@ static void process_send_sockets(struct work_struct *work)
 
 static void work_stop(void)
 {
-	if (recv_workqueue)
+	if (recv_workqueue) {
 		destroy_workqueue(recv_workqueue);
-	if (send_workqueue)
+		recv_workqueue = NULL;
+	}
+
+	if (send_workqueue) {
 		destroy_workqueue(send_workqueue);
+		send_workqueue = NULL;
+	}
 }
 
 static int work_start(void)
@@ -1823,6 +1828,7 @@ static int work_start(void)
 	if (!send_workqueue) {
 		log_print("can't start dlm_send");
 		destroy_workqueue(recv_workqueue);
+		recv_workqueue = NULL;
 		return -ENOMEM;
 	}
 
@@ -1960,7 +1966,7 @@ int dlm_lowcomms_start(void)
 
 	error = work_start();
 	if (error)
-		goto fail;
+		goto fail_local;
 
 	dlm_allow_conn = 1;
 
@@ -1977,6 +1983,9 @@ int dlm_lowcomms_start(void)
 fail_unlisten:
 	dlm_allow_conn = 0;
 	dlm_close_sock(&listen_con.sock);
+	work_stop();
+fail_local:
+	deinit_local();
 fail:
 	return error;
 }
-- 
2.26.3



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-06-02 13:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-02 13:45 [Cluster-devel] [PATCH dlm/next 1/6] fs: dlm: fix lowcomms_start error case Alexander Aring
2021-06-02 13:45 ` [Cluster-devel] [PATCH dlm/next 2/6] fs: dlm: fix memory leak when fenced Alexander Aring
2021-06-02 13:45 ` [Cluster-devel] [PATCH dlm/next 3/6] fs: dlm: use alloc_ordered_workqueue Alexander Aring
2021-06-02 13:45 ` [Cluster-devel] [PATCH dlm/next 4/6] fs: dlm: move dlm allow conn Alexander Aring
2021-06-02 13:45 ` [Cluster-devel] [PATCH dlm/next 5/6] fs: dlm: introduce proto values Alexander Aring
2021-06-02 13:45 ` [Cluster-devel] [PATCH dlm/next 6/6] fs: dlm: rename socket and app buffer defines Alexander Aring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).