Bug 8566 - umount: add support for the -O option
Summary: umount: add support for the -O option
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.27.x
Hardware: PC Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-23 20:08 UTC by austinenglish@gmail.com
Modified: 2018-01-26 15:00 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description austinenglish@gmail.com 2015-12-23 20:08:33 UTC
austin@austin1:~$ busybox umount -O
umount: invalid option -- 'O'
BusyBox v1.24.1 (2015-12-08 17:41:42 CST) multi-call binary.

Usage: umount [OPTIONS] FILESYSTEM|DIRECTORY

Unmount file systems

	-a	Unmount all file systems in /etc/mtab
	-n	Don't erase /etc/mtab entries
	-r	Try to remount devices as read-only if mount is busy
	-l	Lazy umount (detach filesystem)
	-f	Force umount (i.e., unreachable NFS server)
	-D	Don't free loop device even if it has been used

note that mount supports -O, already:
austin@austin1:~$ busybox mount -O
mount: option requires an argument -- 'O'
BusyBox v1.24.1 (2015-12-08 17:41:42 CST) multi-call binary.

This is needed by OpenRC:
OpenRC uses "umount -O _netdev" in the netmount script as part of the
process to unmount all network file systems on Linux.
However, the busybox umount command does not support -O.
If it did, I believe we could just use this command to unmount *all*
network file systems on Linux and not worry about fs types.

See https://bugs.gentoo.org/show_bug.cgi?id=468604
Comment 1 Mukuntha Rajaa 2017-11-02 09:21:23 UTC
Loop mount fails with "Device or resource busy". Mounting same device with util-linux based mount, it succeeds.

# mount -o loop /dev/VG_CFPU-0/config-R_FPT_180.0.1.36.WR.bcn.rm.1710290936.408465-INITIAL /mnt/backup/
mount: mounting /dev/VG_CFPU-0/config-R_FPT_180.0.1.36.WR.bcn.rm.1710290936.408465-INITIAL on /mnt/backup/ failed: Device or resource busy

# ls -l /dev/VG_CFPU-0/config-R_FPT_180.0.1.36.WR.bcn.rm.1710290936.408465-INITIAL-INITIAL
lrwxrwxrwx 1 root root 8 Oct 23 08:23 /dev/VG_CFPU-0/config-R_FPT_180.0.1.36.WR.bcn.rm.1710290936.408465-INITIAL -> ../dm-18


Util-linux mount:
# /tmp/mount -o loop /dev/VG_CFPU-0/config-config-R_FPT_180.0.1.36.WR.bcn.rm.1710290936.408465-INITIAL /mnt/backup
#

Looking at strace, util-linux is able to follow softlink to dm device and find out the actual one from /dev/mapper/ and mount that device finally. This part seems to be missing while I did strace on busybox mount

29730 readlink("/dev/VG_CFPU-0/config-R_FPT_180.0.1.34.WR.bcn.rm.1710220915.408367-INITIAL", "../dm-18", 4095) = 8
29730 lstat("/dev/dm-18", {st_mode=S_IFBLK|0600, st_rdev=makedev(254, 18), ...}) = 0
29730 stat("/dev/dm-18", {st_mode=S_IFBLK|0600, st_rdev=makedev(254, 18), ...}) = 0
29730 open("/sys/block/dm-18/dm/name", O_RDONLY|O_CLOEXEC) = 3
29730 fstat(3, {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0
29730 read(3, "VG_CFPU--0-config--R_FPT_180.0.1.34.WR.bcn.rm.1710220915.408367--INITIAL\n", 4096) = 73
29730 access("/dev/mapper/VG_CFPU--0-config--R_FPT_180.0.1.34.WR.bcn.rm.1710220915.408367--INITIAL", F_OK) = 0
29730 stat("/dev/mapper/VG_CFPU--0-config--R_FPT_180.0.1.34.WR.bcn.rm.1710220915.408367--INITIAL", {st_mode=S_IFBLK|0600, st_rdev=makedev(254, 18), ...}) = 0
Comment 2 Denys Vlasenko 2018-01-26 15:00:41 UTC
(In reply to Mukuntha Rajaa from comment #1)
Please attach complete straces of working and failing mounts.