gfs2 filesystem and dlm development
 help / color / mirror / Atom feed
* [PATCH] dlm_controld: remove 'detect' mode from config item 'protocol'
@ 2025-03-10  7:36 Heming Zhao
  2025-03-10  7:36 ` [PATCH] dlm: make tcp still work in multi-link env Heming Zhao
  2025-03-18  7:35 ` [PATCH] dlm_controld: remove 'detect' mode from config item 'protocol' Heming Zhao
  0 siblings, 2 replies; 6+ messages in thread
From: Heming Zhao @ 2025-03-10  7:36 UTC (permalink / raw)
  To: teigland, aahringo; +Cc: Heming Zhao, gfs2, glass.su, zzhou

This patch removes the 'detect' mode for the configuration
item 'protocol'.

After this patch, dlm 'protocol' behaviors:
- TCP is now the default protocol.
- Stop trying to detect:
  - use dlm.conf or dlm_controld command line to switch from TCP
    to SCTP.
  - corosync.conf 'rrp_mode' is not supported in corosync 2.x env.
- TCP can work with multi-link, but uses only the first ip address
  from corosync.
- SCTP can support up to 8 ip addresses.

Note: This change requires a corresponding update to the dlm kernel
function dlm_tcp_listen_validate().

Signed-off-by: Heming Zhao <heming.zhao@suse.com>
---
 dlm_controld/action.c       | 39 ++++++-------------------------------
 dlm_controld/dlm.conf.5     | 11 ++++++++++-
 dlm_controld/dlm_controld.8 |  2 +-
 dlm_controld/main.c         |  4 ++--
 4 files changed, 19 insertions(+), 37 deletions(-)

diff --git a/dlm_controld/action.c b/dlm_controld/action.c
index 60eb22a78c56..10f0f67387b1 100644
--- a/dlm_controld/action.c
+++ b/dlm_controld/action.c
@@ -21,35 +21,6 @@ static int comms_nodes_count;
 #define SPACES_DIR    "/sys/kernel/config/dlm/cluster/spaces"
 #define COMMS_DIR     "/sys/kernel/config/dlm/cluster/comms"
 
-static int detect_protocol(void)
-{
-	cmap_handle_t handle;
-	char *str = NULL;
-	int rv, proto = -1;
-
-	rv = cmap_initialize(&handle);
-	if (rv != CS_OK) {
-		log_error("cmap_initialize error %d", rv);
-		return -1; 
-	}
-
-	rv = cmap_get_string(handle, "totem.rrp_mode", &str);
-	if (rv != CS_OK)
-		goto out;
-
-	log_debug("cmap totem.rrp_mode = '%s'", str);
-
-	if (!strcmp(str, "none"))
-		proto = PROTO_TCP;
-	else
-		proto = PROTO_SCTP;
- out:
-	if (str)
-		free(str);
-	cmap_finalize(handle);
-	return proto;
-}
-
 static int detect_cluster_name(void)
 {
 	cmap_handle_t handle;
@@ -870,12 +841,14 @@ int setup_configfs_options(void)
 	set_configfs_cluster("mark", NULL, optu(mark_ind));
 
 	proto_name = opts(protocol_ind);
-	proto_num = -1;
+	proto_num = 0; /* default is tcp */
 
-	if (!strcasecmp(proto_name, "detect") || !strcmp(proto_name, "2"))
-		proto_num = detect_protocol(); /* may be -1 */
+	if (!strcasecmp(proto_name, "detect") || !strcmp(proto_name, "2")) {
+		log_error("'detect' mode is not supported anymore, will use default mode (TCP).");
+		log_error("see dlm_conf(5) for details.");
+	}
 
-	else if (!strcasecmp(proto_name, "tcp") || !strcmp(proto_name, "0"))
+	if (!strcasecmp(proto_name, "tcp") || !strcmp(proto_name, "0"))
 		proto_num = PROTO_TCP;
 
 	else if (!strcasecmp(proto_name, "sctp") || !strcmp(proto_name, "1"))
diff --git a/dlm_controld/dlm.conf.5 b/dlm_controld/dlm.conf.5
index cb13eaf0db28..073baf883b38 100644
--- a/dlm_controld/dlm.conf.5
+++ b/dlm_controld/dlm.conf.5
@@ -77,13 +77,22 @@ enable_helper
 
 Options with (*) can be reloaded, see Reload config.
 
-.SH Reload config
+.SH Reload configuration
 
 Some dlm.conf settings can be changed while dlm_controld is running using
 dlm_tool reload_config.  Edit dlm.conf, adding, removing, commenting or
 changing values, then run dlm_tool reload_config to apply the changes in
 dlm_controld.  dlm_tool dump_config will show the new settings.
 
+.SH Protocol configuration
+
+Since the totem.rrp_mode configuration item was deprecated in Corosync 3,
+the DLM adjusts the protocol configuration item's style to ensure DLM
+functionality on both Corosync 2 and 3. The change is that the protocol
+configuration item no longer supports 'detect|2'. The default protocol is
+TCP if the user does not specify a protocol on the dlm_daemon command line
+or in dlm.conf.
+
 .SH Fencing
 
 A fence device definition begins with a
diff --git a/dlm_controld/dlm_controld.8 b/dlm_controld/dlm_controld.8
index 3aab388531df..d72ebb299f7d 100644
--- a/dlm_controld/dlm_controld.8
+++ b/dlm_controld/dlm_controld.8
@@ -31,7 +31,7 @@ For default settings, see dlm_controld -h.
 
 .B --protocol | -r
 .I str
-        dlm kernel lowcomms protocol: tcp, sctp, detect
+        dlm kernel lowcomms protocol: tcp, sctp
 
 .B --debug_logfile | -L
         write debugging to log file
diff --git a/dlm_controld/main.c b/dlm_controld/main.c
index 1c4333373617..6fb6dffeadaf 100644
--- a/dlm_controld/main.c
+++ b/dlm_controld/main.c
@@ -1817,8 +1817,8 @@ static void set_opt_defaults(void)
 
 	set_opt_default(protocol_ind,
 			"protocol", 'r', req_arg_str,
-			-1, "detect", 0, 0,
-			"dlm kernel lowcomms protocol: tcp, sctp, detect");
+			0, "tcp", 0, 0,
+			"dlm kernel lowcomms protocol: tcp, sctp");
 
 	set_opt_default(port_ind,
 			"port", 'R', req_arg_uint,
-- 
2.43.0


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

* [PATCH] dlm: make tcp still work in multi-link env
  2025-03-10  7:36 [PATCH] dlm_controld: remove 'detect' mode from config item 'protocol' Heming Zhao
@ 2025-03-10  7:36 ` Heming Zhao
  2025-03-18  7:35   ` Heming Zhao
  2025-03-18 13:44   ` Alexander Aring
  2025-03-18  7:35 ` [PATCH] dlm_controld: remove 'detect' mode from config item 'protocol' Heming Zhao
  1 sibling, 2 replies; 6+ messages in thread
From: Heming Zhao @ 2025-03-10  7:36 UTC (permalink / raw)
  To: teigland, aahringo; +Cc: Heming Zhao, gfs2, glass.su, zzhou

This patch bypasses multi-link errors in TCP mode, allowing dlm
to operate on the first tcp link.

Signed-off-by: Heming Zhao <heming.zhao@suse.com>
---
 fs/dlm/lowcomms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index d28141829c05..70abd4da17a6 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1826,8 +1826,8 @@ static int dlm_tcp_listen_validate(void)
 {
 	/* We don't support multi-homed hosts */
 	if (dlm_local_count > 1) {
-		log_print("TCP protocol can't handle multi-homed hosts, try SCTP");
-		return -EINVAL;
+		log_print("Detect multi-homed hosts but use only the first IP address.");
+		log_print("Try SCTP, if you want to enable multi-link.");
 	}
 
 	return 0;
-- 
2.43.0


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

* Re: [PATCH] dlm_controld: remove 'detect' mode from config item 'protocol'
  2025-03-10  7:36 [PATCH] dlm_controld: remove 'detect' mode from config item 'protocol' Heming Zhao
  2025-03-10  7:36 ` [PATCH] dlm: make tcp still work in multi-link env Heming Zhao
@ 2025-03-18  7:35 ` Heming Zhao
  2025-03-18 13:42   ` Alexander Aring
  1 sibling, 1 reply; 6+ messages in thread
From: Heming Zhao @ 2025-03-18  7:35 UTC (permalink / raw)
  To: teigland, aahringo; +Cc: gfs2, glass.su, zzhou

ping...

On 3/10/25 15:36, Heming Zhao wrote:
> This patch removes the 'detect' mode for the configuration
> item 'protocol'.
> 
> After this patch, dlm 'protocol' behaviors:
> - TCP is now the default protocol.
> - Stop trying to detect:
>    - use dlm.conf or dlm_controld command line to switch from TCP
>      to SCTP.
>    - corosync.conf 'rrp_mode' is not supported in corosync 2.x env.
> - TCP can work with multi-link, but uses only the first ip address
>    from corosync.
> - SCTP can support up to 8 ip addresses.
> 
> Note: This change requires a corresponding update to the dlm kernel
> function dlm_tcp_listen_validate().
> 
> Signed-off-by: Heming Zhao <heming.zhao@suse.com>
> ---
>   dlm_controld/action.c       | 39 ++++++-------------------------------
>   dlm_controld/dlm.conf.5     | 11 ++++++++++-
>   dlm_controld/dlm_controld.8 |  2 +-
>   dlm_controld/main.c         |  4 ++--
>   4 files changed, 19 insertions(+), 37 deletions(-)
> 

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

* Re: [PATCH] dlm: make tcp still work in multi-link env
  2025-03-10  7:36 ` [PATCH] dlm: make tcp still work in multi-link env Heming Zhao
@ 2025-03-18  7:35   ` Heming Zhao
  2025-03-18 13:44   ` Alexander Aring
  1 sibling, 0 replies; 6+ messages in thread
From: Heming Zhao @ 2025-03-18  7:35 UTC (permalink / raw)
  To: teigland, aahringo; +Cc: gfs2, glass.su, zzhou

ping...

On 3/10/25 15:36, Heming Zhao wrote:
> This patch bypasses multi-link errors in TCP mode, allowing dlm
> to operate on the first tcp link.
> 
> Signed-off-by: Heming Zhao <heming.zhao@suse.com>
> ---
>   fs/dlm/lowcomms.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
> index d28141829c05..70abd4da17a6 100644
> --- a/fs/dlm/lowcomms.c
> +++ b/fs/dlm/lowcomms.c
> @@ -1826,8 +1826,8 @@ static int dlm_tcp_listen_validate(void)
>   {
>   	/* We don't support multi-homed hosts */
>   	if (dlm_local_count > 1) {
> -		log_print("TCP protocol can't handle multi-homed hosts, try SCTP");
> -		return -EINVAL;
> +		log_print("Detect multi-homed hosts but use only the first IP address.");
> +		log_print("Try SCTP, if you want to enable multi-link.");
>   	}
>   
>   	return 0;


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

* Re: [PATCH] dlm_controld: remove 'detect' mode from config item 'protocol'
  2025-03-18  7:35 ` [PATCH] dlm_controld: remove 'detect' mode from config item 'protocol' Heming Zhao
@ 2025-03-18 13:42   ` Alexander Aring
  0 siblings, 0 replies; 6+ messages in thread
From: Alexander Aring @ 2025-03-18 13:42 UTC (permalink / raw)
  To: Heming Zhao; +Cc: teigland, gfs2, glass.su, zzhou

Hi Heming,

On Tue, Mar 18, 2025 at 3:35 AM Heming Zhao <heming.zhao@suse.com> wrote:
>
> ping...
>

sorry, I applied this patch to dlm user space upstream. [0]

- Alex

[0] https://pagure.io/dlm/commits/main


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

* Re: [PATCH] dlm: make tcp still work in multi-link env
  2025-03-10  7:36 ` [PATCH] dlm: make tcp still work in multi-link env Heming Zhao
  2025-03-18  7:35   ` Heming Zhao
@ 2025-03-18 13:44   ` Alexander Aring
  1 sibling, 0 replies; 6+ messages in thread
From: Alexander Aring @ 2025-03-18 13:44 UTC (permalink / raw)
  To: Heming Zhao; +Cc: teigland, gfs2, glass.su, zzhou

Hi,

On Mon, Mar 10, 2025 at 3:36 AM Heming Zhao <heming.zhao@suse.com> wrote:
>
> This patch bypasses multi-link errors in TCP mode, allowing dlm
> to operate on the first tcp link.
>
> Signed-off-by: Heming Zhao <heming.zhao@suse.com>

Acked-by: Alexander Aring <aahringo@redhat.com>

- Alex


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

end of thread, other threads:[~2025-03-18 13:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-10  7:36 [PATCH] dlm_controld: remove 'detect' mode from config item 'protocol' Heming Zhao
2025-03-10  7:36 ` [PATCH] dlm: make tcp still work in multi-link env Heming Zhao
2025-03-18  7:35   ` Heming Zhao
2025-03-18 13:44   ` Alexander Aring
2025-03-18  7:35 ` [PATCH] dlm_controld: remove 'detect' mode from config item 'protocol' Heming Zhao
2025-03-18 13:42   ` Alexander Aring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox