Comment # 4 on bug 1149980 from
Deciding which of the entries in /proc/mounts is a true toplevel Btrfs and
which is only a subvolume is very hard; even more so if it is possible that
there are SEVERAL toplevel Btrfs mounts.

One approach might be to check each entry during unmounting avain if it's even
mounted: A previous unmount might have taken care of it as well. Of course that
works only if we strictly follow the order of /proc/mounts.

But that is in contradiction of the other requirement: Unmount from deeper
nesting upwards to the target's root because otherwise the root will still be
busy. The same applies to mounts like /boot that might have more mounts inside
them.

  /
  ������������������/boot
  ��������� ������������������/boot/efi
  ��������� ������������������/boot/morestuff

So we NEED to start unmounting from the deepest mounts upwards.

For Btrfs (i.e. all mounts containing mount options "subvolid" or "subvol=") it
is tempting to make an exception and start from the top. That works well as
long as it's only subvolumes of that same Btrfs mounted inside it.

But it is entirely possible that another Btrfs is mounted to that Btrfs, and
that might also have those mount options "subvolid" or "subvol=". In that case,
it would not be unmounted first, and unmounting the toplevel Btrfs would fail
with "filesystem busy".


You are receiving this mail because: