mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-30 10:49:28 +00:00
fs: dlm: handle non blocked connect event
The manpage of connect shows that in non blocked mode a writeability indicates successful connection event. This patch is handling this event inside the writeability callback. In case of SCTP we use blocking connect functionality which indicates a successful connect when the function returns with a successful return value. Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
This commit is contained in:
parent
53a5edaa05
commit
19633c7e20
1 changed files with 12 additions and 1 deletions
|
@ -78,6 +78,7 @@ struct connection {
|
||||||
#define CF_APP_LIMITED 7
|
#define CF_APP_LIMITED 7
|
||||||
#define CF_CLOSING 8
|
#define CF_CLOSING 8
|
||||||
#define CF_SHUTDOWN 9
|
#define CF_SHUTDOWN 9
|
||||||
|
#define CF_CONNECTED 10
|
||||||
struct list_head writequeue; /* List of outgoing writequeue_entries */
|
struct list_head writequeue; /* List of outgoing writequeue_entries */
|
||||||
spinlock_t writequeue_lock;
|
spinlock_t writequeue_lock;
|
||||||
int (*rx_action) (struct connection *); /* What to do when active */
|
int (*rx_action) (struct connection *); /* What to do when active */
|
||||||
|
@ -419,6 +420,12 @@ static void lowcomms_write_space(struct sock *sk)
|
||||||
if (!con)
|
if (!con)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
if (!test_and_set_bit(CF_CONNECTED, &con->flags)) {
|
||||||
|
log_print("successful connected to node %d", con->nodeid);
|
||||||
|
queue_work(send_workqueue, &con->swork);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
clear_bit(SOCK_NOSPACE, &con->sock->flags);
|
clear_bit(SOCK_NOSPACE, &con->sock->flags);
|
||||||
|
|
||||||
if (test_and_clear_bit(CF_APP_LIMITED, &con->flags)) {
|
if (test_and_clear_bit(CF_APP_LIMITED, &con->flags)) {
|
||||||
|
@ -604,6 +611,7 @@ static void close_connection(struct connection *con, bool and_other,
|
||||||
|
|
||||||
con->rx_leftover = 0;
|
con->rx_leftover = 0;
|
||||||
con->retries = 0;
|
con->retries = 0;
|
||||||
|
clear_bit(CF_CONNECTED, &con->flags);
|
||||||
mutex_unlock(&con->sock_mutex);
|
mutex_unlock(&con->sock_mutex);
|
||||||
clear_bit(CF_CLOSING, &con->flags);
|
clear_bit(CF_CLOSING, &con->flags);
|
||||||
}
|
}
|
||||||
|
@ -1027,8 +1035,11 @@ static void sctp_connect_to_sock(struct connection *con)
|
||||||
|
|
||||||
if (result == -EINPROGRESS)
|
if (result == -EINPROGRESS)
|
||||||
result = 0;
|
result = 0;
|
||||||
if (result == 0)
|
if (result == 0) {
|
||||||
|
if (!test_and_set_bit(CF_CONNECTED, &con->flags))
|
||||||
|
log_print("successful connected to node %d", con->nodeid);
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
bind_err:
|
bind_err:
|
||||||
con->sock = NULL;
|
con->sock = NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue