Jeff Mahoney
2006-Jan-09 22:39 UTC
[Ocfs2-devel] [PATCH 08/11] ocfs2: only disconnect tcp connections when the last reference is dropped
Since o2net wants all events from any resource, by default it will drop the TCP connection when a single resource fails. This patch waits until all listeners have been dropped to drop the connection. fs/ocfs2/cluster/nodemanager.h | 1 + fs/ocfs2/cluster/tcp.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) Signed-off-by: Jeff Mahoney <jeffm at suse.com> diff -ruNpX dontdiff linux-2.6.15/fs/ocfs2/cluster/nodemanager.h linux-2.6.15-ocfs2/fs/ocfs2/cluster/nodemanager.h --- linux-2.6.15/fs/ocfs2/cluster/nodemanager.h 2006-01-06 12:24:12.505215920 -0500 +++ linux-2.6.15-ocfs2/fs/ocfs2/cluster/nodemanager.h 2006-01-06 12:24:21.421860384 -0500 @@ -51,6 +51,7 @@ struct o2nm_node { int nd_local; unsigned long nd_set_attributes; + atomic_t nd_count; }; struct o2nm_cluster { diff -ruNpX dontdiff linux-2.6.15/fs/ocfs2/cluster/tcp.c linux-2.6.15-ocfs2/fs/ocfs2/cluster/tcp.c --- linux-2.6.15/fs/ocfs2/cluster/tcp.c 2006-01-06 12:24:12.506215768 -0500 +++ linux-2.6.15-ocfs2/fs/ocfs2/cluster/tcp.c 2006-01-06 12:24:21.422860232 -0500 @@ -1448,8 +1448,10 @@ void o2net_disconnect_node(struct o2nm_n static void o2net_hb_node_down_cb(struct o2nm_node *node, int node_num, void *data) { - if (node_num != o2nm_this_node()) - o2net_disconnect_node(node); + if (node_num != o2nm_this_node()) { + if (atomic_dec_and_test(&node->nd_count)) + o2net_disconnect_node(node); + } } static void o2net_hb_node_up_cb(struct o2nm_node *node, int node_num, @@ -1462,6 +1464,7 @@ static void o2net_hb_node_up_cb(struct o (msecs_to_jiffies(O2NET_RECONNECT_DELAY_MS) + 1); if (node_num != o2nm_this_node()) { + atomic_inc(&node->nd_count); /* heartbeat doesn't work unless a local node number is * configured and doing so brings up the o2net_wq, so we can * use it.. */