Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp476686pxb; Thu, 21 Jan 2021 11:34:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJyKxv+8lQnACEZO6+GJwkREJGRQboz+1ZeQ+4murQa8bg/LFc24AY85kyw+oTrI0D1u3Cm7 X-Received: by 2002:a50:c94c:: with SMTP id p12mr567464edh.154.1611257646305; Thu, 21 Jan 2021 11:34:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611257646; cv=none; d=google.com; s=arc-20160816; b=AM7H00xK6L4OE2Dxghn17T58OP4+eDauLoo5IwXhnIPg5drc23cbZHvy8M8iGoJ95t ZKb3oQILpNRd8Ac0F8YgRdytEZwSBEoICTgqD+cS99JET0CSkgHL+/9z08GLLvXDK5Z4 ndJMXIE1i2jib/ACPv8FdlwQtDPSLNTSaVs2kQGl40mNZ2fJ/8RPpWKGtaZmt2B/pi0M zRK5/+s9lxBUnyz4T7mKAKWrgfcBaZZmMeYHjx294AplcQQoXcPtqa4s+SQ5cEXXaPhn V2n69aYCgqX+1zS9EqPX2g7l1gGvyxD+6TBNTpikZ+88lsOvLrtDR7dxHMa9AfQkDTMl fAoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-filter; bh=lscifQ6r88dH3+dEBOLTCzjjKE7Sc4rNxLAl63bvmfU=; b=IgtCrcfisJc/oqcOyTsY8bFLu0Lg4bAce0fZDc2hXhD3ykbZRkD8ERFKrd4l+SFQi5 2orQzL2JT6EZP1dC4EqxvLxLr/quAGTepTM9NAmcVCV/R4f15IAQS2pVsNxTbZOXXAOb 9UtcrS5WWD6O9EBt2ZklqCfAwzpDaN3e0NQrkTjX4W/TksqbgW4elrsbKgieGWLJhvg3 EM9MjLMl71vjTXQHvl6MTHvEirLkQqQwKZPgAZ+004oqnagvknTJAv0SE3aM4Rs5BMsp MGe396ydugirNnpd4c021BZLPmJC4hN3JNoKLSNtY72nVW6Q2LwrlC+7EzgF/wnUCTi5 FCuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lx2si2159933ejb.131.2021.01.21.11.33.41; Thu, 21 Jan 2021 11:34:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726563AbhAUTdd (ORCPT + 99 others); Thu, 21 Jan 2021 14:33:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726730AbhAUSvK (ORCPT ); Thu, 21 Jan 2021 13:51:10 -0500 Received: from fieldses.org (fieldses.org [IPv6:2600:3c00:e000:2f7::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EC40C061351 for ; Thu, 21 Jan 2021 10:50:00 -0800 (PST) Received: by fieldses.org (Postfix, from userid 2815) id CEE5B6F0B; Thu, 21 Jan 2021 13:49:58 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.11.0 fieldses.org CEE5B6F0B From: "J. Bruce Fields" To: Chuck Lever Cc: linux-nfs@vger.kernel.org, "J. Bruce Fields" Subject: [PATCH 6/9] nfsd: find_cpntf_state cleanup Date: Thu, 21 Jan 2021 13:49:52 -0500 Message-Id: <1611254995-23131-6-git-send-email-bfields@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1611254995-23131-1-git-send-email-bfields@redhat.com> References: <6D288689-85E5-4E3E-9117-B71FB45FFABB@oracle.com> <1611254995-23131-1-git-send-email-bfields@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: "J. Bruce Fields" I think this unusual use of struct compound_state could cause confusion. It's not that much more complicated just to open-code this stateid lookup. The only change in behavior should be a different error return in the case the copy is using a source stateid that is a revoked delegation, but I doubt that matters. Signed-off-by: J. Bruce Fields --- fs/nfsd/nfs4state.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index c74bf3b5b0de..db10fef1c1d2 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -5812,21 +5812,27 @@ static __be32 find_cpntf_state(struct nfsd_net *nn, stateid_t *st, { __be32 status; struct nfs4_cpntf_state *cps = NULL; - struct nfsd4_compound_state cstate; + struct nfs4_client *found; status = manage_cpntf_state(nn, st, NULL, &cps); if (status) return status; cps->cpntf_time = ktime_get_boottime_seconds(); - memset(&cstate, 0, sizeof(cstate)); - status = set_client(&cps->cp_p_clid, &cstate, nn, true); - if (status) + + status = nfserr_expired; + found = lookup_clientid(&cps->cp_p_clid, true, nn); + if (!found) goto out; - status = nfsd4_lookup_stateid(&cstate, &cps->cp_p_stateid, - NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID, - stid, nn); - put_client_renew(cstate.clp); + + *stid = find_stateid_by_type(found, &cps->cp_p_stateid, + NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID); + if (stid) + status = nfs_ok; + else + status = nfserr_bad_stateid; + + put_client_renew(found); out: nfs4_put_cpntf_state(nn, cps); return status; -- 2.29.2