[source] sysupgrade: unmount filesystems before reboot

LEDE Commits lede-commits at lists.infradead.org
Thu Aug 4 09:19:54 PDT 2016


nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/?p=source.git;a=commitdiff;h=3004298e625c47537877bfd1e95806fad7c39f27

commit 3004298e625c47537877bfd1e95806fad7c39f27
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Tue Aug 2 22:29:31 2016 +0200

    sysupgrade: unmount filesystems before reboot
    
    sysupgrade immediately reboots after flashing an image and doesn't
    allow to unmount filesystems. At least in case the image used for
    sysupgrade is stored on a FAT formatted usb flash drive, the following
    warning is printed during the next mount of the flash drive:
    
    FAT-fs (sda1): Volume was not properly unmounted. Some data may be
    corrupt. Please run fsck.
    
    Although a data corruption during read operations is unlikely, there is
    no need to scare the users.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 package/base-files/files/lib/upgrade/common.sh | 1 +
 package/system/procd/files/nand.sh             | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh
index ea03f77..bed9c18 100644
--- a/package/base-files/files/lib/upgrade/common.sh
+++ b/package/base-files/files/lib/upgrade/common.sh
@@ -243,6 +243,7 @@ do_upgrade() {
 	[ -n "$DELAY" ] && sleep "$DELAY"
 	ask_bool 1 "Reboot" && {
 		v "Rebooting system..."
+		umount -a
 		reboot -f
 		sleep 5
 		echo b 2>/dev/null >/proc/sysrq-trigger
diff --git a/package/system/procd/files/nand.sh b/package/system/procd/files/nand.sh
index 8b0564d..70b9af5 100644
--- a/package/system/procd/files/nand.sh
+++ b/package/system/procd/files/nand.sh
@@ -198,6 +198,7 @@ nand_do_upgrade_success() {
 	sync
 	[ -f "$conf_tar" ] && nand_restore_config "$conf_tar"
 	echo "sysupgrade successful"
+	umount -a
 	reboot -f
 }
 
@@ -213,6 +214,7 @@ nand_upgrade_ubinized() {
 
 	if [ ! "$mtdnum" ]; then
 		echo "cannot find mtd device $CI_UBIPART"
+		umount -a
 		reboot -f
 	fi
 



More information about the lede-commits mailing list