mirror of
https://github.com/utmapp/qemu.git
synced 2026-12-01 22:23:23 -10:00
block/raw-posix: Fix disk corruption in try_fiemap
Using fiemap without FIEMAP_FLAG_SYNC is a known corrupter. Add the FIEMAP_FLAG_SYNC flag to the FS_IOC_FIEMAP ioctl. This has the downside of significantly reducing performance. Reported-By: Michael Steffens <[email protected]> Signed-off-by: Tony Breeds <[email protected]> Cc: Kevin Wolf <[email protected]> Cc: Markus Armbruster <[email protected]> Cc: Stefan Hajnoczi <[email protected]> Cc: Max Reitz <[email protected]> Cc: Pádraig Brady <[email protected]> Cc: Eric Blake <[email protected]> Reviewed-by: Eric Blake <[email protected]> Reviewed-by: Max Reitz <[email protected]> Signed-off-by: Kevin Wolf <[email protected]>
This commit is contained in:
1 parent
d8bb71b622
commit
38c4d0aea3
1 file changed
+1
-1
+1
-1
@@ -1482,7 +1482,7 @@ static int64_t try_fiemap(BlockDriverState *bs, off_t start, off_t *data,
|
||||
|
||||
f.fm.fm_start = start;
|
||||
f.fm.fm_length = (int64_t)nb_sectors * BDRV_SECTOR_SIZE;
|
||||
f.fm.fm_flags = 0;
|
||||
f.fm.fm_flags = FIEMAP_FLAG_SYNC;
|
||||
f.fm.fm_extent_count = 1;
|
||||
f.fm.fm_reserved = 0;
|
||||
if (ioctl(s->fd, FS_IOC_FIEMAP, &f) == -1) {
|
||||
|
||||
Reference in new issue
Block a user