]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ext4: fail unaligned direct IO write with EINVAL
authorJan Kara <jack@suse.cz>
Mon, 1 Sep 2025 11:27:40 +0000 (13:27 +0200)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 26 Sep 2025 12:36:08 +0000 (08:36 -0400)
commit963845748fe67125006859229487b45485564db7
treea6c2dec20ed7dec27469822232406073b843d520
parent46c22a8bb4cb03211da1100d7ee4a2005bf77c70
ext4: fail unaligned direct IO write with EINVAL

Commit bc264fea0f6f ("iomap: support incremental iomap_iter advances")
changed the error handling logic in iomap_iter(). Previously any error
from iomap_dio_bio_iter() got propagated to userspace, after this commit
if ->iomap_end returns error, it gets propagated to userspace instead of
an error from iomap_dio_bio_iter(). This results in unaligned writes to
ext4 to silently fallback to buffered IO instead of erroring out.

Now returning ENOTBLK for DIO writes from ext4_iomap_end() seems
unnecessary these days. It is enough to return ENOTBLK from
ext4_iomap_begin() when we don't support DIO write for that particular
file offset (due to hole).

Fixes: bc264fea0f6f ("iomap: support incremental iomap_iter advances")
Cc: stable@kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Message-ID: <20250901112739.32484-2-jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/inode.c