Skip to content

Commit 90d21fc

Browse files
Alexander Aringteigland
authored andcommitted
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>
1 parent 2dc6b11 commit 90d21fc

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

fs/dlm/lowcomms.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1864,11 +1864,9 @@ static int dlm_listen_for_all(void)
18641864
log_print("Using %s for communications",
18651865
dlm_proto_ops->name);
18661866

1867-
if (dlm_proto_ops->listen_validate) {
1868-
result = dlm_proto_ops->listen_validate();
1869-
if (result < 0)
1870-
return result;
1871-
}
1867+
result = dlm_proto_ops->listen_validate();
1868+
if (result < 0)
1869+
return result;
18721870

18731871
result = sock_create_kern(&init_net, dlm_local_addr[0]->ss_family,
18741872
SOCK_STREAM, dlm_proto_ops->proto, &sock);
@@ -1945,6 +1943,17 @@ static const struct dlm_proto_ops dlm_tcp_ops = {
19451943
.eof_condition = tcp_eof_condition,
19461944
};
19471945

1946+
static int dlm_sctp_listen_validate(void)
1947+
{
1948+
if (!IS_ENABLED(CONFIG_IP_SCTP)) {
1949+
log_print("SCTP is not enabled by this kernel");
1950+
return -EOPNOTSUPP;
1951+
}
1952+
1953+
request_module("sctp");
1954+
return 0;
1955+
}
1956+
19481957
static int dlm_sctp_bind_listen(struct socket *sock)
19491958
{
19501959
return sctp_bind_addrs(sock, dlm_config.ci_tcp_port);
@@ -1960,6 +1969,7 @@ static void dlm_sctp_sockopts(struct socket *sock)
19601969
static const struct dlm_proto_ops dlm_sctp_ops = {
19611970
.name = "SCTP",
19621971
.proto = IPPROTO_SCTP,
1972+
.listen_validate = dlm_sctp_listen_validate,
19631973
.listen_sockopts = dlm_sctp_sockopts,
19641974
.listen_bind = dlm_sctp_bind_listen,
19651975
.connect_action = sctp_connect_to_sock,

0 commit comments

Comments
 (0)