Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nfsd: switch to autogenerated definitions for open_delegation_type4

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 <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

authored by

Jeff Layton and committed by
Chuck Lever
8dfbea8b 8e1d3227

+61 -26
+8 -1
Documentation/sunrpc/xdr/nfs4_1.x
··· 161 161 const FATTR4_TIME_DELEG_ACCESS = 84; 162 162 const FATTR4_TIME_DELEG_MODIFY = 85; 163 163 164 - 165 164 const OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS = 0x100000; 166 165 166 + enum open_delegation_type4 { 167 + OPEN_DELEGATE_NONE = 0, 168 + OPEN_DELEGATE_READ = 1, 169 + OPEN_DELEGATE_WRITE = 2, 170 + OPEN_DELEGATE_NONE_EXT = 3, /* new to v4.1 */ 171 + OPEN_DELEGATE_READ_ATTRS_DELEG = 4, 172 + OPEN_DELEGATE_WRITE_ATTRS_DELEG = 5 173 + };
+17 -17
fs/nfsd/nfs4state.c
··· 2965 2965 seq_puts(s, ": { type: deleg, "); 2966 2966 2967 2967 seq_printf(s, "access: %s", 2968 - ds->dl_type == NFS4_OPEN_DELEGATE_READ ? "r" : "w"); 2968 + ds->dl_type == OPEN_DELEGATE_READ ? "r" : "w"); 2969 2969 2970 2970 /* XXX: lease time, whether it's being recalled. */ 2971 2971 ··· 5581 5581 static inline __be32 5582 5582 nfs4_check_delegmode(struct nfs4_delegation *dp, int flags) 5583 5583 { 5584 - if ((flags & WR_STATE) && (dp->dl_type == NFS4_OPEN_DELEGATE_READ)) 5584 + if ((flags & WR_STATE) && (dp->dl_type == OPEN_DELEGATE_READ)) 5585 5585 return nfserr_openmode; 5586 5586 else 5587 5587 return nfs_ok; ··· 5823 5823 return NULL; 5824 5824 fl->fl_lmops = &nfsd_lease_mng_ops; 5825 5825 fl->c.flc_flags = FL_DELEG; 5826 - fl->c.flc_type = flag == NFS4_OPEN_DELEGATE_READ? F_RDLCK: F_WRLCK; 5826 + fl->c.flc_type = flag == OPEN_DELEGATE_READ ? F_RDLCK : F_WRLCK; 5827 5827 fl->c.flc_owner = (fl_owner_t)dp; 5828 5828 fl->c.flc_pid = current->tgid; 5829 5829 fl->c.flc_file = dp->dl_stid.sc_file->fi_deleg_file->nf_file; ··· 5969 5969 */ 5970 5970 if ((open->op_share_access & NFS4_SHARE_ACCESS_BOTH) == NFS4_SHARE_ACCESS_BOTH) { 5971 5971 nf = find_rw_file(fp); 5972 - dl_type = NFS4_OPEN_DELEGATE_WRITE; 5972 + dl_type = OPEN_DELEGATE_WRITE; 5973 5973 } 5974 5974 5975 5975 /* ··· 5978 5978 */ 5979 5979 if (!nf && (open->op_share_access & NFS4_SHARE_ACCESS_READ)) { 5980 5980 nf = find_readable_file(fp); 5981 - dl_type = NFS4_OPEN_DELEGATE_READ; 5981 + dl_type = OPEN_DELEGATE_READ; 5982 5982 } 5983 5983 5984 5984 if (!nf) ··· 6067 6067 6068 6068 static void nfsd4_open_deleg_none_ext(struct nfsd4_open *open, int status) 6069 6069 { 6070 - open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT; 6070 + open->op_delegate_type = OPEN_DELEGATE_NONE_EXT; 6071 6071 if (status == -EAGAIN) 6072 6072 open->op_why_no_deleg = WND4_CONTENTION; 6073 6073 else { ··· 6183 6183 destroy_delegation(dp); 6184 6184 goto out_no_deleg; 6185 6185 } 6186 - open->op_delegate_type = NFS4_OPEN_DELEGATE_WRITE; 6186 + open->op_delegate_type = OPEN_DELEGATE_WRITE; 6187 6187 dp->dl_cb_fattr.ncf_cur_fsize = stat.size; 6188 6188 dp->dl_cb_fattr.ncf_initial_cinfo = nfsd4_change_attribute(&stat); 6189 6189 trace_nfsd_deleg_write(&dp->dl_stid.sc_stateid); 6190 6190 } else { 6191 - open->op_delegate_type = NFS4_OPEN_DELEGATE_READ; 6191 + open->op_delegate_type = OPEN_DELEGATE_READ; 6192 6192 trace_nfsd_deleg_read(&dp->dl_stid.sc_stateid); 6193 6193 } 6194 6194 nfs4_put_stid(&dp->dl_stid); 6195 6195 return; 6196 6196 out_no_deleg: 6197 - open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE; 6197 + open->op_delegate_type = OPEN_DELEGATE_NONE; 6198 6198 if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS && 6199 - open->op_delegate_type != NFS4_OPEN_DELEGATE_NONE) { 6199 + open->op_delegate_type != OPEN_DELEGATE_NONE) { 6200 6200 dprintk("NFSD: WARNING: refusing delegation reclaim\n"); 6201 6201 open->op_recall = true; 6202 6202 } ··· 6211 6211 struct nfs4_delegation *dp) 6212 6212 { 6213 6213 if (open->op_deleg_want == NFS4_SHARE_WANT_READ_DELEG && 6214 - dp->dl_type == NFS4_OPEN_DELEGATE_WRITE) { 6215 - open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT; 6214 + dp->dl_type == OPEN_DELEGATE_WRITE) { 6215 + open->op_delegate_type = OPEN_DELEGATE_NONE_EXT; 6216 6216 open->op_why_no_deleg = WND4_NOT_SUPP_DOWNGRADE; 6217 6217 } else if (open->op_deleg_want == NFS4_SHARE_WANT_WRITE_DELEG && 6218 - dp->dl_type == NFS4_OPEN_DELEGATE_WRITE) { 6219 - open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT; 6218 + dp->dl_type == OPEN_DELEGATE_WRITE) { 6219 + open->op_delegate_type = OPEN_DELEGATE_NONE_EXT; 6220 6220 open->op_why_no_deleg = WND4_NOT_SUPP_UPGRADE; 6221 6221 } 6222 6222 /* Otherwise the client must be confused wanting a delegation 6223 6223 * it already has, therefore we don't return 6224 - * NFS4_OPEN_DELEGATE_NONE_EXT and reason. 6224 + * OPEN_DELEGATE_NONE_EXT and reason. 6225 6225 */ 6226 6226 } 6227 6227 ··· 6311 6311 6312 6312 if (nfsd4_has_session(&resp->cstate)) { 6313 6313 if (open->op_deleg_want & NFS4_SHARE_WANT_NO_DELEG) { 6314 - open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT; 6314 + open->op_delegate_type = OPEN_DELEGATE_NONE_EXT; 6315 6315 open->op_why_no_deleg = WND4_NOT_WANTED; 6316 6316 goto nodeleg; 6317 6317 } ··· 6327 6327 trace_nfsd_open(&stp->st_stid.sc_stateid); 6328 6328 out: 6329 6329 /* 4.1 client trying to upgrade/downgrade delegation? */ 6330 - if (open->op_delegate_type == NFS4_OPEN_DELEGATE_NONE && dp && 6330 + if (open->op_delegate_type == OPEN_DELEGATE_NONE && dp && 6331 6331 open->op_deleg_want) 6332 6332 nfsd4_deleg_xgrade_none_ext(open, dp); 6333 6333
+4 -4
fs/nfsd/nfs4xdr.c
··· 4233 4233 if (xdr_stream_encode_u32(xdr, open->op_delegate_type) != XDR_UNIT) 4234 4234 return nfserr_resource; 4235 4235 switch (open->op_delegate_type) { 4236 - case NFS4_OPEN_DELEGATE_NONE: 4236 + case OPEN_DELEGATE_NONE: 4237 4237 status = nfs_ok; 4238 4238 break; 4239 - case NFS4_OPEN_DELEGATE_READ: 4239 + case OPEN_DELEGATE_READ: 4240 4240 /* read */ 4241 4241 status = nfsd4_encode_open_read_delegation4(xdr, open); 4242 4242 break; 4243 - case NFS4_OPEN_DELEGATE_WRITE: 4243 + case OPEN_DELEGATE_WRITE: 4244 4244 /* write */ 4245 4245 status = nfsd4_encode_open_write_delegation4(xdr, open); 4246 4246 break; 4247 - case NFS4_OPEN_DELEGATE_NONE_EXT: 4247 + case OPEN_DELEGATE_NONE_EXT: 4248 4248 /* od_whynone */ 4249 4249 status = nfsd4_encode_open_none_delegation4(xdr, open); 4250 4250 break;
+18 -1
fs/nfsd/nfs4xdr_gen.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 // Generated by xdrgen. Manual edits will be lost. 3 3 // XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_1.x 4 - // XDR specification modification time: Thu Oct 3 11:30:59 2024 4 + // XDR specification modification time: Sat Oct 12 08:10:54 2024 5 5 6 6 #include <linux/sunrpc/svc.h> 7 7 ··· 136 136 }; 137 137 138 138 static bool __maybe_unused 139 + xdrgen_decode_open_delegation_type4(struct xdr_stream *xdr, open_delegation_type4 *ptr) 140 + { 141 + u32 val; 142 + 143 + if (xdr_stream_decode_u32(xdr, &val) < 0) 144 + return false; 145 + *ptr = val; 146 + return true; 147 + } 148 + 149 + static bool __maybe_unused 139 150 xdrgen_encode_int64_t(struct xdr_stream *xdr, const int64_t value) 140 151 { 141 152 return xdrgen_encode_hyper(xdr, value); ··· 248 237 { 249 238 return xdrgen_encode_nfstime4(xdr, value); 250 239 }; 240 + 241 + static bool __maybe_unused 242 + xdrgen_encode_open_delegation_type4(struct xdr_stream *xdr, open_delegation_type4 value) 243 + { 244 + return xdr_stream_encode_u32(xdr, value) == XDR_UNIT; 245 + }
+1 -1
fs/nfsd/nfs4xdr_gen.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 2 /* Generated by xdrgen. Manual edits will be lost. */ 3 3 /* XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_1.x */ 4 - /* XDR specification modification time: Thu Oct 3 11:30:59 2024 */ 4 + /* XDR specification modification time: Sat Oct 12 08:10:54 2024 */ 5 5 6 6 #ifndef _LINUX_XDRGEN_NFS4_1_DECL_H 7 7 #define _LINUX_XDRGEN_NFS4_1_DECL_H
+1 -1
include/linux/nfs4.h
··· 366 366 NFS4_LIMIT_BLOCKS = 2 367 367 }; 368 368 369 - enum open_delegation_type4 { 369 + enum nfs4_open_delegation_type4 { 370 370 NFS4_OPEN_DELEGATE_NONE = 0, 371 371 NFS4_OPEN_DELEGATE_READ = 1, 372 372 NFS4_OPEN_DELEGATE_WRITE = 2,
+12 -1
include/linux/sunrpc/xdrgen/nfs4_1.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 2 /* Generated by xdrgen. Manual edits will be lost. */ 3 3 /* XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_1.x */ 4 - /* XDR specification modification time: Thu Oct 3 11:30:59 2024 */ 4 + /* XDR specification modification time: Sat Oct 12 08:10:54 2024 */ 5 5 6 6 #ifndef _LINUX_XDRGEN_NFS4_1_DEF_H 7 7 #define _LINUX_XDRGEN_NFS4_1_DEF_H ··· 98 98 99 99 enum { OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS = 0x100000 }; 100 100 101 + enum open_delegation_type4 { 102 + OPEN_DELEGATE_NONE = 0, 103 + OPEN_DELEGATE_READ = 1, 104 + OPEN_DELEGATE_WRITE = 2, 105 + OPEN_DELEGATE_NONE_EXT = 3, 106 + OPEN_DELEGATE_READ_ATTRS_DELEG = 4, 107 + OPEN_DELEGATE_WRITE_ATTRS_DELEG = 5, 108 + }; 109 + typedef enum open_delegation_type4 open_delegation_type4; 110 + 101 111 #define NFS4_int64_t_sz \ 102 112 (XDR_hyper) 103 113 #define NFS4_uint32_t_sz \ ··· 130 120 (NFS4_nfstime4_sz) 131 121 #define NFS4_fattr4_time_deleg_modify_sz \ 132 122 (NFS4_nfstime4_sz) 123 + #define NFS4_open_delegation_type4_sz (XDR_int) 133 124 134 125 #endif /* _LINUX_XDRGEN_NFS4_1_DEF_H */