rpms/kernel/F-12 dlm-fix-connection-close-handling.patch, NONE, 1.1 kernel.spec, 1.1935, 1.1936

Kyle McMartin kyle at fedoraproject.org
Wed Nov 25 20:03:58 UTC 2009


Author: kyle

Update of /cvs/pkgs/rpms/kernel/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv20082

Modified Files:
	kernel.spec 
Added Files:
	dlm-fix-connection-close-handling.patch 
Log Message:
* Wed Nov 25 2009 Kyle McMartin <kyle at redhat.com>
- dlm: fix connection close handling.
  Fix by lmb, requested by fabio.


dlm-fix-connection-close-handling.patch:
 lowcomms.c |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

--- NEW FILE dlm-fix-connection-close-handling.patch ---
From: Lars Marowsky-Bree <lmb at suse.de>
Date: Tue, 11 Aug 2009 21:18:23 +0000 (-0500)
Subject: dlm: fix connection close handling
X-Git-Tag: v2.6.32-rc1~646^2~1
X-Git-Url: http://git.kernel.org/gitweb.cgi?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=063c4c99630c0b06afad080d2a18bda64172c1a2

dlm: fix connection close handling

Closing a connection to a node can create problems if there are
outstanding messages for that node.  The problems include dlm_send
spinning attempting to reconnect, or BUG from tcp_connect_to_sock()
attempting to use a partially closed connection.

To cleanly close a connection, we now first attempt to send any pending
messages, cancel any remaining workqueue work, and flag the connection
as closed to avoid reconnect attempts.

Signed-off-by: Lars Marowsky-Bree <lmb at suse.de>
Signed-off-by: Christine Caulfield <ccaulfie at redhat.com>
Signed-off-by: David Teigland <teigland at redhat.com>
---

diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 210d52c..bda690c 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -106,6 +106,7 @@ struct connection {
 #define CF_CONNECT_PENDING 3
 #define CF_INIT_PENDING 4
 #define CF_IS_OTHERCON 5
+#define CF_CLOSE 6
 	struct list_head writequeue;  /* List of outgoing writequeue_entries */
 	spinlock_t writequeue_lock;
 	int (*rx_action) (struct connection *);	/* What to do when active */
@@ -299,6 +300,8 @@ static void lowcomms_write_space(struct sock *sk)
 
 static inline void lowcomms_connect_sock(struct connection *con)
 {
+	if (test_bit(CF_CLOSE, &con->flags))
+		return;
 	if (!test_and_set_bit(CF_CONNECT_PENDING, &con->flags))
 		queue_work(send_workqueue, &con->swork);
 }
@@ -1368,6 +1371,13 @@ int dlm_lowcomms_close(int nodeid)
 	log_print("closing connection to node %d", nodeid);
 	con = nodeid2con(nodeid, 0);
 	if (con) {
+		clear_bit(CF_CONNECT_PENDING, &con->flags);
+		clear_bit(CF_WRITE_PENDING, &con->flags);
+		set_bit(CF_CLOSE, &con->flags);
+		if (cancel_work_sync(&con->swork))
+			log_print("canceled swork for node %d", nodeid);
+		if (cancel_work_sync(&con->rwork))
+			log_print("canceled rwork for node %d", nodeid);
 		clean_one_writequeue(con);
 		close_connection(con, true);
 	}
@@ -1393,9 +1403,10 @@ static void process_send_sockets(struct work_struct *work)
 
 	if (test_and_clear_bit(CF_CONNECT_PENDING, &con->flags)) {
 		con->connect_action(con);
+		set_bit(CF_WRITE_PENDING, &con->flags);
 	}
-	clear_bit(CF_WRITE_PENDING, &con->flags);
-	send_to_sock(con);
+	if (test_and_clear_bit(CF_WRITE_PENDING, &con->flags))
+		send_to_sock(con);
 }
 
 


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-12/kernel.spec,v
retrieving revision 1.1935
retrieving revision 1.1936
diff -u -p -r1.1935 -r1.1936
--- kernel.spec	25 Nov 2009 10:39:10 -0000	1.1935
+++ kernel.spec	25 Nov 2009 20:03:58 -0000	1.1936
@@ -804,6 +804,8 @@ Patch14460: highmem-Fix-debug_kmap_atomi
 Patch14461: highmem-Fix-race-in-debug_kmap_atomic-which-could-ca.patch
 Patch14462: highmem-fix-arm-powerpc-kmap_types.patch
 
+Patch14463: dlm-fix-connection-close-handling.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1499,6 +1501,8 @@ ApplyPatch highmem-Fix-debug_kmap_atomic
 ApplyPatch highmem-Fix-race-in-debug_kmap_atomic-which-could-ca.patch
 ApplyPatch highmem-fix-arm-powerpc-kmap_types.patch
 
+ApplyPatch dlm-fix-connection-close-handling.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -2148,6 +2152,10 @@ fi
 # and build.
 
 %changelog
+* Wed Nov 25 2009 Kyle McMartin <kyle at redhat.com>
+- dlm: fix connection close handling.
+  Fix by lmb, requested by fabio.
+
 * Wed Nov 25 2009 David Woodhouse <David.Woodhouse at intel.com> 2.6.31.6-149
 - VT-d: Work around more HP BIOS brokenness.
 




More information about the fedora-extras-commits mailing list