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