qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2 1/2] block/raw-posix: Fix disk corruption in try_


From: Tony Breeds
Subject: [Qemu-devel] [PATCH v2 1/2] block/raw-posix: Fix disk corruption in try_fiemap
Date: Fri, 26 Sep 2014 09:14:11 +1000

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 <address@hidden>
Signed-off-by: Tony Breeds <address@hidden>
Cc: Kevin Wolf <address@hidden>
Cc: Markus Armbruster <address@hidden>
Cc: Stefan Hajnoczi <address@hidden>
Cc: Max Reitz <address@hidden>
Cc: Pádraig Brady <address@hidden>
Cc: Eric Blake <address@hidden>
---
Changes since v1:
 - split in to 2 patches
 - tried to make the commit messages better

 block/raw-posix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/raw-posix.c b/block/raw-posix.c
index a253697..b8203e9 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -1472,7 +1472,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) {
-- 
1.9.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]