From nobody Sat Dec 28 04:15:12 2024 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 2785A19F119; Mon, 9 Dec 2024 21:14:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733778859; cv=none; b=U2dhSS0b17QLTz+3Ggt+6JqTFIhWPfghnUIkfXRCJ3DgG9ZWPfVbM3S6ZJ0/nXiBHmGP1Ctgx5aH3jj9ET9CFBh284hPbuf2Q012rFiE0uP7eSO4qoZ7BThRJQUZH7w3LMPLTeWsOE56yGJmt4DS84OUL6E1dQJ5a8dnX5EnYnY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733778859; c=relaxed/simple; bh=3si8j3lSEkeRRpO/9BBiyWD86Yw3ikSlJSYDWuYCyEw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mvdyIhcW91/a+XMsl8Lq13xBnK4VLnUqANDDno2JvyVcUm+dW7l7MpL57V7YxoDLrf+U7ZhDAwPSy0B/lcBRCp46K9ocUL4XYhjT/cJnHfAZ7Wm0MoT82oGbgmv8YjIUwdjUY+5zAvT00hyzBXAv9A7jo6llKtqGYj5pDcuraKc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Inywus6Q; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Inywus6Q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04610C4CEE2; Mon, 9 Dec 2024 21:14:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733778859; bh=3si8j3lSEkeRRpO/9BBiyWD86Yw3ikSlJSYDWuYCyEw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Inywus6QSamnpTKLQ7FA/6i/xmIbYlLMEdglK5zLyuaCGndw/vrcvim41MIfiUms6 AsZ1utODQP4mFhqaKT0oMHxyra83qxfKYFka+0Roo3fNU5YNP7+LEUteLS9fKDHuLg qGBwIyXHYY05Llf7+/tgg/5Bjk24DZO+jdi4Ba/gwB6PKnBsfKXwVTn+1FPklvfjeI iYod3fFLMhPVCdxqlku5fztGYZYrcyhnAFA8OVL+Y/Ik0BKUIBbofOTFciPxMRTFSd BOOr78ZzA1hqI/3JcYpFKEQOER2tppovHnLm5IL4Y4CPykoM6ZNQsvvF+pGMvGuSig QtaLqx1UmRgiA== From: Jeff Layton Date: Mon, 09 Dec 2024 16:13:55 -0500 Subject: [PATCH v5 03/10] nfsd: switch to autogenerated definitions for open_delegation_type4 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241209-delstid-v5-3-42308228f692@kernel.org> References: <20241209-delstid-v5-0-42308228f692@kernel.org> In-Reply-To: <20241209-delstid-v5-0-42308228f692@kernel.org> To: Chuck Lever , Neil Brown , Olga Kornievskaia , Dai Ngo , Tom Talpey , Jonathan Corbet , Trond Myklebust , Anna Schumaker Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Jeff Layton X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=11695; i=jlayton@kernel.org; h=from:subject:message-id; bh=3si8j3lSEkeRRpO/9BBiyWD86Yw3ikSlJSYDWuYCyEw=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBnV12kRpgouaWKmQ3PTSq2VAznB+jImSgaQc/fE 2uh0gtNPLGJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZ1ddpAAKCRAADmhBGVaC FeghEAC8aRYzWCnWh6xeShjq7vWLxOYc6VdBNFGOM3ieDYNky6Vk1rhHWkA2ehJ082FxuDiLa1i 9afN5jt/4JzbeWFebjtk2QNpTszwYDVVwn2Bx2ALk7LghW8sizn3t/1CNdqD9me9zeY7shZi0QW zZ3Dj3DMN7zXDR/4zPvsnlTASX3Iq1M9NX5PFIK1g4YST9cuV7T65RiumwlaqNX6k2uRK3VmM2q Eg9Zzj+w5HYWnxRWXsesSI4BS6mD2kKorJ1StUrFgEg9DErTR/uYHaxwv/9pproL1AMrK2+6UsR xCao5As69hQRHMsse/wzPdzVOPY3WRsJMBxb8TcldbmdcQOwXDTgz3OndmtnE/ZaxOdOJa36Ukp TgvNXXyDMo/kz7d6T3yZZra5UOtuTX1do8gC2BKQtRAGxyJsFXTC7+zARhKJ8W70tSzE+zhxHx0 3RM9FEDPvpsA4LyR96GqyOYM2KLVZgBk6/yyHkQ7+XeCUCHvOdZBITa2cwzTbp3ZdZoI3XN7tGy AuOjySrm6HZjEMsLg9G+rYtx9ENifzjgxqi9pZwRXU4wLUf4JcOD4hdqrIRF830AvFtoq5vJB60 vOfONag9lwFGYofEiLKltrc7C4C4pqqqUyQQlHaYBPhwF+cvl5MasC7S0HuoS+IpRmIRc06RFNj wd+jWZSB8bTS+qA== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 Rename the enum with the same name in include/linux/nfs4.h, add the proper enum to nfs4_1.x and regenerate the headers and source files. Do a mass rename of all NFS4_OPEN_DELEGATE_* to OPEN_DELEGATE_* in the nfsd directory. Signed-off-by: Jeff Layton --- Documentation/sunrpc/xdr/nfs4_1.x | 9 ++++++++- fs/nfsd/nfs4state.c | 34 +++++++++++++++++---------------= -- fs/nfsd/nfs4xdr.c | 8 ++++---- fs/nfsd/nfs4xdr_gen.c | 19 ++++++++++++++++++- fs/nfsd/nfs4xdr_gen.h | 2 +- include/linux/nfs4.h | 2 +- include/linux/sunrpc/xdrgen/nfs4_1.h | 13 ++++++++++++- 7 files changed, 61 insertions(+), 26 deletions(-) diff --git a/Documentation/sunrpc/xdr/nfs4_1.x b/Documentation/sunrpc/xdr/n= fs4_1.x index fc37d1ecba0f40e46c6986df90d07a0e6e6ae9b2..ee9f8f249f1e71dbfc383007a69= 50ebc4104ed67 100644 --- a/Documentation/sunrpc/xdr/nfs4_1.x +++ b/Documentation/sunrpc/xdr/nfs4_1.x @@ -161,6 +161,13 @@ pragma public fattr4_time_deleg_modify; const FATTR4_TIME_DELEG_ACCESS =3D 84; const FATTR4_TIME_DELEG_MODIFY =3D 85; =20 - const OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS =3D 0x100000; =20 +enum open_delegation_type4 { + OPEN_DELEGATE_NONE =3D 0, + OPEN_DELEGATE_READ =3D 1, + OPEN_DELEGATE_WRITE =3D 2, + OPEN_DELEGATE_NONE_EXT =3D 3, /* new to v4.1 */ + OPEN_DELEGATE_READ_ATTRS_DELEG =3D 4, + OPEN_DELEGATE_WRITE_ATTRS_DELEG =3D 5 +}; diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 741b9449f727defc794347f1b116c955d715e691..c0e46ce0e068d8c73226dfe73ad= c58c24a630d77 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -2887,7 +2887,7 @@ static int nfs4_show_deleg(struct seq_file *s, struct= nfs4_stid *st) seq_puts(s, ": { type: deleg, "); =20 seq_printf(s, "access: %s", - ds->dl_type =3D=3D NFS4_OPEN_DELEGATE_READ ? "r" : "w"); + ds->dl_type =3D=3D OPEN_DELEGATE_READ ? "r" : "w"); =20 /* XXX: lease time, whether it's being recalled. */ =20 @@ -5472,7 +5472,7 @@ nfsd4_process_open1(struct nfsd4_compound_state *csta= te, static inline __be32 nfs4_check_delegmode(struct nfs4_delegation *dp, int flags) { - if ((flags & WR_STATE) && (dp->dl_type =3D=3D NFS4_OPEN_DELEGATE_READ)) + if ((flags & WR_STATE) && (dp->dl_type =3D=3D OPEN_DELEGATE_READ)) return nfserr_openmode; else return nfs_ok; @@ -5714,7 +5714,7 @@ static struct file_lease *nfs4_alloc_init_lease(struc= t nfs4_delegation *dp, return NULL; fl->fl_lmops =3D &nfsd_lease_mng_ops; fl->c.flc_flags =3D FL_DELEG; - fl->c.flc_type =3D flag =3D=3D NFS4_OPEN_DELEGATE_READ? F_RDLCK: F_WRLCK; + fl->c.flc_type =3D flag =3D=3D OPEN_DELEGATE_READ ? F_RDLCK : F_WRLCK; fl->c.flc_owner =3D (fl_owner_t)dp; fl->c.flc_pid =3D current->tgid; fl->c.flc_file =3D dp->dl_stid.sc_file->fi_deleg_file->nf_file; @@ -5860,7 +5860,7 @@ nfs4_set_delegation(struct nfsd4_open *open, struct n= fs4_ol_stateid *stp, */ if ((open->op_share_access & NFS4_SHARE_ACCESS_BOTH) =3D=3D NFS4_SHARE_AC= CESS_BOTH) { nf =3D find_rw_file(fp); - dl_type =3D NFS4_OPEN_DELEGATE_WRITE; + dl_type =3D OPEN_DELEGATE_WRITE; } =20 /* @@ -5869,7 +5869,7 @@ nfs4_set_delegation(struct nfsd4_open *open, struct n= fs4_ol_stateid *stp, */ if (!nf && (open->op_share_access & NFS4_SHARE_ACCESS_READ)) { nf =3D find_readable_file(fp); - dl_type =3D NFS4_OPEN_DELEGATE_READ; + dl_type =3D OPEN_DELEGATE_READ; } =20 if (!nf) @@ -5958,7 +5958,7 @@ nfs4_set_delegation(struct nfsd4_open *open, struct n= fs4_ol_stateid *stp, =20 static void nfsd4_open_deleg_none_ext(struct nfsd4_open *open, int status) { - open->op_delegate_type =3D NFS4_OPEN_DELEGATE_NONE_EXT; + open->op_delegate_type =3D OPEN_DELEGATE_NONE_EXT; if (status =3D=3D -EAGAIN) open->op_why_no_deleg =3D WND4_CONTENTION; else { @@ -6074,20 +6074,20 @@ nfs4_open_delegation(struct nfsd4_open *open, struc= t nfs4_ol_stateid *stp, destroy_delegation(dp); goto out_no_deleg; } - open->op_delegate_type =3D NFS4_OPEN_DELEGATE_WRITE; + open->op_delegate_type =3D OPEN_DELEGATE_WRITE; dp->dl_cb_fattr.ncf_cur_fsize =3D stat.size; dp->dl_cb_fattr.ncf_initial_cinfo =3D nfsd4_change_attribute(&stat); trace_nfsd_deleg_write(&dp->dl_stid.sc_stateid); } else { - open->op_delegate_type =3D NFS4_OPEN_DELEGATE_READ; + open->op_delegate_type =3D OPEN_DELEGATE_READ; trace_nfsd_deleg_read(&dp->dl_stid.sc_stateid); } nfs4_put_stid(&dp->dl_stid); return; out_no_deleg: - open->op_delegate_type =3D NFS4_OPEN_DELEGATE_NONE; + open->op_delegate_type =3D OPEN_DELEGATE_NONE; if (open->op_claim_type =3D=3D NFS4_OPEN_CLAIM_PREVIOUS && - open->op_delegate_type !=3D NFS4_OPEN_DELEGATE_NONE) { + open->op_delegate_type !=3D OPEN_DELEGATE_NONE) { dprintk("NFSD: WARNING: refusing delegation reclaim\n"); open->op_recall =3D true; } @@ -6102,17 +6102,17 @@ static void nfsd4_deleg_xgrade_none_ext(struct nfsd= 4_open *open, struct nfs4_delegation *dp) { if (open->op_deleg_want =3D=3D NFS4_SHARE_WANT_READ_DELEG && - dp->dl_type =3D=3D NFS4_OPEN_DELEGATE_WRITE) { - open->op_delegate_type =3D NFS4_OPEN_DELEGATE_NONE_EXT; + dp->dl_type =3D=3D OPEN_DELEGATE_WRITE) { + open->op_delegate_type =3D OPEN_DELEGATE_NONE_EXT; open->op_why_no_deleg =3D WND4_NOT_SUPP_DOWNGRADE; } else if (open->op_deleg_want =3D=3D NFS4_SHARE_WANT_WRITE_DELEG && - dp->dl_type =3D=3D NFS4_OPEN_DELEGATE_WRITE) { - open->op_delegate_type =3D NFS4_OPEN_DELEGATE_NONE_EXT; + dp->dl_type =3D=3D OPEN_DELEGATE_WRITE) { + open->op_delegate_type =3D OPEN_DELEGATE_NONE_EXT; open->op_why_no_deleg =3D WND4_NOT_SUPP_UPGRADE; } /* Otherwise the client must be confused wanting a delegation * it already has, therefore we don't return - * NFS4_OPEN_DELEGATE_NONE_EXT and reason. + * OPEN_DELEGATE_NONE_EXT and reason. */ } =20 @@ -6202,7 +6202,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct sv= c_fh *current_fh, struct nf =20 if (nfsd4_has_session(&resp->cstate)) { if (open->op_deleg_want & NFS4_SHARE_WANT_NO_DELEG) { - open->op_delegate_type =3D NFS4_OPEN_DELEGATE_NONE_EXT; + open->op_delegate_type =3D OPEN_DELEGATE_NONE_EXT; open->op_why_no_deleg =3D WND4_NOT_WANTED; goto nodeleg; } @@ -6218,7 +6218,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct sv= c_fh *current_fh, struct nf trace_nfsd_open(&stp->st_stid.sc_stateid); out: /* 4.1 client trying to upgrade/downgrade delegation? */ - if (open->op_delegate_type =3D=3D NFS4_OPEN_DELEGATE_NONE && dp && + if (open->op_delegate_type =3D=3D OPEN_DELEGATE_NONE && dp && open->op_deleg_want) nfsd4_deleg_xgrade_none_ext(open, dp); =20 diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index c8e8d3f0dff4bb5288186369aad821906e684db7..593cf8c2ffe9dad90549ae0d0d5= d9cbcbf18a690 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -4232,18 +4232,18 @@ nfsd4_encode_open_delegation4(struct xdr_stream *xd= r, struct nfsd4_open *open) if (xdr_stream_encode_u32(xdr, open->op_delegate_type) !=3D XDR_UNIT) return nfserr_resource; switch (open->op_delegate_type) { - case NFS4_OPEN_DELEGATE_NONE: + case OPEN_DELEGATE_NONE: status =3D nfs_ok; break; - case NFS4_OPEN_DELEGATE_READ: + case OPEN_DELEGATE_READ: /* read */ status =3D nfsd4_encode_open_read_delegation4(xdr, open); break; - case NFS4_OPEN_DELEGATE_WRITE: + case OPEN_DELEGATE_WRITE: /* write */ status =3D nfsd4_encode_open_write_delegation4(xdr, open); break; - case NFS4_OPEN_DELEGATE_NONE_EXT: + case OPEN_DELEGATE_NONE_EXT: /* od_whynone */ status =3D nfsd4_encode_open_none_delegation4(xdr, open); break; diff --git a/fs/nfsd/nfs4xdr_gen.c b/fs/nfsd/nfs4xdr_gen.c index e5d34f9a3147d9d51fb3b9db4c29b048b1083cbf..a0e01f50a28d7f6828f3e6ef02f= 90b84bf180841 100644 --- a/fs/nfsd/nfs4xdr_gen.c +++ b/fs/nfsd/nfs4xdr_gen.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 // Generated by xdrgen. Manual edits will be lost. // XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_1.x -// XDR specification modification time: Thu Oct 3 11:30:59 2024 +// XDR specification modification time: Sat Oct 12 08:10:54 2024 =20 #include =20 @@ -135,6 +135,17 @@ xdrgen_decode_fattr4_time_deleg_modify(struct xdr_stre= am *xdr, fattr4_time_deleg return xdrgen_decode_nfstime4(xdr, ptr); }; =20 +static bool __maybe_unused +xdrgen_decode_open_delegation_type4(struct xdr_stream *xdr, open_delegatio= n_type4 *ptr) +{ + u32 val; + + if (xdr_stream_decode_u32(xdr, &val) < 0) + return false; + *ptr =3D val; + return true; +} + static bool __maybe_unused xdrgen_encode_int64_t(struct xdr_stream *xdr, const int64_t value) { @@ -237,3 +248,9 @@ xdrgen_encode_fattr4_time_deleg_modify(struct xdr_strea= m *xdr, const fattr4_time { return xdrgen_encode_nfstime4(xdr, value); }; + +static bool __maybe_unused +xdrgen_encode_open_delegation_type4(struct xdr_stream *xdr, open_delegatio= n_type4 value) +{ + return xdr_stream_encode_u32(xdr, value) =3D=3D XDR_UNIT; +} diff --git a/fs/nfsd/nfs4xdr_gen.h b/fs/nfsd/nfs4xdr_gen.h index c4c6a5075b17be3f931e2a20e282e33dc6e10ef1..3fc8bde2b3b5db6f80f17b41e7f= 5991487cfa959 100644 --- a/fs/nfsd/nfs4xdr_gen.h +++ b/fs/nfsd/nfs4xdr_gen.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* Generated by xdrgen. Manual edits will be lost. */ /* XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_1.x */ -/* XDR specification modification time: Thu Oct 3 11:30:59 2024 */ +/* XDR specification modification time: Sat Oct 12 08:10:54 2024 */ =20 #ifndef _LINUX_XDRGEN_NFS4_1_DECL_H #define _LINUX_XDRGEN_NFS4_1_DECL_H diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index b907192447755a614289554a01928c1ebb61c3dc..71fbebfa43c7e2bd27708814c73= 00c506ce64c1b 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h @@ -366,7 +366,7 @@ enum limit_by4 { NFS4_LIMIT_BLOCKS =3D 2 }; =20 -enum open_delegation_type4 { +enum nfs4_open_delegation_type4 { NFS4_OPEN_DELEGATE_NONE =3D 0, NFS4_OPEN_DELEGATE_READ =3D 1, NFS4_OPEN_DELEGATE_WRITE =3D 2, diff --git a/include/linux/sunrpc/xdrgen/nfs4_1.h b/include/linux/sunrpc/xd= rgen/nfs4_1.h index 6025ab6b739833aad33567102e216c162003f408..9ca83a4a04cff8ebb5aafa08a24= a2db771d6c1ef 100644 --- a/include/linux/sunrpc/xdrgen/nfs4_1.h +++ b/include/linux/sunrpc/xdrgen/nfs4_1.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* Generated by xdrgen. Manual edits will be lost. */ /* XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_1.x */ -/* XDR specification modification time: Thu Oct 3 11:30:59 2024 */ +/* XDR specification modification time: Sat Oct 12 08:10:54 2024 */ =20 #ifndef _LINUX_XDRGEN_NFS4_1_DEF_H #define _LINUX_XDRGEN_NFS4_1_DEF_H @@ -98,6 +98,16 @@ enum { FATTR4_TIME_DELEG_MODIFY =3D 85 }; =20 enum { OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS =3D 0x100000 }; =20 +enum open_delegation_type4 { + OPEN_DELEGATE_NONE =3D 0, + OPEN_DELEGATE_READ =3D 1, + OPEN_DELEGATE_WRITE =3D 2, + OPEN_DELEGATE_NONE_EXT =3D 3, + OPEN_DELEGATE_READ_ATTRS_DELEG =3D 4, + OPEN_DELEGATE_WRITE_ATTRS_DELEG =3D 5, +}; +typedef enum open_delegation_type4 open_delegation_type4; + #define NFS4_int64_t_sz \ (XDR_hyper) #define NFS4_uint32_t_sz \ @@ -120,5 +130,6 @@ enum { OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS =3D 0x1= 00000 }; (NFS4_nfstime4_sz) #define NFS4_fattr4_time_deleg_modify_sz \ (NFS4_nfstime4_sz) +#define NFS4_open_delegation_type4_sz (XDR_int) =20 #endif /* _LINUX_XDRGEN_NFS4_1_DEF_H */ --=20 2.47.1