Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
2 VMs can not boot at the same time with 'share-rw=on' for the same luks format image.
Version-Release number of selected component (if applicable):
Host:
kernel-3.10.0-915.el7.x86_64
qemu-kvm-rhev-2.12.0-6.el7
Guest:
kernel-3.10.0-862.el7.x86_64
How reproducible:
100%
Steps to Reproduce:
1. create luks format disk and install guest
# qemu-img create -f luks --object secret,id=sec0,data=`printf %s "redhat" |base64`,format=base64 -o key-secret=sec0 system.luks 20G
2. boot guest with share-rw=on
/usr/libexec/qemu-kvm \
-cpu host \
-rtc base=localtime,clock=host,driftfix=slew \
-M pc-i440fx-rhel7.5.0 \
-enable-kvm \
-name rhel7.5 \
-smp 4,cores=2,threads=1,sockets=2 \
-m 4G \
-uuid c944829b-9aa0-46a2-b3d0-493c135da24d \
-boot menu=on \
-object iothread,id=iothread0 \
-object secret,id=sec0,data=`printf %s "redhat" |base64`,format=base64 \
-device virtio-scsi-pci,id=scsi0,addr=0x3,iothread=iothread0 \
-drive format=luks,key-secret=sec0,file=/home/system.luks,id=drive_sysdisk,if=none,werror=stop,rerror=stop \
-device scsi-hd,drive=drive_sysdisk,bootindex=0,share-rw=on \
-device virtio-net-pci,mac=fa:f7:f8:5f:fa:5b,id=idn0VnaA,vectors=4,netdev=id8xJhp7,bus=pci.0,addr=06 \
-netdev tap,id=id8xJhp7,vhost=on \
-monitor stdio \
-usb \
-vnc :0 \
3. boot the guest with share-rw=on again.
Actual results:
after step 2, guest boot up normally.
after step 3, guest can not boot up.
qemu-kvm: -drive format=luks,key-secret=sec0,file=/home/system.luks,id=drive_sysdisk,if=none,werror=stop,rerror=stop: Failed to get "write" lock
Is another process using the image?
Expected results:
two guest can boot up at the same time.
Additional info:
Tested with luks format on RHEL7.5 also hit this issue.
Host:
kernel-3.10.0-862.el7.x86_64
qemu-kvm-rhev-2.10.0-21.el7_5.4
Guest:
kernel-3.10.0-862.el7.x86_64
Tested with raw format, works well.
Re-opening, as there is no reason why sharing could not be made to work. LUKS is a format driver, but all the metadata in the LUKS header region is readonly, at least by default. So it is reasonable to expect to be able to have multiple writers, provided the driver beneath lucks supports it.
In the future, we will allow some live changes to the header regions, such as adding/removing key slots. In such a cases, we would need to require exclusive access during those operations, but that shouldn't block sharing during normal use.
Dan, does that mean if I use "locking=off" on the "driver beneath luks", it is guaranteed safe to write to the image from two VMs, and no corruption can happen with today's QEMU luks driver? Or is there additional work needed on the driver to handle concurrent writes?
Yes, /at this point in time/ it should be safe to use locking=off on the driver beneath luks.
This will change when we later provide the ability to update keyslots on the fly, but we can worry about that when we get there.
Addressed by below commit from QEMU 3.1:
commit 497da8236ab2663a8108858ba7ea59aac21c5fe6
Author: Fam Zheng <famz>
Date: Tue Aug 14 15:25:51 2018 +0800
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>
Signed-off-by: Fam Zheng <famz>
Reviewed-by: Daniel P. Berrangé <berrange>
Signed-off-by: Kevin Wolf <kwolf>
(In reply to Fam Zheng from comment #7)
> Addressed by below commit from QEMU 3.1:
>
> commit 497da8236ab2663a8108858ba7ea59aac21c5fe6
> Author: Fam Zheng <famz>
> Date: Tue Aug 14 15:25:51 2018 +0800
>
> 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>
> Signed-off-by: Fam Zheng <famz>
> Reviewed-by: Daniel P. Berrangé <berrange>
> Signed-off-by: Kevin Wolf <kwolf>
Pending backport.
Comment 12Miroslav Rezanina
2019-02-05 17:08:15 UTC
According to steps mentioned in Description, tested on qemu-kvm-rhev-2.12.0-22.el7, not hit this issue. So set status to VERIFIED.
Versions:
kernel-3.10.0-991.el7.x86_64
qemu-kvm-rhev-2.12.0-22.el7
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHSA-2019:2553