Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp5049196rwn; Mon, 12 Sep 2022 03:42:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR5QEypme7EXWnzSinQeaT9Gl4fP1hawOV391HEHZFVulrOYHYr7j5bz5gHlmyAyC2wg9Zy4 X-Received: by 2002:a17:906:eecb:b0:73c:5c85:142b with SMTP id wu11-20020a170906eecb00b0073c5c85142bmr17961910ejb.433.1662979370967; Mon, 12 Sep 2022 03:42:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662979370; cv=none; d=google.com; s=arc-20160816; b=tenVKmn7PoxWCo5x4e7BXHXVFZPjv77ygJDsurW3VEClg2jEIGQX3HCqel4YfoDKa7 FjEJecE/Ae7cT003B7dyrAcDD/fsB4H43Av2YlNUzW/kb1dHlsleeVEqernePenoIiRP cRf3j+vytwrVtoRnHxx2pp6DpBCSbOCkqE8bQL+FnhGCSymywSMe6ca0izEsKlwYYPmV l/v7zERbvD94zI0FpOTdBYsCGsUhYcurR/5YAJGMSgwW8A7SkwrGf1RS5Jhp4b9UBJxf tzD10xWDFKoLGV+F0h70AK7Jg2QIIfs8uh7VQOKlCIihy7h8BWQmaUWEz6K7fJbH3TGv lXig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=aEsFjPW8rmnIGgIcCd5WboB5n+Sy5beBgEjlGkElzSU=; b=oaOCEG7uQkyvaPdbSD+d+m8IfbFluSPPILmMTR8HIa7xsCDQJfT6TLTM1ZteIAdOi3 ist8vXde/YgqtqACMkFT8gRWrfY1LWpJb29pq5tYfhgGmyn3HfxPC6A9b1JUkilZtouv EEi8R1d2bt8PgvSRNdOK6ge5X1OWFCM3BrEKOc0BlPoLdBI53eXakPUvTvVPGdQMQR93 0diuwzeq3RqYYkIipFB6jV9rLJXzIXLiOpLi2guRdX4wdRt41R6QruMFYBlQnoMaPDpR yElms3sl18z9B2lPsz3/PNgoASzvqe9XjXNn24Qq20WRan8zNtRqiLCOL2yo2ClrOino Asgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ek22-20020a056402371600b0045174ca49fesi3156623edb.67.2022.09.12.03.42.25; Mon, 12 Sep 2022 03:42:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229877AbiILKFb (ORCPT + 99 others); Mon, 12 Sep 2022 06:05:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229724AbiILKF2 (ORCPT ); Mon, 12 Sep 2022 06:05:28 -0400 Received: from hi1smtp01.de.adit-jv.com (smtp1.de.adit-jv.com [93.241.18.167]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E2A2167F9; Mon, 12 Sep 2022 03:05:27 -0700 (PDT) Received: from hi2exch02.adit-jv.com (hi2exch02.adit-jv.com [10.72.92.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hi1smtp01.de.adit-jv.com (Postfix) with ESMTPS id 87E5A520594; Mon, 12 Sep 2022 12:05:24 +0200 (CEST) Received: from lxhi-065 (10.72.94.21) by hi2exch02.adit-jv.com (10.72.92.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Mon, 12 Sep 2022 12:05:23 +0200 Date: Mon, 12 Sep 2022 12:05:15 +0200 From: Eugeniu Rosca To: NeilBrown CC: "gregkh@linuxfoundation.org" , Eugeniu Rosca , Trond Myklebust , "mrodin@de.adit-jv.com" , "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "roscaeugeniu@gmail.com" Subject: Re: [PATCH - stable] SUNRPC: use _bh spinlocking on ->transport_lock Message-ID: <20220912100515.GA5252@lxhi-065> References: <20220418121210.689577360@linuxfoundation.org> <20220418121211.327937970@linuxfoundation.org> <20220907142548.GA9975@lxhi-065> <166259870333.30452.4204968221881228505@noble.neil.brown.name> <20220908120931.GA3480@lxhi-065> <166293725263.30452.1720462103844620549@noble.neil.brown.name> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <166293725263.30452.1720462103844620549@noble.neil.brown.name> User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [10.72.94.21] X-ClientProxiedBy: hi2exch02.adit-jv.com (10.72.92.28) To hi2exch02.adit-jv.com (10.72.92.28) X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Neil, Many thanks for the solution. Much appreciated. On Mo, Sep 12, 2022 at 09:00:52 +1000, NeilBrown wrote: > > Prior to Linux 5.3, ->transport_lock in sunrpc required the _bh style > spinlocks (when not called from a bottom-half handler). > > When upstream 3848e96edf4788f772d83990022fa7023a233d83 was backported to > stable kernels, the spin_lock/unlock calls should have been changed to > the _bh version, but this wasn't noted in the patch and didn't happen. > > So convert these lock/unlock calls to the _bh versions. > > This patch is required for any stable kernel prior to 5.3 to which the > above mentioned patch was backported. Namely 4.9.y, 4.14.y, 4.19.y. > > Signed-off-by: NeilBrown > --- > net/sunrpc/xprt.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c > index d05fa7c36d00..b1abf4848bbc 100644 > --- a/net/sunrpc/xprt.c > +++ b/net/sunrpc/xprt.c > @@ -1550,9 +1550,9 @@ static void xprt_destroy(struct rpc_xprt *xprt) > * is cleared. We use ->transport_lock to ensure the mod_timer() > * can only run *before* del_time_sync(), never after. > */ > - spin_lock(&xprt->transport_lock); > + spin_lock_bh(&xprt->transport_lock); > del_timer_sync(&xprt->timer); > - spin_unlock(&xprt->transport_lock); > + spin_unlock_bh(&xprt->transport_lock); > > /* > * Destroy sockets etc from the system workqueue so they can Fixes: v4.19.238 commit 242a3e0c75b64b ("SUNRPC: avoid race between mod_timer() and del_timer_sync()") Fixes: v4.14.276 commit dd7d3a609aac16 ("SUNRPC: avoid race between mod_timer() and del_timer_sync()") Fixes: v4.9.311 commit 6180bbce52739e ("SUNRPC: avoid race between mod_timer() and del_timer_sync()") Reported-by: Eugeniu Rosca Reviewed-by: Eugeniu Rosca Tested-by: Eugeniu Rosca Best Regards, Eugeniu Rosca