yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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