Skip to content

Commit 08b81d8

Browse files
geliangtangdavem330
authored andcommitted
mptcp: add sk_stop_timer_sync helper
This patch added a new helper sk_stop_timer_sync, it deactivates a timer like sk_stop_timer, but waits for the handler to finish. Acked-by: Paolo Abeni <[email protected]> Signed-off-by: Geliang Tang <[email protected]> Reviewed-by: Mat Martineau <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0abd40f commit 08b81d8

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

include/net/sock.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,6 +2195,8 @@ void sk_reset_timer(struct sock *sk, struct timer_list *timer,
21952195

21962196
void sk_stop_timer(struct sock *sk, struct timer_list *timer);
21972197

2198+
void sk_stop_timer_sync(struct sock *sk, struct timer_list *timer);
2199+
21982200
int __sk_queue_drop_skb(struct sock *sk, struct sk_buff_head *sk_queue,
21992201
struct sk_buff *skb, unsigned int flags,
22002202
void (*destructor)(struct sock *sk,

net/core/sock.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2947,6 +2947,13 @@ void sk_stop_timer(struct sock *sk, struct timer_list* timer)
29472947
}
29482948
EXPORT_SYMBOL(sk_stop_timer);
29492949

2950+
void sk_stop_timer_sync(struct sock *sk, struct timer_list *timer)
2951+
{
2952+
if (del_timer_sync(timer))
2953+
__sock_put(sk);
2954+
}
2955+
EXPORT_SYMBOL(sk_stop_timer_sync);
2956+
29502957
void sock_init_data(struct socket *sock, struct sock *sk)
29512958
{
29522959
sk_init_common(sk);

0 commit comments

Comments
 (0)