| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
Instead of relying on /sys/devices/virtual/ubi/* better use
/sys/class/ubi/* which makes things more straight forward.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 1ea5855e980c ("partname: Introduce fstools_partname_fallback_scan
option") had two problems:
1. The strcmp() aborted when the param *matched* 1; we wanted the
inverse
2. It was too aggressive about skipping the fallback behavior. For
devices that had no root= parameter, they would always attempt the
fallback scan.
Fix both of those.
Fixes: 1ea5855e980c ("partname: Introduce fstools_partname_fallback_scan option")
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
[ add extra spacing between function ]
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some device may contains a GPT partition named rootfs_data that may
not be suitable.
To save from regression with old implementation that doesn't use
fstools_ignore_partname to explicitly say that that parname scan
should be ignored, make explicit that scanning each partition should
be done by providing fstools_partname_fallback_scan=1 and skip partname
scan in every other case.
Fixes: e9b59f063bb3 ("partname: Ignore root=PARTUUID...")
Tested-by: Dirk Buchwalder <buchwalder@posteo.de>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|
|
|
|
|
|
|
| |
We're assuming all root= arguments are /dev/ paths, but many targets
utilize root=PARTUUID=<xxx> strategies. At least allow them to fall back
to scanning all block devices.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
NTFS filesystem is supported by multiple implementations. Try mounting
it using all known drivers. Trying just "ntfs" string was limiting
fstools to compatibility with the read-only upstream Linux driver.
This fixes:
daemon.err block: No "mount.ntfs" utility available
daemon.err block: mounting /dev/sda1 (ntfs) as /mnt/sda1 failed (25) - Not a tty
Above errors were appearing even with ntfs3 upstrea kernel driver or
ntfs-3g (user-space) installed.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|
|
|
|
|
|
|
|
| |
Images also used on devices with NOR flash may come with JFFS2 deadc0de
marking and padding up to the largest NOR erase size.
Skip that padding and take it into account when extracting sysupgrade
backup from mmc/block partition.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
glibc 2.36 changed the definition of enum fsconfig_command in
sys/mount.h. This definition collides with the same definition from
linux/fs.h now. Remove the include of linux/fs.h. This compiles still
with musl too.
musl and glibc provide the defines linux/fs.h was included for in
sys/mount.h since some years.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|
|
|
|
|
|
|
| |
glibc in version 2.36 defines an own function named move_mount() in some
header. The definition from glibc collides with our definition, just
rename the function in fstools.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix the following compilation warning:
libfstools/common.c: In function 'block_volume_format':
libfstools/common.c:120:17: error: ignoring return value of 'system' declared with attribute 'warn_unused_result' [-Werror=unused-result]
120 | system(str);
| ^~~~~~~~~~~
Correctly handle return value from gzip and print an error on such case.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
Now that procd only relables the filesystem in case of the system
beging started with initramfs we will again need to take care of
labeling newly created /overlay.
This reverts commit 9e11b3723ce30b9b8c94ad7d15072a10cf13c0b4.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
| |
Now that procd takes care of it properly we no longer need this hack.
Remove it to safe some space also on non-SELinux systems.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Recent kernels started to spill warnings on the log if a userspace
process open()s an mtdblock device backed by NAND flash:
mtdblock: MTD device 'foo' is NAND, please consider using UBI block devices instead.
The warning itself is legitimate -- one really shouldn't be using
mtdblock on NAND.
Hence make fstools skip probing mtdblock devices if their underlaying
mtd device is of type 'nand'. As we don't want to break boards actually
using JFFS2 and squashfs directly on NAND, still probe the mtdblock
device in case the mtd device name is 'rootfs' or 'rootfs_data'.
This will then also trigger the kernel warning as it should.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before commit 4963db4 block device were only removed and re-added in
case of device_move() returning a non-zero value. Commit 4963db4 then
(supposedly) accidentally inverted that logic and also (probably to
work-around the problems resulting from the now inverted logic) limited
this behavior to autofs mounts, leaving the autofs codepath in a semi-
broken state.
Restore the original semantics as of before commit 4963db4 to fully
restore functionality for autofs mounts.
Fixes: 4963db4 ("blockd: use uloop_process for calling /sbin/hotplug-call mount")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
| |
Use -1 to mark invalid file descriptors as 0 can theoretically be a
valid open file descriptor.
Do not ignore lseek() return value and check if an error has occured.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
| |
If block is NULL, find_mount_point will segfault when comparing it
against the device name found in /proc/self/mountinfo. Avoid this by
checking if block is NULL.
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
|
|
|
|
|
|
| |
This avoids duplicating path over and over.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|
|
|
|
|
|
| |
Replace it with mount_extroot() argument. It's cleaner than a global
var.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|
|
|
|
|
|
|
| |
Comment in start() was invalid as mount_extroot() doesn't handle any
mounting internally. It was a misunderstanding coming from block.c
function called just the same.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|
|
|
| |
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|
|
|
|
|
| |
Improve error handling and fix a resource leak inside an error path.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
| |
Detect partition name based on 'uevent' instead of relying in custom
kernel patch exposing 'name' in sysfs directly.
This will allow to drop the custom patch again.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
| |
Coverity CID: 1330286 Resource leak
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
| |
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
| |
Coverity CID: 1490101 Argument cannot be negative
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
| |
Coverity CID: 1412456 Resource leak
Coverity CID: 1412458 Resource leak
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
|
|
|
| |
I'm not even sure we are even using this 'ubi' tool anywhere.
Fix the resource leak reported by Coverity anyway.
Coverity CID: 1330289 Resource leak
Coverity CID: 1330290 Resource leak
Coverity CID: 1330291 Resource leak
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
|
| |
Coverity CID: 1329896 Out-of-bounds access
Coverity CID: 1330127 Resource leak
Coverity CID: 1330173 Resource leak
Coverity CID: 1330472 Wrong size argument
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
| |
Fixes Coverity CID 1463265
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
| |
Useful to start/stop services triggered by mountpoints.
See procd.sh procd_add_mount_trigger to make use of that.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
| |
Hence libblkid-tiny is a shared lib, it makes sense to install it's
header to the system incldue/ dir for other applications to use it.
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
|
|
|
|
|
|
| |
open() returns -1 on error, not 0 (stdin).
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Don't wait for calls to 'block' to complete unless it's for an
autofs event (which cannot be handled async).
Use uloop for 'mount.ready' notificaion when startup has completed
to avoid blocking in waitpid() while the 'block' process is calling
back via ubus.
This greatly reduces the amount of time blockd needs on boot.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
| |
Emmit mount.ready notification when 'block autofs start' has completed.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
| |
As they require ubiblock to be mounted, just skip ubi devices in case
they don't contain a ubifs.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
| |
blockd calls the umount action with the basename of the device rather
than the full path.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
| |
AUTOFS_IOC_SETTIMEOUT expects a pointer to an 'unsigned long' which
will result in out-of-bounds access when passing a pointer to an 'int'.
Change type of timeout to 'unsigned long'.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
|
| |
As the hotplug event fires after the device has been removed, it will
never be found by _cache_load(). Hence the 'remove' event needs to
propagate in all cases and we only need to populate the cache in case
of 'add' events.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
| |
This avoids a lot of problems as hotplug events also arrive for the
/dev/dm-* names.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
| |
This reverts commit 4d4dcfb33c5d9fa31c9916e106bee309ec7b4b01.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
|
| |
Turns out using the device nodes /dev/mapper/* turns out to be a bad
idea to begin with. Will use /dev/dm-* instead.
This reverts commit 2f42515977adef7c026eb380ed2423c533cf8f3d.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
| |
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
|
|
| |
Not to be confused with cgroups, there are also POSIX process groups.
They do matter when it comes to autofs, as all requests coming from the
process group of the automounter itself will be ignored.
Hence, if blockd runs in the same process group as init and all
services, requests from services will be ignored.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
| |
Make it 'mount.add' instead of just 'add' which is more obvious when
used with procd_add_raw_trigger.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
|
|
| |
Also sending a ubus notification on mount hotplug provides a useful
shortcut for procd service triggers.
As the /etc/hotplug.d/mount API for now doesn't have any users and also
makes it hard to aggregate hotplug calls, we should consider removing it
in favor of only using triggers on the block notifications in future.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
| |
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
| |
If a device cannot be found in /dev, also try /dev/mapper.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
| |
asprintf requires _GNU_SOURCE to be defined. Set it.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
| |
As devices with large NAND flash are becoming more common, users may
use that resource for additional (UBI) volumes. To support that in
fstools, allow autofs and umount also on MTD/UBI devices.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
|
| |
Block devices created by device mapper are in /dev/mapper/ folder,
hence the assumption of the 'block' tool expecting /dev/%s being the
path of a device doesn't hold true.
Match device path from cache instead.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Copying device name into a fixed-length buffer is problematic as
the name can be longer than the buffer, resulting in subsequent fields
getting corrupted and potentially even worse things.
Drop strcpy of device name and use of the copied value as it is known
anyway.
Before this fix:
/dev/mapper/owrt--volumes--e093cc66-rw_test: UUID="c66-rw_test" LABEL="test" VERSION="1.14" TYPE="f2fs"
After this fix:
/dev/mapper/owrt--volumes--e093cc66-rw_test: UUID="5eda3e52-3427-493a-a6d6-ffdb5a5836fd" LABEL="test" VERSION="1.14" TYPE="f2fs"
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|