linux/fs/nfsd
Mike Snitzer a97bf1a0cd nfs/localio: avoid issuing misaligned IO using O_DIRECT
[ Upstream commit 25ba2b84c3 ]

Add nfsd_file_dio_alignment and use it to avoid issuing misaligned IO
using O_DIRECT. Any misaligned DIO falls back to using buffered IO.

Because misaligned DIO is now handled safely, remove the nfs modparam
'localio_O_DIRECT_semantics' that was added to require users opt-in to
the requirement that all O_DIRECT be properly DIO-aligned.

Also, introduce nfs_iov_iter_aligned_bvec() which is a variant of
iov_iter_aligned_bvec() that also verifies the offset associated with
an iov_iter is DIO-aligned.  NOTE: in a parallel effort,
iov_iter_aligned_bvec() is being removed along with
iov_iter_is_aligned().

Lastly, add pr_info_ratelimited if underlying filesystem returns
-EINVAL because it was made to try O_DIRECT for IO that is not
DIO-aligned (shouldn't happen, so its best to be louder if it does).

Fixes: 3feec68563 ("nfs/localio: add direct IO enablement with sync and async IO support")
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-10-15 12:04:13 +02:00
..
acl.h NFSD: add posix ACLs to struct nfsd_attrs 2022-08-04 10:28:03 -04:00
auth.c nfsd: avoid pointless cred reference count bump 2024-12-02 11:25:14 +01:00
auth.h nfsd: Pass 'cred' instead of 'rqstp' to some functions. 2024-09-20 19:31:03 -04:00
blocklayout.c nfsd: Use correct error code when decoding extents 2025-07-14 12:46:41 -04:00
blocklayoutxdr.c nfsd: Drop dprintk in blocklayout xdr functions 2025-07-14 12:46:50 -04:00
blocklayoutxdr.h nfsd: Use correct error code when decoding extents 2025-07-14 12:46:41 -04:00
cache.h nfsd: don't allocate the versions array. 2024-09-20 19:29:23 -04:00
current_stateid.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
debugfs.c NFSD: Add experimental setting to disable the use of splice read 2025-05-11 19:48:24 -04:00
export.c nfsd: Change the type of ek_fsidtype from int to u8 and use kstrtou8 2025-07-14 12:46:39 -04:00
export.h nfsd: Change the type of ek_fsidtype from int to u8 and use kstrtou8 2025-07-14 12:46:39 -04:00
filecache.c NFSD: filecache: add STATX_DIOALIGN and STATX_DIO_READ_ALIGN support 2025-10-15 12:04:13 +02:00
filecache.h NFSD: filecache: add STATX_DIOALIGN and STATX_DIO_READ_ALIGN support 2025-10-15 12:04:13 +02:00
flexfilelayout.c nfsd: move nfserrno() to vfs.c 2022-11-28 12:54:44 -05:00
flexfilelayoutxdr.c NFSD: Make @gdev parameter of ->encode_getdeviceinfo a const pointer 2023-10-16 12:44:29 -04:00
flexfilelayoutxdr.h NFSD: Make @gdev parameter of ->encode_getdeviceinfo a const pointer 2023-10-16 12:44:29 -04:00
idmap.h nfsd: Remove duplicate define of IDMAP_NAMESZ/IDMAP_TYPE_xx 2015-07-20 14:58:46 -04:00
Kconfig nfsd: use SHA-256 library API instead of crypto_shash API 2025-05-11 19:48:29 -04:00
localio.c nfs/localio: avoid issuing misaligned IO using O_DIRECT 2025-10-15 12:04:13 +02:00
lockd.c nfsd: refine and rename NFSD_MAY_LOCK 2024-11-18 20:23:00 -05:00
Makefile NFSD: Add /sys/kernel/debug/nfsd 2025-05-11 19:48:23 -04:00
netlink.c nfsd: new netlink ops to get/set server pool_mode 2024-07-08 14:10:05 -04:00
netlink.h nfsd: new netlink ops to get/set server pool_mode 2024-07-08 14:10:05 -04:00
netns.h NFS Client Updates for Linux 6.14 2025-01-28 14:23:46 -08:00
nfs2acl.c nfsd: clear acl_access/acl_default after releasing them 2025-02-02 11:31:45 -05:00
nfs3acl.c nfsd: clear acl_access/acl_default after releasing them 2025-02-02 11:31:45 -05:00
nfs3proc.c sunrpc: simplify xdr_init_encode_pages 2025-07-14 12:46:37 -04:00
nfs3xdr.c nfsd: Use lookup_one() rather than lookup_one_len() 2025-04-07 09:25:32 +02:00
nfs4acl.c NFSD: Remove unnecessary posix_acl_entry pointer initialization 2024-11-11 13:41:58 -05:00
nfs4callback.c NFSD: Avoid corruption of a referring call list 2025-06-12 20:37:32 -04:00
nfs4idmap.c nfsd: call cache_put if xdr_reserve_space returns NULL 2024-09-20 19:31:03 -04:00
nfs4layouts.c NFSD: Access a knfsd_fh's fsid by pointer 2025-07-14 12:46:46 -04:00
nfs4proc.c Revert "NFSD: Force all NFSv4.2 COPY requests to be synchronous" 2025-07-14 12:46:46 -04:00
nfs4recover.c rpc_mkpipe_dentry(): saner calling conventions 2025-07-02 22:44:55 -04:00
nfs4state.c NFSD: Remove the cap on number of operations per NFSv4 COMPOUND 2025-07-14 12:46:41 -04:00
nfs4xdr.c NFSD: Remove the cap on number of operations per NFSv4 COMPOUND 2025-07-14 12:46:41 -04:00
nfs4xdr_gen.c nfsd: rename NFS4_SHARE_WANT_* constants to OPEN4_SHARE_ACCESS_WANT_* 2025-01-21 15:30:01 -05:00
nfs4xdr_gen.h nfsd: rename NFS4_SHARE_WANT_* constants to OPEN4_SHARE_ACCESS_WANT_* 2025-01-21 15:30:01 -05:00
nfscache.c nfsd: Simplify the allocation of slab caches in nfsd_drc_slab_create 2024-03-01 09:12:24 -05:00
nfsctl.c Networking changes for 6.17. 2025-07-30 08:58:55 -07:00
nfsd.h nfsd: Use correct error code when decoding extents 2025-07-14 12:46:41 -04:00
nfsfh.c NFSD: Access a knfsd_fh's fsid by pointer 2025-07-14 12:46:46 -04:00
nfsfh.h NFSD: Simplify struct knfsd_fh 2025-07-14 12:46:47 -04:00
nfsproc.c sunrpc: simplify xdr_init_encode_pages 2025-07-14 12:46:37 -04:00
nfssvc.c NFSD: Add a "default" block size 2025-05-15 16:16:28 -04:00
nfsxdr.c NFSD: Remove NFSSVC_MAXBLKSIZE_V2 macro 2025-05-15 16:16:28 -04:00
pnfs.h nfsd: allow layout state to be admin-revoked. 2024-03-01 09:12:22 -05:00
state.h NFSD: release read access of nfs4_file when a write delegation is returned 2025-07-14 12:46:36 -04:00
stats.c nfsd: don't ignore the return code of svc_proc_register() 2025-03-10 09:10:59 -04:00
stats.h nfsd: don't ignore the return code of svc_proc_register() 2025-03-10 09:10:59 -04:00
trace.c NFSD: Add SPDX header for fs/nfsd/trace.c 2020-11-30 13:00:24 -05:00
trace.h NFSD: filecache: add STATX_DIOALIGN and STATX_DIO_READ_ALIGN support 2025-10-15 12:04:13 +02:00
vfs.c nfsd-6.17 fixes: 2025-08-11 07:38:55 -07:00
vfs.h NFSD: filecache: add STATX_DIOALIGN and STATX_DIO_READ_ALIGN support 2025-10-15 12:04:13 +02:00
xdr.h NFSD: prevent underflow in nfssvc_decode_writeargs() 2022-03-15 09:35:56 -04:00
xdr3.h nfsd: Fix NFSv3 atomicity bugs in nfsd_setattr() 2024-03-01 09:12:33 -05:00
xdr4.h NFSD: Remove the cap on number of operations per NFSv4 COMPOUND 2025-07-14 12:46:41 -04:00
xdr4cb.h NFSD: Implement CB_SEQUENCE referring call lists 2025-05-11 19:48:20 -04:00