]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Forcibly mknod() even if it exists
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 8 Nov 2019 08:41:35 +0000 (09:41 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 20 Nov 2019 13:05:37 +0000 (14:05 +0100)
commitcdd8a6690ee3fa4b4b8ca1d4531924bd33be136a
treee043064407d4832e438bb008c2ee420b62f83874
parent73197f980399ba904a31983fb3938345f3691a89
qemu: Forcibly mknod() even if it exists

Another weird bug appeared concerning qemu namespaces. Basically
the problem is as follows:

1) Issue an API that causes libvirt to create a node in domain's
   namespace, say /dev/nvme0n1 with 8:0 as major:minor (the API can
   be attach-disk for instance). Or simply create the node from a
   console by hand.

2) Detach the disk from qemu.

3) Do something that makes /dev/nvme0n1 change it's minor number.

4) Try to attach the disk again.

The problem is, in a few cases - like disk-detach - we don't
remove the corresponding /dev node from the mount namespace
(because it may be used by some other disk's backing chain). But
this creates a problem, because if the node changes its MAJ:MIN
numbers we don't propagate the change into the domain's
namespace. We do plain mknod() and ignore EEXIST which obviously
is not enough because it doesn't guarantee that the node has
updated MAJ:MIN pair.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1752978

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/qemu/qemu_domain.c