cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH] [DLM] Bind connections from known local address when using TCP
@ 2007-10-25 22:49 Lon Hohberger
  2007-10-25 22:51 ` Lon Hohberger
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Lon Hohberger @ 2007-10-25 22:49 UTC (permalink / raw)
  To: cluster-devel.redhat.com

A common problem occurs when multiple IP addresses within the same
subnet are assigned to the same NIC.  If we make a connection attempt to
another address on the same subnet as one of those addresses, the
connection attempt will not necessarily be routed from the address we
want.

In the case of the DLM, the other nodes will quickly drop the connection
attempt, causing problems.

This patch makes the DLM bind to the local address it acquired from the
cluster manager when using TCP prior to making a connection, obviating
the need for administrators to "fix" their systems or use clever routing
tricks.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dlm-lowcomms-tcp-src-upstream.patch
Type: text/x-patch
Size: 1099 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20071025/cc427c3d/attachment.bin>

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [Cluster-devel] [PATCH] dlm: bind connections from known local address when using TCP
@ 2008-01-21 22:25 David Teigland
  0 siblings, 0 replies; 8+ messages in thread
From: David Teigland @ 2008-01-21 22:25 UTC (permalink / raw)
  To: cluster-devel.redhat.com

From: Lon Hohberger <lhh@redhat.com>

A common problem occurs when multiple IP addresses within the same
subnet are assigned to the same NIC.  If we make a connection attempt to
another address on the same subnet as one of those addresses, the
connection attempt will not necessarily be routed from the address we
want.

In the case of the DLM, the other nodes will quickly drop the connection
attempt, causing problems.

This patch makes the DLM bind to the local address it acquired from the
cluster manager when using TCP prior to making a connection, obviating
the need for administrators to "fix" their systems or use clever routing
tricks.

Signed-off-by: Lon Hohberger <lhh@redhat.com>
Signed-off-by: Patrick Caulfield <pcaulfie@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
---
 fs/dlm/lowcomms.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index e9923ca..0bea802 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -864,7 +864,7 @@ static void sctp_init_assoc(struct connection *con)
 static void tcp_connect_to_sock(struct connection *con)
 {
 	int result = -EHOSTUNREACH;
-	struct sockaddr_storage saddr;
+	struct sockaddr_storage saddr, src_addr;
 	int addr_len;
 	struct socket *sock;
 
@@ -898,6 +898,17 @@ static void tcp_connect_to_sock(struct connection *con)
 	con->connect_action = tcp_connect_to_sock;
 	add_sock(sock, con);
 
+	/* Bind to our cluster-known address connecting to avoid
+	   routing problems */
+	memcpy(&src_addr, dlm_local_addr[0], sizeof(src_addr));
+	make_sockaddr(&src_addr, 0, &addr_len);
+	result = sock->ops->bind(sock, (struct sockaddr *) &src_addr,
+				 addr_len);
+	if (result < 0) {
+		printk("dlm: could not bind for connect: %d\n", result);
+		/* This *may* not indicate a critical error */
+	}
+
 	make_sockaddr(&saddr, dlm_config.ci_tcp_port, &addr_len);
 
 	log_print("connecting to %d", con->nodeid);
-- 
1.5.3.3



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

end of thread, other threads:[~2008-01-21 22:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-25 22:49 [Cluster-devel] [PATCH] [DLM] Bind connections from known local address when using TCP Lon Hohberger
2007-10-25 22:51 ` Lon Hohberger
2007-10-25 22:51 ` Lon Hohberger
2007-10-29  9:22 ` [Cluster-devel] " Steven Whitehouse
2007-10-30 14:02   ` Patrick Caulfield
2007-10-31 13:33     ` Steven Whitehouse
2007-10-31 13:54       ` Patrick Caulfield
  -- strict thread matches above, loose matches on Subject: below --
2008-01-21 22:25 [Cluster-devel] [PATCH] dlm: bind " David Teigland

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).