#944547 libvirt-daemon: libvirt interferes with filesystem mounting

Package:
libvirt-daemon
Source:
libvirt
Description:
Virtualization daemon
Submitter:
Mikulas Patocka
Date:
2019-11-11 16:36:08 UTC
Severity:
normal
#944547#5
Date:
2019-11-11 16:25:12 UTC
From:
To:
Dear Maintainer,

   * What led up to the situation?

When libvirt starts qemu, it copies the current mount namespace to qemu.
If we mount a filesystem, start some virtual machine and unmount the
filesystem, the filesystem is still mounted because the qemu process still
holds a reference on it.

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

Steps to reproduce:
# truncate -s 16M fs.img
# mkfs.ext2 fs.img
# mount -t ext2 fs.img /mnt/test
# virsh start <some virtual machine>
# umount /mnt/test

   * What was the outcome of this action?

Now, we are in a situation when the filesystem is no longer accessible at
/mnt/test, however it is still mounted. We can check it:
# losetup -a
	- it still reports that /dev/loop0 is attached to fs.img
# fsck.ext2 -n fs.img
	- reports "fs.img was not cleanly unmounted, check forced." even
	  though we ran the umount command

If we look at "/proc/`pidof qemu-system-aarch64`/mounts" or
"/proc/`pidof qemu-system-aarch64`/mountinfo", we can see that the
filesystem /mnt/test is still there.

   * What outcome did you expect instead?

Unmount should work as expected. Libvirt should not interfere with mounts.

This bug only exists in Debian Buster. I doesn't exist in Debian Stretch.