aboutsummaryrefslogtreecommitdiff
path: root/block/crypto.c
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2018-08-14 15:25:51 +0800
committerKevin Wolf <kwolf@redhat.com>2018-08-15 12:50:39 +0200
commit497da8236ab2663a8108858ba7ea59aac21c5fe6 (patch)
tree47f46c340b10a95cc696004a34794abb89794991 /block/crypto.c
parent25b8e4db7f3baca47244ccd945eb62b32a6e2019 (diff)
luks: Allow share-rw=on
Format drivers such as qcow2 don't allow sharing the same image between two QEMU instances in order to prevent image corruptions, because of metadata cache. LUKS driver don't modify metadata except for when creating image, so it is safe to relax the permission. This makes share-rw=on property work on virtual devices. Suggested-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/crypto.c')
-rw-r--r--block/crypto.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/block/crypto.c b/block/crypto.c
index 146d81c90a..33ee01bebd 100644
--- a/block/crypto.c
+++ b/block/crypto.c
@@ -627,7 +627,9 @@ BlockDriver bdrv_crypto_luks = {
.bdrv_probe = block_crypto_probe_luks,
.bdrv_open = block_crypto_open_luks,
.bdrv_close = block_crypto_close,
- .bdrv_child_perm = bdrv_format_default_perms,
+ /* This driver doesn't modify LUKS metadata except when creating image.
+ * Allow share-rw=on as a special case. */
+ .bdrv_child_perm = bdrv_filter_default_perms,
.bdrv_co_create = block_crypto_co_create_luks,
.bdrv_co_create_opts = block_crypto_co_create_opts_luks,
.bdrv_co_truncate = block_crypto_co_truncate,