Received: by 2002:ac8:71d8:0:b0:40f:fb00:664b with SMTP id i24csp218575qtp; Fri, 4 Aug 2023 08:55:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEq8YzkqXi7qPCmCsJRwlgv0QV9fFHU2oRgWJjT+1Mim3DyUFhL5V5ZEfw93bRBihf1zZ1K X-Received: by 2002:a17:90a:380b:b0:267:f66a:f25f with SMTP id w11-20020a17090a380b00b00267f66af25fmr2082116pjb.11.1691164527539; Fri, 04 Aug 2023 08:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691164527; cv=none; d=google.com; s=arc-20160816; b=o5MqP4WMbqcBAOBH1nBIcURtazuXagjwZYqA3aK6TVDSwyNdQhpbUsqgRLmQWHTwfV oKKwz6vTTy51I0wUwzvveLYJJZRWCrcvbyRCXEcLeLKp3boobMsWgj019ahKUHtkMiSj OAMf4o5eIuWqNVd04jQtseduUEIMB+Juih/zIvjj2BYXRepjXhH8Z5o2yeL/frSQaciS jbYhJdXLtBmAPK2rpPdBQbhUk/Q9JlQBb5azLjUc2IP0Lk3qr5PZ2YJcPY/c8to13nTp zDW2ZXVhGHCCYeVPPUMW7i9bLlvtRXfKcPk8aWc4EJVBft46l37RVOb4/iDoE3K0CtFH KGQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=yF8S1xoyOWqcZLbTWqqSxlPfC6M4IpzvT/XfxKjItxo=; fh=jsEm+JXec67OkmxjmRw8oiffAUKA2aefkYUCjXeppOg=; b=oLgdDzO+3Ikzbdr4ERK3ITWUzFPc27F+c6pOg0XrmfW/OL/4zaIusX/wXzFb+ZjuKd UpZW9zzxGGucQjziFubSFM++hTGgualzpLT3shN4U9zDEywSkOxIdY4Mh9UJInjVZNMk llo8ReaHABMFzW0he7EQ7QmQY3+JV7LQ20d9k2DbdcOPtUtklC04qvc4a7PtcQWwC1g7 6UAV4p4DiiCUkAs1d0S2S6XQFCt/YLwFVvzmzdjFoELrKC/OIXlc4xmJQDh6rXqUHqOA oc5aZLqPIp3hHudEUaPNewOi5Mm8Wj20u+UFzL2AcBJTYMwZTginx+QUbKJX9+660FIE 6PSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pl31AtQM; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lw8-20020a17090b180800b0025c1f64f29dsi2112232pjb.171.2023.08.04.08.55.12; Fri, 04 Aug 2023 08:55:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pl31AtQM; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230004AbjHDPeF (ORCPT + 99 others); Fri, 4 Aug 2023 11:34:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230446AbjHDPeA (ORCPT ); Fri, 4 Aug 2023 11:34:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E5654C0E for ; Fri, 4 Aug 2023 08:33:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BF72862056 for ; Fri, 4 Aug 2023 15:33:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1DC8C433C7; Fri, 4 Aug 2023 15:33:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691163233; bh=j0RAmJR6ruIOyFTrxY2IKpBOEE0J8IoyJzli8g9rfwE=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=pl31AtQM4u4zelZokL3MybMrCOo8ZRTocg4tN+VR2UZsf3Xt+EJeLQki6SILkEXku QP3/YltXEkuNtekyeMXgiifZnL9ikHHqdj62f2thnMYhBuxKs0YZTDUMfPbBiqAnFu 1xWkdnOYNZ7YEhCSe7w5WAKy2rjdg3DpLLObgYZwdPLsHiKyHA9klTLClLbJ7pd+O7 JTITfujlpjfZy/wxeE8Ta4Jc58cF6djWmHDjb8fuiOIQYuGn5Uew252Sav2FxUZIM0 GLv6dVbCqECauDP06aEgr2yAH6SHr75dnRc4WUm8gBEuwaljUUbc2AwjxiljiKHFsH xfK6dGpGi0LMQ== Message-ID: <7e6053d48b2e4d62c7875e76653ecbc7557ec8d4.camel@kernel.org> Subject: Re: [PATCH] nfsd: Fix race to FREE_STATEID and cl_revoked From: Jeff Layton To: Chuck Lever , Benjamin Coddington Cc: linux-nfs@vger.kernel.org Date: Fri, 04 Aug 2023 11:33:51 -0400 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham 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-nfs@vger.kernel.org On Fri, 2023-08-04 at 11:02 -0400, Chuck Lever wrote: > On Fri, Aug 04, 2023 at 10:52:20AM -0400, Benjamin Coddington wrote: > > We have some reports of linux NFS clients that cannot satisfy a linux k= nfsd > > server that always sets SEQ4_STATUS_RECALLABLE_STATE_REVOKED even thoug= h > > those clients repeatedly walk all their known state using TEST_STATEID = and > > receive NFS4_OK for all. > >=20 > > Its possible for revoke_delegation() to set NFS4_REVOKED_DELEG_STID, th= en > > nfsd4_free_stateid() finds the delegation and returns NFS4_OK to > > FREE_STATEID. Afterward, revoke_delegation() moves the same delegation= to > > cl_revoked. This would produce the observed client/server effect. > >=20 > > Fix this by ensuring that the setting of sc_type to NFS4_REVOKED_DELEG_= STID > > and move to cl_revoked happens within the same cl_lock. This will allo= w > > nfsd4_free_stateid() to properly remove the delegation from cl_revoked. > >=20 > > Link: https://bugzilla.redhat.com/show_bug.cgi?id=3D2217103 > > Link: https://bugzilla.redhat.com/show_bug.cgi?id=3D2176575 > > Signed-off-by: Benjamin Coddington >=20 > Hi Ben, does this fix deserve: >=20 > Cc: stable@vger.kernel.org # v4.17+ >=20 > ?? >=20 What's special about v4.17? Is there a patch that broke it that went into that release? > > --- > > fs/nfsd/nfs4state.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > >=20 > > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c > > index 3aefbad4cc09..daf305daa751 100644 > > --- a/fs/nfsd/nfs4state.c > > +++ b/fs/nfsd/nfs4state.c > > @@ -1354,9 +1354,9 @@ static void revoke_delegation(struct nfs4_delegat= ion *dp) > > trace_nfsd_stid_revoke(&dp->dl_stid); > > =20 > > if (clp->cl_minorversion) { > > + spin_lock(&clp->cl_lock); > > dp->dl_stid.sc_type =3D NFS4_REVOKED_DELEG_STID; > > refcount_inc(&dp->dl_stid.sc_count); > > - spin_lock(&clp->cl_lock); > > list_add(&dp->dl_recall_lru, &clp->cl_revoked); > > spin_unlock(&clp->cl_lock); > > } > > --=20 > > 2.40.1 > >=20 >=20 The fix looks correct though. You can also add: Reviewed-by: Jeff Layton