[Bug 10771] New: busybox umount -t fstype without -a causes unexpected umount
bugzilla at busybox.net
bugzilla at busybox.net
Mon Feb 19 11:55:16 UTC 2018
https://bugs.busybox.net/show_bug.cgi?id=10771
Bug ID: 10771
Summary: busybox umount -t fstype without -a causes unexpected
umount
Product: Busybox
Version: unspecified
Hardware: All
OS: Linux
Status: NEW
Severity: major
Priority: P5
Component: Standard Compliance
Assignee: unassigned at busybox.net
Reporter: zubkov318 at gmail.com
CC: busybox-cvs at busybox.net
Target Milestone: ---
Created attachment 7456
--> https://bugs.busybox.net/attachment.cgi?id=7456&action=edit
umount-fstype.patch
Hello,
I find weird behaviour of umount applet when it is calles with "-t fstype"
flag. It causes additional unmount of last entry in mtab with this filesystem
type:
# mount -t tmpfs test /test1
# mount -t tmpfs test /test2
# mount -t tmpfs test /test3
# cat /proc/mounts | grep test
test /test1 tmpfs rw,relatime 0 0
test /test2 tmpfs rw,relatime 0 0
test /test3 tmpfs rw,relatime 0 0
# cat /proc/mounts | tail -n 3
test /test1 tmpfs rw,relatime 0 0
test /test2 tmpfs rw,relatime 0 0
test /test3 tmpfs rw,relatime 0 0
# busybox umount -t tmpfs /test2
# cat /proc/mounts | grep test
test /test1 tmpfs rw,relatime 0 0
# busybox umount -t tmpfs /test1
umount: can't unmount /test1: Invalid argument
# cat /proc/mounts | grep test
#
After first unmount run for /test2 - we can see that /test3 has been umounted
too. And when we unmount /test1 which is the last tmpfs in mtab, it tries to
umount it twice (you can see it in strace) and the second call fails.
As I see in the code:
https://git.busybox.net/busybox/tree/util-linux/umount.c
It reads entries from mtab that matches the filesystem type into a linked list
"m" and should forget about it in the case when we do not want to unmount all.
But for whatever reason it checks that "-t" option is not specifed too and so
do not forgets the list. I think this causes it to umount the top of the list
(last enty in the mtab with that fstype) and then move towards to required
path.
I think attached patch should fix this behaviour.
PS. Also it states in the code that "-t" option is ignored, but it is not so.
And it is not documented.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the busybox-cvs
mailing list