Skip to contentSkip to conversation

History of Lazy and Force unmouting

DISCUSSION Joshua Watt 2 participants 3 messages Oct 30, 2017 – Nov 3, 2017 Util-Linux package

lore
Share & tools
lore
#0 lore raw

All,

I was hoping to get some background on why the util-linux umount command doesn't allow lazy unmounting (the -l flag) to be combined with force unmounting (the -f flag). If both flags are specified, umount only passes MNT_DETACH to the kernel instead of MNT_DETACH | MNT_FORCE.
I looked through the kernel code, and it appears that the two flags
are orthogonal, so you *should* be able to specify both? I tried looking back in the git history of util-linux, but it appears to have been that way since support for lazy unmounting was added in 2006.

Thanks,
Joshua Watt

maintainer
#1 lore raw
Quoted 4 lines · Joshua Watt

I was hoping to get some background on why the util-linux umount command doesn't allow lazy unmounting (the -l flag) to be combined with force unmounting (the -f flag). If both flags are specified, umount only passes MNT_DETACH to the kernel instead of MNT_DETACH | MNT_FORCE.

The current libmount code follows the original mount(*) behavior. The flag MNT_DETACH is supported since util-linux 2.11m (year 2001).

Quoted 4 lines

I looked through the kernel code, and it appears that the two flags
are orthogonal, so you *should* be able to specify both? I tried looking back in the git history of util-linux, but it appears to have been that way since support for lazy unmounting was added in 2006.

2006 is time when the code was imported to the git. The important tarball are older.

Anyway, does it make sense to use the both flags in the same time?

Quoted 1 line

From kernel code it seems that MNT_FORCE forces FS driver to kill all

resources (by op->umount_begin()) before the umount, so what do you expect from later MNT_DETACH?

The problem is that libmount prefers MNT_DETACH, so if you specify both flags that MNT_FORCE is silently ignored. It would be better prefer MNT_FORCE or accept both flags and don't try to be more smart than kernel.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#2 lore raw

On Nov 3, 2017 06:00, "Karel Zak" <[email protected]> wrote:

Quoted 4 lines · Joshua Watt

I was hoping to get some background on why the util-linux umount command doesn't allow lazy unmounting (the -l flag) to be combined with force unmounting (the -f flag). If both flags are specified, umount only passes MNT_DETACH to the kernel instead of MNT_DETACH | MNT_FORCE.

The current libmount code follows the original mount(*) behavior. The flag MNT_DETACH is supported since util-linux 2.11m (year 2001).

Quoted 4 lines

I looked through the kernel code, and it appears that the two flags
are orthogonal, so you *should* be able to specify both? I tried looking back in the git history of util-linux, but it appears to have been that way since support for lazy unmounting was added in 2006.

2006 is time when the code was imported to the git. The important tarball are older.

Anyway, does it make sense to use the both flags in the same time?

Quoted 1 line

From kernel code it seems that MNT_FORCE forces FS driver to kill all

resources (by op->umount_begin()) before the umount, so what do you expect from later MNT_DETACH?

I'm currently in discussion with the kernel nfs team about the MNT_FORCE behavior, specifically that it doesn't shut everything down. I came across this oddity in my testing and was curious if it was on purpose.

http://www.spinics.net/lists/linux-nfs/msg66073.html

The problem is that libmount prefers MNT_DETACH, so if you specify both flags that MNT_FORCE is silently ignored. It would be better prefer MNT_FORCE or accept both flags and don't try to be more smart than kernel.

Ok. I'll submit a patch after I get home from vacation.

Karel

--
Karel Zak <[email protected]>
http://karelzak.blogspot.com