so you have to unmount /mnt/A/B before /mnt/A. In some cases especially in
scripts it could be a little bit tricky to umount all in the right order. The
user friendly solution is --recursive:

# umount --recursive /mnt/A

Note that this solution is not atomic and possible umount options (like --lazy)
are applied to all umount(2) calls.

The another improvement is the option --all-targets. It umounts all mountpoints
for the given filesystem (device) in the current namespace. This options is usable
in situations when the same device is mounted on more places. The option
--all-targets could be used together with the option --recursive.

Note that /proc/self/mountinfo contains information about mountpoints hierarchy
as well as chronological order.

All these umount(8) improvements have a small limitation -- umount(8) works with the
current namespace only. It means if you want to be really paranoid than you
should not expect that after --all-targets is the devices completely unmounted.

Fortunately we have a new command nsenter(1) to enter the namespaces of the
other processes.
Let's create a session with unshared mount namespace:

Note that Linux kernel still does not allow to use propagation flags together with another mount operations. All is implemented in userspace by additional mount(2) calls -- one call for one propagation flag, see strace output: