summaryrefslogtreecommitdiff
path: root/fs/dlm/lowcomms.c
diff options
context:
space:
mode:
authorAlexander Aring <aahringo@redhat.com>2021-07-16 23:22:42 +0300
committerDavid Teigland <teigland@redhat.com>2021-07-19 19:56:26 +0300
commit90d21fc0479dc0b5d338d664ddb55e5017b44f3e (patch)
treefc9200b80479ac5eb0c6bc7a73688df5a80c4f1c /fs/dlm/lowcomms.c
parent2dc6b1158c28c3a5e86d162628810312f98d5e97 (diff)
downloadlinux-90d21fc0479dc0b5d338d664ddb55e5017b44f3e.tar.xz
fs: dlm: auto load sctp module
This patch adds a "for now" better handling of missing SCTP support in the kernel and try to load the sctp module if SCTP is set. Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm/lowcomms.c')
-rw-r--r--fs/dlm/lowcomms.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index a042ea413f74..30d10d19ecac 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1864,11 +1864,9 @@ static int dlm_listen_for_all(void)
log_print("Using %s for communications",
dlm_proto_ops->name);
- if (dlm_proto_ops->listen_validate) {
- result = dlm_proto_ops->listen_validate();
- if (result < 0)
- return result;
- }
+ result = dlm_proto_ops->listen_validate();
+ if (result < 0)
+ return result;
result = sock_create_kern(&init_net, dlm_local_addr[0]->ss_family,
SOCK_STREAM, dlm_proto_ops->proto, &sock);
@@ -1945,6 +1943,17 @@ static const struct dlm_proto_ops dlm_tcp_ops = {
.eof_condition = tcp_eof_condition,
};
+static int dlm_sctp_listen_validate(void)
+{
+ if (!IS_ENABLED(CONFIG_IP_SCTP)) {
+ log_print("SCTP is not enabled by this kernel");
+ return -EOPNOTSUPP;
+ }
+
+ request_module("sctp");
+ return 0;
+}
+
static int dlm_sctp_bind_listen(struct socket *sock)
{
return sctp_bind_addrs(sock, dlm_config.ci_tcp_port);
@@ -1960,6 +1969,7 @@ static void dlm_sctp_sockopts(struct socket *sock)
static const struct dlm_proto_ops dlm_sctp_ops = {
.name = "SCTP",
.proto = IPPROTO_SCTP,
+ .listen_validate = dlm_sctp_listen_validate,
.listen_sockopts = dlm_sctp_sockopts,
.listen_bind = dlm_sctp_bind_listen,
.connect_action = sctp_connect_to_sock,