From: Chuck Lever <chuck.lever@oracle.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH v3 58/85] NFSD: Add a helper to decode state_protect4_a
Date: Mon, 23 Nov 2020 15:09:04 -0500 [thread overview]
Message-ID: <160616214430.51996.12356284605153624353.stgit@klimt.1015granger.net> (raw)
In-Reply-To: <160616177104.51996.14915419165992024951.stgit@klimt.1015granger.net>
Refactor for clarity.
Also, remove a stale comment. Commit ed94164398c9 ("nfsd: implement
machine credential support for some operations") added support for
SP4_MACH_CRED, so state_protect_a is no longer completely ignored.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/nfsd/nfs4state.c | 2 +-
fs/nfsd/nfs4xdr.c | 44 +++++++++++++++++++++++++++-----------------
fs/nfsd/xdr4.h | 2 +-
3 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index d7f27ed6b794..be6dcc4c2ab0 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3066,7 +3066,7 @@ nfsd4_exchange_id(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
rpc_ntop(sa, addr_str, sizeof(addr_str));
dprintk("%s rqstp=%p exid=%p clname.len=%u clname.data=%p "
- "ip_addr=%s flags %x, spa_how %d\n",
+ "ip_addr=%s flags %x, spa_how %u\n",
__func__, rqstp, exid, exid->clname.len, exid->clname.data,
addr_str, exid->flags, exid->spa_how);
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 86147f53f5e7..ecae29ba9bb7 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1531,25 +1531,13 @@ nfsd4_decode_ssv_sp_parms(struct nfsd4_compoundargs *argp,
}
static __be32
-nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
- struct nfsd4_exchange_id *exid)
+nfsd4_decode_state_protect4_a(struct nfsd4_compoundargs *argp,
+ struct nfsd4_exchange_id *exid)
{
- DECODE_HEAD;
- int dummy;
-
- READ_BUF(NFS4_VERIFIER_SIZE);
- COPYMEM(exid->verifier.data, NFS4_VERIFIER_SIZE);
+ __be32 status;
- status = nfsd4_decode_opaque(argp, &exid->clname);
- if (status)
+ if (xdr_stream_decode_u32(argp->xdr, &exid->spa_how) < 0)
return nfserr_bad_xdr;
-
- READ_BUF(4);
- exid->flags = be32_to_cpup(p++);
-
- /* Ignore state_protect4_a */
- READ_BUF(4);
- exid->spa_how = be32_to_cpup(p++);
switch (exid->spa_how) {
case SP4_NONE:
break;
@@ -1564,9 +1552,31 @@ nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
return status;
break;
default:
- goto xdr_error;
+ return nfserr_bad_xdr;
}
+ return nfs_ok;
+}
+
+static __be32
+nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
+ struct nfsd4_exchange_id *exid)
+{
+ DECODE_HEAD;
+ int dummy;
+
+ status = nfsd4_decode_verifier4(argp, &exid->verifier);
+ if (status)
+ return status;
+ status = nfsd4_decode_opaque(argp, &exid->clname);
+ if (status)
+ return status;
+ if (xdr_stream_decode_u32(argp->xdr, &exid->flags) < 0)
+ return nfserr_bad_xdr;
+ status = nfsd4_decode_state_protect4_a(argp, exid);
+ if (status)
+ return status;
+
READ_BUF(4); /* nfs_impl_id4 array length */
dummy = be32_to_cpup(p++);
diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
index 6245004a9993..232529bc1b79 100644
--- a/fs/nfsd/xdr4.h
+++ b/fs/nfsd/xdr4.h
@@ -433,7 +433,7 @@ struct nfsd4_exchange_id {
u32 flags;
clientid_t clientid;
u32 seqid;
- int spa_how;
+ u32 spa_how;
u32 spo_must_enforce[3];
u32 spo_must_allow[3];
struct xdr_netobj nii_domain;
next prev parent reply other threads:[~2020-11-23 20:10 UTC|newest]
Thread overview: 86+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-23 20:03 [PATCH v3 00/85] Update NFSD XDR functions Chuck Lever
2020-11-23 20:04 ` [PATCH v3 01/85] SUNRPC: Add xdr_set_scratch_page() and xdr_reset_scratch_buffer() Chuck Lever
2020-11-23 20:04 ` [PATCH v3 02/85] SUNRPC: Prepare for xdr_stream-style decoding on the server-side Chuck Lever
2020-11-23 20:04 ` [PATCH v3 03/85] NFSD: Add common helpers to decode void args and encode void results Chuck Lever
2020-11-23 20:04 ` [PATCH v3 04/85] NFSD: Add tracepoints in nfsd_dispatch() Chuck Lever
2020-11-23 20:04 ` [PATCH v3 05/85] NFSD: Add tracepoints in Chuck Lever
2020-11-23 20:04 ` [PATCH v3 06/85] NFSD: Replace the internals of the READ_BUF() macro Chuck Lever
2020-11-23 20:04 ` [PATCH v3 07/85] NFSD: Replace READ* macros in nfsd4_decode_access() Chuck Lever
2020-11-23 20:04 ` [PATCH v3 08/85] NFSD: Replace READ* macros in nfsd4_decode_close() Chuck Lever
2020-11-23 20:04 ` [PATCH v3 09/85] NFSD: Replace READ* macros in nfsd4_decode_commit() Chuck Lever
2020-11-23 20:04 ` [PATCH v3 10/85] NFSD: Change the way the expected length of a fattr4 is checked Chuck Lever
2020-11-23 20:04 ` [PATCH v3 11/85] NFSD: Replace READ* macros that decode the fattr4 size attribute Chuck Lever
2020-11-23 20:05 ` [PATCH v3 12/85] NFSD: Replace READ* macros that decode the fattr4 acl attribute Chuck Lever
2020-11-23 20:05 ` [PATCH v3 13/85] NFSD: Replace READ* macros that decode the fattr4 mode attribute Chuck Lever
2020-11-23 20:05 ` [PATCH v3 14/85] NFSD: Replace READ* macros that decode the fattr4 owner attribute Chuck Lever
2020-11-23 20:05 ` [PATCH v3 15/85] NFSD: Replace READ* macros that decode the fattr4 owner_group attribute Chuck Lever
2020-11-23 20:05 ` [PATCH v3 16/85] NFSD: Replace READ* macros that decode the fattr4 time_set attributes Chuck Lever
2020-11-23 20:05 ` [PATCH v3 17/85] NFSD: Replace READ* macros that decode the fattr4 security label attribute Chuck Lever
2020-11-23 20:05 ` [PATCH v3 18/85] NFSD: Replace READ* macros that decode the fattr4 umask attribute Chuck Lever
2020-11-23 20:05 ` [PATCH v3 19/85] NFSD: Replace READ* macros in nfsd4_decode_fattr() Chuck Lever
2020-11-23 20:05 ` [PATCH v3 20/85] NFSD: Replace READ* macros in nfsd4_decode_create() Chuck Lever
2020-11-23 20:05 ` [PATCH v3 21/85] NFSD: Replace READ* macros in nfsd4_decode_delegreturn() Chuck Lever
2020-11-23 20:05 ` [PATCH v3 22/85] NFSD: Replace READ* macros in nfsd4_decode_getattr() Chuck Lever
2020-11-23 20:06 ` [PATCH v3 23/85] NFSD: Replace READ* macros in nfsd4_decode_link() Chuck Lever
2020-11-23 20:06 ` [PATCH v3 24/85] NFSD: Relocate nfsd4_decode_opaque() Chuck Lever
2020-11-23 20:06 ` [PATCH v3 25/85] NFSD: Add helpers to decode a clientid4 and an NFSv4 state owner Chuck Lever
2020-11-23 20:06 ` [PATCH v3 26/85] NFSD: Add helper for decoding locker4 Chuck Lever
2020-11-23 20:06 ` [PATCH v3 27/85] NFSD: Replace READ* macros in nfsd4_decode_lock() Chuck Lever
2020-11-23 20:06 ` [PATCH v3 28/85] NFSD: Replace READ* macros in nfsd4_decode_lockt() Chuck Lever
2020-11-23 20:06 ` [PATCH v3 29/85] NFSD: Replace READ* macros in nfsd4_decode_locku() Chuck Lever
2020-11-23 20:06 ` [PATCH v3 30/85] NFSD: Replace READ* macros in nfsd4_decode_lookup() Chuck Lever
2020-11-23 20:06 ` [PATCH v3 31/85] NFSD: Add helper to decode NFSv4 verifiers Chuck Lever
2020-11-23 20:06 ` [PATCH v3 32/85] NFSD: Add helper to decode OPEN's createhow4 argument Chuck Lever
2020-11-23 20:06 ` [PATCH v3 33/85] NFSD: Add helper to decode OPEN's openflag4 argument Chuck Lever
2020-11-23 20:06 ` [PATCH v3 34/85] NFSD: Replace READ* macros in nfsd4_decode_share_access() Chuck Lever
2020-11-23 20:07 ` [PATCH v3 35/85] NFSD: Replace READ* macros in nfsd4_decode_share_deny() Chuck Lever
2020-11-23 20:07 ` [PATCH v3 36/85] NFSD: Add helper to decode OPEN's open_claim4 argument Chuck Lever
2020-11-23 20:07 ` [PATCH v3 37/85] NFSD: Replace READ* macros in nfsd4_decode_open() Chuck Lever
2020-11-23 20:07 ` [PATCH v3 38/85] NFSD: Replace READ* macros in nfsd4_decode_open_confirm() Chuck Lever
2020-11-23 20:07 ` [PATCH v3 39/85] NFSD: Replace READ* macros in nfsd4_decode_open_downgrade() Chuck Lever
2020-11-23 20:07 ` [PATCH v3 40/85] NFSD: Replace READ* macros in nfsd4_decode_putfh() Chuck Lever
2020-11-23 20:07 ` [PATCH v3 41/85] NFSD: Replace READ* macros in nfsd4_decode_read() Chuck Lever
2020-11-23 20:07 ` [PATCH v3 42/85] NFSD: Replace READ* macros in nfsd4_decode_readdir() Chuck Lever
2020-11-23 20:07 ` [PATCH v3 43/85] NFSD: Replace READ* macros in nfsd4_decode_remove() Chuck Lever
2020-11-23 20:07 ` [PATCH v3 44/85] NFSD: Replace READ* macros in nfsd4_decode_rename() Chuck Lever
2020-11-23 20:07 ` [PATCH v3 45/85] NFSD: Replace READ* macros in nfsd4_decode_renew() Chuck Lever
2020-11-23 20:08 ` [PATCH v3 46/85] NFSD: Replace READ* macros in nfsd4_decode_secinfo() Chuck Lever
2020-11-23 20:08 ` [PATCH v3 47/85] NFSD: Replace READ* macros in nfsd4_decode_setattr() Chuck Lever
2020-11-23 20:08 ` [PATCH v3 48/85] NFSD: Replace READ* macros in nfsd4_decode_setclientid() Chuck Lever
2020-11-23 20:08 ` [PATCH v3 49/85] NFSD: Replace READ* macros in nfsd4_decode_setclientid_confirm() Chuck Lever
2020-11-23 20:08 ` [PATCH v3 50/85] NFSD: Replace READ* macros in nfsd4_decode_verify() Chuck Lever
2020-11-23 20:08 ` [PATCH v3 51/85] NFSD: Replace READ* macros in nfsd4_decode_write() Chuck Lever
2020-11-23 20:08 ` [PATCH v3 52/85] NFSD: Replace READ* macros in nfsd4_decode_release_lockowner() Chuck Lever
2020-11-23 20:08 ` [PATCH v3 53/85] NFSD: Replace READ* macros in nfsd4_decode_cb_sec() Chuck Lever
2020-11-23 20:08 ` [PATCH v3 54/85] NFSD: Replace READ* macros in nfsd4_decode_backchannel_ctl() Chuck Lever
2020-11-23 20:08 ` [PATCH v3 55/85] NFSD: Replace READ* macros in nfsd4_decode_bind_conn_to_session() Chuck Lever
2020-11-23 20:08 ` [PATCH v3 56/85] NFSD: Add a separate decoder to handle state_protect_ops Chuck Lever
2020-11-23 20:08 ` [PATCH v3 57/85] NFSD: Add a separate decoder for ssv_sp_parms Chuck Lever
2020-11-23 20:09 ` Chuck Lever [this message]
2020-11-23 20:09 ` [PATCH v3 59/85] NFSD: Add a helper to decode nfs_impl_id4 Chuck Lever
2020-11-23 20:09 ` [PATCH v3 60/85] NFSD: Add a helper to decode channel_attrs4 Chuck Lever
2020-11-23 20:09 ` [PATCH v3 61/85] NFSD: Replace READ* macros in nfsd4_decode_create_session() Chuck Lever
2020-11-23 20:09 ` [PATCH v3 62/85] NFSD: Replace READ* macros in nfsd4_decode_destroy_session() Chuck Lever
2020-11-23 20:09 ` [PATCH v3 63/85] NFSD: Replace READ* macros in nfsd4_decode_free_stateid() Chuck Lever
2020-11-23 20:09 ` [PATCH v3 64/85] NFSD: Replace READ* macros in nfsd4_decode_getdeviceinfo() Chuck Lever
2020-11-23 20:09 ` [PATCH v3 65/85] NFSD: Replace READ* macros in nfsd4_decode_layoutcommit() Chuck Lever
2020-11-23 20:09 ` [PATCH v3 66/85] NFSD: Replace READ* macros in nfsd4_decode_layoutget() Chuck Lever
2020-11-23 20:09 ` [PATCH v3 67/85] NFSD: Replace READ* macros in nfsd4_decode_layoutreturn() Chuck Lever
2020-11-23 20:09 ` [PATCH v3 68/85] NFSD: Replace READ* macros in nfsd4_decode_secinfo_no_name() Chuck Lever
2020-11-23 20:10 ` [PATCH v3 69/85] NFSD: Replace READ* macros in nfsd4_decode_sequence() Chuck Lever
2020-11-23 20:10 ` [PATCH v3 70/85] NFSD: Replace READ* macros in nfsd4_decode_test_stateid() Chuck Lever
2020-11-23 20:10 ` [PATCH v3 71/85] NFSD: Replace READ* macros in nfsd4_decode_destroy_clientid() Chuck Lever
2020-11-23 20:10 ` [PATCH v3 72/85] NFSD: Replace READ* macros in nfsd4_decode_reclaim_complete() Chuck Lever
2020-11-23 20:10 ` [PATCH v3 73/85] NFSD: Replace READ* macros in nfsd4_decode_fallocate() Chuck Lever
2020-11-23 20:10 ` [PATCH v3 74/85] NFSD: Replace READ* macros in nfsd4_decode_nl4_server() Chuck Lever
2020-11-23 20:10 ` [PATCH v3 75/85] NFSD: Replace READ* macros in nfsd4_decode_copy() Chuck Lever
2020-11-23 20:10 ` [PATCH v3 76/85] NFSD: Replace READ* macros in nfsd4_decode_copy_notify() Chuck Lever
2020-11-23 20:10 ` [PATCH v3 77/85] NFSD: Replace READ* macros in nfsd4_decode_offload_status() Chuck Lever
2020-11-23 20:10 ` [PATCH v3 78/85] NFSD: Replace READ* macros in nfsd4_decode_seek() Chuck Lever
2020-11-23 20:10 ` [PATCH v3 79/85] NFSD: Replace READ* macros in nfsd4_decode_clone() Chuck Lever
2020-11-23 20:10 ` [PATCH v3 80/85] NFSD: Replace READ* macros in nfsd4_decode_xattr_name() Chuck Lever
2020-11-23 20:11 ` [PATCH v3 81/85] NFSD: Replace READ* macros in nfsd4_decode_setxattr() Chuck Lever
2020-11-23 20:11 ` [PATCH v3 82/85] NFSD: Replace READ* macros in nfsd4_decode_listxattrs() Chuck Lever
2020-11-23 20:11 ` [PATCH v3 83/85] NFSD: Make nfsd4_ops::opnum a u32 Chuck Lever
2020-11-23 20:11 ` [PATCH v3 84/85] NFSD: Replace READ* macros in nfsd4_decode_compound() Chuck Lever
2020-11-23 20:11 ` [PATCH v3 85/85] NFSD: Remove macros that are no longer used Chuck Lever
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=160616214430.51996.12356284605153624353.stgit@klimt.1015granger.net \
--to=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).