From patchwork Sat Nov 5 06:00:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 13032848 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 590E8C433FE for ; Sat, 5 Nov 2022 06:01:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229645AbiKEGBw (ORCPT ); Sat, 5 Nov 2022 02:01:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbiKEGBa (ORCPT ); Sat, 5 Nov 2022 02:01:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E32F030560; Fri, 4 Nov 2022 23:01:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 81756B830BB; Sat, 5 Nov 2022 06:01:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17943C433D7; Sat, 5 Nov 2022 06:01:27 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1orCFf-007OfS-0g; Sat, 05 Nov 2022 02:01:55 -0400 Message-ID: <20221105060155.047357452@goodmis.org> User-Agent: quilt/0.66 Date: Sat, 05 Nov 2022 02:00:25 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Linus Torvalds , Thomas Gleixner , Stephen Boyd , Guenter Roeck , Anna-Maria Gleixner , Andrew Morton , Chuck Lever , Jeff Layton , Trond Myklebust , Anna Schumaker , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-nfs@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v4a 01/38] SUNRPC/xprt: Use del_timer_sync() instead of del_singleshot_timer_sync() References: <20221105060024.598488967@goodmis.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: "Steven Rostedt (Google)" Back on June 22, 2005, it was decided to use del_singleshot_timer_sync() because it wouldn't loop like del_timer_sync(), and since the timer that was being removed was not about to be rearmed, it was considered an efficiency to use del_singleshot_timer_sync() over del_timer_sync(). But on June 23, 2005, commit 55c888d6d09a0 ("timers fixes/improvements") happened, which converted del_singleshot_timer_sync() into: #define del_singleshot_timer_sync(t) del_timer_sync(t) Making the to equivalent. Now work is being done to add a "shutdown" state to timers where a timer must be in that state in order to be freed to prevent use-after-free bugs caused by timers being re-armed just before being freed, the del_singleshot_timer_sync() is now being converted into something that will set the timer to the shutdown state. This means that once del_singleshot_timer_sync() is called, the timer can no longer be re-armed. As the timer here will be re-armed, it can not use del_singleshot_timer_sync(). But as the reason it was used in the first place no longer exists, just use del_timer_sync(). Link: https://lore.kernel.org/lkml/20221028145005.28bc324d@gandalf.local.home/ Cc: Chuck Lever Cc: Jeff Layton Cc: Trond Myklebust Cc: Anna Schumaker Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: linux-nfs@vger.kernel.org Cc: netdev@vger.kernel.org Fixes: 0f9dc2b16884b ("RPC: Clean up socket autodisconnect") Signed-off-by: Steven Rostedt (Google) --- net/sunrpc/xprt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 656cec208371..ab453ede54f0 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -1164,7 +1164,7 @@ xprt_request_enqueue_receive(struct rpc_task *task) spin_unlock(&xprt->queue_lock); /* Turn off autodisconnect */ - del_singleshot_timer_sync(&xprt->timer); + del_timer_sync(&xprt->timer); return 0; }