umount: always use MNT_FORCE in umount_all() (#7213)
authorNeilBrown <neil@brown.name>
Wed, 8 Nov 2017 08:29:32 +0000 (19:29 +1100)
committerLennart Poettering <lennart@poettering.net>
Wed, 8 Nov 2017 08:29:32 +0000 (11:29 +0300)
commitc44cac7c6c43407d28bd8daebff39f6145a2a33e
tree4c180b5c3d60d6c275affbdc0dea58ea920d38d8
parent3a58ca47eee903383695866a14ade3beee0f10cc
umount: always use MNT_FORCE in umount_all() (#7213)

The linux umount2() systemcall accepts a MNT_FORCE flags
which some filesystems honor, particularly FUSE and various
network filesystems such as NFS.
These filesystems can sometimes wait for an indefinite period
for a response from an external service, and the wait if
sometimes "uninterruptible" meaning that the process cannot be
killed.
Using MNT_FORCE causes any such request that are outstanding to
be aborted.  This normally allows the waiting process to
be killed.  It will then realease and reference it has to the
filesytem, this allowing the filesystem to be unmounted.

If there remain active references to the filesystem, MNT_FORCE
is *not* forcefull enough to unmount the filesystem anyway.

By the time that umount_all() is run by systemd-shutdown, all
filesystems *should* be unmounted, and sync() will have been
called.  Anything that remains cannot be unmounted in a
completely clean manner and just nees to be dealt with as firmly
as possible.  So use MNT_FORCE and try to explain why in the
comment.

Also enhance an earlier comment to explain why umount2() is
safe even though mount(MNT_REMOUNT) isn't.
src/core/umount.c