mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
ntfs: flush the block device when syncing a directory
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: 1e9ea7e044 ("Revert "fs: Remove NTFS classic"")
Cc: stable@vger.kernel.org
Signed-off-by: DaeMyung Kang <charsyam@gmail.com>
Reviewed-by: Baolin Liu <liubaolin@kylinos.cn>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
parent
9b32a74f4e
commit
569f514f0e
|
|
@ -1192,6 +1192,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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user