All of lore.kernel.org
 help / color / mirror / Atom feed
From: swhiteho@redhat.com <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] [DLM] More othercon fixes
Date: Tue, 14 Aug 2007 10:47:09 +0100	[thread overview]
Message-ID: <11870848503463-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <11870848365-git-send-email-swhiteho@redhat.com>

From: Patrick Caulfield <pcaulfie@redhat.com>

The last patch to clean out 'othercon' structures only fixed half the problem.
The attached addresses the other situations too, and fixes bz#238490

Signed-Off-By: Patrick Caulfield <pcaulfie@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 631bc43..9e9d2e8 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -328,15 +328,24 @@ static void close_connection(struct connection *con, bool and_other)
 	if (con->othercon && and_other) {
 		/* Will only re-enter once. */
 		close_connection(con->othercon, false);
-		kmem_cache_free(con_cache, con->othercon);
-		con->othercon = NULL;
 	}
 	if (con->rx_page) {
 		__free_page(con->rx_page);
 		con->rx_page = NULL;
 	}
-	con->retries = 0;
-	mutex_unlock(&con->sock_mutex);
+
+	/* If we are an 'othercon' then NULL the pointer to us
+	   from the parent and tidy ourself up */
+	if (test_bit(CF_IS_OTHERCON, &con->flags)) {
+		struct connection *parent = __nodeid2con(con->nodeid, 0);
+		parent->othercon = NULL;
+		kmem_cache_free(con_cache, con);
+	}
+	else {
+		/* Parent connections get reused */
+		con->retries = 0;
+		mutex_unlock(&con->sock_mutex);
+	}
 }
 
 /* We only send shutdown messages to nodes that are not part of the cluster */
@@ -634,7 +643,7 @@ out_resched:
 
 out_close:
 	mutex_unlock(&con->sock_mutex);
-	if (ret != -EAGAIN && !test_bit(CF_IS_OTHERCON, &con->flags)) {
+	if (ret != -EAGAIN) {
 		close_connection(con, false);
 		/* Reconnect when there is something to send */
 	}
@@ -1125,8 +1134,6 @@ static int tcp_listen_for_all(void)
 
 	log_print("Using TCP for communications");
 
-	set_bit(CF_IS_OTHERCON, &con->flags);
-
 	sock = tcp_create_listen_sock(con, dlm_local_addr[0]);
 	if (sock) {
 		add_sock(sock, con);
@@ -1410,7 +1417,7 @@ void dlm_lowcomms_stop(void)
 	for (i = 0; i <= max_nodeid; i++) {
 		con = __nodeid2con(i, 0);
 		if (con) {
-			con->flags |= 0xFF;
+			con->flags |= 0x0F;
 			if (con->sock)
 				con->sock->sk->sk_user_data = NULL;
 		}
@@ -1426,8 +1433,6 @@ void dlm_lowcomms_stop(void)
 		con = __nodeid2con(i, 0);
 		if (con) {
 			close_connection(con, true);
-			if (con->othercon)
-				kmem_cache_free(con_cache, con->othercon);
 			kmem_cache_free(con_cache, con);
 		}
 	}
-- 
1.5.1.2



WARNING: multiple messages have this Message-ID (diff)
From: swhiteho@redhat.com
To: linux-kernel@vger.kernel.org, cluster-devel@redhat.com
Cc: Patrick Caulfield <pcaulfie@redhat.com>,
	Steven Whitehouse <swhiteho@redhat.com>
Subject: [PATCH] [DLM] More othercon fixes
Date: Tue, 14 Aug 2007 10:47:09 +0100	[thread overview]
Message-ID: <11870848503463-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <11870848365-git-send-email-swhiteho@redhat.com>

From: Patrick Caulfield <pcaulfie@redhat.com>

The last patch to clean out 'othercon' structures only fixed half the problem.
The attached addresses the other situations too, and fixes bz#238490

Signed-Off-By: Patrick Caulfield <pcaulfie@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 631bc43..9e9d2e8 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -328,15 +328,24 @@ static void close_connection(struct connection *con, bool and_other)
 	if (con->othercon && and_other) {
 		/* Will only re-enter once. */
 		close_connection(con->othercon, false);
-		kmem_cache_free(con_cache, con->othercon);
-		con->othercon = NULL;
 	}
 	if (con->rx_page) {
 		__free_page(con->rx_page);
 		con->rx_page = NULL;
 	}
-	con->retries = 0;
-	mutex_unlock(&con->sock_mutex);
+
+	/* If we are an 'othercon' then NULL the pointer to us
+	   from the parent and tidy ourself up */
+	if (test_bit(CF_IS_OTHERCON, &con->flags)) {
+		struct connection *parent = __nodeid2con(con->nodeid, 0);
+		parent->othercon = NULL;
+		kmem_cache_free(con_cache, con);
+	}
+	else {
+		/* Parent connections get reused */
+		con->retries = 0;
+		mutex_unlock(&con->sock_mutex);
+	}
 }
 
 /* We only send shutdown messages to nodes that are not part of the cluster */
@@ -634,7 +643,7 @@ out_resched:
 
 out_close:
 	mutex_unlock(&con->sock_mutex);
-	if (ret != -EAGAIN && !test_bit(CF_IS_OTHERCON, &con->flags)) {
+	if (ret != -EAGAIN) {
 		close_connection(con, false);
 		/* Reconnect when there is something to send */
 	}
@@ -1125,8 +1134,6 @@ static int tcp_listen_for_all(void)
 
 	log_print("Using TCP for communications");
 
-	set_bit(CF_IS_OTHERCON, &con->flags);
-
 	sock = tcp_create_listen_sock(con, dlm_local_addr[0]);
 	if (sock) {
 		add_sock(sock, con);
@@ -1410,7 +1417,7 @@ void dlm_lowcomms_stop(void)
 	for (i = 0; i <= max_nodeid; i++) {
 		con = __nodeid2con(i, 0);
 		if (con) {
-			con->flags |= 0xFF;
+			con->flags |= 0x0F;
 			if (con->sock)
 				con->sock->sk->sk_user_data = NULL;
 		}
@@ -1426,8 +1433,6 @@ void dlm_lowcomms_stop(void)
 		con = __nodeid2con(i, 0);
 		if (con) {
 			close_connection(con, true);
-			if (con->othercon)
-				kmem_cache_free(con_cache, con->othercon);
 			kmem_cache_free(con_cache, con);
 		}
 	}
-- 
1.5.1.2


  parent reply	other threads:[~2007-08-14  9:47 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-14  9:47 [Cluster-devel] [PATCH] [DLM] Clear othercon pointers when a connection is closed swhiteho
2007-08-14  9:47 ` swhiteho
2007-08-14  9:47 ` [Cluster-devel] [PATCH] [DLM] fix NULL ls usage swhiteho
2007-08-14  9:47   ` swhiteho
2007-08-14  9:47 ` [Cluster-devel] [PATCH] [DLM] zero unused parts of sockaddr_storage swhiteho
2007-08-14  9:47   ` swhiteho
2007-08-14  9:47 ` [Cluster-devel] [PATCH] [DLM] Fix memory leak in dlm_add_member() when dlm_node_weight() returns less than zero swhiteho
2007-08-14  9:47   ` swhiteho
2007-08-14  9:47 ` swhiteho [this message]
2007-08-14  9:47   ` [PATCH] [DLM] More othercon fixes swhiteho
2007-08-14  9:47 ` [Cluster-devel] [PATCH] [DLM] fix basts for granted PR waiting CW swhiteho
2007-08-14  9:47   ` swhiteho
2007-08-14  9:47 ` [Cluster-devel] [PATCH] [GFS2] soft lockup detected in databuf_lo_before_commit swhiteho
2007-08-14  9:47   ` swhiteho
2007-08-14  9:47 ` [Cluster-devel] [PATCH] [GFS2] soft lockup in rgblk_search swhiteho
2007-08-14  9:47   ` swhiteho
2007-08-14  9:47 ` [Cluster-devel] [PATCH] [GFS2] Fix incorrect return code in rgrp.c swhiteho
2007-08-14  9:47   ` swhiteho
2007-08-14  9:47 ` [Cluster-devel] [PATCH] [GFS2] Fix incorrect error path in prepare_write() swhiteho
2007-08-14  9:47   ` swhiteho
2007-08-14  9:47 ` [Cluster-devel] [PATCH] [GFS2] Fix setting of inherit jdata attr swhiteho
2007-08-14  9:47   ` swhiteho
2007-08-14  9:47 ` [Cluster-devel] [PATCH] [GFS2] Revert remounting w/o acl option leaves acls enabled swhiteho
2007-08-14  9:47   ` swhiteho
2007-08-14 10:08 ` [Cluster-devel] [GFS2/DLM] [0/12] Pre pull request patch posting Steven Whitehouse
2007-08-14 10:08   ` Steven Whitehouse
2007-08-14 16:44   ` [Cluster-devel] [GFS2/DLM] Pull request Steven Whitehouse
2007-08-14 16:44     ` Steven Whitehouse
  -- strict thread matches above, loose matches on Subject: below --
2007-08-02 13:58 [Cluster-devel] [PATCH] dlm: More othercon fixes Patrick Caulfield
2007-08-02 15:08 ` Steven Whitehouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11870848503463-git-send-email-swhiteho@redhat.com \
    --to=swhiteho@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.