Commit graph

36 commits

Author SHA1 Message Date
Chuck Lever
a90593a639 SUNRPC: Change return value type of .pc_encode
[ Upstream commit 130e2054d4a652a2bd79fb1557ddcd19c053cb37 ]

Returning an undecorated integer is an age-old trope, but it's
not clear (even to previous experts in this code) that the only
valid return values are 1 and 0. These functions do not return
a negative errno, rpc_stat value, or a positive length.

Document there are only two valid return values by having
.pc_encode return only true or false.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:48 +01:00
Chuck Lever
ad7cd61954 SUNRPC: Replace the "__be32 *p" parameter to .pc_encode
[ Upstream commit fda494411485aff91768842c532f90fb8eb54943 ]

The passed-in value of the "__be32 *p" parameter is now unused in
every server-side XDR encoder, and can be removed.

Note also that there is a line in each encoder that sets up a local
pointer to a struct xdr_stream. Passing that pointer from the
dispatcher instead saves one line per encoder function.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:48 +01:00
Chuck Lever
876bbff0f3 SUNRPC: Change return value type of .pc_decode
[ Upstream commit c44b31c263798ec34614dd394c31ef1a2e7e716e ]

Returning an undecorated integer is an age-old trope, but it's
not clear (even to previous experts in this code) that the only
valid return values are 1 and 0. These functions do not return
a negative errno, rpc_stat value, or a positive length.

Document there are only two valid return values by having
.pc_decode return only true or false.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:48 +01:00
Chuck Lever
6e864f8e82 SUNRPC: Replace the "__be32 *p" parameter to .pc_decode
[ Upstream commit 16c663642c7ec03cd4cee5fec520bb69e97babe4 ]

The passed-in value of the "__be32 *p" parameter is now unused in
every server-side XDR decoder, and can be removed.

Note also that there is a line in each decoder that sets up a local
pointer to a struct xdr_stream. Passing that pointer from the
dispatcher instead saves one line per decoder function.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:48 +01:00
Chuck Lever
252ec73572 NFSD: Have legacy NFSD WRITE decoders use xdr_stream_subsegment()
[ Upstream commit dae9a6cab8009e526570e7477ce858dcdfeb256e ]

Refactor.

Now that the NFSv2 and NFSv3 XDR decoders have been converted to
use xdr_streams, the WRITE decoder functions can use
xdr_stream_subsegment() to extract the WRITE payload into its own
xdr_buf, just as the NFSv4 WRITE XDR decoder currently does.

That makes it possible to pass the first kvec, pages array + length,
page_base, and total payload length via a single function parameter.

The payload's page_base is not yet assigned or used, but will be in
subsequent patches.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
[ cel: adjusted to apply to v5.10.y ]
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:48 +01:00
Chuck Lever
4309c8c5e5 NFSD: Clean up NFSDDBG_FACILITY macro
[ Upstream commit 219a170502b3d597c52eeec088aee8fbf7b90da5 ]

These are no longer needed because there are no dprintk() call sites
in these files.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:36 +01:00
Chuck Lever
b638ee45ac NFSD: Clean up after updating NFSv2 ACL encoders
[ Upstream commit 83d0b84572775a29f800de67a1b9b642a5376bc3 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:35 +01:00
Chuck Lever
1f70d81dcf NFSD: Update the NFSv2 GETACL result encoder to use struct xdr_stream
[ Upstream commit f8cba47344f794b54373189bec23195b51020faf ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:35 +01:00
Chuck Lever
b6b773d33f NFSD: Remove unused NFSv2 directory entry encoders
[ Upstream commit 8a2cf9f5709cc20a1114a7d22655928314fc86f8 ]

Clean up.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:35 +01:00
Chuck Lever
c750724716 NFSD: Update the NFSv2 READDIR entry encoder to use struct xdr_stream
[ Upstream commit f5dcccd647da513a89f3b6ca392b0c1eb050b9fc ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:35 +01:00
Chuck Lever
6c4d316ef4 NFSD: Update the NFSv2 READDIR result encoder to use struct xdr_stream
[ Upstream commit 94c8f8c682a6497af7ea71351b18f637c6337d42 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:35 +01:00
Chuck Lever
adec3bc3b2 NFSD: Count bytes instead of pages in the NFSv2 READDIR encoder
[ Upstream commit 8141d6a2bb6c655ff0c0b81ced80d9025f03e926 ]

Clean up: Counting the bytes used by each returned directory entry
seems less brittle to me than trying to measure consumed pages after
the fact.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:35 +01:00
Chuck Lever
027123af6d NFSD: Add a helper that encodes NFSv3 directory offset cookies
[ Upstream commit d52532002ffa217ad3fa4c3ba86c95203d21dd21 ]

Refactor: Add helper function similar to nfs3svc_encode_cookie3().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:35 +01:00
Chuck Lever
0379d2419a NFSD: Update the NFSv2 STATFS result encoder to use struct xdr_stream
[ Upstream commit bf15229f2ced4f14946eef958336f764e30f8efb ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:34 +01:00
Chuck Lever
9b4dc4f022 NFSD: Update the NFSv2 READ result encoder to use struct xdr_stream
[ Upstream commit a6f8d9dc9e44b51303d9abde4643460137d19b28 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:34 +01:00
Chuck Lever
12000cd126 NFSD: Update the NFSv2 READLINK result encoder to use struct xdr_stream
[ Upstream commit d9014b0f8fae11f22a3d356553844e06ddcdce4a ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:34 +01:00
Chuck Lever
6b2ab70994 NFSD: Update the NFSv2 diropres encoder to use struct xdr_stream
[ Upstream commit e3b4ef221ac57c08341c97a10c8a81c041f76716 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:34 +01:00
Chuck Lever
991b778b3a NFSD: Update the NFSv2 attrstat encoder to use struct xdr_stream
[ Upstream commit 92b54a4fa4224e6116eb0d87a39dd05af23fcdfa ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:34 +01:00
Chuck Lever
9e9a3adf4a NFSD: Update the NFSv2 stat encoder to use struct xdr_stream
[ Upstream commit a887eaed2a964754334cd3f8c5fe87e413e68fef ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:34 +01:00
Chuck Lever
2da089d28a NFSD: Clean up after updating NFSv2 ACL decoders
[ Upstream commit baadce65d6ee3032b921d9c043ba808bc69d6b13 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:31 +01:00
Chuck Lever
67e87fecaa NFSD: Update the NFSv2 GETACL argument decoder to use struct xdr_stream
[ Upstream commit 635a45d34706400c59c3b18ca9fccba195147bda ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:30 +01:00
Chuck Lever
fa60fdae82 NFSD: Update the NFSv2 SYMLINK argument decoder to use struct xdr_stream
[ Upstream commit 09f75a5375ac61f4adb94da0accc1cfc60eb4f2b ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:30 +01:00
Chuck Lever
6a9bde4e9f NFSD: Update the NFSv2 CREATE argument decoder to use struct xdr_stream
[ Upstream commit 7dcf65b91ecaf60ce593e7859ae2b29b7c46ccbd ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:30 +01:00
Chuck Lever
846c00e1da NFSD: Update the NFSv2 SETATTR argument decoder to use struct xdr_stream
[ Upstream commit 2fdd6bd293b9e7dda61220538b2759fbf06f5af0 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:30 +01:00
Chuck Lever
42f9734887 NFSD: Update the NFSv2 LINK argument decoder to use struct xdr_stream
[ Upstream commit 77edcdf91f6245a9881b84e4e101738148bd039a ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:30 +01:00
Chuck Lever
600cb5c632 NFSD: Update the NFSv2 RENAME argument decoder to use struct xdr_stream
[ Upstream commit 62aa557efb81ea3339fabe7f5b1a343e742bbbdf ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:30 +01:00
Chuck Lever
3973346f7b NFSD: Update NFSv2 diropargs decoding to use struct xdr_stream
[ Upstream commit 6d742c1864c18f143ea2031f1ed66bcd8f4812de ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:30 +01:00
Chuck Lever
a157e4f21a NFSD: Update the NFSv2 READDIR argument decoder to use struct xdr_stream
[ Upstream commit 8688361ae2edb8f7e61d926dc5000c9a44f29370 ]

As an additional clean up, move code not related to XDR decoding
into readdir's .pc_func call out.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:30 +01:00
Chuck Lever
30d0fb860f NFSD: Add helper to set up the pages where the dirlist is encoded
[ Upstream commit 788cd46ecf83ee2d561cb4e754e276dc8089b787 ]

Add a helper similar to nfsd3_init_dirlist_pages().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:30 +01:00
Chuck Lever
a6f42c646f NFSD: Update the NFSv2 READLINK argument decoder to use struct xdr_stream
[ Upstream commit 1fcbd1c9456ba129d38420e345e91c4b6363db47 ]

If the code that sets up the sink buffer for nfsd_readlink() is
moved adjacent to the nfsd_readlink() call site that uses it, then
the only argument is a file handle, and the fhandle decoder can be
used instead.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:30 +01:00
Chuck Lever
1aa33901b0 NFSD: Update the NFSv2 WRITE argument decoder to use struct xdr_stream
[ Upstream commit a51b5b737a0be93fae6ea2a18df03ab2359a3f4b ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:30 +01:00
Chuck Lever
a0c53cf707 NFSD: Update the NFSv2 READ argument decoder to use struct xdr_stream
[ Upstream commit 8c293ef993c8df0b1bea9ecb0de6eb96dec3ac9d ]

The code that sets up rq_vec is refactored so that it is now
adjacent to the nfsd_read() call site where it is used.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:30 +01:00
Chuck Lever
25fd2ba100 NFSD: Update the NFSv2 GETATTR argument decoder to use struct xdr_stream
[ Upstream commit ebcd8e8b28535b643a4c06685bd363b3b73a96af ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:30 +01:00
Chuck Lever
cfa6efa018 NFSD: Add common helpers to decode void args and encode void results
[ Upstream commit 788f7183fba86b46074c16e7d57ea09302badff4 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:20 +01:00
Chuck Lever
8a1b5ced4f NFSD: Invoke svc_encode_result_payload() in "read" NFSD encoders
[ Upstream commit 76e5492b161f555c0fb69cad9eb39a7d8467f5fe ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:20 +01:00
Gabriel2392
7ed7ee9edf Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00