Skip to content

Commit 4f76435

Browse files
committed
NFSD: Define actions for the new time_deleg FATTR4 attributes
NFSv4 clients won't send legitimate GETATTR requests for these new attributes because they are intended to be used only with CB_GETATTR and SETATTR. But NFSD has to do something besides crashing if it ever sees a GETATTR request that queries these attributes. RFC 8881 Section 18.7.3 states: > The server MUST return a value for each attribute that the client > requests if the attribute is supported by the server for the > target file system. If the server does not support a particular > attribute on the target file system, then it MUST NOT return the > attribute value and MUST NOT set the attribute bit in the result > bitmap. The server MUST return an error if it supports an > attribute on the target but cannot obtain its value. In that case, > no attribute values will be returned. Further, RFC 9754 Section 5 states: > These new attributes are invalid to be used with GETATTR, VERIFY, > and NVERIFY, and they can only be used with CB_GETATTR and SETATTR > by a client holding an appropriate delegation. Thus there does not appear to be a specific server response mandated by specification. Taking the guidance that querying these attributes via GETATTR is "invalid", NFSD will return nfserr_inval, failing the request entirely. Reported-by: Robert Morris <[email protected]> Closes: https://lore.kernel.org/linux-nfs/[email protected]/T/#t Fixes: 51c0d4f ("nfsd: add support for FATTR4_OPEN_ARGUMENTS") Cc: [email protected] Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 4b47a86 commit 4f76435

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

fs/nfsd/nfs4xdr.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2939,6 +2939,12 @@ struct nfsd4_fattr_args {
29392939
typedef __be32(*nfsd4_enc_attr)(struct xdr_stream *xdr,
29402940
const struct nfsd4_fattr_args *args);
29412941

2942+
static __be32 nfsd4_encode_fattr4__inval(struct xdr_stream *xdr,
2943+
const struct nfsd4_fattr_args *args)
2944+
{
2945+
return nfserr_inval;
2946+
}
2947+
29422948
static __be32 nfsd4_encode_fattr4__noop(struct xdr_stream *xdr,
29432949
const struct nfsd4_fattr_args *args)
29442950
{
@@ -3560,6 +3566,8 @@ static const nfsd4_enc_attr nfsd4_enc_fattr4_encode_ops[] = {
35603566

35613567
[FATTR4_MODE_UMASK] = nfsd4_encode_fattr4__noop,
35623568
[FATTR4_XATTR_SUPPORT] = nfsd4_encode_fattr4_xattr_support,
3569+
[FATTR4_TIME_DELEG_ACCESS] = nfsd4_encode_fattr4__inval,
3570+
[FATTR4_TIME_DELEG_MODIFY] = nfsd4_encode_fattr4__inval,
35633571
[FATTR4_OPEN_ARGUMENTS] = nfsd4_encode_fattr4_open_arguments,
35643572
};
35653573

0 commit comments

Comments
 (0)