if (ret <= 0)
goto out_close;
+ if (ret == -EAGAIN)
+ goto out_resched;
+
if (ret == len)
call_again_soon = 1;
cbuf_add(&con->cb, ret);
if (!test_and_set_bit(CF_READ_PENDING, &con->flags))
queue_work(recv_workqueue, &con->rwork);
up_read(&con->sock_sem);
- cond_resched();
- return 0;
+ return -EAGAIN;
out_close:
up_read(&con->sock_sem);
int len;
int nodeid;
struct connection *newcon;
+ struct connection *addcon;
memset(&peeraddr, 0, sizeof(peeraddr));
result = sock_create_kern(dlm_local_addr.ss_family, SOCK_STREAM,
othercon->sock = newsock;
newsock->sk->sk_user_data = othercon;
add_sock(newsock, othercon);
+ addcon = othercon;
}
else {
newsock->sk->sk_user_data = newcon;
newcon->rx_action = receive_from_sock;
add_sock(newsock, newcon);
-
+ addcon = newcon;
}
up_write(&newcon->sock_sem);
* beween processing the accept adding the socket
* to the read_sockets list
*/
- if (!test_and_set_bit(CF_READ_PENDING, &newcon->flags))
- queue_work(recv_workqueue, &newcon->rwork);
+ if (!test_and_set_bit(CF_READ_PENDING, &addcon->flags))
+ queue_work(recv_workqueue, &addcon->rwork);
up_read(&con->sock_sem);
return 0;
result = sock->ops->listen(sock, 5);
if (result < 0) {
- printk("dlm: Can't listen on port %d\n",
- dlm_config.ci_tcp_port);
+ printk("dlm: Can't listen on port %d\n", dlm_config.ci_tcp_port);
sock_release(sock);
sock = NULL;
goto create_out;
out_connect:
up_read(&con->sock_sem);
- lowcomms_connect_sock(con);
+ connect_to_sock(con);
return;
}
connect_to_sock(con);
}
- if (test_and_clear_bit(CF_WRITE_PENDING, &con->flags)) {
- send_to_sock(con);
- }
+ clear_bit(CF_WRITE_PENDING, &con->flags);
+ send_to_sock(con);
}