From 9b32a74f4ef52d26d68ceb3f5e492d5eac26f5fc Mon Sep 17 00:00:00 2001 From: DaeMyung Kang Date: Tue, 13 Oct 2026 23:58:45 +0900 Subject: [PATCH] ntfs: report block device flush failures from fsync ntfs_file_fsync() calls blkdev_issue_flush() after writeback but discards its return value. If the device cannot flush its write cache, fsync() reports success even though the file is not guaranteed to be durable. Reproduce this with QEMU blkdebug failing flush_to_disk with -EIO. On ntfs-next at 04fb910da2c8, a kretprobe recorded -EIO from blkdev_issue_flush() while fsync() returned 0. With this change, fsync() returns -EIO and logs the failure. The syncfs() path already reports this error. Fixes: 9c87959601e8 ("ntfs: update file operations") Cc: stable@vger.kernel.org Signed-off-by: DaeMyung Kang Reviewed-by: Baolin Liu Signed-off-by: Namjae Jeon --- fs/ntfs/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index dafaeee6092b..0c83a0dbc981 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c @@ -417,14 +417,14 @@ int ntfs_file_fsync(struct file *filp, loff_t start, loff_t end, err = sync_blockdev(vi->i_sb->s_bdev); if (unlikely(err && !ret)) ret = err; + if (!ret) + ret = blkdev_issue_flush(vi->i_sb->s_bdev); if (likely(!ret)) ntfs_debug("Done."); else ntfs_warning(vi->i_sb, "Failed to f%ssync inode 0x%llx. Error %u.", datasync ? "data" : "", ni->mft_no, -ret); - if (!ret) - blkdev_issue_flush(vi->i_sb->s_bdev); return ret; }