yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
ae23c9
From f864b6b5b9dd5bc7c853c002657d8497d285cee4 Mon Sep 17 00:00:00 2001
ae23c9
From: Fam Zheng <famz@redhat.com>
ae23c9
Date: Fri, 28 Sep 2018 06:09:52 +0100
ae23c9
Subject: [PATCH 1/3] luks: Allow share-rw=on
ae23c9
MIME-Version: 1.0
ae23c9
Content-Type: text/plain; charset=UTF-8
ae23c9
Content-Transfer-Encoding: 8bit
ae23c9
ae23c9
RH-Author: Fam Zheng <famz@redhat.com>
ae23c9
Message-id: <20180928060952.8616-2-famz@redhat.com>
ae23c9
Patchwork-id: 82311
ae23c9
O-Subject: [RHEL8/rhel qemu-kvm PATCH 1/1] luks: Allow share-rw=on
ae23c9
Bugzilla: 1629701
ae23c9
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
ae23c9
RH-Acked-by: John Snow <jsnow@redhat.com>
ae23c9
RH-Acked-by: Thomas Huth <thuth@redhat.com>
ae23c9
ae23c9
Format drivers such as qcow2 don't allow sharing the same image between
ae23c9
two QEMU instances in order to prevent image corruptions, because of
ae23c9
metadata cache. LUKS driver don't modify metadata except for when
ae23c9
creating image, so it is safe to relax the permission. This makes
ae23c9
share-rw=on property work on virtual devices.
ae23c9
ae23c9
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
ae23c9
Signed-off-by: Fam Zheng <famz@redhat.com>
ae23c9
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
ae23c9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ae23c9
(cherry picked from commit 497da8236ab2663a8108858ba7ea59aac21c5fe6)
ae23c9
Signed-off-by: Fam Zheng <famz@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 block/crypto.c | 4 +++-
ae23c9
 1 file changed, 3 insertions(+), 1 deletion(-)
ae23c9
ae23c9
diff --git a/block/crypto.c b/block/crypto.c
ae23c9
index 02f04f3..0bb0db6 100644
ae23c9
--- a/block/crypto.c
ae23c9
+++ b/block/crypto.c
ae23c9
@@ -698,7 +698,9 @@ BlockDriver bdrv_crypto_luks = {
ae23c9
     .bdrv_probe         = block_crypto_probe_luks,
ae23c9
     .bdrv_open          = block_crypto_open_luks,
ae23c9
     .bdrv_close         = block_crypto_close,
ae23c9
-    .bdrv_child_perm    = bdrv_format_default_perms,
ae23c9
+    /* This driver doesn't modify LUKS metadata except when creating image.
ae23c9
+     * Allow share-rw=on as a special case. */
ae23c9
+    .bdrv_child_perm    = bdrv_filter_default_perms,
ae23c9
     .bdrv_co_create     = block_crypto_co_create_luks,
ae23c9
     .bdrv_co_create_opts = block_crypto_co_create_opts_luks,
ae23c9
     .bdrv_co_truncate   = block_crypto_co_truncate,
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9