Files
kernel-sophgo-sg2044-revyos…/fs/nfs
Mike Snitzer a97bf1a0cd nfs/localio: avoid issuing misaligned IO using O_DIRECT
[ Upstream commit 25ba2b84c38f624151a3ba36e56d41c39b9223ad ]

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>
2025-10-15 12:04:13 +02:00
..
2024-09-23 15:03:13 -04:00
2024-09-23 15:03:30 -04:00
2025-07-14 15:20:02 -07:00
2024-11-08 14:17:37 -05:00
2025-06-10 22:21:16 -04:00
2025-05-15 12:14:29 +02:00
2025-05-28 17:17:13 -04:00