Commit graph

55 commits

Author SHA1 Message Date
Chuck Lever
f43151a538 NFSD: Fix NFSv3 SETATTR/CREATE's handling of large file sizes
[ Upstream commit a648fdeb7c0e17177a2280344d015dba3fbe3314 ]

iattr::ia_size is a loff_t, so these NFSv3 procedures must be
careful to deal with incoming client size values that are larger
than s64_max without corrupting the value.

Silently capping the value results in storing a different value
than the client passed in which is unexpected behavior, so remove
the min_t() check in decode_sattr3().

Note that RFC 1813 permits only the WRITE procedure to return
NFS3ERR_FBIG. We believe that NFSv3 reference implementations
also return NFS3ERR_FBIG when ia_size is too large.

Cc: stable@vger.kernel.org
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:53 +01:00
Chuck Lever
8cabb46f6c NFSD: Move fill_pre_wcc() and fill_post_wcc()
[ Upstream commit fcb5e3fa012351f3b96024c07bc44834c2478213 ]

These functions are related to file handle processing and have
nothing to do with XDR encoding or decoding. Also they are no longer
NFSv3-specific. As a clean-up, move their definitions to a more
appropriate location. WCC is also an NFSv3-specific term, so rename
them as general-purpose helpers.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:53 +01:00
Chuck Lever
124a3cdf27 Revert "nfsd: skip some unnecessary stats in the v4 case"
[ Upstream commit 58f258f65267542959487dbe8b5641754411843d ]

On the wire, I observed NFSv4 OPEN(CREATE) operations sometimes
returning a reasonable-looking value in the cinfo.before field and
zero in the cinfo.after field.

RFC 8881 Section 10.8.1 says:
> When a client is making changes to a given directory, it needs to
> determine whether there have been changes made to the directory by
> other clients.  It does this by using the change attribute as
> reported before and after the directory operation in the associated
> change_info4 value returned for the operation.

and

> ... The post-operation change
> value needs to be saved as the basis for future change_info4
> comparisons.

A good quality client implementation therefore saves the zero
cinfo.after value. During a subsequent OPEN operation, it will
receive a different non-zero value in the cinfo.before field for
that directory, and it will incorrectly believe the directory has
changed, triggering an undesirable directory cache invalidation.

There are filesystem types where fs_supports_change_attribute()
returns false, tmpfs being one. On NFSv4 mounts, this means the
fh_getattr() call site in fill_pre_wcc() and fill_post_wcc() is
never invoked. Subsequently, nfsd4_change_attribute() is invoked
with an uninitialized @stat argument.

In fill_pre_wcc(), @stat contains stale stack garbage, which is
then placed on the wire. In fill_post_wcc(), ->fh_post_wc is all
zeroes, so zero is placed on the wire. Both of these values are
meaningless.

This fix can be applied immediately to stable kernels. Once there
are more regression tests in this area, this optimization can be
attempted again.

Fixes: 428a23d2bf0c ("nfsd: skip some unnecessary stats in the v4 case")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:52 +01:00
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
59ad394efc NFSD: Clean up after updating NFSv3 ACL encoders
[ Upstream commit 1416f435303d81070c6bcf5a4a9b4ed0f7a9f013 ]

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
1c7e927146 NFSD: Update the NFSv3 GETACL result encoder to use struct xdr_stream
[ Upstream commit 20798dfe249a01ad1b12eec7dbc572db5003244a ]

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
2415336d32 NFSD: Remove unused NFSv3 directory entry encoders
[ Upstream commit 1411934627f9fe31a36ac8c43179ce9b63edce5c ]

Clean up.

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
c6fa35a441 NFSD: Update NFSv3 READDIR entry encoders to use struct xdr_stream
[ Upstream commit 7f87fc2d34d475225e78b7f5c4eabb121f4282b2 ]

The benefit of the xdr_stream helpers is that they transparently
handle encoding an XDR data item that crosses page boundaries.
Most of the open-coded logic to do that here can be eliminated.

A sub-buffer and sub-stream are set up as a sink buffer for the
directory entry encoder. As an entry is encoded, it is added to
the end of the content in this buffer/stream. The total length of
the directory list is tracked in the buffer's @len field.

When it comes time to encode the Reply, the sub-buffer is merged
into rq_res's page array at the correct place using
xdr_write_pages().

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
ebd915cf85 NFSD: Update the NFSv3 READDIR3res encoder to use struct xdr_stream
[ Upstream commit e4ccfe3014de435984939a3d84b7f241d3b57b0d ]

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
1cf0ab7219 NFSD: Count bytes instead of pages in the NFSv3 READDIR encoder
[ Upstream commit a1409e2de4f11034c8eb30775cc3e37039a4ef13 ]

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:34 +01:00
Chuck Lever
74e82961ae NFSD: Add a helper that encodes NFSv3 directory offset cookies
[ Upstream commit a161e6c76aeba835e475a2f27dbbe5c37e565e94 ]

Refactor: De-duplicate identical code that handles encoding of
directory offset cookies across page boundaries.

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
70b33c5fdb NFSD: Update the NFSv3 COMMIT3res encoder to use struct xdr_stream
[ Upstream commit 5ef2826c761079e27904c85034df34e601b82d94 ]

As an additional clean up, encode_wcc_data() is removed because it
is now no longer used.

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
5d797a7434 NFSD: Update the NFSv3 PATHCONF3res encoder to use struct xdr_stream
[ Upstream commit ded04a587f6ceaaba3caefad4021f2212b46c9ff ]

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
c730c58c76 NFSD: Update the NFSv3 FSINFO3res encoder to use struct xdr_stream
[ Upstream commit 0a139d1b7f327010acc36e8162936d3108c7addb ]

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
791921849b NFSD: Update the NFSv3 FSSTAT3res encoder to use struct xdr_stream
[ Upstream commit 8b7044984fd6eeadf72285e3617116bd15e9e676 ]

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
f73ea84fca NFSD: Update the NFSv3 LINK3res encoder to use struct xdr_stream
[ Upstream commit 4d74380a446f75eebb2171687d9b8baf0025bdf1 ]

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
5cd3abdfee NFSD: Update the NFSv3 RENAMEv3res encoder to use struct xdr_stream
[ Upstream commit 89d79e9672dfa6d0cc416699c16f2d312da58ff2 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:33 +01:00
Chuck Lever
2f31aa3e49 NFSD: Update the NFSv3 CREATE family of encoders to use struct xdr_stream
[ Upstream commit 78315b36781d259dcbdc102ff22c3f2f25712223 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:33 +01:00
Chuck Lever
071f3e7c61 NFSD: Update the NFSv3 WRITE3res encoder to use struct xdr_stream
[ Upstream commit ecb7a085ac15a8844ebf12fca6ae51ce71ac9b3b ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:33 +01:00
Chuck Lever
5a2a508148 NFSD: Update the NFSv3 READ3res encode to use struct xdr_stream
[ Upstream commit cc9bcdad7773c295375e66c892c7ac00524706f2 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:33 +01:00
Chuck Lever
73f907895f NFSD: Update the NFSv3 READLINK3res encoder to use struct xdr_stream
[ Upstream commit 9a9c8923b3efd593d0e6a405efef9d58c6e6804b ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:33 +01:00
Chuck Lever
5b10023828 NFSD: Update the NFSv3 wccstat result encoder to use struct xdr_stream
[ Upstream commit 70f8e839859a994e324e1d18889f8319bbd5bff9 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:33 +01:00
Chuck Lever
68eefaa8dd NFSD: Update the NFSv3 LOOKUP3res encoder to use struct xdr_stream
[ Upstream commit 5cf353354af1a385f29dec4609a1532d32c83a25 ]

Also, clean up: Rename the encoder function to match the name of
the result structure in RFC 1813, consistent with other encoder
function names in nfs3xdr.c. "diropres" is an NFSv2 thingie.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:33 +01:00
Chuck Lever
ed2796887b NFSD: Update the NFSv3 ACCESS3res encoder to use struct xdr_stream
[ Upstream commit 907c38227fb57f5c537491ca76dd0b9636029393 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:33 +01:00
Chuck Lever
36318a0ed9 NFSD: Update the GETATTR3res encoder to use struct xdr_stream
[ Upstream commit 2c42f804d30f6a8d86665eca84071b316821ea08 ]

As an additional clean up, some renaming is done to more closely
reflect the data type and variable names used in the NFSv3 XDR
definition provided in RFC 1813. "attrstat" is an NFSv2 thingie.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:33 +01:00
J. Bruce Fields
3ecb34ecc2 nfsd: skip some unnecessary stats in the v4 case
[ Upstream commit 428a23d2bf0ca8fd4d364a464c3e468f0e81671e ]

In the typical case of v4 and an i_version-supporting filesystem, we can
skip a stat which is only required to fake up a change attribute from
ctime.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:32 +01:00
Chuck Lever
3d34960ddb NFSD: Clean up after updating NFSv3 ACL decoders
[ Upstream commit 9cee763ee654ce8622d673b8e32687d738e24ace ]

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
367a75f550 NFSD: Update the NFSv3 GETACL argument decoder to use struct xdr_stream
[ Upstream commit 05027eafc266487c6e056d10ab352861df95b5d4 ]

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
49dee133c8 NFSD: Update the MKNOD3args decoder to use struct xdr_stream
[ Upstream commit f8a38e2d6c885f9d7cd03febc515d36293de4a5b ]

This commit removes the last usage of the original decode_sattr3(),
so it is removed as a clean-up.

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
0bc673e32a NFSD: Update the SYMLINK3args decoder to use struct xdr_stream
[ Upstream commit da39201637297460c13134c29286a00f3a1c92fe ]

Similar to the WRITE decoder, code that checks the sanity of the
payload size is re-wired to work with xdr_stream infrastructure.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:29 +01:00
Chuck Lever
08ac11cca2 NFSD: Update the MKDIR3args decoder to use struct xdr_stream
[ Upstream commit 83374c278db193f3e8b2608b45da1132b867a760 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:29 +01:00
Chuck Lever
0112701439 NFSD: Update the CREATE3args decoder to use struct xdr_stream
[ Upstream commit 6b3a11960d898b25a30103cc6a2ff0b24b90a83b ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:29 +01:00
Chuck Lever
c591d746bf NFSD: Update the SETATTR3args decoder to use struct xdr_stream
[ Upstream commit 9cde9360d18d8b352b737d10f90f2aecccf93dbe ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:29 +01:00
Chuck Lever
b4501304c1 NFSD: Update the LINK3args decoder to use struct xdr_stream
[ Upstream commit efaa1e7c2c7475f0a9bbeb904d9aba09b73dd52a ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:29 +01:00
Chuck Lever
a22aea1a3f NFSD: Update the RENAME3args decoder to use struct xdr_stream
[ Upstream commit d181e0a4bef36ee74d1338e5b5c2561d7463a5d0 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:29 +01:00
Chuck Lever
a921f47270 NFSD: Update the NFSv3 DIROPargs decoder to use struct xdr_stream
[ Upstream commit 54d1d43dc709f58be38d278bfc38e9bfb38d35fc ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:29 +01:00
Chuck Lever
0047ce3f85 NFSD: Update COMMIT3arg decoder to use struct xdr_stream
[ Upstream commit c8d26a0acfe77f0880e0acfe77e4209cf8f3a38b ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:29 +01:00
Chuck Lever
3860dc70e0 NFSD: Update READDIR3args decoders to use struct xdr_stream
[ Upstream commit 9cedc2e64c296efb3bebe93a0ceeb5e71e8d722d ]

As an additional clean up, neither nfsd3_proc_readdir() nor
nfsd3_proc_readdirplus() make use of the dircount argument, so
remove it from struct nfsd3_readdirargs.

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

De-duplicate some code that is used by both READDIR and READDIRPLUS
to build the dirlist in the Reply. Because this code is not related
to decoding READ arguments, it is moved to a more appropriate spot.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:29 +01:00
Chuck Lever
a63bb88fb1 NFSD: Update READLINK3arg decoder to use struct xdr_stream
[ Upstream commit 224c1c894e48cd72e4dd9fb6311be80cbe1369b0 ]

The NFSv3 READLINK request takes a single filehandle, so it can
re-use GETATTR's decoder.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:29 +01:00
Chuck Lever
61407ff817 NFSD: Update WRITE3arg decoder to use struct xdr_stream
[ Upstream commit c43b2f229a01969a7ccf94b033c5085e0ec2040c ]

As part of the update, open code that sanity-checks the size of the
data payload against the length of the RPC Call message has to be
re-implemented to use xdr_stream infrastructure.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:29 +01:00
Chuck Lever
0be6ef7cf7 NFSD: Update READ3arg decoder to use struct xdr_stream
[ Upstream commit be63bd2ac6bbf8c065a0ef6dfbea76934326c352 ]

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:29 +01:00
Chuck Lever
31b738b2d4 NFSD: Update ACCESS3arg decoder to use struct xdr_stream
[ Upstream commit 3b921a2b14251e9e203f1e8af76e8ade79f50e50 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:29 +01:00
Chuck Lever
cfdfe5a7de NFSD: Update GETATTR3args decoder to use struct xdr_stream
[ Upstream commit 9575363a9e4c8d7e2f9ba5e79884d623fff0be6f ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:29 +01:00
Jeff Layton
04188462fa nfsd: add a new EXPORT_OP_NOWCC flag to struct export_operations
[ Upstream commit daab110e47f8d7aa6da66923e3ac1a8dbd2b2a72 ]

With NFSv3 nfsd will always attempt to send along WCC data to the
client. This generally involves saving off the in-core inode information
prior to doing the operation on the given filehandle, and then issuing a
vfs_getattr to it after the op.

Some filesystems (particularly clustered or networked ones) have an
expensive ->getattr inode operation. Atomicity is also often difficult
or impossible to guarantee on such filesystems. For those, we're best
off not trying to provide WCC information to the client at all, and to
simply allow it to poll for that information as needed with a GETATTR
RPC.

This patch adds a new flags field to struct export_operations, and
defines a new EXPORT_OP_NOWCC flag that filesystems can use to indicate
that nfsd should not attempt to provide WCC info in NFSv3 replies. It
also adds a blurb about the new flags field and flag to the exporting
documentation.

The server will also now skip collecting this information for NFSv2 as
well, since that info is never used there anyway.

Note that this patch does not add this flag to any filesystem
export_operations structures. This was originally developed to allow
reexporting nfs via nfsd.

Other filesystems may want to consider enabling this flag too. It's hard
to tell however which ones have export operations to enable export via
knfsd and which ones mostly rely on them for open-by-filehandle support,
so I'm leaving that up to the individual maintainers to decide. I am
cc'ing the relevant lists for those filesystems that I think may want to
consider adding this though.

Cc: HPDD-discuss@lists.01.org
Cc: ceph-devel@vger.kernel.org
Cc: cluster-devel@redhat.com
Cc: fuse-devel@lists.sourceforge.net
Cc: ocfs2-devel@oss.oracle.com
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: Lance Shelton <lance.shelton@hammerspace.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:26 +01:00