| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
| |
This is required at least in system startup when "block hotplug" will be
triggered by udevtrigger. E.g. /dev/vdb needs to be mounted at /mnt/s
and /dev/vdc /mnt. It does not work if /dev/vdb was triggered then
mounted first
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is needed when e.g. sda1 needs to be mounted to /mnt and sda2
/mnt/srv. We need to make sure sda1 was mounted first.
"devices" is now an ordered list with elements pointing to both "struct
probe_info" and "struct mount". The order is firstly on presence of
mount info, then strlen(mount.target), then strcmp(probe_info.dev)
Resolves FS#2214
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
Dosfsck is only available when --enable-compat-symlinks was given when
configuring dosfstools. These symlinks are not enabled in OpenWrt
dosfstools package
Suggested by Reiner Otto in FS#2408
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
|
|
|
|
| |
The memory pointed to by ns can be reallocated when checking mft records
Fixes FS#2129
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
|
|
|
|
|
| |
readlink() truncates and does not null terminate the string when more
bytes would be written than available. Just increase the char array by
one and assume that there is a problem when all bytes are needed.
Coverity: #1330087, #1329991
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|
|
|
| |
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
|
|
|
|
|
| |
Currently set_utf8label support is missing. Adds a stripped down version of encode.c file from original libblkid and adds the function to libblkid-tiny.c.
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
OpenWrt commit 0e70f69a35 ("treewide: revise library packaging") removed
the unversioned library symlink from the libblkid package, breaking
dynamic loading of the library at runtime.
Add a fallback to "libblkid.so.1" to allow using the dynamic library
for filesystem probing again.
Fixes: FS#2274
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
|
|
| |
Btrfs max label lenght is 255. Increment the blkid_struct_probe struct to respect this new max value.
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
|
|
|
|
|
| |
Btrfs label length is 256 included the termination char ( '\0' ) as the real max length is 255 (less than 256 from the wiki).
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
Do not perform substring matches when identifying mount points to
avoid returning wrong entries, e.g. "/dev/mmcblk0p10" when
"/dev/mmcblk0p1" was requested.
Fixes: FS#2196
Ref: https://bugs.openwrt.org/index.php?do=details&task_id=2196
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
|
|
|
|
| |
Revise matching code using strncmp() in order to avoid returning wrong
items, e.g. /dev/sda1 when /dev/sda was requested.
Ref: https://bugs.openwrt.org/index.php?do=details&task_id=2196
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
|
|
|
|
|
| |
I wasn't able to to use f2fs on armvirt/32 platform and I've found out
that it was due to F2FS_MINSIZE constant overflow leading to value of 13
exabytes instead of 100 megabytes.
Acked-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
|
|
|
|
|
|
|
|
|
| |
It took me quite some time today(while fixing squashfs+overlay on
armvirt) to find out, that I was missing support for loop block device
in kernel, so I'm adding error message which might be helpful for
someone else in the future as well.
Acked-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
So far - when using autofs - "add" and "remove" action events were
triggered on every (un)mount. It wasn't very helpful when using autofs
due to its nature.
The point of blockd & autofs is to have block devices mounted on an
access request. Its users should not care / know if it's currently
mounted or not. Mounting should be handled transparently.
To make that work it requires informing listeners whenever device:
1) Becomes *ready* for mounting (by triggering "add" action)
2) Becomes *unavailable* (by triggering "remove" action)
The current mounting state is something that autofs & blockd should
handle internally and should not notify listeners about.
This is implemented by:
1) block generating events for non-autofs cases only (when (un)mounting)
2) blockd informing block when autofs resource becomes (un)available
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|
|
|
|
|
|
|
|
|
|
|
| |
To keep autofs behavior consistent blockd should request both: mounting
and unmounting when needed. It's important as autofs-related actions may
require slightly different handling.
Without this patch:
1) autofs mounts were handled using TYPE_AUTOFS
2) autofs unmounts were handled using TYPE_HOTPLUG
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This removes dangling directory fixing two issues:
1) Non autofs case
Leaving directory in /mnt/ and switching to autofs would result in
blockd failing to symlink().
2) autofs case
Leaving directory in /var/run/blockd/ could result in apps trying to
access it causing errors like:
blockd: kernel is requesting a mount -> sda1
blockd: failed to run block. add/sda1
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When blockd starts it uses "start" action for getting current state of
block devices. The way main_autofs() was implemented was a bit hacky
though:
1) It was calling mount_device() with TYPE_HOTPLUG
First of all that made code harder to understand. Faking TYPE_HOTPLUG
for a TYPE_AUTOFS made following mount_device() logic more complex.
Secondly the only reason for that seems to be to trigger "swap" and
extroot checks in the mount_device(). Other than that it was only
about calling blockd_notify() anyway.
2) It wasn't consistent
Consider a "swap" or extroot without an "autofs" set (a pretty
expected case).
a) During original TYPE_HOTPLUG event mount_device() would detect
both cases early and return without calling blockd_notify().
b) With previous main_autofs() implementation blockd_notify() was
called for both cases.
With this change main_autofs() doesn't fake TYPE_HOTPLUG and it follows
mount_device() logic which should result in an expected & consistent
state of devices in blockd.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|
|
|
|
|
| |
It allows improving block by handling blockd_notify() errors.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With this change block generates 2 "mount" hotplug.d subsystem events:
1) "add" when block device gets mounted
2) "remove" when block device gets unmounted
This allows e.g. controlling USB storage dependant software using
hotplug.d listeners.
A very similar solution was implemented in mountd which was replaced by
blockd.
Right now this is implemented using a call to the /sbin/hotplug-call.
A possible improvement is to rewrite above shell script into a C lib
function. For now let's just assume that script exists.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|
|
|
|
|
|
|
|
| |
Using argv[3] without checking argc value could result in undefined
behavior. It could result in a crash or accessing a NULL that separates
argv from envp on UNIX.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
ubus message is parsed in the block_hotplug() which fills all the struct
device fields. Once that is done there is no need to parse original
message again - it's enough to get required data from the struct.
This also fixes handling messages with "autofs" set to 0. They were
incorrectly interpreted due to the missing blobmsg_get_u32().
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Device gets removed from the list (vlist_delete()) when block calls
"hotplug" method of blockd using ubus. Right after that block unmounts
that device on its own.
blockd shouldn't care about unmounting on its own for following reasons:
1) To avoid code/behavior duplication with block
2) To keep behavior consistent with mounting (blockd doesn't mount)
3) To allow implementing more features in block (e.g. hotplug.d events)
To make unmounting the most reliable the plan is to have:
1) block receiving hotplug.d "block" subsystem events "remove"
2) blockd stopping reporting device (so we avoid new users & let
existing ones realize mount can't be used anymore)
3) block notifying (through hotplug.d "mount" subsystem) all users about
device being unmounted - that should stop all apps accessing it
4) block unmount device
That should allow storage users stop accessing mount point & let block
unmount device cleanly.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
|
|
|
|
|
|
| |
Use umount_device() helper instead.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|
|
|
|
|
|
|
|
|
| |
Make it accept device path instead of struct probe_info. This way it can
be reused by code fired when device is already gone.
To keep existing functionality two checks have been moved to the
main_umount().
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|
|
|
|
|
|
|
| |
Once target directory gets specified mounting code is identical for
devices having and not having UCI config entry. Share it.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Michael Heimpold <mhei@heimpold.de>
|
|
|
|
|
|
|
|
| |
Using a set of 3 conditional block each setting "target" variable makes
code easier to follow.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Michael Heimpold <mhei@heimpold.de>
|
|
|
|
|
|
|
|
|
| |
That function is called no matter if "m" variable is null or not. This
saves a one duplicated line & allows merging two conditional blocks
starting with if (m). It doesn't change code execution order.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Michael Heimpold <mhei@heimpold.de>
|
|
|
|
|
|
|
|
| |
There was some misformatted code that seemed like switch block having an
else block. This improves code readability.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Michael Heimpold <mhei@heimpold.de>
|
|
|
|
|
|
|
| |
According to man page, using the EXIT_* macros is more portable than using
plain integer values.
Signed-off-by: Michael Heimpold <mhei@heimpold.de>
|
|
|
|
|
|
|
|
|
|
| |
According to man page, using WEXITSTATUS should be guarded by a check
of WIFEXITED, so add this check.
While at, also print an error message in case fsck was terminated
by a signal.
Signed-off-by: Michael Heimpold <mhei@heimpold.de>
|
|
|
|
|
|
| |
This adds ntfs support to block-mount
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
|
|
|
|
|
|
|
| |
In order to allow the mounting of the filesystem with full access time
accounting, a new CMake option (eg: CMAKE_OVL_MOUNT_FULL_ACCESS_TIME)
has been added.
Signed-off-by: Pierre Lebleu <pme.lebleu@gmail.com>
|
|
|
|
|
|
|
| |
In order to allow the mounting of the filesystem with the zlib compression,
a new CMake option (eg: CMAKE_OVL_MOUNT_COMPRESS_ZLIB) has been added.
Signed-off-by: Pierre Lebleu <pme.lebleu@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Switching from "tmpfs" to "jffs2" happens after JFFS2 formatting is
done. During that time user can use filesystem (thanks to RAM) and the
role of switch2jffs() is to copy all changes to the JFFS2 overlay
partition.
What wasn't handled so far was moving mount points. User can create
custom mounts, cp command won't copy them and umounting "tmpfs" will
cause these mounts to go away. To preserve them switch2jffs() has to
find all custom mount points and move them to the new filesystem.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
|
|
|
|
|
|
|
|
| |
That function never modifies these strings so it can/should use consts.
It makes it a bit more flexible as now callers can also pass consts.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit cc63723d886fd ("overlay: use lstat rather than stat and make sure
there are no trailing spaces") changed behavior of foreachdir() breaking
some callbacks. Before that modification all callbacks were getting
directory with a trailing slash. Above commit started removing them.
This broke handle_whiteout() which doesn't work at all since then. It
constructs file paths incorrectly: slash is missing between directory
and a file name. It seems noone noticed it for years because this issue
got hidden by switch2jffs() which also handles whiteouts with its system
command "cp -a" call.
Fix that regression by setting trailing slash back - right after calling
lstat(). Also to keep code simple just skip all entries that aren't
directories. This keeps conditions for removing/setting trailing slash
trivial. A side effect is not calling callbacks for files which is a
free bonus optimization.
Fixes: cc63723d886fd ("overlay: use lstat rather than stat and make sure there are no trailing spaces")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
|
|
|
|
| |
Signed-off-by: John Crispin <john@phrozen.org>
|
|
|
|
|
|
| |
the libblkid copies len+1 bytes causing a buffer overrun.
Signed-off-by: John Crispin <john@phrozen.org>
|
|
|
|
|
|
|
| |
Add glob for NVM Express SSD device nodes to support systems with
such PCIe SSDs.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
glibc fails with:
warn_unused_result [-Wunused-result]
system("cp -a /tmp/root/upper/* / 2>/dev/null");
Regression intoroduced with 11efbf3b90f031ce634fc38cad07a4aef2985777
Reported here:
https://www.mail-archive.com/lede-dev@lists.infradead.org/msg10502.html
Signed-off-by: Roman Yeryomin <roman@advem.lv>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
|
|
|
|
|
|
|
| |
glob should handle paths like /foo/bar//* so we probably don't need this
extra check & code.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|
|
|
|
|
|
|
| |
Alloc globdir buffer dynamically and simply use realloc when needed.
This fixes e.g. segmentation fault in jffs2reset due to an infinite
recurrency when dealing with longs paths.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is a race between `cp -a /tmp/root/* /rom/overlay` from
libfstools/overlay.c and a process creating new file(s) before
pivot(/rom, /mnt) occured.
That is a process can create a file and it will not be copied.
To workaround this, do additional copy after jffs2 is ready.
This doesn't completely solve the problem but since there
was no other fix provided since original RFC [1], it is better
than nothiing.
[1] https://www.mail-archive.com/openwrt-devel@lists.openwrt.org/msg38218.html
Signed-off-by: Roman Yeryomin <roman@advem.lv>
|
|
|
|
|
|
|
|
|
| |
Its copied from the util-linux project and its libblkid. Call to the
blkid_probe_set_utf8label was commented out due to libblkid-tiny not
supporting it yet.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
|
|
|
|
|
|
| |
Saves 1472 bytes under glibc. No other difference.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Detecting UBI superblock may be useful for tools wanting to simplify or
automate attaching UBI. Please note it's not directly related to the
ubifs support which is just a filesystem working on top of UBI volume.
This patch adds simple code reading UBI version and unique number and
setting it in the blkid_probe.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|
|
|
| |
Signed-off-by: Robert Young <yayooo@gmail.com>
|
|
|
|
|
|
|
|
|
| |
Xen provides paravirtualized block devices which most often appear as
/dev/xvd*. This patch adds this pattern to those known to the block
utilitiy. These devices require a kernel compiled with the xen-blkfront
driver.
Signed-off-by: W. Michael Petullo <mike@flyn.org>
|