uvol: ubi: fix bring-up of ro volumes
authorDaniel Golle <daniel@makrotopia.org>
Wed, 28 Jul 2021 17:18:33 +0000 (18:18 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Wed, 28 Jul 2021 19:29:56 +0000 (20:29 +0100)
Fix bring-up of ro volumes on creation and on boot.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
utils/uvol/files/ubi.sh
utils/uvol/files/uvol.init

index 9ddda54da43a96f3c0b72b9e668e8b638d089bcf..0a43224fbb87fd47bf316a9acdf1e6e2823a694c 100644 (file)
@@ -151,7 +151,6 @@ activatevol() {
        if vol_is_mode "$voldev" rd; then
                ubirename "/dev/$ubidev" "uvol-rd-$1" "uvol-ro-$1" || return $?
                ubiblock --create "/dev/$voldev" || return $?
-               block_hotplug add "ubiblock${voldev:3}"
                return 0
        elif vol_is_mode "$voldev" wd; then
                ubirename "/dev/$ubidev" "uvol-wd-$1" "uvol-rw-$1" || return $?
@@ -188,7 +187,9 @@ updatevol() {
        [ "$2" ] || return 22
        vol_is_mode "$voldev" wo || return 22
        ubiupdatevol -s "$2" "/dev/$voldev" -
-       uvol_uci_add "$1" "/dev/$voldev" "ro"
+       ubiblock --create "/dev/$voldev"
+       uvol_uci_add "$1" "/dev/ubiblock${voldev:3}" "ro"
+       ubiblock --remove "/dev/$voldev"
        ubirename "/dev/$ubidev" "uvol-wo-$1" "uvol-rd-$1"
 }
 
@@ -218,7 +219,6 @@ bootvols() {
                fstype=
                case "$volname" in
                        uvol-ro-*)
-                               voldev="/dev/ubiblock${voldev:3}"
                                ubiblock --create "/dev/$voldev" || return $?
                                ;;
                        *)
index 7c290d732396cbaeee85bca5ec99fee1cf3e1908..1f6e2aac0800592ffcdf71ea3cb31e15e3e3051a 100644 (file)
@@ -6,7 +6,7 @@ NAME=uvol
 PROG=/usr/sbin/uvol
 
 start_service() {
-       [ "${__BOOT_UVOL}" = "1" ] || return 0
+       [ "${__BOOT_UVOL}" = "1" ] && return 0
        procd_open_instance "$NAME"
        procd_set_param command "$PROG" boot
        procd_close_instance
@@ -16,3 +16,8 @@ boot() {
        __BOOT_UVOL=1
        start
 }
+
+service_triggers() {
+       procd_add_raw_trigger "mount.ready" 200 /etc/init.d/uvol start
+}
+