linux-stable/fs/nfsd
Chuck Lever 384d1b1138 NFSD: Fix zero-length NFSv3 WRITEs
[ Upstream commit 6a2f774424 ]

The Linux NFS server currently responds to a zero-length NFSv3 WRITE
request with NFS3ERR_IO. It responds to a zero-length NFSv4 WRITE
with NFS4_OK and count of zero.

RFC 1813 says of the WRITE procedure's @count argument:

count
         The number of bytes of data to be written. If count is
         0, the WRITE will succeed and return a count of 0,
         barring errors due to permissions checking.

RFC 8881 has similar language for NFSv4, though NFSv4 removed the
explicit @count argument because that value is already contained in
the opaque payload array.

The synthetic client pynfs's WRT4 and WRT15 tests do emit zero-
length WRITEs to exercise this spec requirement. Commit fdec6114ee
("nfsd4: zero-length WRITE should succeed") addressed the same
problem there with the same fix.

But interestingly the Linux NFS client does not appear to emit zero-
length WRITEs, instead squelching them. I'm not aware of a test that
can generate such WRITEs for NFSv3, so I wrote a naive C program to
generate a zero-length WRITE and test this fix.

Fixes: 8154ef2776 ("NFSD: Clean up legacy NFS WRITE argument XDR decoders")
Reported-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: stable@vger.kernel.org
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-03-08 19:12:33 +01:00
..
acl.h
auth.c
auth.h
blocklayout.c block: remove REQ_OP_SCSI_{IN,OUT} 2021-06-30 15:34:19 -06:00
blocklayoutxdr.c
blocklayoutxdr.h
cache.h nfsd4: make drc_slab global, not per-net 2020-06-01 17:44:45 -04:00
current_stateid.h
export.c idmapped-mounts-v5.12 2021-02-23 13:39:45 -08:00
export.h nfsd: report per-export stats 2021-01-25 09:36:28 -05:00
fault_inject.c
filecache.c nfsd: Fix a warning for nfsd_file_close_inode 2021-10-01 11:17:40 -04:00
filecache.h nfsd: convert file cache to use over/underflow safe refcount 2020-02-06 11:22:55 -05:00
flexfilelayout.c
flexfilelayoutxdr.c
flexfilelayoutxdr.h
idmap.h
Kconfig scsi: core: Rename CONFIG_BLK_SCSI_REQUEST to CONFIG_SCSI_COMMON 2021-07-28 22:24:27 -04:00
lockd.c Keep read and write fds with each nlm_file 2021-08-23 18:05:31 -04:00
Makefile nfsd: remove fault injection code 2020-09-25 18:01:26 -04:00
netns.h NFSD: delay unmount source's export after inter-server copy completed. 2021-05-25 17:06:51 -04:00
nfs2acl.c NFSD: Update the NFSv2 ACL ACCESS result encoder to use struct xdr_stream 2021-03-22 10:19:01 -04:00
nfs3acl.c nfsd: fix NULL dereference in nfs3svc_encode_getaclres 2021-07-06 20:14:44 -04:00
nfs3proc.c NFSD: Fix zero-length NFSv3 WRITEs 2022-03-08 19:12:33 +01:00
nfs3xdr.c NFSD: Have legacy NFSD WRITE decoders use xdr_stream_subsegment() 2022-03-08 19:12:33 +01:00
nfs4acl.c acl: handle idmapped mounts 2021-01-24 14:27:17 +01:00
nfs4callback.c nfsd: rpc_peeraddr2str needs rcu lock 2021-07-06 20:14:42 -04:00
nfs4idmap.c nfsd: Use seq_putc() in two functions 2020-07-13 17:28:46 -04:00
nfs4layouts.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
nfs4proc.c NFSD: Have legacy NFSD WRITE decoders use xdr_stream_subsegment() 2022-03-08 19:12:33 +01:00
nfs4recover.c nfsd: Fix nsfd startup race (again) 2021-12-14 10:57:14 +01:00
nfs4state.c nfsd: nfsd4_setclientid_confirm mistakenly expires confirmed client. 2022-02-08 18:34:11 +01:00
nfs4xdr.c NFSD: Fix the behavior of READ near OFFSET_MAX 2022-02-16 12:56:06 +01:00
nfscache.c nfsd: protect concurrent access to nfsd stats counters 2021-01-25 09:36:27 -05:00
nfsctl.c fsnotify: fix fsnotify hooks in pseudo filesystems 2022-02-01 17:27:01 +01:00
nfsd.h NFSD: delay unmount source's export after inter-server copy completed. 2021-05-25 17:06:51 -04:00
nfsfh.c NFSD: Update the GETATTR3res encoder to use struct xdr_stream 2021-03-22 10:18:51 -04:00
nfsfh.h NFSD: Constify @fh argument of knfsd_fh_hash() 2021-05-18 13:44:03 -04:00
nfsproc.c NFSD: Fix zero-length NFSv3 WRITEs 2022-03-08 19:12:33 +01:00
nfssvc.c NFSD: delay unmount source's export after inter-server copy completed. 2021-05-25 17:06:51 -04:00
nfsxdr.c NFSD: Have legacy NFSD WRITE decoders use xdr_stream_subsegment() 2022-03-08 19:12:33 +01:00
pnfs.h
state.h nfsd: track filehandle aliasing in nfs4_files 2021-04-19 16:41:36 -04:00
stats.c nfsd: protect concurrent access to nfsd stats counters 2021-01-25 09:36:27 -05:00
stats.h nfsd: report per-export stats 2021-01-25 09:36:28 -05:00
trace.c NFSD: Add SPDX header for fs/nfsd/trace.c 2020-11-30 13:00:24 -05:00
trace.h NFSD: Fix offset type in I/O trace points 2022-02-16 12:56:06 +01:00
vfs.c NFSD: Fix ia_size underflow 2022-02-16 12:56:06 +01:00
vfs.h NFSD: Update the NFSv3 ACCESS3res encoder to use struct xdr_stream 2021-03-22 10:18:52 -04:00
xdr.h NFSD: Have legacy NFSD WRITE decoders use xdr_stream_subsegment() 2022-03-08 19:12:33 +01:00
xdr3.h NFSD: Have legacy NFSD WRITE decoders use xdr_stream_subsegment() 2022-03-08 19:12:33 +01:00
xdr4.h NFSD add vfs_fsync after async copy is done 2021-05-25 17:06:51 -04:00
xdr4cb.h