The reported case was an attempt to remount,rw a CD-ROM:
mount -o remount,rw /mnt/sr0
which "succeeded" by falling back to RO:
mount("/dev/sr0", "/mnt/sr0", 0x412862, MS_REMOUNT|MS_SILENT|MS_RELATIME, "nojoliet,check=s,map=n,blocksize"...) = -1 EROFS (Read-only file system)
...
mount("/dev/sr0", "/mnt/sr0", 0x412862, MS_RDONLY|MS_REMOUNT|MS_SILENT|MS_RELATIME, "nojoliet,check=s,map=n,blocksize"...) = 0
Clearly, not what was intended!
function old new delta
parse_mount_options 241 267 +26
mount_main 1198 1211 +13
singlemount 1301 1313 +12
inetd_main 1919 1911 -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 51/-8) Total: 43 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This lets bb mount build for limited targets without syslog.h,
as long as the parts using it like NFS are disabled.
Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
When mounting, in parallel, multiple loop devices (squashfs for the
submitter's case), the following behavior can be observed:
stat64(/path/to/image, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
openat(AT_FDCWD, /path/to/image, O_RDWR|O_LARGEFILE) = 3
openat(AT_FDCWD, /dev/loop-control, O_RDWR|O_LARGEFILE|O_CLOEXEC) = 4
ioctl(4, LOOP_CTL_GET_FREE) = 12
close(4) = 0
openat(AT_FDCWD, /dev/loop12, O_RDWR|O_LARGEFILE) = 4
ioctl(4, LOOP_GET_STATUS64, {lo_offset=0, lo_number=12, lo_flags=LO_FLAGS_AUTOCLEAR, lo_file_name=/path/to/image, ...}) = 0
close(4) = 0
close(3) = 0
write(2, "mount: can't setup loop device\n", 31mount: can't setup loop device
) = 31
exit_group(0) = ?
+++ exited with 0 +++
The ioctl LOOP_CTL_GET_FREE has resulted in the same result for
a competing mount process. The subsequent ioctl LOOP_GET_STATUS64
fails, having succeeded for the competing mount process.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
The (1 << 8) MS_ flag is MS_NOSYMFOLLOW, not MS_UNION.
As far as I see in git history of kernel and util-linux,
MS_UNION did not ever exist.
Why did it appear in our tree in 2009?...
function old new delta
mount_option_str 379 385 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Fails as follows:
$ mount -o bind /dev/disk/by-path/pci-0000:13:00.0-scsi-0:0:3:0 /dir
mount: bad address '/dev/disk/by-path/pci-0000'
function old new delta
singlemount 1256 1273 +17
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Starting with linux kernel v5.4 squashfs has a more strict parameter
checking implemented. Unlike util-linux mount, busybox never supported
the sizelimit option but simply forwards it to the kernel.
Since v5.4 mounting will fail with
squashfs: Unknown parameter 'sizelimit'
Support the sizelimit parameter by setting it in the LOOP_SET_STATUS64
structure before handing it to the kernel.
While at it also add support for the offset option, which currently will
always be set to 0.
function old new delta
cut_out_ull_opt - 167 +167
singlemount 1230 1266 +36
set_loop 834 862 +28
losetup_main 479 483 +4
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/0 up/down: 235/0) Total: 235 bytes
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
PLATFORM_LINUX is a hidden configuration option which is disabled by
default and enabled at over a hundred locations for features that are
deemed to be Linux specific.
The only effect of PLATFORM_LINUX is to control compilation of
libbb/match_fstype.c. This file is only needed by mount and umount.
Remove all references to PLATFORM_LINUX and compile match_fstype.c
if mount or umount is enabled.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Back in 2007, commit 0c97c9d437 ("'simple' error message functions by
Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower
overhead call to bb_perror_msg() when only a string was being printed
with no parameters. This saves space for some CPU architectures because
it avoids the overhead of a call to a variadic function. However there
has never been a simple version of bb_error_msg(), and since 2007 many
new calls to bb_perror_msg() have been added that only take a single
parameter and so could have been using bb_simple_perror_message().
This changeset introduces 'simple' versions of bb_info_msg(),
bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and
bb_herror_msg_and_die(), and replaces all calls that only take a
single parameter, or use something like ("%s", arg), with calls to the
corresponding 'simple' version.
Since it is likely that single parameter calls to the variadic functions
may be accidentally reintroduced in the future a new debugging config
option WARN_SIMPLE_MSG has been introduced. This uses some macro magic
which will cause any such calls to generate a warning, but this is
turned off by default to avoid use of the unpleasant macros in normal
circumstances.
This is a large changeset due to the number of calls that have been
replaced. The only files that contain changes other than simple
substitution of function calls are libbb.h, libbb/herror_msg.c,
libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c,
networking/udhcp/common.h and util-linux/mdev.c additonal macros have
been added for logging so that single parameter and multiple parameter
logging variants exist.
The amount of space saved varies considerably by architecture, and was
found to be as follows (for 'defconfig' using GCC 7.4):
Arm: -92 bytes
MIPS: -52 bytes
PPC: -1836 bytes
x86_64: -938 bytes
Note that for the MIPS architecture only an exception had to be made
disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h)
because it made these files larger on MIPS.
Signed-off-by: James Byrne <james.byrne@origamienergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
The "autolooped" mount (mount [-oloop] IMAGE /DIR/DIR)
always creates AUTOCLEARed loopdevs, so that umounting
drops them (and this does not require any code in the
umount userspace).
This happens since circa linux-2.6.25:
commit 96c5865559cee0f9cbc5173f3c949f6ce3525581
Date: Wed Feb 6 01:36:27 2008 -0800
Subject: Allow auto-destruction of loop devices
IOW: in this case, umount does not have to use -d
to drop the loopdev.
The explicit loop mount (mount /dev/loopN /DIR/DIR)
does not do this. In this case, umount without -d
should not drop loopdev.
Unfortunately, bbox umount currently always implies -d,
this probably needs fixing.
function old new delta
set_loop 537 597 +60
singlemount 1101 1138 +37
losetup_main 419 432 +13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 110/0) Total: 110 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Redundant help texts (one which only repeats the description)
are deleted.
Descriptions and help texts are trimmed.
Some config options are moved, even across menus.
No config option _names_ are changed.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This makes it possible to use scoped IPv6 addresses:
mount -t cifs -o ip=<ADDR>%<iface_id> //<ADDR>/test test
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Gives "mount -t cifs //fe80::6a05:caff:fe3e:dbf5%eth0/test test"
a chance to work: mount must pass "ip=numeric_IPv6%numeric_iface_id"
in the omunt option string. Currently, it does not.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
The result of looking at "grep -F -B2 '*fill*' busybox_unstripped.map"
text data bss dec hex filename
829901 4086 1904 835891 cc133 busybox_before
829665 4086 1904 835655 cc047 busybox
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
function old new delta
mount_main 1221 1241 +20
packed_usage 30616 30610 -6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Isaac Dunham <ibid.ag@gmail.com>
unc option for CIFS mount is mandatory after CIFS option parsing
was rewritten in Linux 3.4
Signed-off-by: Martin Santesson <martinsn@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>