diff options
Diffstat (limited to 'fs/dlm/lowcomms.c')
-rw-r--r-- | fs/dlm/lowcomms.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 27970a58d29b..0553a6158dcb 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
@@ -260,7 +260,7 @@ static int nodeid_to_addr(int nodeid, struct sockaddr *retaddr) | |||
260 | static void lowcomms_data_ready(struct sock *sk, int count_unused) | 260 | static void lowcomms_data_ready(struct sock *sk, int count_unused) |
261 | { | 261 | { |
262 | struct connection *con = sock2con(sk); | 262 | struct connection *con = sock2con(sk); |
263 | if (!test_and_set_bit(CF_READ_PENDING, &con->flags)) | 263 | if (con && !test_and_set_bit(CF_READ_PENDING, &con->flags)) |
264 | queue_work(recv_workqueue, &con->rwork); | 264 | queue_work(recv_workqueue, &con->rwork); |
265 | } | 265 | } |
266 | 266 | ||
@@ -268,7 +268,7 @@ static void lowcomms_write_space(struct sock *sk) | |||
268 | { | 268 | { |
269 | struct connection *con = sock2con(sk); | 269 | struct connection *con = sock2con(sk); |
270 | 270 | ||
271 | if (!test_and_set_bit(CF_WRITE_PENDING, &con->flags)) | 271 | if (con && !test_and_set_bit(CF_WRITE_PENDING, &con->flags)) |
272 | queue_work(send_workqueue, &con->swork); | 272 | queue_work(send_workqueue, &con->swork); |
273 | } | 273 | } |
274 | 274 | ||
@@ -720,11 +720,17 @@ static int tcp_accept_from_sock(struct connection *con) | |||
720 | INIT_WORK(&othercon->rwork, process_recv_sockets); | 720 | INIT_WORK(&othercon->rwork, process_recv_sockets); |
721 | set_bit(CF_IS_OTHERCON, &othercon->flags); | 721 | set_bit(CF_IS_OTHERCON, &othercon->flags); |
722 | newcon->othercon = othercon; | 722 | newcon->othercon = othercon; |
723 | othercon->sock = newsock; | ||
724 | newsock->sk->sk_user_data = othercon; | ||
725 | add_sock(newsock, othercon); | ||
726 | addcon = othercon; | ||
727 | } | ||
728 | else { | ||
729 | printk("Extra connection from node %d attempted\n", nodeid); | ||
730 | result = -EAGAIN; | ||
731 | mutex_unlock(&newcon->sock_mutex); | ||
732 | goto accept_err; | ||
723 | } | 733 | } |
724 | othercon->sock = newsock; | ||
725 | newsock->sk->sk_user_data = othercon; | ||
726 | add_sock(newsock, othercon); | ||
727 | addcon = othercon; | ||
728 | } | 734 | } |
729 | else { | 735 | else { |
730 | newsock->sk->sk_user_data = newcon; | 736 | newsock->sk->sk_user_data = newcon; |
@@ -1400,8 +1406,11 @@ void dlm_lowcomms_stop(void) | |||
1400 | down(&connections_lock); | 1406 | down(&connections_lock); |
1401 | for (i = 0; i <= max_nodeid; i++) { | 1407 | for (i = 0; i <= max_nodeid; i++) { |
1402 | con = __nodeid2con(i, 0); | 1408 | con = __nodeid2con(i, 0); |
1403 | if (con) | 1409 | if (con) { |
1404 | con->flags |= 0xFF; | 1410 | con->flags |= 0xFF; |
1411 | if (con->sock) | ||
1412 | con->sock->sk->sk_user_data = NULL; | ||
1413 | } | ||
1405 | } | 1414 | } |
1406 | up(&connections_lock); | 1415 | up(&connections_lock); |
1407 | 1416 | ||