diff options
Diffstat (limited to 'fs/dlm/lowcomms.c')
-rw-r--r-- | fs/dlm/lowcomms.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index dd362739d291..9e9d2e82f40f 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
@@ -313,6 +313,7 @@ static void make_sockaddr(struct sockaddr_storage *saddr, uint16_t port, | |||
313 | in6_addr->sin6_port = cpu_to_be16(port); | 313 | in6_addr->sin6_port = cpu_to_be16(port); |
314 | *addr_len = sizeof(struct sockaddr_in6); | 314 | *addr_len = sizeof(struct sockaddr_in6); |
315 | } | 315 | } |
316 | memset((char *)saddr + *addr_len, 0, sizeof(struct sockaddr_storage) - *addr_len); | ||
316 | } | 317 | } |
317 | 318 | ||
318 | /* Close a remote connection and tidy up */ | 319 | /* Close a remote connection and tidy up */ |
@@ -332,8 +333,19 @@ static void close_connection(struct connection *con, bool and_other) | |||
332 | __free_page(con->rx_page); | 333 | __free_page(con->rx_page); |
333 | con->rx_page = NULL; | 334 | con->rx_page = NULL; |
334 | } | 335 | } |
335 | con->retries = 0; | 336 | |
336 | mutex_unlock(&con->sock_mutex); | 337 | /* If we are an 'othercon' then NULL the pointer to us |
338 | from the parent and tidy ourself up */ | ||
339 | if (test_bit(CF_IS_OTHERCON, &con->flags)) { | ||
340 | struct connection *parent = __nodeid2con(con->nodeid, 0); | ||
341 | parent->othercon = NULL; | ||
342 | kmem_cache_free(con_cache, con); | ||
343 | } | ||
344 | else { | ||
345 | /* Parent connections get reused */ | ||
346 | con->retries = 0; | ||
347 | mutex_unlock(&con->sock_mutex); | ||
348 | } | ||
337 | } | 349 | } |
338 | 350 | ||
339 | /* We only send shutdown messages to nodes that are not part of the cluster */ | 351 | /* We only send shutdown messages to nodes that are not part of the cluster */ |
@@ -631,7 +643,7 @@ out_resched: | |||
631 | 643 | ||
632 | out_close: | 644 | out_close: |
633 | mutex_unlock(&con->sock_mutex); | 645 | mutex_unlock(&con->sock_mutex); |
634 | if (ret != -EAGAIN && !test_bit(CF_IS_OTHERCON, &con->flags)) { | 646 | if (ret != -EAGAIN) { |
635 | close_connection(con, false); | 647 | close_connection(con, false); |
636 | /* Reconnect when there is something to send */ | 648 | /* Reconnect when there is something to send */ |
637 | } | 649 | } |
@@ -1122,8 +1134,6 @@ static int tcp_listen_for_all(void) | |||
1122 | 1134 | ||
1123 | log_print("Using TCP for communications"); | 1135 | log_print("Using TCP for communications"); |
1124 | 1136 | ||
1125 | set_bit(CF_IS_OTHERCON, &con->flags); | ||
1126 | |||
1127 | sock = tcp_create_listen_sock(con, dlm_local_addr[0]); | 1137 | sock = tcp_create_listen_sock(con, dlm_local_addr[0]); |
1128 | if (sock) { | 1138 | if (sock) { |
1129 | add_sock(sock, con); | 1139 | add_sock(sock, con); |
@@ -1407,7 +1417,7 @@ void dlm_lowcomms_stop(void) | |||
1407 | for (i = 0; i <= max_nodeid; i++) { | 1417 | for (i = 0; i <= max_nodeid; i++) { |
1408 | con = __nodeid2con(i, 0); | 1418 | con = __nodeid2con(i, 0); |
1409 | if (con) { | 1419 | if (con) { |
1410 | con->flags |= 0xFF; | 1420 | con->flags |= 0x0F; |
1411 | if (con->sock) | 1421 | if (con->sock) |
1412 | con->sock->sk->sk_user_data = NULL; | 1422 | con->sock->sk->sk_user_data = NULL; |
1413 | } | 1423 | } |
@@ -1423,8 +1433,6 @@ void dlm_lowcomms_stop(void) | |||
1423 | con = __nodeid2con(i, 0); | 1433 | con = __nodeid2con(i, 0); |
1424 | if (con) { | 1434 | if (con) { |
1425 | close_connection(con, true); | 1435 | close_connection(con, true); |
1426 | if (con->othercon) | ||
1427 | kmem_cache_free(con_cache, con->othercon); | ||
1428 | kmem_cache_free(con_cache, con); | 1436 | kmem_cache_free(con_cache, con); |
1429 | } | 1437 | } |
1430 | } | 1438 | } |