Skip to content

Commit

Permalink
rds: tcp: block BH in TCP callbacks
Browse files Browse the repository at this point in the history
TCP stack can now run from process context.

Use read_lock_bh(&sk->sk_callback_lock) variant to restore previous
assumption.

Fixes: 5413d1b ("net: do not block BH while processing socket backlog")
Fixes: d41a69f ("tcp: make tcp_sendmsg() aware of socket backlog")
Signed-off-by: Eric Dumazet <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Eric Dumazet authored and davem330 committed May 19, 2016
1 parent e1daca2 commit 3803662
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions net/rds/tcp_connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void rds_tcp_state_change(struct sock *sk)
struct rds_connection *conn;
struct rds_tcp_connection *tc;

read_lock(&sk->sk_callback_lock);
read_lock_bh(&sk->sk_callback_lock);
conn = sk->sk_user_data;
if (!conn) {
state_change = sk->sk_state_change;
Expand All @@ -69,7 +69,7 @@ void rds_tcp_state_change(struct sock *sk)
break;
}
out:
read_unlock(&sk->sk_callback_lock);
read_unlock_bh(&sk->sk_callback_lock);
state_change(sk);
}

Expand Down
4 changes: 2 additions & 2 deletions net/rds/tcp_listen.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void rds_tcp_listen_data_ready(struct sock *sk)

rdsdebug("listen data ready sk %p\n", sk);

read_lock(&sk->sk_callback_lock);
read_lock_bh(&sk->sk_callback_lock);
ready = sk->sk_user_data;
if (!ready) { /* check for teardown race */
ready = sk->sk_data_ready;
Expand All @@ -183,7 +183,7 @@ void rds_tcp_listen_data_ready(struct sock *sk)
rds_tcp_accept_work(sk);

out:
read_unlock(&sk->sk_callback_lock);
read_unlock_bh(&sk->sk_callback_lock);
ready(sk);
}

Expand Down
4 changes: 2 additions & 2 deletions net/rds/tcp_recv.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ void rds_tcp_data_ready(struct sock *sk)

rdsdebug("data ready sk %p\n", sk);

read_lock(&sk->sk_callback_lock);
read_lock_bh(&sk->sk_callback_lock);
conn = sk->sk_user_data;
if (!conn) { /* check for teardown race */
ready = sk->sk_data_ready;
Expand All @@ -315,7 +315,7 @@ void rds_tcp_data_ready(struct sock *sk)
if (rds_tcp_read_sock(conn, GFP_ATOMIC) == -ENOMEM)
queue_delayed_work(rds_wq, &conn->c_recv_w, 0);
out:
read_unlock(&sk->sk_callback_lock);
read_unlock_bh(&sk->sk_callback_lock);
ready(sk);
}

Expand Down
4 changes: 2 additions & 2 deletions net/rds/tcp_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void rds_tcp_write_space(struct sock *sk)
struct rds_connection *conn;
struct rds_tcp_connection *tc;

read_lock(&sk->sk_callback_lock);
read_lock_bh(&sk->sk_callback_lock);
conn = sk->sk_user_data;
if (!conn) {
write_space = sk->sk_write_space;
Expand All @@ -200,7 +200,7 @@ void rds_tcp_write_space(struct sock *sk)
queue_delayed_work(rds_wq, &conn->c_send_w, 0);

out:
read_unlock(&sk->sk_callback_lock);
read_unlock_bh(&sk->sk_callback_lock);

/*
* write_space is only called when data leaves tcp's send queue if
Expand Down

0 comments on commit 3803662

Please sign in to comment.