linux-yocto/fs/iomap
Jan Kara 86de3aaf29 iomap: Fix broken data integrity guarantees for O_SYNC writes
commit 6b65028e2b51c023a816eabffea88980fdd5564e upstream.

Commit d279c80e0b ("iomap: inline iomap_dio_bio_opflags()") has broken
the logic in iomap_dio_bio_iter() in a way that when the device does
support FUA (or has no writeback cache) and the direct IO happens to
freshly allocated or unwritten extents, we will *not* issue fsync after
completing direct IO O_SYNC / O_DSYNC write because the
IOMAP_DIO_WRITE_THROUGH flag stays mistakenly set. Fix the problem by
clearing IOMAP_DIO_WRITE_THROUGH whenever we do not perform FUA write as
it was originally intended.

CC: John Garry <john.g.garry@oracle.com>
CC: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Fixes: d279c80e0b ("iomap: inline iomap_dio_bio_opflags()")
CC: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/20250730102840.20470-2-jack@suse.cz
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-08-28 16:34:25 +02:00
..
buffered-io.c iomap: avoid unnecessary ifs_set_range_uptodate() with locks 2025-07-11 11:42:44 +02:00
direct-io.c iomap: Fix broken data integrity guarantees for O_SYNC writes 2025-08-28 16:34:25 +02:00
fiemap.c iomap: introduce a full map advance helper 2025-02-26 09:42:37 +01:00
internal.h iomap: optionally use ioends for direct I/O 2025-02-06 13:02:14 +01:00
ioend.c iomap: add a io_private field to struct iomap_ioend 2025-02-06 13:02:15 +01:00
iter.c iomap: rename iomap_iter processed field to status 2025-02-26 09:42:37 +01:00
Makefile iomap: split bios to zone append limits in the submission handlers 2025-02-06 13:02:14 +01:00
seek.c iomap: rename iomap_iter processed field to status 2025-02-26 09:42:37 +01:00
swapfile.c iomap: introduce a full map advance helper 2025-02-26 09:42:37 +01:00
trace.c iomap: Add DIO tracepoints 2023-04-21 08:54:47 -07:00
trace.h iomap: trace: Add missing flags to [IOMAP_|IOMAP_F_]FLAGS_STRINGS 2025-04-15 10:30:49 +02:00