linux-stable/fs/nfsd
Chuck Lever efcae97fa4 NFSD: da_addr_body field missing in some GETDEVICEINFO replies
[ Upstream commit 6372e2ee62 ]

The XDR specification in RFC 8881 looks like this:

struct device_addr4 {
	layouttype4	da_layout_type;
	opaque		da_addr_body<>;
};

struct GETDEVICEINFO4resok {
	device_addr4	gdir_device_addr;
	bitmap4		gdir_notification;
};

union GETDEVICEINFO4res switch (nfsstat4 gdir_status) {
case NFS4_OK:
	GETDEVICEINFO4resok gdir_resok4;
case NFS4ERR_TOOSMALL:
	count4		gdir_mincount;
default:
	void;
};

Looking at nfsd4_encode_getdeviceinfo() ....

When the client provides a zero gd_maxcount, then the Linux NFS
server implementation encodes the da_layout_type field and then
skips the da_addr_body field completely, proceeding directly to
encode gdir_notification field.

There does not appear to be an option in the specification to skip
encoding da_addr_body. Moreover, Section 18.40.3 says:

> If the client wants to just update or turn off notifications, it
> MAY send a GETDEVICEINFO operation with gdia_maxcount set to zero.
> In that event, if the device ID is valid, the reply's da_addr_body
> field of the gdir_device_addr field will be of zero length.

Since the layout drivers are responsible for encoding the
da_addr_body field, put this fix inside the ->encode_getdeviceinfo
methods.

Fixes: 9cf514ccfa ("nfsd: implement pNFS operations")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Tom Haynes <loghyr@gmail.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-09-13 09:48:24 +02:00
..
acl.h NFSD: add posix ACLs to struct nfsd_attrs 2022-08-04 10:28:03 -04:00
auth.c
auth.h
blocklayout.c nfsd: call op_release, even when op_func returns an error 2023-03-31 17:29:49 -04:00
blocklayoutxdr.c NFSD: da_addr_body field missing in some GETDEVICEINFO replies 2023-09-13 09:48:24 +02:00
blocklayoutxdr.h
cache.h nfsd: move init of percpu reply_cache_stats counters back to nfsd_init_net 2023-07-19 16:36:51 +02:00
current_stateid.h
export.c NFSD: Handle new xprtsec= export option 2023-04-27 18:49:24 -04:00
export.h NFSD: Handle new xprtsec= export option 2023-04-27 18:49:24 -04:00
filecache.c NFSD: Fix problem of COMMIT and NFS4ERR_DELAY in infinite loop 2023-04-27 18:49:24 -04:00
filecache.h NFSD: Convert filecache to rhltable 2023-04-26 09:04:59 -04:00
flexfilelayout.c nfsd: move nfserrno() to vfs.c 2022-11-28 12:54:44 -05:00
flexfilelayoutxdr.c NFSD: da_addr_body field missing in some GETDEVICEINFO replies 2023-09-13 09:48:24 +02:00
flexfilelayoutxdr.h
idmap.h
Kconfig NFS & NFSD: Update GSS dependencies 2023-03-10 09:38:47 -05:00
lockd.c
Makefile nfsd: allow disabling NFSv2 at compile time 2022-11-28 12:54:45 -05:00
netns.h File locking changes for v6.3 2023-02-20 11:10:38 -08:00
nfs2acl.c NFSD 6.3 Release Notes 2023-02-22 14:21:40 -08:00
nfs3acl.c NFSD 6.3 Release Notes 2023-02-22 14:21:40 -08:00
nfs3proc.c NFSD 6.3 Release Notes 2023-02-22 14:21:40 -08:00
nfs3xdr.c NFSD: Clean up WRITE arg decoders 2022-09-26 14:02:47 -04:00
nfs4acl.c fs: rename current get acl method 2022-10-20 10:13:27 +02:00
nfs4callback.c NFSD: callback request does not use correct credential for AUTH_SYS 2023-04-04 09:55:27 -04:00
nfs4idmap.c SUNRPC: return proper error from get_expiry() 2023-04-26 09:05:00 -04:00
nfs4layouts.c nfsd: fix race to check ls_layouts 2023-02-20 09:20:56 -05:00
nfs4proc.c NFSD: fix problems with cleanup on errors in nfsd4_copy 2023-02-20 09:20:57 -05:00
nfs4recover.c fs: port vfs_*() helpers to struct mnt_idmap 2023-01-18 17:51:45 +01:00
nfs4state.c nfsd: Fix race to FREE_STATEID and cl_revoked 2023-08-30 14:52:40 +02:00
nfs4xdr.c NFSD: da_addr_body field missing in some GETDEVICEINFO replies 2023-09-13 09:48:24 +02:00
nfscache.c nfsd: move init of percpu reply_cache_stats counters back to nfsd_init_net 2023-07-19 16:36:51 +02:00
nfsctl.c nfsd: move init of percpu reply_cache_stats counters back to nfsd_init_net 2023-07-19 16:36:51 +02:00
nfsd.h SUNRPC: Refactor RPC server dispatch method 2023-02-20 09:20:31 -05:00
nfsfh.c fs.idmapped.v6.3 2023-02-20 11:53:11 -08:00
nfsfh.h nfsd: move nfsd4_change_attribute to nfsfh.c 2023-01-26 07:00:06 -05:00
nfsproc.c NFSD 6.3 Release Notes 2023-02-22 14:21:40 -08:00
nfssvc.c NFSD: copy the whole verifier in nfsd_copy_write_verifier 2023-02-20 09:20:59 -05:00
nfsxdr.c NFSD: Clean up WRITE arg decoders 2022-09-26 14:02:47 -04:00
pnfs.h
state.h nfsd: don't take nfsd4_copy ref for OP_OFFLOAD_STATUS 2023-02-20 09:20:51 -05:00
stats.c nfsd: use DEFINE_PROC_SHOW_ATTRIBUTE to define nfsd_proc_ops 2022-09-26 14:02:49 -04:00
stats.h
trace.c
trace.h NFSD: Remove open coding of string copy 2023-05-15 08:03:04 -04:00
vfs.c nfsd: use vfs setgid helper 2023-07-19 16:36:54 +02:00
vfs.h nfsd: use the getattr operation to fetch i_version 2023-01-26 07:00:06 -05:00
xdr.h
xdr3.h
xdr4.h NFSD: enhance inter-server copy cleanup 2023-02-20 09:20:21 -05:00
xdr4cb.h NFSD: add support for sending CB_RECALL_ANY 2022-12-10 11:01:12 -05:00