Skip to content

Commit

Permalink
fs: dlm: introduce proto values
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David Teigland <[email protected]>
  • Loading branch information
Alexander Aring authored and teigland committed Jun 2, 2021
1 parent 9a4139a commit ac7d5d0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fs/dlm/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions fs/dlm/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
23 changes: 19 additions & 4 deletions fs/dlm/lowcomms.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit ac7d5d0

Please sign in to comment.