From: Heming Zhao <heming.zhao@suse.com>
To: teigland@redhat.com, aahringo@redhat.com
Cc: Heming Zhao <heming.zhao@suse.com>,
ccaulfie@redhat.com, jfriesse@redhat.com, nicholas.yang@suse.com,
glass.su@suse.com, gfs2@lists.linux.dev
Subject: [PATCH v2 1/1] dlm_controld: support corosync3/knet multi-link
Date: Tue, 24 Dec 2024 16:42:39 +0800 [thread overview]
Message-ID: <20241224084241.13563-2-heming.zhao@suse.com> (raw)
In-Reply-To: <20241224084241.13563-1-heming.zhao@suse.com>
The totem.rrp_mode config item was obsolete in corosync3. And
this patch gives dlm_controld the ability to detect multiple
links.
The corosync and dlm network protocol relationship table:
-------------+-----------------------+---------------------
| totem.transport=udpu | totem.transport=udp
+-----------------------+---------------------
corosync 2.x | | | multicast
| 1-ring | 2-ring |---------------------
| | | default | 2-ring
-------------+------------+----------+---------------------
dlm | tcp | sctp | tcp | sctp
-------------+------------+----------+---------------------
-------------+----------------------------+----------------------
| totem.transport = udpu/udp | totem.transport=knet
corosync 3.x |----------------------------+----------------------
| 1-ring | 1-link | multi-links
-------------+----------------------------+---------+-----------
dlm | tcp | tcp | sctp
-------------+----------------------------+---------+-----------
At last, 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 | 44 ++++++++++++++++++++++++++++++---------
dlm_controld/dlm_daemon.h | 4 ++--
dlm_sand/sand_internal.h | 4 ++--
3 files changed, 38 insertions(+), 14 deletions(-)
diff --git a/dlm_controld/action.c b/dlm_controld/action.c
index 60eb22a78c56..4b54a28707c6 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,40 @@ 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);
+ 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 only 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)
+ else if (link == 1)
+ proto = PROTO_TCP;
+
+ /*
+ * Since corosync3 retains rrp_mode but allows any value,
+ * we should precisely match the rrp_mode value (none,
+ * active, passive) used in corosync2 env.
+ */
+ rv = cmap_get_string(handle, "totem.rrp_mode", &str);
+ if (rv == CS_OK) {
+ log_debug("cmap totem.rrp_mode = '%s'", str);
+
+ if (!strcmp(str, "none"))
+ proto = PROTO_TCP;
+ else if (!strcmp(str, "active") || !strcmp(str, "passive"))
+ proto = PROTO_SCTP;
free(str);
+ }
+
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
next prev parent reply other threads:[~2024-12-24 8:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-24 8:42 [PATCH 0/1] dlm_tools: support corosync3/knet multi-link Heming Zhao
2024-12-24 8:42 ` Heming Zhao [this message]
2025-01-06 18:11 ` [PATCH v2 1/1] dlm_controld: " Alexander Aring
2025-01-07 4:59 ` Heming Zhao
2025-01-08 15:54 ` Alexander Aring
2025-01-09 2:26 ` Heming Zhao
2025-01-09 15:34 ` Alexander Aring
2025-01-09 15:38 ` christine caulfield
2025-01-10 14:28 ` Heming Zhao
2025-01-10 14:43 ` christine caulfield
2025-01-13 3:12 ` Heming Zhao
2025-01-17 15:11 ` Alexander Aring
2025-01-17 15:16 ` christine caulfield
2025-02-18 11:46 ` Heming Zhao
2025-02-18 16:35 ` Alexander Aring
2025-02-20 3:56 ` Heming Zhao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241224084241.13563-2-heming.zhao@suse.com \
--to=heming.zhao@suse.com \
--cc=aahringo@redhat.com \
--cc=ccaulfie@redhat.com \
--cc=gfs2@lists.linux.dev \
--cc=glass.su@suse.com \
--cc=jfriesse@redhat.com \
--cc=nicholas.yang@suse.com \
--cc=teigland@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox