7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: DaeMyung Kang [ Upstream commit 569f514f0ec74c4162241e10b7893bff109f8aca ] ntfs_dir_fsync() writes directory metadata and calls sync_blockdev(), but does not flush the block device write cache. A successful fsync() can therefore leave the directory's metadata in a volatile device cache. Issue a cache flush after successful writeback and return any flush error. This matches the regular-file fsync and syncfs paths. With QEMU blkdebug injecting -EIO for flush_to_disk, fsync() on an NTFS directory returned 0 before this change while syncfs() returned -EIO. After this change, both return -EIO. A kretprobe confirmed the flush error in the directory fsync path. Fixes: 1e9ea7e04472 ("Revert "fs: Remove NTFS classic"") Cc: stable@vger.kernel.org Signed-off-by: DaeMyung Kang Reviewed-by: Baolin Liu Signed-off-by: Namjae Jeon Signed-off-by: Sasha Levin --- fs/ntfs/dir.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/ntfs/dir.c b/fs/ntfs/dir.c index df60138f9b2d3..09b890b41c4a9 100644 --- a/fs/ntfs/dir.c +++ b/fs/ntfs/dir.c @@ -1182,6 +1182,8 @@ static int ntfs_dir_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 -- 2.53.0