diff options
-rw-r--r-- | fs/dlm/lowcomms.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 631bc431e6af..9e9d2e82f40f 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
@@ -328,15 +328,24 @@ static void close_connection(struct connection *con, bool and_other) | |||
328 | if (con->othercon && and_other) { | 328 | if (con->othercon && and_other) { |
329 | /* Will only re-enter once. */ | 329 | /* Will only re-enter once. */ |
330 | close_connection(con->othercon, false); | 330 | close_connection(con->othercon, false); |
331 | kmem_cache_free(con_cache, con->othercon); | ||
332 | con->othercon = NULL; | ||
333 | } | 331 | } |
334 | if (con->rx_page) { | 332 | if (con->rx_page) { |
335 | __free_page(con->rx_page); | 333 | __free_page(con->rx_page); |
336 | con->rx_page = NULL; | 334 | con->rx_page = NULL; |
337 | } | 335 | } |
338 | con->retries = 0; | 336 | |
339 | 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 | } | ||
340 | } | 349 | } |
341 | 350 | ||
342 | /* 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 */ |
@@ -634,7 +643,7 @@ out_resched: | |||
634 | 643 | ||
635 | out_close: | 644 | out_close: |
636 | mutex_unlock(&con->sock_mutex); | 645 | mutex_unlock(&con->sock_mutex); |
637 | if (ret != -EAGAIN && !test_bit(CF_IS_OTHERCON, &con->flags)) { | 646 | if (ret != -EAGAIN) { |
638 | close_connection(con, false); | 647 | close_connection(con, false); |
639 | /* Reconnect when there is something to send */ | 648 | /* Reconnect when there is something to send */ |
640 | } | 649 | } |
@@ -1125,8 +1134,6 @@ static int tcp_listen_for_all(void) | |||
1125 | 1134 | ||
1126 | log_print("Using TCP for communications"); | 1135 | log_print("Using TCP for communications"); |
1127 | 1136 | ||
1128 | set_bit(CF_IS_OTHERCON, &con->flags); | ||
1129 | |||
1130 | sock = tcp_create_listen_sock(con, dlm_local_addr[0]); | 1137 | sock = tcp_create_listen_sock(con, dlm_local_addr[0]); |
1131 | if (sock) { | 1138 | if (sock) { |
1132 | add_sock(sock, con); | 1139 | add_sock(sock, con); |
@@ -1410,7 +1417,7 @@ void dlm_lowcomms_stop(void) | |||
1410 | for (i = 0; i <= max_nodeid; i++) { | 1417 | for (i = 0; i <= max_nodeid; i++) { |
1411 | con = __nodeid2con(i, 0); | 1418 | con = __nodeid2con(i, 0); |
1412 | if (con) { | 1419 | if (con) { |
1413 | con->flags |= 0xFF; | 1420 | con->flags |= 0x0F; |
1414 | if (con->sock) | 1421 | if (con->sock) |
1415 | con->sock->sk->sk_user_data = NULL; | 1422 | con->sock->sk->sk_user_data = NULL; |
1416 | } | 1423 | } |
@@ -1426,8 +1433,6 @@ void dlm_lowcomms_stop(void) | |||
1426 | con = __nodeid2con(i, 0); | 1433 | con = __nodeid2con(i, 0); |
1427 | if (con) { | 1434 | if (con) { |
1428 | close_connection(con, true); | 1435 | close_connection(con, true); |
1429 | if (con->othercon) | ||
1430 | kmem_cache_free(con_cache, con->othercon); | ||
1431 | kmem_cache_free(con_cache, con); | 1436 | kmem_cache_free(con_cache, con); |
1432 | } | 1437 | } |
1433 | } | 1438 | } |