From patchwork Mon Sep 21 07:30:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 1368117 X-Patchwork-Delegate: matthieu.baerts@tessares.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=2001:19d0:306:5::1; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=fUHoMm1/; dkim-atps=neutral Received: from ml01.01.org (ml01.01.org [IPv6:2001:19d0:306:5::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bvx9N4jQ4z9sSn for ; Mon, 21 Sep 2020 17:37:28 +1000 (AEST) Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id F354C142D71B1; Mon, 21 Sep 2020 00:37:26 -0700 (PDT) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::443; helo=mail-pf1-x443.google.com; envelope-from=geliangtang@gmail.com; receiver= Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4B874142D71AC for ; Mon, 21 Sep 2020 00:37:25 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id x22so3716579pfo.12 for ; Mon, 21 Sep 2020 00:37:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=Ll0c2V+41MWQmXgp/vAy9XVo7c/PO1hjC09r2dxAZrQ=; b=fUHoMm1/vlHzXIJo9cHJ5uhn34bNLpnkUyzCRWUz+MLHRPMIAnw2I0TYesqNb6ibsw xOWLuSI4H49oFFbeAQDPqyhi1MXhzd7MYEp6/HF0PzCzgm7sCHBD8wXbjlFnPFlPIJDb EX4i8ZqSLlpXo+q/Wa2/7Vrp1EmZIv/VDFOvmIsG1IpJcIcNuClCmfa9sDg3wMaFUnGS GXWZzcv2eHnCySaTTOa4LVxkea+IJoMa9Ehx1R8zD0jh2BQ13VoKUG/AK5+h/AuT7/vX viI0HpIMNKR6TND5ZEOpcIIyOhi4k1oVI7OucaeElhSIQ6VVLP3T3jCCU1zVTTN3+9OJ DUdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=Ll0c2V+41MWQmXgp/vAy9XVo7c/PO1hjC09r2dxAZrQ=; b=ORrqA4YOXb/HcpyCiL74auqxgwo6WzDaJv3GkcXUYBK0/CqVHCnse25YINy3VY6u8Y fuUc7eLCVaeApWfoxme7A5itbkZWB0GE/jhb+EQ3DdxPCfdk1OqNUrnzg1lb9rqdlr/M QttQlB3JZ6optKydqcfkKnoacoZb4jJTrhBNqBtnu95dGL0/+v8gSmg4kFPXOJ1rTCAG 6pEXNhLLC1fUsyAsXGLU2QPsFTerpoQfkPcUWJsXn+LjNFGfr5e4AsFcYOl9FQSp36tL d/9Pu6RbgK+viZQyhCxMloX7jccuDtwzS5yH7oGlZYZS5CepBvIe/EvnKcLjQTieDto7 V2/w== X-Gm-Message-State: AOAM5313UyN37NtG3ZapZls9jPTkcinEsqYPbRTHVw/koxgEP+lAf+qg Ddej+HPdAwwFq9lhohLUSXVA41T7FM7uLg== X-Google-Smtp-Source: ABdhPJxD9bQ7qRC39NOQUdXIOoIu63PelaXr9iZgv1qX0RWddVbD2BpoOwkeT2mgrJKldTp3jElt0w== X-Received: by 2002:a17:902:59d7:b029:d1:e5e7:bdf9 with SMTP id d23-20020a17090259d7b02900d1e5e7bdf9mr26022184plj.44.1600673844618; Mon, 21 Sep 2020 00:37:24 -0700 (PDT) Received: from localhost ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id d128sm11324752pfc.8.2020.09.21.00.37.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 00:37:24 -0700 (PDT) From: Geliang Tang To: mptcp@lists.01.org Date: Mon, 21 Sep 2020 15:30:37 +0800 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: <98ee06c2effa72beb8fbc796e92cba6fa2663e77.1600672866.git.geliangtang@gmail.com> References: <98ee06c2effa72beb8fbc796e92cba6fa2663e77.1600672866.git.geliangtang@gmail.com> Message-ID-Hash: ROGXFCTOYDW4VEKCPI5TOYIO6IGVOT3Q X-Message-ID-Hash: ROGXFCTOYDW4VEKCPI5TOYIO6IGVOT3Q X-MailFrom: geliangtang@gmail.com X-Mailman-Rule-Hits: member-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address CC: Geliang Tang X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] [MPTCP][PATCH v5 mptcp-next 2/3] mptcp: add sk_stop_timer_sync helper List-Id: Discussions regarding MPTCP upstreaming Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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. Signed-off-by: Geliang Tang --- include/net/sock.h | 2 ++ net/core/sock.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/include/net/sock.h b/include/net/sock.h index eaa5cac5e836..a5c6ae78df77 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2195,6 +2195,8 @@ void sk_reset_timer(struct sock *sk, struct timer_list *timer, void sk_stop_timer(struct sock *sk, struct timer_list *timer); +void sk_stop_timer_sync(struct sock *sk, struct timer_list *timer); + int __sk_queue_drop_skb(struct sock *sk, struct sk_buff_head *sk_queue, struct sk_buff *skb, unsigned int flags, void (*destructor)(struct sock *sk, diff --git a/net/core/sock.c b/net/core/sock.c index ba9e7d91e2ef..d9a537e6876a 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -2947,6 +2947,13 @@ void sk_stop_timer(struct sock *sk, struct timer_list* timer) } EXPORT_SYMBOL(sk_stop_timer); +void sk_stop_timer_sync(struct sock *sk, struct timer_list *timer) +{ + if (del_timer_sync(timer)) + __sock_put(sk); +} +EXPORT_SYMBOL(sk_stop_timer_sync); + void sock_init_data(struct socket *sock, struct sock *sk) { sk_init_common(sk);