From: Alexander Aring <aahringo@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH dlm/next 5/6] fs: dlm: introduce proto values
Date: Wed, 2 Jun 2021 09:45:19 -0400 [thread overview]
Message-ID: <20210602134520.71030-5-aahringo@redhat.com> (raw)
In-Reply-To: <20210602134520.71030-1-aahringo@redhat.com>
Currently the dlm protocol values are that TCP is 0 and everything else
is SCTP. This makes it difficult to introduce possible other transport
layers. The only one user space tool dlm_controld, which I am aware of,
handles the protocol value 1 for SCTP. We change it now to handle SCTP
as 1, this will break user space API but it will fix it so we can add
possible other transport layers.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
fs/dlm/config.c | 2 +-
fs/dlm/config.h | 3 +++
fs/dlm/lowcomms.c | 23 +++++++++++++++++++----
3 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index db717a879537..c91c1c73ed9d 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -952,7 +952,7 @@ int dlm_our_addr(struct sockaddr_storage *addr, int num)
#define DEFAULT_SCAN_SECS 5
#define DEFAULT_LOG_DEBUG 0
#define DEFAULT_LOG_INFO 1
-#define DEFAULT_PROTOCOL 0
+#define DEFAULT_PROTOCOL DLM_PROTO_TCP
#define DEFAULT_MARK 0
#define DEFAULT_TIMEWARN_CS 500 /* 5 sec = 500 centiseconds */
#define DEFAULT_WAITWARN_US 0
diff --git a/fs/dlm/config.h b/fs/dlm/config.h
index d2cd4bd20313..00374b45c748 100644
--- a/fs/dlm/config.h
+++ b/fs/dlm/config.h
@@ -23,6 +23,9 @@ struct dlm_config_node {
#define DLM_MAX_ADDR_COUNT 3
+#define DLM_PROTO_TCP 0
+#define DLM_PROTO_SCTP 1
+
struct dlm_config_info {
int ci_tcp_port;
int ci_buffer_size;
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 6b150e3aa30c..f2a3b0401b9c 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -208,12 +208,18 @@ static int dlm_con_init(struct connection *con, int nodeid)
INIT_WORK(&con->rwork, process_recv_sockets);
init_waitqueue_head(&con->shutdown_wait);
- if (dlm_config.ci_protocol == 0) {
+ switch (dlm_config.ci_protocol) {
+ case DLM_PROTO_TCP:
con->connect_action = tcp_connect_to_sock;
con->shutdown_action = dlm_tcp_shutdown;
con->eof_condition = tcp_eof_condition;
- } else {
+ break;
+ case DLM_PROTO_SCTP:
con->connect_action = sctp_connect_to_sock;
+ break;
+ default:
+ kfree(con->rx_buf);
+ return -EINVAL;
}
return 0;
@@ -1968,10 +1974,19 @@ int dlm_lowcomms_start(void)
dlm_allow_conn = 1;
/* Start listening */
- if (dlm_config.ci_protocol == 0)
+ switch (dlm_config.ci_protocol) {
+ case DLM_PROTO_TCP:
error = tcp_listen_for_all();
- else
+ break;
+ case DLM_PROTO_SCTP:
error = sctp_listen_for_all(&listen_con);
+ break;
+ default:
+ log_print("Invalid protocol identifier %d set",
+ dlm_config.ci_protocol);
+ error = -EINVAL;
+ break;
+ }
if (error)
goto fail_unlisten;
--
2.26.3
next prev parent reply other threads:[~2021-06-02 13:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-02 13:45 [Cluster-devel] [PATCH dlm/next 1/6] fs: dlm: fix lowcomms_start error case Alexander Aring
2021-06-02 13:45 ` [Cluster-devel] [PATCH dlm/next 2/6] fs: dlm: fix memory leak when fenced Alexander Aring
2021-06-02 13:45 ` [Cluster-devel] [PATCH dlm/next 3/6] fs: dlm: use alloc_ordered_workqueue Alexander Aring
2021-06-02 13:45 ` [Cluster-devel] [PATCH dlm/next 4/6] fs: dlm: move dlm allow conn Alexander Aring
2021-06-02 13:45 ` Alexander Aring [this message]
2021-06-02 13:45 ` [Cluster-devel] [PATCH dlm/next 6/6] fs: dlm: rename socket and app buffer defines Alexander Aring
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=20210602134520.71030-5-aahringo@redhat.com \
--to=aahringo@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;
as well as URLs for NNTP newsgroup(s).