platform/kernel/linux-rpi.git
3 years agoNFSD: Replace READ* macros in nfsd4_decode_layoutreturn()
Chuck Lever [Wed, 4 Nov 2020 15:42:25 +0000 (10:42 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_layoutreturn()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_layoutget()
Chuck Lever [Tue, 3 Nov 2020 20:06:04 +0000 (15:06 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_layoutget()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_layoutcommit()
Chuck Lever [Wed, 4 Nov 2020 15:40:07 +0000 (10:40 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_layoutcommit()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_getdeviceinfo()
Chuck Lever [Tue, 3 Nov 2020 20:03:50 +0000 (15:03 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_getdeviceinfo()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_free_stateid()
Chuck Lever [Sun, 1 Nov 2020 18:38:27 +0000 (13:38 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_free_stateid()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_destroy_session()
Chuck Lever [Wed, 4 Nov 2020 18:50:55 +0000 (13:50 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_destroy_session()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_create_session()
Chuck Lever [Tue, 3 Nov 2020 19:52:44 +0000 (14:52 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_create_session()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Add a helper to decode channel_attrs4
Chuck Lever [Mon, 16 Nov 2020 20:35:05 +0000 (15:35 -0500)]
NFSD: Add a helper to decode channel_attrs4

De-duplicate some code.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Add a helper to decode nfs_impl_id4
Chuck Lever [Mon, 16 Nov 2020 20:21:55 +0000 (15:21 -0500)]
NFSD: Add a helper to decode nfs_impl_id4

Refactor for clarity.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Add a helper to decode state_protect4_a
Chuck Lever [Mon, 2 Nov 2020 20:19:12 +0000 (15:19 -0500)]
NFSD: Add a helper to decode state_protect4_a

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>
3 years agoNFSD: Add a separate decoder for ssv_sp_parms
Chuck Lever [Tue, 3 Nov 2020 16:17:50 +0000 (11:17 -0500)]
NFSD: Add a separate decoder for ssv_sp_parms

Refactor for clarity.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Add a separate decoder to handle state_protect_ops
Chuck Lever [Tue, 3 Nov 2020 16:13:00 +0000 (11:13 -0500)]
NFSD: Add a separate decoder to handle state_protect_ops

Refactor for clarity and de-duplication of code.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_bind_conn_to_session()
Chuck Lever [Tue, 3 Nov 2020 18:16:23 +0000 (13:16 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_bind_conn_to_session()

A dedicated sessionid4 decoder is introduced that will be used by
other operation decoders in subsequent patches.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_backchannel_ctl()
Chuck Lever [Tue, 3 Nov 2020 18:14:35 +0000 (13:14 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_backchannel_ctl()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_cb_sec()
Chuck Lever [Tue, 3 Nov 2020 18:09:34 +0000 (13:09 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_cb_sec()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_release_lockowner()
Chuck Lever [Wed, 4 Nov 2020 18:42:25 +0000 (13:42 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_release_lockowner()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_write()
Chuck Lever [Tue, 3 Nov 2020 19:44:28 +0000 (14:44 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_write()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_verify()
Chuck Lever [Tue, 3 Nov 2020 19:40:32 +0000 (14:40 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_verify()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_setclientid_confirm()
Chuck Lever [Wed, 4 Nov 2020 20:12:33 +0000 (15:12 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_setclientid_confirm()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_setclientid()
Chuck Lever [Tue, 3 Nov 2020 19:35:02 +0000 (14:35 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_setclientid()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_setattr()
Chuck Lever [Sat, 21 Nov 2020 19:14:59 +0000 (14:14 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_setattr()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_secinfo()
Chuck Lever [Wed, 4 Nov 2020 20:09:42 +0000 (15:09 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_secinfo()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_renew()
Chuck Lever [Wed, 4 Nov 2020 20:08:50 +0000 (15:08 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_renew()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_rename()
Chuck Lever [Wed, 4 Nov 2020 20:05:58 +0000 (15:05 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_rename()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_remove()
Chuck Lever [Wed, 4 Nov 2020 20:04:36 +0000 (15:04 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_remove()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_readdir()
Chuck Lever [Tue, 3 Nov 2020 19:30:59 +0000 (14:30 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_readdir()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_read()
Chuck Lever [Tue, 3 Nov 2020 19:28:24 +0000 (14:28 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_read()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_putfh()
Chuck Lever [Tue, 3 Nov 2020 19:23:02 +0000 (14:23 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_putfh()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_open_downgrade()
Chuck Lever [Tue, 3 Nov 2020 19:21:01 +0000 (14:21 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_open_downgrade()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_open_confirm()
Chuck Lever [Tue, 3 Nov 2020 19:18:57 +0000 (14:18 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_open_confirm()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_open()
Chuck Lever [Sun, 1 Nov 2020 17:04:06 +0000 (12:04 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_open()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Add helper to decode OPEN's open_claim4 argument
Chuck Lever [Mon, 16 Nov 2020 22:45:04 +0000 (17:45 -0500)]
NFSD: Add helper to decode OPEN's open_claim4 argument

Refactor for clarity.

Note that op_fname is the only instance of an NFSv4 filename stored
in a struct xdr_netobj. Convert it to a u32/char * pair so that the
new nfsd4_decode_filename() helper can be used.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_share_deny()
Chuck Lever [Mon, 16 Nov 2020 22:56:17 +0000 (17:56 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_share_deny()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_share_access()
Chuck Lever [Mon, 16 Nov 2020 22:54:48 +0000 (17:54 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_share_access()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Add helper to decode OPEN's openflag4 argument
Chuck Lever [Mon, 16 Nov 2020 22:41:21 +0000 (17:41 -0500)]
NFSD: Add helper to decode OPEN's openflag4 argument

Refactor for clarity.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Add helper to decode OPEN's createhow4 argument
Chuck Lever [Mon, 16 Nov 2020 22:37:42 +0000 (17:37 -0500)]
NFSD: Add helper to decode OPEN's createhow4 argument

Refactor for clarity.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Add helper to decode NFSv4 verifiers
Chuck Lever [Mon, 16 Nov 2020 22:34:01 +0000 (17:34 -0500)]
NFSD: Add helper to decode NFSv4 verifiers

This helper will be used to simplify decoders in subsequent
patches.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_lookup()
Chuck Lever [Wed, 4 Nov 2020 20:02:40 +0000 (15:02 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_lookup()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_locku()
Chuck Lever [Tue, 3 Nov 2020 18:33:28 +0000 (13:33 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_locku()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_lockt()
Chuck Lever [Tue, 3 Nov 2020 18:31:44 +0000 (13:31 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_lockt()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_lock()
Chuck Lever [Tue, 3 Nov 2020 18:29:27 +0000 (13:29 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_lock()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Add helper for decoding locker4
Chuck Lever [Mon, 16 Nov 2020 22:16:52 +0000 (17:16 -0500)]
NFSD: Add helper for decoding locker4

Refactor for clarity.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Add helpers to decode a clientid4 and an NFSv4 state owner
Chuck Lever [Mon, 16 Nov 2020 22:25:02 +0000 (17:25 -0500)]
NFSD: Add helpers to decode a clientid4 and an NFSv4 state owner

These helpers will also be used to simplify decoders in subsequent
patches.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Relocate nfsd4_decode_opaque()
Chuck Lever [Wed, 4 Nov 2020 16:41:55 +0000 (11:41 -0500)]
NFSD: Relocate nfsd4_decode_opaque()

Enable nfsd4_decode_opaque() to be used in more decoders, and
replace the READ* macros in nfsd4_decode_opaque().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years ago NFSD: Replace READ* macros in nfsd4_decode_link()
Chuck Lever [Wed, 4 Nov 2020 20:01:24 +0000 (15:01 -0500)]
 NFSD: Replace READ* macros in nfsd4_decode_link()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_getattr()
Chuck Lever [Thu, 19 Nov 2020 19:40:20 +0000 (14:40 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_getattr()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_delegreturn()
Chuck Lever [Sat, 21 Nov 2020 19:11:58 +0000 (14:11 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_delegreturn()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_create()
Chuck Lever [Tue, 3 Nov 2020 18:24:10 +0000 (13:24 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_create()

A dedicated decoder for component4 is introduced here, which will be
used by other operation decoders in subsequent patches.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_fattr()
Chuck Lever [Tue, 3 Nov 2020 17:56:05 +0000 (12:56 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_fattr()

Let's be more careful to avoid overrunning the memory that backs
the bitmap array. This requires updating the synopsis of
nfsd4_decode_fattr().

Bruce points out that a server needs to be careful to return nfs_ok
when a client presents bitmap bits the server doesn't support. This
includes bits in bitmap words the server might not yet support.

The current READ* based implementation is good about that, but that
requirement hasn't been documented.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros that decode the fattr4 umask attribute
Chuck Lever [Thu, 19 Nov 2020 19:07:43 +0000 (14:07 -0500)]
NFSD: Replace READ* macros that decode the fattr4 umask attribute

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros that decode the fattr4 security label attribute
Chuck Lever [Thu, 19 Nov 2020 19:05:51 +0000 (14:05 -0500)]
NFSD: Replace READ* macros that decode the fattr4 security label attribute

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros that decode the fattr4 time_set attributes
Chuck Lever [Thu, 19 Nov 2020 19:01:08 +0000 (14:01 -0500)]
NFSD: Replace READ* macros that decode the fattr4 time_set attributes

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros that decode the fattr4 owner_group attribute
Chuck Lever [Thu, 19 Nov 2020 18:58:18 +0000 (13:58 -0500)]
NFSD: Replace READ* macros that decode the fattr4 owner_group attribute

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros that decode the fattr4 owner attribute
Chuck Lever [Thu, 19 Nov 2020 18:56:42 +0000 (13:56 -0500)]
NFSD: Replace READ* macros that decode the fattr4 owner attribute

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros that decode the fattr4 mode attribute
Chuck Lever [Thu, 19 Nov 2020 18:54:26 +0000 (13:54 -0500)]
NFSD: Replace READ* macros that decode the fattr4 mode attribute

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros that decode the fattr4 acl attribute
Chuck Lever [Thu, 19 Nov 2020 18:02:54 +0000 (13:02 -0500)]
NFSD: Replace READ* macros that decode the fattr4 acl attribute

Refactor for clarity and to move infrequently-used code out of line.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros that decode the fattr4 size attribute
Chuck Lever [Thu, 19 Nov 2020 18:47:16 +0000 (13:47 -0500)]
NFSD: Replace READ* macros that decode the fattr4 size attribute

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Change the way the expected length of a fattr4 is checked
Chuck Lever [Thu, 19 Nov 2020 18:09:13 +0000 (13:09 -0500)]
NFSD: Change the way the expected length of a fattr4 is checked

Because the fattr4 is now managed in an xdr_stream, all that is
needed is to store the initial position of the stream before
decoding the attribute list. Then the actual length of the list
is computed using the final stream position, after decoding is
complete.

No behavior change is expected.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_commit()
Chuck Lever [Tue, 3 Nov 2020 18:19:51 +0000 (13:19 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_commit()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_close()
Chuck Lever [Tue, 3 Nov 2020 18:18:23 +0000 (13:18 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_close()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace READ* macros in nfsd4_decode_access()
Chuck Lever [Tue, 3 Nov 2020 18:12:27 +0000 (13:12 -0500)]
NFSD: Replace READ* macros in nfsd4_decode_access()

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Replace the internals of the READ_BUF() macro
Chuck Lever [Tue, 3 Nov 2020 16:54:23 +0000 (11:54 -0500)]
NFSD: Replace the internals of the READ_BUF() macro

Convert the READ_BUF macro in nfs4xdr.c from open code to instead
use the new xdr_stream-style decoders already in use by the encode
side (and by the in-kernel NFS client implementation). Once this
conversion is done, each individual NFSv4 argument decoder can be
independently cleaned up to replace these macros with C code.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Add tracepoints in nfsd4_decode/encode_compound()
Chuck Lever [Sat, 21 Nov 2020 16:36:42 +0000 (11:36 -0500)]
NFSD: Add tracepoints in nfsd4_decode/encode_compound()

For troubleshooting purposes, record failures to decode NFSv4
operation arguments and encode operation results.

trace_nfsd_compound_decode_err() replaces the dprintk() call sites
that are embedded in READ_* macros that are about to be removed.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Add tracepoints in nfsd_dispatch()
Chuck Lever [Mon, 19 Oct 2020 17:00:29 +0000 (13:00 -0400)]
NFSD: Add tracepoints in nfsd_dispatch()

For troubleshooting purposes, record GARBAGE_ARGS and CANT_ENCODE
failures.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Add common helpers to decode void args and encode void results
Chuck Lever [Thu, 5 Nov 2020 19:48:29 +0000 (14:48 -0500)]
NFSD: Add common helpers to decode void args and encode void results

Start off the conversion to xdr_stream by de-duplicating the functions
that decode void arguments and encode void results.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoSUNRPC: Prepare for xdr_stream-style decoding on the server-side
Chuck Lever [Thu, 5 Nov 2020 16:19:42 +0000 (11:19 -0500)]
SUNRPC: Prepare for xdr_stream-style decoding on the server-side

A "permanent" struct xdr_stream is allocated in struct svc_rqst so
that it is usable by all server-side decoders. A per-rqst scratch
buffer is also allocated to handle decoding XDR data items that
cross page boundaries.

To demonstrate how it will be used, add the first call site for the
new svcxdr_init_decode() API.

As an additional part of the overall conversion, add symbolic
constants for successful and failed XDR operations. Returning "0" is
overloaded. Sometimes it means something failed, but sometimes it
means success. To make it more clear when XDR decoding functions
succeed or fail, introduce symbolic constants.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoSUNRPC: Add xdr_set_scratch_page() and xdr_reset_scratch_buffer()
Chuck Lever [Wed, 11 Nov 2020 20:52:47 +0000 (15:52 -0500)]
SUNRPC: Add xdr_set_scratch_page() and xdr_reset_scratch_buffer()

Clean up: De-duplicate some frequently-used code.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agonfsd: Fix error return code in nfsd_file_cache_init()
Huang Guobin [Wed, 25 Nov 2020 08:39:33 +0000 (03:39 -0500)]
nfsd: Fix error return code in nfsd_file_cache_init()

Fix to return PTR_ERR() error code from the error handling case instead of
0 in function nfsd_file_cache_init(), as done elsewhere in this function.

Fixes: 65294c1f2c5e7("nfsd: add a new struct file caching facility to nfsd")
Signed-off-by: Huang Guobin <huangguobin4@huawei.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Add SPDX header for fs/nfsd/trace.c
Chuck Lever [Thu, 27 Aug 2020 20:09:53 +0000 (16:09 -0400)]
NFSD: Add SPDX header for fs/nfsd/trace.c

Clean up.

The file was contributed in 2014 by Christoph Hellwig in commit
31ef83dc0538 ("nfsd: add trace events").

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Remove extra "0x" in tracepoint format specifier
Chuck Lever [Fri, 4 Sep 2020 19:06:26 +0000 (15:06 -0400)]
NFSD: Remove extra "0x" in tracepoint format specifier

Clean up: %p adds its own 0x already.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Clean up the show_nf_may macro
Chuck Lever [Wed, 19 Aug 2020 16:56:40 +0000 (12:56 -0400)]
NFSD: Clean up the show_nf_may macro

Display all currently possible NFSD_MAY permission flags.

Move and rename show_nf_may with a more generic name because the
NFSD_MAY permission flags are used in other places besides the file
cache.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoSUNRPC: Move the svc_xdr_recvfrom() tracepoint
Chuck Lever [Fri, 24 Jul 2020 18:39:00 +0000 (14:39 -0400)]
SUNRPC: Move the svc_xdr_recvfrom() tracepoint

Commit c509f15a5801 ("SUNRPC: Split the xdr_buf event class") added
display of the rqst's XID to the svc_xdr_buf_class. However, when
the recvfrom tracepoint fires, rq_xid has yet to be filled in with
the current XID. So it ends up recording the previous XID that was
handled by that svc_rqst.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agonfsd/nfs3: remove unused macro nfsd3_fhandleres
Alex Shi [Fri, 6 Nov 2020 05:40:57 +0000 (13:40 +0800)]
nfsd/nfs3: remove unused macro nfsd3_fhandleres

The macro is unused, remove it to tame gcc warning:
fs/nfsd/nfs3proc.c:702:0: warning: macro "nfsd3_fhandleres" is not used
[-Wunused-macros]

Signed-off-by: Alex Shi <alex.shi@linux.alibaba.com>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: A semicolon is not needed after a switch statement.
Tom Rix [Sun, 1 Nov 2020 15:32:34 +0000 (07:32 -0800)]
NFSD: A semicolon is not needed after a switch statement.

Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agosvcrdma: support multiple Read chunks per RPC
Chuck Lever [Wed, 5 Aug 2020 18:59:05 +0000 (14:59 -0400)]
svcrdma: support multiple Read chunks per RPC

An efficient way to handle multiple Read chunks is to post them all
together and then take a single completion. This is also how the
code is already structured: when the Read completion fires, all
portions of the incoming RPC message are available to be assembled.

The difficult problem is setting up the Read sink buffers so that
the server pulls the client's data into place, making subsequent
pull-up unnecessary. There are several cases:

* No Read chunks. No-op.

* One data item Read chunk. This is the fast case, where the inline
  part of the RPC-over-RDMA message becomes the head and tail, and
  the data item chunk is placed in buf->pages.

* A Position-zero Read chunk. Treated like TCP: the Read chunk is
  pulled into contiguous pages.

+ A Position-zero Read chunk with data item chunks. Treated like
  TCP: all of the Read chunks are pulled into contiguous pages.

+ Multiple data item chunks. Treated like TCP: the inline part is
  copied and the data item chunks are pulled into contiguous pages.

The "*" cases are already supported. This patch adds support for the
"+" cases.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agosvcrdma: Use the new parsed chunk list when pulling Read chunks
Chuck Lever [Thu, 17 Sep 2020 17:04:17 +0000 (13:04 -0400)]
svcrdma: Use the new parsed chunk list when pulling Read chunks

As a pre-requisite for handling multiple Read chunks in each Read
list, convert svc_rdma_recv_read_chunk() to use the new parsed Read
chunk list.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agosvcrdma: Rename info::ri_chunklen
Chuck Lever [Fri, 17 Jul 2020 19:05:51 +0000 (15:05 -0400)]
svcrdma: Rename info::ri_chunklen

I'm about to change the purpose of ri_chunklen: Instead of tracking
the number of bytes in one Read chunk, it will track the total
number of bytes in the Read list. Rename it for clarity.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agosvcrdma: Clean up chunk tracepoints
Chuck Lever [Thu, 11 Jun 2020 17:28:28 +0000 (13:28 -0400)]
svcrdma: Clean up chunk tracepoints

We already have trace_svcrdma_decode_rseg(), which records each
ingress Read segment. Instead of reporting those again when they
are about to be posted as RDMA Reads, let's fire one tracepoint
before posting each type of chunk.

So we'll get:

        nfsd-1998  [002]   321.666615: svcrdma_decode_rseg:  cq.id=4 cid=42 segno=0 position=0 192@0x013ca9ebfae14000:0xb0010b05
        nfsd-1998  [002]   321.666615: svcrdma_decode_rseg:  cq.id=4 cid=42 segno=1 position=0 7688@0x013ca9ebf914e000:0xb0010a05
        nfsd-1998  [002]   321.666615: svcrdma_decode_rseg:  cq.id=4 cid=42 segno=2 position=0 28@0x013ca9ebfae15000:0xb0010905
        nfsd-1998  [002]   321.666622: svcrdma_decode_rqst:  cq.id=4 cid=42 xid=0x013ca9eb vers=1 credits=128 proc=RDMA_NOMSG hdrlen=100

        nfsd-1998  [002]   321.666642: svcrdma_post_read_chunk: cq.id=3 cid=112 sqecount=3

kworker/2:1H-221   [002]   321.673949: svcrdma_wc_read:      cq.id=3 cid=112 status=SUCCESS (0/0x0)

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agosvcrdma: Remove chunk list pointers
Chuck Lever [Wed, 17 Jun 2020 19:19:36 +0000 (15:19 -0400)]
svcrdma: Remove chunk list pointers

Clean up: These pointers are no longer used.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agosvcrdma: Support multiple Write chunks in svc_rdma_send_reply_chunk
Chuck Lever [Mon, 9 Mar 2020 17:29:28 +0000 (13:29 -0400)]
svcrdma: Support multiple Write chunks in svc_rdma_send_reply_chunk

Refactor svc_rdma_send_reply_chunk() so that it Sends only the parts
of rq_res that do not contain a result payload.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agosvcrdma: Support multiple Write chunks in svc_rdma_map_reply_msg()
Chuck Lever [Mon, 9 Mar 2020 17:29:27 +0000 (13:29 -0400)]
svcrdma: Support multiple Write chunks in svc_rdma_map_reply_msg()

Refactor: svc_rdma_map_reply_msg() is restructured to DMA map only
the parts of rq_res that do not contain a result payload.

This change has been tested to confirm that it does not cause a
regression in the no Write chunk and single Write chunk cases.
Multiple Write chunks have not been tested.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agosvcrdma: Support multiple write chunks when pulling up
Chuck Lever [Fri, 13 Mar 2020 14:42:11 +0000 (10:42 -0400)]
svcrdma: Support multiple write chunks when pulling up

When counting the number of SGEs needed to construct a Send request,
do not count result payloads. And, when copying the Reply message
into the pull-up buffer, result payloads are not to be copied to the
Send buffer.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agosvcrdma: Use parsed chunk lists to encode Reply transport headers
Chuck Lever [Wed, 17 Jun 2020 15:50:34 +0000 (11:50 -0400)]
svcrdma: Use parsed chunk lists to encode Reply transport headers

Refactor: Instead of re-parsing the ingress RPC Call transport
header when constructing the egress RPC Reply transport header, use
the new parsed Write list and Reply chunk, which are version-
agnostic and already XDR decoded.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agosvcrdma: Use parsed chunk lists to construct RDMA Writes
Chuck Lever [Wed, 17 Jun 2020 15:07:00 +0000 (11:07 -0400)]
svcrdma: Use parsed chunk lists to construct RDMA Writes

Refactor: Instead of re-parsing the ingress RPC Call transport
header when constructing RDMA Writes, use the new parsed chunk lists
for the Write list and Reply chunk, which are version-agnostic and
already XDR-decoded.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agosvcrdma: Use parsed chunk lists to detect reverse direction replies
Chuck Lever [Sun, 22 Mar 2020 17:06:55 +0000 (13:06 -0400)]
svcrdma: Use parsed chunk lists to detect reverse direction replies

Refactor: Don't duplicate header decoding smarts here. Instead, use
the new parsed chunk lists.

Note that the XID sanity test is also removed. The XID is already
looked up by the cb handler, and is rejected if it's not recognized.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agosvcrdma: Use parsed chunk lists to derive the inv_rkey
Chuck Lever [Mon, 22 Jun 2020 13:46:05 +0000 (09:46 -0400)]
svcrdma: Use parsed chunk lists to derive the inv_rkey

Refactor: Don't duplicate header decoding smarts here. Instead, use
the new parsed chunk lists.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agosvcrdma: Add a "parsed chunk list" data structure
Chuck Lever [Mon, 22 Jun 2020 14:15:41 +0000 (10:15 -0400)]
svcrdma: Add a "parsed chunk list" data structure

This simple data structure binds the location of each data payload
inside of an RPC message to the chunk that will be used to push it
to or pull it from the client.

There are several benefits to this small additional overhead:

 * It enables support for more than one chunk in incoming Read and
   Write lists.

 * It translates the version-specific on-the-wire format into a
   generic in-memory structure, enabling support for multiple
   versions of the RPC/RDMA transport protocol.

 * It enables the server to re-organize a chunk list if it needs to
   adjust where Read chunk data lands in server memory without
   altering the contents of the XDR-encoded Receive buffer.

Construction of these lists is done while sanity checking each
incoming RPC/RDMA header. Subsequent patches will make use of the
generated data structures.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agosvcrdma: Clean up svc_rdma_encode_reply_chunk()
Chuck Lever [Fri, 13 Mar 2020 14:42:10 +0000 (10:42 -0400)]
svcrdma: Clean up svc_rdma_encode_reply_chunk()

Refactor: Match the control flow of svc_rdma_encode_write_list().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agosvcrdma: Post RDMA Writes while XDR encoding replies
Chuck Lever [Fri, 13 Mar 2020 14:42:10 +0000 (10:42 -0400)]
svcrdma: Post RDMA Writes while XDR encoding replies

The only RPC/RDMA ordering requirement between RDMA Writes and RDMA
Sends is that the responder must post the Writes on the Send queue
before posting the Send that conveys the RPC Reply for that Write
payload.

The Linux NFS server implementation now has a transport method that
can post result Payload Writes earlier than svc_rdma_sendto:

   ->xpo_result_payload()

This gets RDMA Writes going earlier so they are more likely to be
complete at the remote end before the Send completes.

Some care must be taken with pulled-up Replies. We don't want to
push the Write chunk and then send the same payload data via Send.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoNFSD: Invoke svc_encode_result_payload() in "read" NFSD encoders
Chuck Lever [Thu, 5 Nov 2020 15:24:19 +0000 (10:24 -0500)]
NFSD: Invoke svc_encode_result_payload() in "read" NFSD encoders

Have the NFSD encoders annotate the boundaries of every
direct-data-placement eligible result data payload. Then change
svcrdma to use that annotation instead of the xdr->page_len
when handling Write chunks.

For NFSv4 on RDMA, that enables the ability to recognize multiple
result payloads per compound. This is a pre-requisite for supporting
multiple Write chunks per RPC transaction.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoSUNRPC: Rename svc_encode_read_payload()
Chuck Lever [Wed, 10 Jun 2020 14:36:42 +0000 (10:36 -0400)]
SUNRPC: Rename svc_encode_read_payload()

Clean up: "result payload" is a less confusing name for these
payloads. "READ payload" reflects only the NFS usage.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agosvcrdma: Refactor the RDMA Write path
Chuck Lever [Fri, 13 Mar 2020 14:42:10 +0000 (10:42 -0400)]
svcrdma: Refactor the RDMA Write path

Refactor for subsequent changes.

Constify the xdr_buf argument to ensure the code here does not
modify it, and to enable callers to pass in a
"const struct xdr_buf *".

At the same time, rename the helper functions, which emit RDMA
Writes, not RDMA Sends, and add documenting comments.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agosvcrdma: Const-ify the xdr_buf arguments
Chuck Lever [Fri, 13 Mar 2020 14:42:10 +0000 (10:42 -0400)]
svcrdma: Const-ify the xdr_buf arguments

Clean up: Ensure the code in rw.c does not modify the argument, and
enable callers to also use "const struct xdr_buf *".

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoSUNRPC: Adjust synopsis of xdr_buf_subsegment()
Chuck Lever [Fri, 13 Mar 2020 14:42:09 +0000 (10:42 -0400)]
SUNRPC: Adjust synopsis of xdr_buf_subsegment()

Clean up: This enables xdr_buf_subsegment()'s callers to pass in a
const pointer to that buffer.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agosvcrdma: Catch another Reply chunk overflow case
Chuck Lever [Thu, 12 Nov 2020 19:47:14 +0000 (14:47 -0500)]
svcrdma: Catch another Reply chunk overflow case

When space in the Reply chunk runs out in the middle of a segment,
we end up passing a zero-length SGL to rdma_rw_ctx_init(), and it
oopses.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
3 years agoLinux 5.10-rc6
Linus Torvalds [Sun, 29 Nov 2020 23:50:50 +0000 (15:50 -0800)]
Linux 5.10-rc6

3 years agoMerge tag 'locking-urgent-2020-11-29' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 29 Nov 2020 19:19:26 +0000 (11:19 -0800)]
Merge tag 'locking-urgent-2020-11-29' of git://git./linux/kernel/git/tip/tip

Pull locking fixes from Thomas Gleixner:
 "Two more places which invoke tracing from RCU disabled regions in the
  idle path.

  Similar to the entry path the low level idle functions have to be
  non-instrumentable"

* tag 'locking-urgent-2020-11-29' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  intel_idle: Fix intel_idle() vs tracing
  sched/idle: Fix arch_cpu_idle() vs tracing

3 years agoMerge tag 'irq-urgent-2020-11-29' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 29 Nov 2020 19:06:57 +0000 (11:06 -0800)]
Merge tag 'irq-urgent-2020-11-29' of git://git./linux/kernel/git/tip/tip

Pull irq fixes from Thomas Gleixner:
 "Two fixes for irqchip drivers:

   - Save and restore the GICV3 ITS state unconditionally on
     suspend/resume to handle firmware which fails to do so.

   - Use the correct index into the fwspec parameters to read the irq
     trigger type in the EXIU chip driver"

* tag 'irq-urgent-2020-11-29' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  irqchip/gic-v3-its: Unconditionally save/restore the ITS state on suspend
  irqchip/exiu: Fix the index of fwspec for IRQ type

3 years agoMerge tag 'efi-urgent-for-v5.10-rc5' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 29 Nov 2020 18:18:53 +0000 (10:18 -0800)]
Merge tag 'efi-urgent-for-v5.10-rc5' of git://git./linux/kernel/git/tip/tip

Pull EFI fixes from Borislav Petkov:
 "More EFI fixes forwarded from Ard Biesheuvel:

   - revert efivarfs kmemleak fix again - it was a false positive

   - make CONFIG_EFI_EARLYCON depend on CONFIG_EFI explicitly so it does
     not pull in other dependencies unnecessarily if CONFIG_EFI is not
     set

   - defer attempts to load SSDT overrides from EFI vars until after the
     efivar layer is up"

* tag 'efi-urgent-for-v5.10-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  efi: EFI_EARLYCON should depend on EFI
  efivarfs: revert "fix memory leak in efivarfs_create()"
  efi/efivars: Set generic ops before loading SSDT

3 years agoMerge tag 'x86_urgent_for_v5.10-rc6' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 29 Nov 2020 18:08:17 +0000 (10:08 -0800)]
Merge tag 'x86_urgent_for_v5.10-rc6' of git://git./linux/kernel/git/tip/tip

Pull x86 fixes from Borislav Petkov:
 "A couple of urgent fixes which accumulated this last week:

   - Two resctrl fixes to prevent refcount leaks when manipulating the
     resctrl fs (Xiaochen Shen)

   - Correct prctl(PR_GET_SPECULATION_CTRL) reporting (Anand K Mistry)

   - A fix to not lose already seen MCE severity which determines
     whether the machine can recover (Gabriele Paoloni)"

* tag 'x86_urgent_for_v5.10-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/mce: Do not overwrite no_way_out if mce_end() fails
  x86/speculation: Fix prctl() when spectre_v2_user={seccomp,prctl},ibpb
  x86/resctrl: Add necessary kernfs_put() calls to prevent refcount leak
  x86/resctrl: Remove superfluous kernfs_get() calls to prevent refcount leak