public inbox for gfs2@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH 0/1] dlm_tools: support corosync3/knet multi-link
@ 2024-12-20  7:14 Heming Zhao
  2024-12-20  7:14 ` [PATCH 1/1] dlm_controld: " Heming Zhao
  2024-12-20  7:38 ` [PATCH 0/1] dlm_tools: " Heming Zhao
  0 siblings, 2 replies; 3+ messages in thread
From: Heming Zhao @ 2024-12-20  7:14 UTC (permalink / raw)
  To: teigland, aahringo; +Cc: Heming Zhao, gfs2, ccaulfie, jfriesse, nicholas.yang

This patch is to support corosync3/knet multi-link.

btw, this mailing list (gfs2@lists.linux.dev) is the right place
to send this patch?

Heming Zhao (1):
  dlm_controld: support corosync3/knet multi-link

 dlm_controld/action.c     | 31 ++++++++++++++++++++-----------
 dlm_controld/dlm_daemon.h |  4 ++--
 dlm_sand/sand_internal.h  |  4 ++--
 3 files changed, 24 insertions(+), 15 deletions(-)

-- 
2.43.0


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

* [PATCH 1/1] dlm_controld: support corosync3/knet multi-link
  2024-12-20  7:14 [PATCH 0/1] dlm_tools: support corosync3/knet multi-link Heming Zhao
@ 2024-12-20  7:14 ` Heming Zhao
  2024-12-20  7:38 ` [PATCH 0/1] dlm_tools: " Heming Zhao
  1 sibling, 0 replies; 3+ messages in thread
From: Heming Zhao @ 2024-12-20  7:14 UTC (permalink / raw)
  To: teigland, aahringo; +Cc: Heming Zhao, gfs2, ccaulfie, jfriesse, nicholas.yang

The totem.rrp_mode config item was obsolete in corosync3. And
this patch gives dlm_controld the ability to detect multiple links

And this patch should be work with updated kernel dlm module.
Because the DLM_MAX_ADDR_COUNT is changed from 3 to 8.

Signed-off-by: Heming Zhao <heming.zhao@suse.com>
---
 dlm_controld/action.c     | 31 ++++++++++++++++++++-----------
 dlm_controld/dlm_daemon.h |  4 ++--
 dlm_sand/sand_internal.h  |  4 ++--
 3 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/dlm_controld/action.c b/dlm_controld/action.c
index 60eb22a78c56..48a30a20f00f 100644
--- a/dlm_controld/action.c
+++ b/dlm_controld/action.c
@@ -20,12 +20,15 @@ static int comms_nodes_count;
 #define CLUSTER_DIR   "/sys/kernel/config/dlm/cluster"
 #define SPACES_DIR    "/sys/kernel/config/dlm/cluster/spaces"
 #define COMMS_DIR     "/sys/kernel/config/dlm/cluster/comms"
+#define CMAP_STR_LEN  27
 
 static int detect_protocol(void)
 {
 	cmap_handle_t handle;
 	char *str = NULL;
+	char key[CMAP_STR_LEN];
 	int rv, proto = -1;
+	int i, link = 0;
 
 	rv = cmap_initialize(&handle);
 	if (rv != CS_OK) {
@@ -33,19 +36,25 @@ static int detect_protocol(void)
 		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);
+	/* corosync3 supports MAX_NODE_ADDRESSES links at max */
+	for (i = 0; i < MAX_NODE_ADDRESSES; i++) {
+		snprintf(key, CMAP_STR_LEN, "nodelist.node.0.ring%d_addr", i);
+		rv = cmap_get_string(handle, key, &str);
+		if (rv != CS_OK) {
+			/* we just care the link number, ignore all error here */
+			log_debug("[%d] %s rv:%d", i, key, rv);
+			continue;
+		}
+		log_debug("[%d] %s : %s", i, key, str);
+		link++;
+		free(str);
+	}
 
-	if (!strcmp(str, "none"))
-		proto = PROTO_TCP;
-	else
+	if (link > 1)
 		proto = PROTO_SCTP;
- out:
-	if (str)
-		free(str);
+	else
+		proto = PROTO_TCP;
+
 	cmap_finalize(handle);
 	return proto;
 }
diff --git a/dlm_controld/dlm_daemon.h b/dlm_controld/dlm_daemon.h
index 4a533e3451e2..3ed4e235a83c 100644
--- a/dlm_controld/dlm_daemon.h
+++ b/dlm_controld/dlm_daemon.h
@@ -176,9 +176,9 @@ EXTERN struct dlm_option dlm_options[dlm_options_max];
 #define MAX_NODES	128
 
 /* Maximum number of IP addresses per node, when using SCTP and multi-ring in
-   corosync  In dlm-kernel this is DLM_MAX_ADDR_COUNT, currently 3. */
+   corosync  In dlm-kernel this is DLM_MAX_ADDR_COUNT, currently 8. */
 
-#define MAX_NODE_ADDRESSES 4
+#define MAX_NODE_ADDRESSES 8
 
 #define PROTO_TCP  0
 #define PROTO_SCTP 1
diff --git a/dlm_sand/sand_internal.h b/dlm_sand/sand_internal.h
index 4c2fc0897051..c17287abcd47 100644
--- a/dlm_sand/sand_internal.h
+++ b/dlm_sand/sand_internal.h
@@ -138,9 +138,9 @@ EXTERN struct dlm_option dlm_options[dlm_options_max];
    Copied in libdlm.h so apps don't need to include the kernel header. */
 
 /* Maximum number of IP addresses per node, when using SCTP.
-   In dlm-kernel this is DLM_MAX_ADDR_COUNT, currently 3. */
+   In dlm-kernel this is DLM_MAX_ADDR_COUNT, currently 8. */
 
-#define MAX_NODE_ADDRESSES 4
+#define MAX_NODE_ADDRESSES 8
 
 #define PROTO_TCP  0
 #define PROTO_SCTP 1
-- 
2.43.0


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

* Re: [PATCH 0/1] dlm_tools: support corosync3/knet multi-link
  2024-12-20  7:14 [PATCH 0/1] dlm_tools: support corosync3/knet multi-link Heming Zhao
  2024-12-20  7:14 ` [PATCH 1/1] dlm_controld: " Heming Zhao
@ 2024-12-20  7:38 ` Heming Zhao
  1 sibling, 0 replies; 3+ messages in thread
From: Heming Zhao @ 2024-12-20  7:38 UTC (permalink / raw)
  To: teigland, aahringo; +Cc: gfs2, ccaulfie, jfriesse, nicholas.yang

Hi all,

Nicholas notified me the new code is not compatible with corosync2
multicast mode. I withdraw this patch and will send a new patch.

Thanks,
Heming

On 12/20/24 15:14, Heming Zhao wrote:
> This patch is to support corosync3/knet multi-link.
> 
> btw, this mailing list (gfs2@lists.linux.dev) is the right place
> to send this patch?
> 
> Heming Zhao (1):
>    dlm_controld: support corosync3/knet multi-link
> 
>   dlm_controld/action.c     | 31 ++++++++++++++++++++-----------
>   dlm_controld/dlm_daemon.h |  4 ++--
>   dlm_sand/sand_internal.h  |  4 ++--
>   3 files changed, 24 insertions(+), 15 deletions(-)
> 



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

end of thread, other threads:[~2024-12-20  7:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-20  7:14 [PATCH 0/1] dlm_tools: support corosync3/knet multi-link Heming Zhao
2024-12-20  7:14 ` [PATCH 1/1] dlm_controld: " Heming Zhao
2024-12-20  7:38 ` [PATCH 0/1] dlm_tools: " Heming Zhao

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