Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3036099rdh; Mon, 27 Nov 2023 05:17:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IHKnFs0AdpL1Z3vO7Z4FGTr9/Zx7PBXbGfDgU37hIyfjuOJqwHy879Yj56J2dX1lEJUSppz X-Received: by 2002:a17:906:3b47:b0:a10:e86f:5594 with SMTP id h7-20020a1709063b4700b00a10e86f5594mr958219ejf.3.1701091054249; Mon, 27 Nov 2023 05:17:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701091054; cv=none; d=google.com; s=arc-20160816; b=L/HH+i8ZOBE76r7hYHTvWR3XyPVP4ctrBTUsmeoBoRbKxA9Ixz2HzXy4b6ae7fvp2r RqTy1FmfQ69C+Cbf5ZLWuZ6og7KEiDLwDVdbwc4vYLp6dQRMFINdr+C7OjpucTKOei+u 2VWMsl+kGX1O75XgNGoTq5/F1cx6fjsb4uRPnU0vx7CjYdHY5J+62g6ZXTIvEhu7BXtF wz/XGZkkN3YG4FjMHamI70/avaqPv7V3/uvPRQhAjzWNt8gyb3nkkFK1RMGbIREsJuvQ 4JPOmnSG+aku5aDNNx5uwdjKoaEvou5vKDZ/vL9nIX3CS+7Emu3c4gGzyZu6CfLkLGcP wnvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:autocrypt:references :in-reply-to:date:cc:to:from:subject:message-id:dkim-signature; bh=U63FnF6UrtCul3Y+Rf2Ak21uEJ9E96S21GzR6VZLj1M=; fh=OcKsFOYHXkFUuroZFv0kDoaH9wMEljnKMGoW5XIvX+Q=; b=sMpjnY5oOeksWJCreUNSxjCUJrjcDLDfklwwhPnDYCzQ89fFKbBs5O5fA0k4X1haA0 HDTJs0V0zCtg26WxzYKV/aoWXvcT++7afRpvBqgApKe/PH/DbjVwGwE26jxm/qiRfjPD JFisHEJrOfkAfI/N4BbDwVc5MhjAx5alXJceKUwCFxTagZrqMvaay/rQOvkjBcR6rmkO W1zdmUStI9Xb5J89JuEATgRJWmUx2fBkcACOibmf1GAMAr9/zITq9Wcmzmu6uvUMY/oA laCBHlAYMyHKnX9Ein8+qOkPVWHhN+kmwNLwsFD8ojjuBOJZn+6nkeHm2MpLCowgpF6K hK3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lwTgCVCF; spf=pass (google.com: domain of linux-nfs+bounces-86-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-nfs+bounces-86-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f20-20020a170906391400b009fae1658f64si5044562eje.890.2023.11.27.05.17.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 05:17:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-86-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lwTgCVCF; spf=pass (google.com: domain of linux-nfs+bounces-86-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-nfs+bounces-86-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D1FF41F20C74 for ; Mon, 27 Nov 2023 13:17:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 95E011A725; Mon, 27 Nov 2023 13:17:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lwTgCVCF" X-Original-To: linux-nfs@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 734681108 for ; Mon, 27 Nov 2023 13:17:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D595C433C9; Mon, 27 Nov 2023 13:17:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701091049; bh=aVu2B8ljX02QOknEtFfyRrKu4BY+lmPpsYZlRUFki4U=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=lwTgCVCFlzEqzgH39V+652B9ykZz30vpoR2CdlqQNK20ODfn+Ij1jwXxMyWVEawTk iHVVG1a+zfHqexsKvc8iy6vbdHEcpq0HLnHKIKrywgHPGnQqXK/5huHPFJGwKGodDr 61+W9j3TtuC2Cnc1kpoW6qzElCqu8gqknZmfBmn4KXmrrlcOQBiyYwDSWK/DJ7akvY gHjHUx1bxl1HoEu+wifOKHMtif+0zJe/KSrBADp4fzy0fHAHUsd5nDzqaYLFFc466r ZR7Dt6ZA2ICZtf/C0w7ZyXfgvr+jH8pYQclYMLlBHRqSG5AVHUKVx5Z/uh2i/vkvLy 4sLIuhETsBk6A== Message-ID: Subject: Re: [PATCH 04/11] nfsd: split sc_status out of sc_type From: Jeff Layton To: NeilBrown , Chuck Lever Cc: linux-nfs@vger.kernel.org, Olga Kornievskaia , Dai Ngo , Tom Talpey Date: Mon, 27 Nov 2023 08:17:28 -0500 In-Reply-To: <20231124002504.19515-5-neilb@suse.de> References: <20231124002504.19515-1-neilb@suse.de> <20231124002504.19515-5-neilb@suse.de> Autocrypt: addr=jlayton@kernel.org; prefer-encrypt=mutual; keydata=mQINBE6V0TwBEADXhJg7s8wFDwBMEvn0qyhAnzFLTOCHooMZyx7XO7dAiIhDSi7G1NPxwn8jdFUQMCR/GlpozMFlSFiZXiObE7sef9rTtM68ukUyZM4pJ9l0KjQNgDJ6Fr342Htkjxu/kFV1WvegyjnSsFt7EGoDjdKqr1TS9syJYFjagYtvWk/UfHlW09X+jOh4vYtfX7iYSx/NfqV3W1D7EDi0PqVT2h6v8i8YqsATFPwO4nuiTmL6I40ZofxVd+9wdRI4Db8yUNA4ZSP2nqLcLtFjClYRBoJvRWvsv4lm0OX6MYPtv76hka8lW4mnRmZqqx3UtfHX/hF/zH24Gj7A6sYKYLCU3YrI2Ogiu7/ksKcl7goQjpvtVYrOOI5VGLHge0awt7bhMCTM9KAfPc+xL/ZxAMVWd3NCk5SamL2cE99UWgtvNOIYU8m6EjTLhsj8snVluJH0/RcxEeFbnSaswVChNSGa7mXJrTR22lRL6ZPjdMgS2Km90haWPRc8Wolcz07Y2se0xpGVLEQcDEsvv5IMmeMe1/qLZ6NaVkNuL3WOXvxaVT9USW1+/SGipO2IpKJjeDZfehlB/kpfF24+RrK+seQfCBYyUE8QJpvTZyfUHNYldXlrjO6n5MdOempLqWpfOmcGkwnyNRBR46g/jf8KnPRwXs509yAqDB6sELZH+yWr9LQZEwARAQABtCVKZWZmIExheXRvbiA8amxheXRvbkBwb29jaGllcmVkcy5uZXQ+iQI7BBMBAgAlAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAUCTpXWPAIZAQAKCRAADmhBGVaCFc65D/4gBLNMHopQYgG/9RIM3kgFCCQV0pLv0hcg1cjr+bPI5f1PzJoOVi9s0wBDHwp8+vtHgYhM54yt43uI7Htij0RHFL5eFqoVT4TSfAg2qlvNemJEOY0e4daljjmZM7UtmpGs9N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fL3QCvcw2XoZTH2l2umPiTzrCsDJhgwZfG9BDyOHaYhPasd5qgrUBtjjUiNKjVM+Cx1DnieR0dZWafnqGv682avPblfi70XXr2juRE/fSZoZkyZhm+nsLuIcXTnzY4D572JGrpRMTpNpGmitBdh1l/9O7Fb64uLOtA5Qj5jcHHOjL0DZpjmFWYKlSAHmURHrE8M0qRryQXvlhoQxlJR4nvQrjOPMsqWD5F9mcRyowOzr8amasLv43w92rD2nHoBK6rbFE/qC7AAjABEsZq8+TQmueN0maIXUQu7TBzejsEbV0i29z+kkrjU2NmK5pcxgAtehVxpZJ14LqmN6E0suTtzjNT1eMoqOPrMSx+6vOCIuvJ/MVYnQgHhjtPPnU86mebTY5Loy9YfJAC2EVpxtcCbx2KiwErTndEyWL+GL53LuScUD7tW8vYbGIp4RlnUgPLbqpgssq2gwYO9m75FGuKuB2+2bCGajqalid5nzeq9v7cYLLRgArJfOIBWZrHy2m0C+pFu9DSuV6SNr2dvMQUv1V58h0FaSOxHVQnJdnoHn13g/CKKvyg2EMrMt/EfcXgvDwQbnG9we4xJiWOIOcsvrWcB6C6lWBDA+In7w7SXnnok kZWuOsJdJQdmwlWC5L5ln9xgfr/4mOY38B0U= Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.1 (3.50.1-1.fc39) Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2023-11-24 at 11:23 +1100, NeilBrown wrote: > sc_type identifies the type of a state - open, lock, deleg, layout - and > also the status of a state - closed or revoked. >=20 > This is a bit untidy and could get worse when "admin-revoked" states are > added. So clean it up. >=20 > With this patch, the type is now all that is stored in sc_type. This is > zero when the state is first added to ->cl_stateids (causing it to be > ignored), and is then set appropriately once it is fully initialised. > It is set under ->cl_lock to ensure atomicity w.r.t lookup. It is now > never cleared. >=20 > sc_type is still a bit-set even though at most one bit is set. This allo= ws > lookup functions to be given a bitmap of acceptable types. >=20 > sc_type is now an unsigned short rather than char. There is no value in > restricting to just 8 bits. >=20 > The status is stored in a separate unsigned short named "sc_status". It > has two flags: NFS4_STID_CLOSED and NFS4_STID_REVOKED. > CLOSED combines NFS4_CLOSED_STID, NFS4_CLOSED_DELEG_STID, and is used > for LOCK_STID and LAYOUT_STID instead of setting the sc_type to zero. > These flags are only ever set, never cleared. > For deleg stateids they are set under the global state_lock. > For open and lock stateids they are set under ->cl_lock. > For layout stateids they are set under ->ls_lock >=20 > nfs4_unhash_stid() has been removed, and we never set sc_type =3D 0. Thi= s > was only used for LOCK and LAYOUT stids and they now use > NFS4_STID_CLOSED. >=20 > Also TRACE_DEFINE_NUM() calls for the various STD #define have been > removed because these things are not enums, and so that call is > incorrect. >=20 > Signed-off-by: NeilBrown > --- > fs/nfsd/nfs4layouts.c | 6 +- > fs/nfsd/nfs4state.c | 165 +++++++++++++++++++++--------------------- > fs/nfsd/state.h | 40 +++++++--- > fs/nfsd/trace.h | 23 +++--- > 4 files changed, 122 insertions(+), 112 deletions(-) >=20 > diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c > index 5e8096bc5eaa..77656126ad2a 100644 > --- a/fs/nfsd/nfs4layouts.c > +++ b/fs/nfsd/nfs4layouts.c > @@ -269,13 +269,13 @@ nfsd4_preprocess_layout_stateid(struct svc_rqst *rq= stp, > { > struct nfs4_layout_stateid *ls; > struct nfs4_stid *stid; > - unsigned char typemask =3D NFS4_LAYOUT_STID; > + unsigned short typemask =3D NFS4_LAYOUT_STID; > __be32 status; > =20 > if (create) > typemask |=3D (NFS4_OPEN_STID | NFS4_LOCK_STID | NFS4_DELEG_STID); > =20 > - status =3D nfsd4_lookup_stateid(cstate, stateid, typemask, &stid, > + status =3D nfsd4_lookup_stateid(cstate, stateid, typemask, 0, &stid, > net_generic(SVC_NET(rqstp), nfsd_net_id)); > if (status) > goto out; > @@ -518,7 +518,7 @@ nfsd4_return_file_layouts(struct svc_rqst *rqstp, > lrp->lrs_present =3D true; > } else { > trace_nfsd_layoutstate_unhash(&ls->ls_stid.sc_stateid); > - nfs4_unhash_stid(&ls->ls_stid); > + ls->ls_stid.sc_status |=3D NFS4_STID_CLOSED; > lrp->lrs_present =3D false; > } > spin_unlock(&ls->ls_lock); > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c > index 276afcba07a0..b9239f2ebc79 100644 > --- a/fs/nfsd/nfs4state.c > +++ b/fs/nfsd/nfs4state.c > @@ -1265,11 +1265,6 @@ static void destroy_unhashed_deleg(struct nfs4_del= egation *dp) > nfs4_put_stid(&dp->dl_stid); > } > =20 > -void nfs4_unhash_stid(struct nfs4_stid *s) > -{ > - s->sc_type =3D 0; > -} > - > /** > * nfs4_delegation_exists - Discover if this delegation already exists > * @clp: a pointer to the nfs4_client we're granting a delegation to > @@ -1334,7 +1329,7 @@ static bool delegation_hashed(struct nfs4_delegatio= n *dp) > } > =20 > static bool > -unhash_delegation_locked(struct nfs4_delegation *dp, unsigned char type) > +unhash_delegation_locked(struct nfs4_delegation *dp, unsigned short stat= usmask) > { > struct nfs4_file *fp =3D dp->dl_stid.sc_file; > =20 > @@ -1344,8 +1339,9 @@ unhash_delegation_locked(struct nfs4_delegation *dp= , unsigned char type) > return false; > =20 > if (dp->dl_stid.sc_client->cl_minorversion =3D=3D 0) > - type =3D NFS4_CLOSED_DELEG_STID; > - dp->dl_stid.sc_type =3D type; > + statusmask =3D NFS4_STID_CLOSED; > + dp->dl_stid.sc_status |=3D statusmask; > + > /* Ensure that deleg break won't try to requeue it */ > ++dp->dl_time; > spin_lock(&fp->fi_lock); > @@ -1361,7 +1357,7 @@ static void destroy_delegation(struct nfs4_delegati= on *dp) > bool unhashed; > =20 > spin_lock(&state_lock); > - unhashed =3D unhash_delegation_locked(dp, NFS4_CLOSED_DELEG_STID); > + unhashed =3D unhash_delegation_locked(dp, NFS4_STID_CLOSED); > spin_unlock(&state_lock); > if (unhashed) > destroy_unhashed_deleg(dp); > @@ -1375,7 +1371,7 @@ static void revoke_delegation(struct nfs4_delegatio= n *dp) > =20 > trace_nfsd_stid_revoke(&dp->dl_stid); > =20 > - if (dp->dl_stid.sc_type =3D=3D NFS4_REVOKED_DELEG_STID) { > + if (dp->dl_stid.sc_status & NFS4_STID_REVOKED) { > spin_lock(&clp->cl_lock); > refcount_inc(&dp->dl_stid.sc_count); > list_add(&dp->dl_recall_lru, &clp->cl_revoked); > @@ -1384,8 +1380,8 @@ static void revoke_delegation(struct nfs4_delegatio= n *dp) > destroy_unhashed_deleg(dp); > } > =20 > -/*=20 > - * SETCLIENTID state=20 > +/* > + * SETCLIENTID state > */ > =20 > static unsigned int clientid_hashval(u32 id) > @@ -1548,7 +1544,7 @@ static bool unhash_lock_stateid(struct nfs4_ol_stat= eid *stp) > if (!unhash_ol_stateid(stp)) > return false; > list_del_init(&stp->st_locks); > - nfs4_unhash_stid(&stp->st_stid); > + stp->st_stid.sc_status |=3D NFS4_STID_CLOSED; > return true; > } > =20 > @@ -1627,6 +1623,7 @@ static void release_open_stateid(struct nfs4_ol_sta= teid *stp) > LIST_HEAD(reaplist); > =20 > spin_lock(&stp->st_stid.sc_client->cl_lock); > + stp->st_stid.sc_status |=3D NFS4_STID_CLOSED; > if (unhash_open_stateid(stp, &reaplist)) > put_ol_stateid_locked(stp, &reaplist); > spin_unlock(&stp->st_stid.sc_client->cl_lock); > @@ -2235,7 +2232,7 @@ __destroy_client(struct nfs4_client *clp) > spin_lock(&state_lock); > while (!list_empty(&clp->cl_delegations)) { > dp =3D list_entry(clp->cl_delegations.next, struct nfs4_delegation, dl= _perclnt); > - unhash_delegation_locked(dp, NFS4_CLOSED_DELEG_STID); > + unhash_delegation_locked(dp, NFS4_STID_CLOSED); > list_add(&dp->dl_recall_lru, &reaplist); > } > spin_unlock(&state_lock); > @@ -2467,14 +2464,16 @@ find_stateid_locked(struct nfs4_client *cl, state= id_t *t) > } > =20 > static struct nfs4_stid * > -find_stateid_by_type(struct nfs4_client *cl, stateid_t *t, char typemask= ) > +find_stateid_by_type(struct nfs4_client *cl, stateid_t *t, > + unsigned short typemask, unsigned short ok_states) > { > struct nfs4_stid *s; > =20 > spin_lock(&cl->cl_lock); > s =3D find_stateid_locked(cl, t); > if (s !=3D NULL) { > - if (typemask & s->sc_type) > + if ((s->sc_status & ~ok_states) =3D=3D 0 && > + (typemask & s->sc_type)) > refcount_inc(&s->sc_count); > else > s =3D NULL; > @@ -4583,7 +4582,8 @@ nfsd4_find_existing_open(struct nfs4_file *fp, stru= ct nfsd4_open *open) > continue; > if (local->st_stateowner !=3D &oo->oo_owner) > continue; > - if (local->st_stid.sc_type =3D=3D NFS4_OPEN_STID) { > + if (local->st_stid.sc_type =3D=3D NFS4_OPEN_STID && > + !local->st_stid.sc_status) { > ret =3D local; > refcount_inc(&ret->st_stid.sc_count); > break; > @@ -4597,17 +4597,10 @@ nfsd4_verify_open_stid(struct nfs4_stid *s) > { > __be32 ret =3D nfs_ok; > =20 > - switch (s->sc_type) { > - default: > - break; > - case 0: > - case NFS4_CLOSED_STID: > - case NFS4_CLOSED_DELEG_STID: > - ret =3D nfserr_bad_stateid; > - break; > - case NFS4_REVOKED_DELEG_STID: > + if (s->sc_status & NFS4_STID_REVOKED) > ret =3D nfserr_deleg_revoked; > - } > + else if (s->sc_status & NFS4_STID_CLOSED) > + ret =3D nfserr_bad_stateid; > return ret; > } > =20 > @@ -4920,9 +4913,9 @@ static int nfsd4_cb_recall_done(struct nfsd4_callba= ck *cb, > =20 > trace_nfsd_cb_recall_done(&dp->dl_stid.sc_stateid, task); > =20 > - if (dp->dl_stid.sc_type =3D=3D NFS4_CLOSED_DELEG_STID || > - dp->dl_stid.sc_type =3D=3D NFS4_REVOKED_DELEG_STID) > - return 1; > + if (dp->dl_stid.sc_status) > + /* CLOSED or REVOKED */ > + return 1; > =20 > switch (task->tk_status) { > case 0: > @@ -5167,12 +5160,12 @@ static int share_access_to_flags(u32 share_access= ) > return share_access =3D=3D NFS4_SHARE_ACCESS_READ ? RD_STATE : WR_STATE= ; > } > =20 > -static struct nfs4_delegation *find_deleg_stateid(struct nfs4_client *cl= , stateid_t *s) > +static struct nfs4_delegation *find_deleg_stateid(struct nfs4_client *cl= , > + stateid_t *s) > { > struct nfs4_stid *ret; > =20 > - ret =3D find_stateid_by_type(cl, s, > - NFS4_DELEG_STID|NFS4_REVOKED_DELEG_STID); > + ret =3D find_stateid_by_type(cl, s, NFS4_DELEG_STID, NFS4_STID_REVOKED)= ; > if (!ret) > return NULL; > return delegstateid(ret); > @@ -5195,7 +5188,7 @@ nfs4_check_deleg(struct nfs4_client *cl, struct nfs= d4_open *open, > deleg =3D find_deleg_stateid(cl, &open->op_delegate_stateid); > if (deleg =3D=3D NULL) > goto out; > - if (deleg->dl_stid.sc_type =3D=3D NFS4_REVOKED_DELEG_STID) { > + if (deleg->dl_stid.sc_status & NFS4_STID_REVOKED) { > nfs4_put_stid(&deleg->dl_stid); > status =3D nfserr_deleg_revoked; > goto out; > @@ -5842,7 +5835,6 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct = svc_fh *current_fh, struct nf > } else { > status =3D nfs4_get_vfs_file(rqstp, fp, current_fh, stp, open, true); > if (status) { > - stp->st_stid.sc_type =3D NFS4_CLOSED_STID; > release_open_stateid(stp); > mutex_unlock(&stp->st_mutex); > goto out; > @@ -6234,7 +6226,7 @@ nfs4_laundromat(struct nfsd_net *nn) > dp =3D list_entry (pos, struct nfs4_delegation, dl_recall_lru); > if (!state_expired(<, dp->dl_time)) > break; > - unhash_delegation_locked(dp, NFS4_REVOKED_DELEG_STID); > + unhash_delegation_locked(dp, NFS4_STID_REVOKED); > list_add(&dp->dl_recall_lru, &reaplist); > } > spin_unlock(&state_lock); > @@ -6473,22 +6465,20 @@ static __be32 nfsd4_validate_stateid(struct nfs4_= client *cl, stateid_t *stateid) > status =3D nfsd4_stid_check_stateid_generation(stateid, s, 1); > if (status) > goto out_unlock; > + status =3D nfsd4_verify_open_stid(s); > + if (status) > + goto out_unlock; > + > switch (s->sc_type) { > case NFS4_DELEG_STID: > status =3D nfs_ok; > break; > - case NFS4_REVOKED_DELEG_STID: > - status =3D nfserr_deleg_revoked; > - break; > case NFS4_OPEN_STID: > case NFS4_LOCK_STID: > status =3D nfsd4_check_openowner_confirmed(openlockstateid(s)); > break; > default: > printk("unknown stateid type %x\n", s->sc_type); > - fallthrough; > - case NFS4_CLOSED_STID: > - case NFS4_CLOSED_DELEG_STID: > status =3D nfserr_bad_stateid; > } > out_unlock: > @@ -6498,7 +6488,8 @@ static __be32 nfsd4_validate_stateid(struct nfs4_cl= ient *cl, stateid_t *stateid) > =20 > __be32 > nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate, > - stateid_t *stateid, unsigned char typemask, > + stateid_t *stateid, > + unsigned short typemask, unsigned short statusmask, > struct nfs4_stid **s, struct nfsd_net *nn) > { > __be32 status; > @@ -6509,10 +6500,13 @@ nfsd4_lookup_stateid(struct nfsd4_compound_state = *cstate, > * only return revoked delegations if explicitly asked. > * otherwise we report revoked or bad_stateid status. > */ > - if (typemask & NFS4_REVOKED_DELEG_STID) > + if (statusmask & NFS4_STID_REVOKED) > return_revoked =3D true; > - else if (typemask & NFS4_DELEG_STID) > - typemask |=3D NFS4_REVOKED_DELEG_STID; > + if (typemask & NFS4_DELEG_STID) > + /* Always allow REVOKED for DELEG so we can > + * retturn the appropriate error. > + */ > + statusmask |=3D NFS4_STID_REVOKED; > =20 > if (ZERO_STATEID(stateid) || ONE_STATEID(stateid) || > CLOSE_STATEID(stateid)) > @@ -6525,14 +6519,12 @@ nfsd4_lookup_stateid(struct nfsd4_compound_state = *cstate, > } > if (status) > return status; > - stid =3D find_stateid_by_type(cstate->clp, stateid, typemask); > + stid =3D find_stateid_by_type(cstate->clp, stateid, typemask, statusmas= k); > if (!stid) > return nfserr_bad_stateid; > - if ((stid->sc_type =3D=3D NFS4_REVOKED_DELEG_STID) && !return_revoked) = { > + if ((stid->sc_status & NFS4_STID_REVOKED) && !return_revoked) { > nfs4_put_stid(stid); > - if (cstate->minorversion) > - return nfserr_deleg_revoked; > - return nfserr_bad_stateid; > + return nfserr_deleg_revoked; > } > *s =3D stid; > return nfs_ok; > @@ -6543,7 +6535,7 @@ nfs4_find_file(struct nfs4_stid *s, int flags) > { > struct nfsd_file *ret =3D NULL; > =20 > - if (!s) > + if (!s || s->sc_status) > return NULL; > =20 > switch (s->sc_type) { > @@ -6666,7 +6658,8 @@ static __be32 find_cpntf_state(struct nfsd_net *nn,= stateid_t *st, > goto out; > =20 > *stid =3D find_stateid_by_type(found, &cps->cp_p_stateid, > - NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID); > + NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID, > + 0); > if (*stid) > status =3D nfs_ok; > else > @@ -6724,7 +6717,7 @@ nfs4_preprocess_stateid_op(struct svc_rqst *rqstp, > =20 > status =3D nfsd4_lookup_stateid(cstate, stateid, > NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID, > - &s, nn); > + 0, &s, nn); > if (status =3D=3D nfserr_bad_stateid) > status =3D find_cpntf_state(nn, stateid, &s); > if (status) > @@ -6742,9 +6735,6 @@ nfs4_preprocess_stateid_op(struct svc_rqst *rqstp, > case NFS4_LOCK_STID: > status =3D nfs4_check_olstateid(openlockstateid(s), flags); > break; > - default: > - status =3D nfserr_bad_stateid; > - break; > } > if (status) > goto out; > @@ -6823,11 +6813,20 @@ nfsd4_free_stateid(struct svc_rqst *rqstp, struct= nfsd4_compound_state *cstate, > =20 > spin_lock(&cl->cl_lock); > s =3D find_stateid_locked(cl, stateid); > - if (!s) > + if (!s || s->sc_status & NFS4_STID_CLOSED) > goto out_unlock; > spin_lock(&s->sc_lock); > switch (s->sc_type) { > case NFS4_DELEG_STID: > + if (s->sc_status & NFS4_STID_REVOKED) { > + spin_unlock(&s->sc_lock); > + dp =3D delegstateid(s); > + list_del_init(&dp->dl_recall_lru); > + spin_unlock(&cl->cl_lock); > + nfs4_put_stid(s); > + ret =3D nfs_ok; > + goto out; > + } > ret =3D nfserr_locks_held; > break; > case NFS4_OPEN_STID: > @@ -6842,14 +6841,6 @@ nfsd4_free_stateid(struct svc_rqst *rqstp, struct = nfsd4_compound_state *cstate, > spin_unlock(&cl->cl_lock); > ret =3D nfsd4_free_lock_stateid(stateid, s); > goto out; > - case NFS4_REVOKED_DELEG_STID: > - spin_unlock(&s->sc_lock); > - dp =3D delegstateid(s); > - list_del_init(&dp->dl_recall_lru); > - spin_unlock(&cl->cl_lock); > - nfs4_put_stid(s); > - ret =3D nfs_ok; > - goto out; > /* Default falls through and returns nfserr_bad_stateid */ > } > spin_unlock(&s->sc_lock); > @@ -6892,6 +6883,7 @@ static __be32 nfs4_seqid_op_checks(struct nfsd4_com= pound_state *cstate, stateid_ > * @seqid: seqid (provided by client) > * @stateid: stateid (provided by client) > * @typemask: mask of allowable types for this operation > + * @statusmask: mask of allowed states: 0 or STID_CLOSED > * @stpp: return pointer for the stateid found > * @nn: net namespace for request > * > @@ -6901,7 +6893,8 @@ static __be32 nfs4_seqid_op_checks(struct nfsd4_com= pound_state *cstate, stateid_ > */ > static __be32 > nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, > - stateid_t *stateid, char typemask, > + stateid_t *stateid, > + unsigned short typemask, unsigned short statusmask, > struct nfs4_ol_stateid **stpp, > struct nfsd_net *nn) > { > @@ -6912,7 +6905,8 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_stat= e *cstate, u32 seqid, > trace_nfsd_preprocess(seqid, stateid); > =20 > *stpp =3D NULL; > - status =3D nfsd4_lookup_stateid(cstate, stateid, typemask, &s, nn); > + status =3D nfsd4_lookup_stateid(cstate, stateid, > + typemask, statusmask, &s, nn); > if (status) > return status; > stp =3D openlockstateid(s); > @@ -6934,7 +6928,7 @@ static __be32 nfs4_preprocess_confirmed_seqid_op(st= ruct nfsd4_compound_state *cs > struct nfs4_ol_stateid *stp; > =20 > status =3D nfs4_preprocess_seqid_op(cstate, seqid, stateid, > - NFS4_OPEN_STID, &stp, nn); > + NFS4_OPEN_STID, 0, &stp, nn); > if (status) > return status; > oo =3D openowner(stp->st_stateowner); > @@ -6965,8 +6959,8 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct n= fsd4_compound_state *cstate, > return status; > =20 > status =3D nfs4_preprocess_seqid_op(cstate, > - oc->oc_seqid, &oc->oc_req_stateid, > - NFS4_OPEN_STID, &stp, nn); > + oc->oc_seqid, &oc->oc_req_stateid, > + NFS4_OPEN_STID, 0, &stp, nn); > if (status) > goto out; > oo =3D openowner(stp->st_stateowner); > @@ -7096,18 +7090,20 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_= compound_state *cstate, > struct net *net =3D SVC_NET(rqstp); > struct nfsd_net *nn =3D net_generic(net, nfsd_net_id); > =20 > - dprintk("NFSD: nfsd4_close on file %pd\n",=20 > + dprintk("NFSD: nfsd4_close on file %pd\n", > cstate->current_fh.fh_dentry); > =20 > status =3D nfs4_preprocess_seqid_op(cstate, close->cl_seqid, > - &close->cl_stateid, > - NFS4_OPEN_STID|NFS4_CLOSED_STID, > - &stp, nn); > + &close->cl_stateid, > + NFS4_OPEN_STID, NFS4_STID_CLOSED, > + &stp, nn); > nfsd4_bump_seqid(cstate, status); > if (status) > - goto out;=20 > + goto out; > =20 > - stp->st_stid.sc_type =3D NFS4_CLOSED_STID; > + spin_lock(&stp->st_stid.sc_client->cl_lock); > + stp->st_stid.sc_status |=3D NFS4_STID_CLOSED; > + spin_unlock(&stp->st_stid.sc_client->cl_lock); > =20 > /* > * Technically we don't _really_ have to increment or copy it, since > @@ -7149,7 +7145,7 @@ nfsd4_delegreturn(struct svc_rqst *rqstp, struct nf= sd4_compound_state *cstate, > if ((status =3D fh_verify(rqstp, &cstate->current_fh, S_IFREG, 0))) > return status; > =20 > - status =3D nfsd4_lookup_stateid(cstate, stateid, NFS4_DELEG_STID, &s, n= n); > + status =3D nfsd4_lookup_stateid(cstate, stateid, NFS4_DELEG_STID, 0, &s= , nn); > if (status) > goto out; > dp =3D delegstateid(s); > @@ -7603,9 +7599,10 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_co= mpound_state *cstate, > &lock_stp, &new); > } else { > status =3D nfs4_preprocess_seqid_op(cstate, > - lock->lk_old_lock_seqid, > - &lock->lk_old_lock_stateid, > - NFS4_LOCK_STID, &lock_stp, nn); > + lock->lk_old_lock_seqid, > + &lock->lk_old_lock_stateid, > + NFS4_LOCK_STID, 0, &lock_stp, > + nn); > } > if (status) > goto out; > @@ -7918,8 +7915,8 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_co= mpound_state *cstate, > return nfserr_inval; > =20 > status =3D nfs4_preprocess_seqid_op(cstate, locku->lu_seqid, > - &locku->lu_stateid, NFS4_LOCK_STID, > - &stp, nn); > + &locku->lu_stateid, NFS4_LOCK_STID, 0, > + &stp, nn); > if (status) > goto out; > nf =3D find_any_file(stp->st_stid.sc_file); > @@ -8353,7 +8350,7 @@ nfs4_state_shutdown_net(struct net *net) > spin_lock(&state_lock); > list_for_each_safe(pos, next, &nn->del_recall_lru) { > dp =3D list_entry (pos, struct nfs4_delegation, dl_recall_lru); > - unhash_delegation_locked(dp, NFS4_CLOSED_DELEG_STID); > + unhash_delegation_locked(dp, NFS4_STID_CLOSED); > list_add(&dp->dl_recall_lru, &reaplist); > } > spin_unlock(&state_lock); > diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h > index f96eaa8e9413..bb00dcd4c1ba 100644 > --- a/fs/nfsd/state.h > +++ b/fs/nfsd/state.h > @@ -88,17 +88,33 @@ struct nfsd4_callback_ops { > */ > struct nfs4_stid { > refcount_t sc_count; > -#define NFS4_OPEN_STID 1 > -#define NFS4_LOCK_STID 2 > -#define NFS4_DELEG_STID 4 > -/* For an open stateid kept around *only* to process close replays: */ > -#define NFS4_CLOSED_STID 8 > + > + /* A new stateid is added to the cl_stateids idr early before it > + * is fully initialised. Its sc_type is then zero. After > + * initialisation the sc_type it set under cl_lock, and then > + * never changes. > + */ > +#define NFS4_OPEN_STID BIT(0) > +#define NFS4_LOCK_STID BIT(1) > +#define NFS4_DELEG_STID BIT(2) > +#define NFS4_LAYOUT_STID BIT(3) > + unsigned short sc_type; > + > +/* state_lock protects sc_status for delegation stateids. > + * ->cl_lock protects sc_status for open and lock stateids. > + * ->st_mutex also protect sc_status for open stateids. > + * ->ls_lock protects sc_status for layout stateids. > + */ > +/* > + * For an open stateid kept around *only* to process close replays. > + * For deleg stateid, kept in idr until last reference is dropped. > + */ > +#define NFS4_STID_CLOSED BIT(0) > /* For a deleg stateid kept around only to process free_stateid's: */ > -#define NFS4_REVOKED_DELEG_STID 16 > -#define NFS4_CLOSED_DELEG_STID 32 > -#define NFS4_LAYOUT_STID 64 > +#define NFS4_STID_REVOKED BIT(1) > + unsigned short sc_status; > + > struct list_head sc_cp_list; > - unsigned char sc_type; > stateid_t sc_stateid; > spinlock_t sc_lock; > struct nfs4_client *sc_client; > @@ -694,15 +710,15 @@ extern __be32 nfs4_preprocess_stateid_op(struct svc= _rqst *rqstp, > stateid_t *stateid, int flags, struct nfsd_file **filp, > struct nfs4_stid **cstid); > __be32 nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate, > - stateid_t *stateid, unsigned char typemask, > - struct nfs4_stid **s, struct nfsd_net *nn); > + stateid_t *stateid, unsigned short typemask, > + unsigned short statusmask, > + struct nfs4_stid **s, struct nfsd_net *nn); > struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct kmem_ca= che *slab, > void (*sc_free)(struct nfs4_stid *)); > int nfs4_init_copy_state(struct nfsd_net *nn, struct nfsd4_copy *copy); > void nfs4_free_copy_state(struct nfsd4_copy *copy); > struct nfs4_cpntf_state *nfs4_alloc_init_cpntf_state(struct nfsd_net *nn= , > struct nfs4_stid *p_stid); > -void nfs4_unhash_stid(struct nfs4_stid *s); > void nfs4_put_stid(struct nfs4_stid *s); > void nfs4_inc_and_copy_stateid(stateid_t *dst, struct nfs4_stid *stid); > void nfs4_remove_reclaim_record(struct nfs4_client_reclaim *, struct nfs= d_net *); > diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h > index d1e8cf079b0f..568b4ec9a2af 100644 > --- a/fs/nfsd/trace.h > +++ b/fs/nfsd/trace.h > @@ -641,24 +641,18 @@ DEFINE_EVENT(nfsd_stateseqid_class, nfsd_##name, \ > DEFINE_STATESEQID_EVENT(preprocess); > DEFINE_STATESEQID_EVENT(open_confirm); > =20 > -TRACE_DEFINE_ENUM(NFS4_OPEN_STID); > -TRACE_DEFINE_ENUM(NFS4_LOCK_STID); > -TRACE_DEFINE_ENUM(NFS4_DELEG_STID); > -TRACE_DEFINE_ENUM(NFS4_CLOSED_STID); > -TRACE_DEFINE_ENUM(NFS4_REVOKED_DELEG_STID); > -TRACE_DEFINE_ENUM(NFS4_CLOSED_DELEG_STID); > -TRACE_DEFINE_ENUM(NFS4_LAYOUT_STID); > - > #define show_stid_type(x) \ > __print_flags(x, "|", \ > { NFS4_OPEN_STID, "OPEN" }, \ > { NFS4_LOCK_STID, "LOCK" }, \ > { NFS4_DELEG_STID, "DELEG" }, \ > - { NFS4_CLOSED_STID, "CLOSED" }, \ > - { NFS4_REVOKED_DELEG_STID, "REVOKED" }, \ > - { NFS4_CLOSED_DELEG_STID, "CLOSED_DELEG" }, \ > { NFS4_LAYOUT_STID, "LAYOUT" }) > =20 > +#define show_stid_status(x) \ > + __print_flags(x, "|", \ > + { NFS4_STID_CLOSED, "CLOSED" }, \ > + { NFS4_STID_REVOKED, "REVOKED" }) \ > + > DECLARE_EVENT_CLASS(nfsd_stid_class, > TP_PROTO( > const struct nfs4_stid *stid > @@ -666,6 +660,7 @@ DECLARE_EVENT_CLASS(nfsd_stid_class, > TP_ARGS(stid), > TP_STRUCT__entry( > __field(unsigned long, sc_type) > + __field(unsigned long, sc_status) > __field(int, sc_count) > __field(u32, cl_boot) > __field(u32, cl_id) > @@ -676,16 +671,18 @@ DECLARE_EVENT_CLASS(nfsd_stid_class, > const stateid_t *stp =3D &stid->sc_stateid; > =20 > __entry->sc_type =3D stid->sc_type; > + __entry->sc_status =3D stid->sc_status; > __entry->sc_count =3D refcount_read(&stid->sc_count); > __entry->cl_boot =3D stp->si_opaque.so_clid.cl_boot; > __entry->cl_id =3D stp->si_opaque.so_clid.cl_id; > __entry->si_id =3D stp->si_opaque.so_id; > __entry->si_generation =3D stp->si_generation; > ), > - TP_printk("client %08x:%08x stateid %08x:%08x ref=3D%d type=3D%s", > + TP_printk("client %08x:%08x stateid %08x:%08x ref=3D%d type=3D%s state= =3D%s", > __entry->cl_boot, __entry->cl_id, > __entry->si_id, __entry->si_generation, > - __entry->sc_count, show_stid_type(__entry->sc_type) > + __entry->sc_count, show_stid_type(__entry->sc_type), > + show_stid_status(__entry->sc_status) > ) > ); > =20 Very nice. This is long overdue. Reviewed-by: Jeff Layton