• M
    qemu: Forcibly mknod() even if it exists · cdd8a669
    Michal Privoznik 提交于
    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=1752978Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
    Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
    cdd8a669
qemu_domain.c 480.4 KB