mount: fix intermittent data partition automount
The udev mount script always queried the active system before mounting any partition. On eMMC systems this lookup used /dev/disk/by-partlabel, which is populated by udev itself and may still be incomplete and the script exited for that partition. Only resolve the active system for linux_a/linux_b, and read the eMMC root partition name from sysfs instead of the udev-created by-partlabel links. https://onedigi.atlassian.net/browse/DEL-10131 Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
This commit is contained in:
parent
32996b0885
commit
58577373ba
|
|
@ -38,12 +38,20 @@ get_active_system() {
|
|||
fi
|
||||
else
|
||||
local MMCROOT_DEV
|
||||
local devname
|
||||
local label
|
||||
local uevent
|
||||
|
||||
MMCROOT_DEV="$(stat -c%D /)"
|
||||
|
||||
for label in /dev/disk/by-partlabel/*; do
|
||||
if [ "$(stat -c"%02t%02T" "$(realpath "${label}")")" = "${MMCROOT_DEV}" ]; then
|
||||
ACTIVE_SYSTEM="$(basename "${label}")"
|
||||
for uevent in /sys/class/block/*/uevent; do
|
||||
devname="$(sed -ne 's/^DEVNAME=//p' "${uevent}")"
|
||||
label="$(sed -ne 's/^PARTNAME=//p' "${uevent}")"
|
||||
[ -n "${devname}" ] || continue
|
||||
[ -n "${label}" ] || continue
|
||||
|
||||
if [ "$(stat -c"%02t%02T" "/dev/${devname}")" = "${MMCROOT_DEV}" ]; then
|
||||
ACTIVE_SYSTEM="${label}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
|
@ -89,10 +97,10 @@ if grep -qs "${MOUNTPOINT}" /proc/mounts; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
# Get from proc/cmdline the active system "a" or "b"
|
||||
get_active_system || exit
|
||||
|
||||
if [ "${PARTNAME}" = "linux_a" ] || [ "${PARTNAME}" = "linux_b" ]; then
|
||||
# Get from proc/cmdline the active system "a" or "b"
|
||||
get_active_system || exit
|
||||
|
||||
PARTINDEX="${PARTNAME#linux_}"
|
||||
if [ "${ACTIVE_SYSTEM}" != "${PARTINDEX}" ]; then
|
||||
logger "Skip mount partition '${PARTNAME}', because it is not the active system"
|
||||
|
|
|
|||
Loading…
Reference in New Issue