linux/fs/nfsd
Chuck Lever 0cb4d23ae0 NFSD: Fix the behavior of READ near OFFSET_MAX
Dan Aloni reports:
> Due to commit 8cfb901528 ("NFS: Always provide aligned buffers to
> the RPC read layers") on the client, a read of 0xfff is aligned up
> to server rsize of 0x1000.
>
> As a result, in a test where the server has a file of size
> 0x7fffffffffffffff, and the client tries to read from the offset
> 0x7ffffffffffff000, the read causes loff_t overflow in the server
> and it returns an NFS code of EINVAL to the client. The client as
> a result indefinitely retries the request.

The Linux NFS client does not handle NFS?ERR_INVAL, even though all
NFS specifications permit servers to return that status code for a
READ.

Instead of NFS?ERR_INVAL, have out-of-range READ requests succeed
and return a short result. Set the EOF flag in the result to prevent
the client from retrying the READ request. This behavior appears to
be consistent with Solaris NFS servers.

Note that NFSv3 and NFSv4 use u64 offset values on the wire. These
must be converted to loff_t internally before use -- an implicit
type cast is not adequate for this purpose. Otherwise VFS checks
against sb->s_maxbytes do not work properly.

Reported-by: Dan Aloni <dan.aloni@vastdata.com>
Cc: stable@vger.kernel.org
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2022-02-09 09:22:34 -05:00
..
acl.h nfsd: eliminate an unnecessary acl size limit 2019-08-28 21:13:45 -04:00
auth.c
auth.h
blocklayout.c nfsd/blocklayout: use ->get_unique_id instead of sending SCSI commands 2021-10-22 08:33:57 -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 nfsd: no need to check return value of debugfs_create functions 2019-07-03 16:57:17 +02:00
filecache.c NFSD: Rename boot verifier functions 2022-01-08 14:42:02 -05:00
filecache.h nfsd: Replace use of rwsem with errseq_t 2022-01-08 14:42:02 -05:00
flexfilelayout.c NFSD: simplify struct nfsfh 2021-10-02 15:51:10 -04:00
flexfilelayoutxdr.c
flexfilelayoutxdr.h
idmap.h
Kconfig nfsd/blocklayout: use ->get_unique_id instead of sending SCSI commands 2021-10-22 08:33:57 -06:00
lockd.c NFSD: simplify struct nfsfh 2021-10-02 15:51:10 -04:00
Makefile nfsd: remove fault injection code 2020-09-25 18:01:26 -04:00
netns.h NFSD: Rename boot verifier functions 2022-01-08 14:42:02 -05:00
nfs2acl.c SUNRPC: Change return value type of .pc_encode 2021-10-13 11:34:49 -04:00
nfs3acl.c SUNRPC: Change return value type of .pc_encode 2021-10-13 11:34:49 -04:00
nfs3proc.c NFSD: Fix the behavior of READ near OFFSET_MAX 2022-02-09 09:22:34 -05:00
nfs3xdr.c NFSD: Move fill_pre_wcc() and fill_post_wcc() 2022-01-08 14:42:03 -05:00
nfs4acl.c acl: handle idmapped mounts 2021-01-24 14:27:17 +01:00
nfs4callback.c NFSD: simplify struct nfsfh 2021-10-02 15:51:10 -04:00
nfs4idmap.c nfsd: Use seq_putc() in two functions 2020-07-13 17:28:46 -04:00
nfs4layouts.c nfsd/blocklayout: use ->get_unique_id instead of sending SCSI commands 2021-10-22 08:33:57 -06:00
nfs4proc.c NFSD: Fix the behavior of READ near OFFSET_MAX 2022-02-09 09:22:34 -05:00
nfs4recover.c nfsd: Fix nsfd startup race (again) 2021-12-10 11:54:59 -05:00
nfs4state.c nfsd: nfsd4_setclientid_confirm mistakenly expires confirmed client. 2022-01-28 09:04:00 -05:00
nfs4xdr.c NFSD: Fix the behavior of READ near OFFSET_MAX 2022-02-09 09:22:34 -05:00
nfscache.c NFSD: Remove be32_to_cpu() from DRC hash function 2021-12-13 13:42:59 -05:00
nfsctl.c NFSD: Clean up the nfsd_net::nfssvc_boot field 2022-01-08 14:42:02 -05:00
nfsd.h SUNRPC/NFSD: clean up get/put functions. 2021-12-13 13:42:50 -05:00
nfsfh.c NFSD: Move fill_pre_wcc() and fill_post_wcc() 2022-01-08 14:42:03 -05:00
nfsfh.h NFSD: Move fill_pre_wcc() and fill_post_wcc() 2022-01-08 14:42:03 -05:00
nfsproc.c nfsd: Retry once in nfsd_open on an -EOPENSTALE return 2022-01-08 14:42:02 -05:00
nfssvc.c NFSD: Rename boot verifier functions 2022-01-08 14:42:02 -05:00
nfsxdr.c SUNRPC: Change return value type of .pc_encode 2021-10-13 11:34:49 -04:00
pnfs.h
state.h nfsd4: add refcount for nfsd4_blocked_lock 2022-01-08 14:42:01 -05:00
stats.c nfsd: make nfsd_stats.th_cnt atomic_t 2021-12-13 13:42:51 -05:00
stats.h nfsd: make nfsd_stats.th_cnt atomic_t 2021-12-13 13:42:51 -05:00
trace.c NFSD: Add SPDX header for fs/nfsd/trace.c 2020-11-30 13:00:24 -05:00
trace.h NFSD: Trace boot verifier resets 2022-01-08 14:42:03 -05:00
vfs.c NFSD: Move fill_pre_wcc() and fill_post_wcc() 2022-01-08 14:42:03 -05:00
vfs.h nfsd: Add a tracepoint for errors in nfsd4_clone_file_range() 2022-01-08 14:42:02 -05:00
xdr3.h SUNRPC: Change return value type of .pc_encode 2021-10-13 11:34:49 -04:00
xdr4.h SUNRPC: Change return value type of .pc_encode 2021-10-13 11:34:49 -04:00
xdr4cb.h NFSD CB_OFFLOAD xdr 2018-09-25 20:34:54 -04:00
xdr.h SUNRPC: Change return value type of .pc_encode 2021-10-13 11:34:49 -04:00