linux/fs/ext2
Danila Chernetsov a4659be0bc ext2: fix ignored return value of generic_write_sync()
Fix ext2_dio_write_iter() to propagate the error returned by
generic_write_sync() instead of silently discarding it, which could
cause write(2) to return success to userspace on O_SYNC/O_DSYNC files
even when the sync failed.

The correct pattern, already used in ext2_dax_write_iter() in the same
file and in ext4, xfs, f2fs among others, is:
    if (ret > 0)
        ret = generic_write_sync(iocb, ret);

Found by Linux Verification Center (linuxtesting.org) with SVACE.

[JK: Reflect also filemap_write_and_wait() return value]

Fixes: fb5de4358e ("ext2: Move direct-io to use iomap")
Signed-off-by: Danila Chernetsov <listdansp@mail.ru>
Link: https://patch.msgid.link/20260530122311.136803-1-listdansp@mail.ru
Signed-off-by: Jan Kara <jack@suse.cz>
2026-06-02 10:56:16 +02:00
..
acl.c
acl.h
balloc.c ext2: guard reservation window dump with EXT2FS_DEBUG 2026-02-27 12:16:07 +01:00
dir.c treewide: change inode->i_ino from unsigned long to u64 2026-03-06 14:31:28 +01:00
ext2.h ext2: Remove deprecated DAX support 2026-06-01 11:20:52 +02:00
file.c ext2: fix ignored return value of generic_write_sync() 2026-06-02 10:56:16 +02:00
ialloc.c treewide: change inode->i_ino from unsigned long to u64 2026-03-06 14:31:28 +01:00
inode.c ext2: Remove deprecated DAX support 2026-06-01 11:20:52 +02:00
ioctl.c tree-wide: s/struct fileattr/struct file_kattr/g 2025-07-04 16:14:39 +02:00
Kconfig
Makefile
namei.c ext2: avoid drop_nlink() during unlink of zero-nlink inode in ext2_unlink() 2026-02-27 12:17:52 +01:00
super.c ext2: Remove deprecated DAX support 2026-06-01 11:20:52 +02:00
symlink.c
trace.c
trace.h ext2: widen trace event i_ino fields to u64 2026-03-06 14:31:27 +01:00
xattr_security.c
xattr_trusted.c
xattr_user.c
xattr.c treewide: fix missed i_ino format specifier conversions 2026-03-06 14:31:30 +01:00
xattr.h