mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 07:38:10 +00:00
tcp: factor out __tcp_close() helper
[ Upstream commit77c3c95637
] unlocked version of protocol level close, will be used by MPTCP to allow decouple orphaning and subflow level close. Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Stable-dep-of:e14cadfd80
("tcp: add annotations around sk->sk_shutdown accesses") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
34a5ee69ec
commit
f86568eca4
2 changed files with 8 additions and 2 deletions
|
@ -381,6 +381,7 @@ void tcp_update_metrics(struct sock *sk);
|
|||
void tcp_init_metrics(struct sock *sk);
|
||||
void tcp_metrics_init(void);
|
||||
bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst);
|
||||
void __tcp_close(struct sock *sk, long timeout);
|
||||
void tcp_close(struct sock *sk, long timeout);
|
||||
void tcp_init_sock(struct sock *sk);
|
||||
void tcp_init_transfer(struct sock *sk, int bpf_op, struct sk_buff *skb);
|
||||
|
|
|
@ -2510,13 +2510,12 @@ bool tcp_check_oom(struct sock *sk, int shift)
|
|||
return too_many_orphans || out_of_socket_memory;
|
||||
}
|
||||
|
||||
void tcp_close(struct sock *sk, long timeout)
|
||||
void __tcp_close(struct sock *sk, long timeout)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
int data_was_unread = 0;
|
||||
int state;
|
||||
|
||||
lock_sock(sk);
|
||||
sk->sk_shutdown = SHUTDOWN_MASK;
|
||||
|
||||
if (sk->sk_state == TCP_LISTEN) {
|
||||
|
@ -2680,6 +2679,12 @@ void tcp_close(struct sock *sk, long timeout)
|
|||
out:
|
||||
bh_unlock_sock(sk);
|
||||
local_bh_enable();
|
||||
}
|
||||
|
||||
void tcp_close(struct sock *sk, long timeout)
|
||||
{
|
||||
lock_sock(sk);
|
||||
__tcp_close(sk, timeout);
|
||||
release_sock(sk);
|
||||
sock_put(sk);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue