Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp6883922rwp; Tue, 18 Jul 2023 07:11:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlHyKzbQMg134tnB9vOAaLtKQ+2rJeajq4QFborXgStOJ2wNcP5BCJzUtwhC0WQ4CdWBJLf9 X-Received: by 2002:a05:6512:2248:b0:4f8:5e49:c613 with SMTP id i8-20020a056512224800b004f85e49c613mr2051460lfu.43.1689689480665; Tue, 18 Jul 2023 07:11:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689689480; cv=none; d=google.com; s=arc-20160816; b=y/rzDT/H2u5eGdVbF8sI/+w19lwKMTFurP7wD7lxll6ehdvdY/weLClX09pAlcH3kY m71YHzPGy1fN4SOTefH/6TlluW/xhYj96Mx7FU/t8OeZkhujiUcuHIskLqPGRLvvGd9U SICq883FH2ojRtRU1e7sMrLM2Ci6b3EAp8qpx/z2B5FtKoRslF2uophw6FKFL/nNI787 TEgNsw0ZMJWqW/Nqd3JKHafIeqsacpF2OKVJ+OYGnVYivsEuAwn911JePaemisYT52pZ 9gOqDB9TZ3G0padLO9rfRRMk54dcFoizKGC1uSxbwDfRNXksiLInJ1ORY6qRjm25GTV7 zIaw== 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=9c3C988jkDd8Kk8czKP2cZc21cuxnAg2V93BFXTPbiw=; fh=07qvKpGlnlaJrIN4bNsOSc6wW4hnjidvC91V8yHDRUQ=; b=C0zdE0+g0n4MHWBGJ1K2cG9q3g5NoU9BL894E/D+zqcruiN1FpFeWHAnpdyBedn1s7 KdZHrwxPtURMHL+1NLaX2wpF/740w+IfaRObDXx+lUF5XmpLnFJDKqAjjB1sznwzfrRD pXVNX8TR6/Fe74l8EidjsQ48r10bfwpMC9FYJ7397yRYW3NGkclLzpT8Y5mWAtqOmdeh 4lsvsiMXhWoPav5JLy/0/mihP2SgPSjeICg1FnBZLg2IGls0CVsEvn/RVAa4qeHtdU2G FrCBLmHvVM4FzddqrKCHsSgOw6aPjlKtdrf4YEocHy5VRnbF7hyGZDaEDGgEmBBieTbF 13mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kexSai0l; 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 y6-20020a50e606000000b0051dd2c19606si1230649edm.465.2023.07.18.07.10.51; Tue, 18 Jul 2023 07:11:20 -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=kexSai0l; 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 S229685AbjGROKr (ORCPT + 99 others); Tue, 18 Jul 2023 10:10:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230428AbjGROKo (ORCPT ); Tue, 18 Jul 2023 10:10:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE3C499 for ; Tue, 18 Jul 2023 07:10:42 -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 7D19A615D4 for ; Tue, 18 Jul 2023 14:10:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87169C433C7; Tue, 18 Jul 2023 14:10:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689689441; bh=9c3C988jkDd8Kk8czKP2cZc21cuxnAg2V93BFXTPbiw=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=kexSai0lKnvhCqAOdBquGAvILYBDMREiFxFPQBr9YeqSSHQHMuUIDec8yOIEciRT0 020khcMkw4CAYGp83K0+RNr3S/YiBjyss9c3KWVI4x37oS5zIW7587ZDR0EV89Z+p7 A2Zy0u3Thp9NcOnl/3tMdKsSeAxUsscDCjh9+hbh7jJGhKDY9af1DMC0sVj0bdFRxC DMShmOEHPy/CKc2IF8J2d/SM8pTUckz2J75f7NqLFRwKJEjimLhH8mPk4WgqXHAaM6 yVat+U/3gRG0fINffMJerKGw5qfrECRo/4GGFdP2GvdGZtcVl8o7v19w3HEFtJKPs2 149J+kJQI6P5g== Message-ID: <916ec4f1999cdb2ff358d7cbfc69f3bbe7f4f2fc.camel@kernel.org> Subject: Re: [PATCH] nfsd: Remove incorrect check in nfsd4_validate_stateid From: Jeff Layton To: Trond Myklebust , Chuck Lever Cc: linux-nfs@vger.kernel.org Date: Tue, 18 Jul 2023 10:10:40 -0400 In-Reply-To: <106daf5e0242b67bdb04e2e8e4ae7e114a4b47ab.camel@kernel.org> References: <20230718123837.124780-1-trondmy@kernel.org> <6dc89e4859a6851773bc2931d919e1cb204ae690.camel@kernel.org> <106daf5e0242b67bdb04e2e8e4ae7e114a4b47ab.camel@kernel.org> 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=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Tue, 2023-07-18 at 09:51 -0400, Trond Myklebust wrote: > On Tue, 2023-07-18 at 09:35 -0400, Jeff Layton wrote: > > On Tue, 2023-07-18 at 08:38 -0400, trondmy@kernel.org=A0wrote: > > > From: Trond Myklebust > > >=20 > > > If the client is calling TEST_STATEID, then it is because some > > > event > > > occurred that requires it to check all the stateids for validity > > > and > > > call FREE_STATEID on the ones that have been revoked. In this case, > > > either the stateid exists in the list of stateids associated with > > > that > > > nfs4_client, in which case it should be tested, or it does not. > > > There > > > are no additional conditions to be considered. > > >=20 > > > Reported-by: Frank Ch. Eigler > > > Fixes: 663e36f07666 ("nfsd4: kill warnings on testing stateids with > > > mismatched clientids") > > > Cc: stable@vger.kernel.org > > > Signed-off-by: Trond Myklebust > > > --- > > > =A0fs/nfsd/nfs4state.c | 2 -- > > > =A01 file changed, 2 deletions(-) > > >=20 > > > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c > > > index 6e61fa3acaf1..3aefbad4cc09 100644 > > > --- a/fs/nfsd/nfs4state.c > > > +++ b/fs/nfsd/nfs4state.c > > > @@ -6341,8 +6341,6 @@ static __be32 nfsd4_validate_stateid(struct > > > nfs4_client *cl, stateid_t *stateid) > > > =A0=A0=A0=A0=A0=A0=A0=A0if (ZERO_STATEID(stateid) || ONE_STATEID(stat= eid) || > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0CLOSE_STATEID(stateid= )) > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0return status; > > > -=A0=A0=A0=A0=A0=A0=A0if (!same_clid(&stateid->si_opaque.so_clid, &cl= - > > > > cl_clientid)) > > > -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0return status; > > > =A0=A0=A0=A0=A0=A0=A0=A0spin_lock(&cl->cl_lock); > > > =A0=A0=A0=A0=A0=A0=A0=A0s =3D find_stateid_locked(cl, stateid); > > > =A0=A0=A0=A0=A0=A0=A0=A0if (!s) > >=20 > > IDGI. Is this fixing an actual bug? Granted this code does seem > > unnecessary, but removing it doesn't seem like it will cause any > > user-visible change in behavior. Am I missing something? >=20 > It was clearly triggering in > https://bugzilla.redhat.com/show_bug.cgi?id=3D2176575 >=20 > Furthermore, if you look at commit 663e36f07666, you'll see that all it > does is remove the log message because "it is expected". For some > unknown reason, it did not register that "then the check is incorrect". >=20 Yeah, that commit just removes the warning, AFAICT. > So yes, this is fixing a real bug. >=20 My assumption was that for any stateid that the server hands out, the si_opaque.so_clid must match the clid. But...it looks like s2s copy might have changed that rule? In any case, the patch looks fine, so I have no objection. I'm just trying to understand how this could happen. Reviewed-by: Jeff Layton