Blame SOURCES/kvm-block-raw-posix-Fix-disk-corruption-in-try_fiemap.patch

958e1b
From 87fe4805dfc783c221090d90ded9c01a8a7e6535 Mon Sep 17 00:00:00 2001
09b1b5
From: Max Reitz <mreitz@redhat.com>
09b1b5
Date: Tue, 18 Nov 2014 15:30:15 +0100
958e1b
Subject: [PATCH 36/41] block/raw-posix: Fix disk corruption in try_fiemap
09b1b5
MIME-Version: 1.0
09b1b5
Content-Type: text/plain; charset=UTF-8
09b1b5
Content-Transfer-Encoding: 8bit
09b1b5
09b1b5
Message-id: <1416324620-16229-3-git-send-email-mreitz@redhat.com>
09b1b5
Patchwork-id: 62437
09b1b5
O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH v3 2/7] block/raw-posix: Fix disk corruption in try_fiemap
958e1b
Bugzilla: 1160237
09b1b5
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
09b1b5
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
09b1b5
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
09b1b5
09b1b5
From: Tony Breeds <tony@bakeyournoodle.com>
09b1b5
09b1b5
Using fiemap without FIEMAP_FLAG_SYNC is a known corrupter.
09b1b5
09b1b5
Add the FIEMAP_FLAG_SYNC flag to the FS_IOC_FIEMAP ioctl.  This has
09b1b5
the downside of significantly reducing performance.
09b1b5
09b1b5
Reported-By: Michael Steffens <michael_steffens@posteo.de>
09b1b5
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
09b1b5
Cc: Kevin Wolf <kwolf@redhat.com>
09b1b5
Cc: Markus Armbruster <armbru@redhat.com>
09b1b5
Cc: Stefan Hajnoczi <stefanha@redhat.com>
09b1b5
Cc: Max Reitz <mreitz@redhat.com>
09b1b5
Cc: Pádraig Brady <pbrady@redhat.com>
09b1b5
Cc: Eric Blake <eblake@redhat.com>
09b1b5
Reviewed-by: Eric Blake <eblake@redhat.com>
09b1b5
Reviewed-by: Max Reitz <mreitz@redhat.com>
09b1b5
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
09b1b5
(cherry picked from commit 38c4d0aea3e1264c86e282d99560330adf2b6e25)
09b1b5
09b1b5
Signed-off-by: Max Reitz <mreitz@redhat.com>
09b1b5
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
09b1b5
---
09b1b5
 block/raw-posix.c | 2 +-
09b1b5
 1 file changed, 1 insertion(+), 1 deletion(-)
09b1b5
09b1b5
diff --git a/block/raw-posix.c b/block/raw-posix.c
958e1b
index 5f57412..8d31628 100644
09b1b5
--- a/block/raw-posix.c
09b1b5
+++ b/block/raw-posix.c
958e1b
@@ -1325,7 +1325,7 @@ static int64_t try_fiemap(BlockDriverState *bs, off_t start, off_t *data,
09b1b5
 
09b1b5
     f.fm.fm_start = start;
09b1b5
     f.fm.fm_length = (int64_t)nb_sectors * BDRV_SECTOR_SIZE;
09b1b5
-    f.fm.fm_flags = 0;
09b1b5
+    f.fm.fm_flags = FIEMAP_FLAG_SYNC;
09b1b5
     f.fm.fm_extent_count = 1;
09b1b5
     f.fm.fm_reserved = 0;
09b1b5
     if (ioctl(s->fd, FS_IOC_FIEMAP, &f) == -1) {
09b1b5
-- 
09b1b5
1.8.3.1
09b1b5