Skip to content

Commit ac7d5d0

Browse files
Alexander Aringteigland
authored andcommitted
fs: dlm: introduce proto values
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]>
1 parent 9a4139a commit ac7d5d0

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

fs/dlm/config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ int dlm_our_addr(struct sockaddr_storage *addr, int num)
952952
#define DEFAULT_SCAN_SECS 5
953953
#define DEFAULT_LOG_DEBUG 0
954954
#define DEFAULT_LOG_INFO 1
955-
#define DEFAULT_PROTOCOL 0
955+
#define DEFAULT_PROTOCOL DLM_PROTO_TCP
956956
#define DEFAULT_MARK 0
957957
#define DEFAULT_TIMEWARN_CS 500 /* 5 sec = 500 centiseconds */
958958
#define DEFAULT_WAITWARN_US 0

fs/dlm/config.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ struct dlm_config_node {
2323

2424
#define DLM_MAX_ADDR_COUNT 3
2525

26+
#define DLM_PROTO_TCP 0
27+
#define DLM_PROTO_SCTP 1
28+
2629
struct dlm_config_info {
2730
int ci_tcp_port;
2831
int ci_buffer_size;

fs/dlm/lowcomms.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,18 @@ static int dlm_con_init(struct connection *con, int nodeid)
208208
INIT_WORK(&con->rwork, process_recv_sockets);
209209
init_waitqueue_head(&con->shutdown_wait);
210210

211-
if (dlm_config.ci_protocol == 0) {
211+
switch (dlm_config.ci_protocol) {
212+
case DLM_PROTO_TCP:
212213
con->connect_action = tcp_connect_to_sock;
213214
con->shutdown_action = dlm_tcp_shutdown;
214215
con->eof_condition = tcp_eof_condition;
215-
} else {
216+
break;
217+
case DLM_PROTO_SCTP:
216218
con->connect_action = sctp_connect_to_sock;
219+
break;
220+
default:
221+
kfree(con->rx_buf);
222+
return -EINVAL;
217223
}
218224

219225
return 0;
@@ -1968,10 +1974,19 @@ int dlm_lowcomms_start(void)
19681974
dlm_allow_conn = 1;
19691975

19701976
/* Start listening */
1971-
if (dlm_config.ci_protocol == 0)
1977+
switch (dlm_config.ci_protocol) {
1978+
case DLM_PROTO_TCP:
19721979
error = tcp_listen_for_all();
1973-
else
1980+
break;
1981+
case DLM_PROTO_SCTP:
19741982
error = sctp_listen_for_all(&listen_con);
1983+
break;
1984+
default:
1985+
log_print("Invalid protocol identifier %d set",
1986+
dlm_config.ci_protocol);
1987+
error = -EINVAL;
1988+
break;
1989+
}
19751990
if (error)
19761991
goto fail_unlisten;
19771992

0 commit comments

Comments
 (0)