mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
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: 9c87959601 ("ntfs: update file operations")
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
9365c4a135
commit
9b32a74f4e
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user