Bug 1814481 - Libvirt doesn't restore xattr labels when qemu crashes
Summary: Libvirt doesn't restore xattr labels when qemu crashes
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.0
Assignee: Michal Privoznik
QA Contact: Han Han
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-03-18 01:30 UTC by Han Han
Modified: 2020-11-17 17:48 UTC (History)
6 users (show)

Fixed In Version: libvirt-6.2.0-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-17 17:47:36 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)
The libvirtd log (1.15 MB, application/gzip)
2020-03-18 01:30 UTC, Han Han
no flags Details

Description Han Han 2020-03-18 01:30:39 UTC
Created attachment 1670981 [details]
The libvirtd log

Description of problem:
As subject

Version-Release number of selected component (if applicable):
qemu-kvm-4.2.0-15.module+el8.2.0+6029+618ef2ec.x86_64
libvirt-6.0.0-10.virtcov.el8.x86_64, libvirt upstream 008abeb03c

How reproducible:
100%

Steps to Reproduce:
1. Trigger https://bugzilla.redhat.com/show_bug.cgi?id=1812399
2. Start VM and attach the disk again:
➜   virsh attach-device pc disk.xml                                                
error: Failed to attach device from disk.xml
error: internal error: child reported (status=125): Requested operation is not valid: Setting different SELinux label on /tmp/disk-raw which is already in use

Actual results:
As subject

Expected results:
Disk attached

Additional info:
A related error happens when qemu crashes:
2020-03-17 09:22:52.405+0000: 396769: error : virProcessRunInFork:1200 : internal error: child reported (status=125): Kernel does not provide mount namespace: No such file or directory

Comment 1 Michal Privoznik 2020-03-18 17:33:26 UTC
Patches proposed upstream:

https://www.redhat.com/archives/libvir-list/2020-March/msg00652.html

Comment 2 Michal Privoznik 2020-03-20 16:22:07 UTC
I've just pushed patches upstream:

ea903036fa security: Try harder to run transactions
c799d150d5 virprocess: Passthru error from virProcessRunInForkHelper
ed8c503ae8 virfile: Handle directories in virFileBindMountDevice()
140036237e qemuDomainBuildNamespace: Make @devPath const
ca2edd678d qemuDomainBuildNamespace: Try harder to remove temp directories
6bc746d66d qemuDomainCreateDeviceRecursive: Report error if mkdir() fails

Comment 6 Han Han 2020-05-19 09:01:17 UTC
Test pass on libirt v6.3.0-107-gc0e04c2e62 qemu-kvm-5.0.0-0.module+el8.3.0+6620+5d5e1420.x86_64

Comment 7 gaojianan 2020-05-22 02:47:19 UTC
Verified at libvirt version:
libvirt-6.3.0-1.module+el8.3.0+6478+69f490bb.x86_64
qemu-kvm-5.0.0-0.module+el8.3.0+6620+5d5e1420.x86_64

Step:
1.Live attach/detach the disk in loop with disk xml:
<disk type="file" device="disk">
      <driver name="qemu" type="raw" cache="none" discard="ignore" io="native"/>
      <source file="/tmp/disk-raw">
      </source>
      <backingStore/>
      <target dev="sdb" bus="scsi"/>
    </disk>

2.Live attach/detach the disk in loop:
# while true;do virsh attach-device test1 attach.xml; virsh detach-device test1 attach.xml;done
Device attached successfully

Device detached successfully

Device attached successfully

Device detached successfully
......
error: Failed to attach device from attach.xml
error: Unable to read from monitor: Connection reset by peer

error: Failed to detach device from attach.xml
error: Requested operation is not valid: domain is not running

Vm crashed as expected.

3.Then attach and detach again:
# virsh attach-device test1 attach.xml 
Device attached successfully

# virsh detach-device test1 attach.xml 
Device detached successfully

No error occured,work as expected only for this bug.
So verified.

Comment 10 errata-xmlrpc 2020-11-17 17:47:36 UTC
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 (virt:8.3 bug fix and enhancement update), 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/RHBA-2020:5137


Note You need to log in before you can comment on or make changes to this bug.