From 828ae6afbef03bfe107a4a8cc38798419d6a2765 Mon Sep 17 00:00:00 2001 From: Andrew Beekhof Date: Mon, 4 Dec 2006 14:04:55 +0100 Subject: [patch 3/3] OCFS2 Configurable timeouts - Protocol changes Modify the OCFS2 handshake to ensure essential timeouts are configured identically on all nodes. Only allow changes when there are no connected peers Improves the logic in o2net_advance_rx() which broke now that sizeof(struct o2net_handshake) is greater than sizeof(struct o2net_msg) Included is the field for userspace-heartbeat timeout to avoid the need for further protocol changes. Uses a global spinlock to ensure the decisions to update configfs entries are made on the correct value. The region covered by the spinlock when incrementing the counter is much larger as this is the more critical case. Small cleanup contributed by Adrian Bunk Signed-off-by: Andrew Beekhof Signed-off-by: Mark Fasheh --- fs/ocfs2/cluster/nodemanager.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'fs/ocfs2/cluster/nodemanager.c') diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c index 234f83f2897..357f1d55177 100644 --- a/fs/ocfs2/cluster/nodemanager.c +++ b/fs/ocfs2/cluster/nodemanager.c @@ -573,12 +573,21 @@ static ssize_t o2nm_cluster_attr_idle_timeout_ms_write( ret = o2nm_cluster_attr_write(page, count, &val); if (ret > 0) { - if (val <= cluster->cl_keepalive_delay_ms) { + if (cluster->cl_idle_timeout_ms != val + && o2net_num_connected_peers()) { + mlog(ML_NOTICE, + "o2net: cannot change idle timeout after " + "the first peer has agreed to it." + " %d connected peers\n", + o2net_num_connected_peers()); + ret = -EINVAL; + } else if (val <= cluster->cl_keepalive_delay_ms) { mlog(ML_NOTICE, "o2net: idle timeout must be larger " "than keepalive delay\n"); - return -EINVAL; + ret = -EINVAL; + } else { + cluster->cl_idle_timeout_ms = val; } - cluster->cl_idle_timeout_ms = val; } return ret; @@ -599,12 +608,21 @@ static ssize_t o2nm_cluster_attr_keepalive_delay_ms_write( ret = o2nm_cluster_attr_write(page, count, &val); if (ret > 0) { - if (val >= cluster->cl_idle_timeout_ms) { + if (cluster->cl_keepalive_delay_ms != val + && o2net_num_connected_peers()) { + mlog(ML_NOTICE, + "o2net: cannot change keepalive delay after" + " the first peer has agreed to it." + " %d connected peers\n", + o2net_num_connected_peers()); + ret = -EINVAL; + } else if (val >= cluster->cl_idle_timeout_ms) { mlog(ML_NOTICE, "o2net: keepalive delay must be " "smaller than idle timeout\n"); - return -EINVAL; + ret = -EINVAL; + } else { + cluster->cl_keepalive_delay_ms = val; } - cluster->cl_keepalive_delay_ms = val; } return ret; -- cgit v1.2.3