[LEDE-DEV] [LEDE-DEV, 3/3] fstools: fix lost mount point when first boot

rosysong at rosinson.com rosysong at rosinson.com
Thu Apr 5 01:47:03 PDT 2018


Sorry for the description.

1. The sda1 is a USB disk (exfat format), not only exfat, but also ntfs, fat16, fat32, ext4, all of them have the same issue.
2. Plug in the USB disk before upgrade firmware (do not unplug) and then wait until the system boot,
    After the filesystem initialized but before the jffs2(FS_DEADCODE) get ready, 
    please use the "mount" command to check if the sda1 is mounted under UART console.
3. You will find that the sda1 is mounted at the begining but lost the mount point after jffs2 get ready (FS_READY).

rosysong at rosinson.com
 
From: John Crispin
Date: 2018-04-02 23:48
To: rosysong at rosinson.com; lede-dev
Subject: Re: [LEDE-DEV] [LEDE-DEV, 3/3] fstools: fix lost mount point when first boot
 
 
On 29/03/18 10:25, rosysong at rosinson.com wrote:
> When firmware is new flashed and reboot with a storage device plug in its usb
> interface. Though the filesystem is not ready (FS_STATE_UNKNOWN), the
> /dev/sda1 still mount on /mnt/sda1 by block-mount, then the system switching jffs...
>
> root at OpenWrt:~# dmesg
> ......
> [   32.224522] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
> [   32.270514] jffs2_build_filesystem(): unlocking the mtd device...
> [   32.278711] jffs2_build_filesystem(): erasing all blocks after the end marker...
>
> root at OpenWrt:~# mount
> ......
> /dev/sda1 on /mnt/sda1 type exfat (rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,iocharset=utf8,namecase=0,errors=remount-ro)
> mountd(pid1314) on /tmp/run/blockd type autofs (rw,relatime,fd=7,pgrp=1,timeout=30,minproto=5,maxproto=5,indirect)
>
> After few miniutes, when filesystem is ready (FS_STATE_READY, /overlay/.fs_state -> 2)
> the /dev/sda1 lost its mount point
>
> root at OpenWrt:~# dmesg
>
> ...
>
> [  207.439407] jffs2: notice: (1336) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
>
> root at OpenWrt:~# mount
> ......
> **no /mnt/sda1 found**
> ......
>
> Signed-off-by: Rosy Song <rosysong at rosinson.com>
 
Hi
the description explains the bug but fails to expalin how the patch
solves the problem. I am also struggeling to understand the problem. You
are trying to use sda1 as jffs2 but there is a exfat already present so
that they collide ?
    John
 
> ---
>   mount_root.c | 11 ++++++++++-
>   1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/mount_root.c b/mount_root.c
> index dffb0a6..110e4fd 100644
> --- a/mount_root.c
> +++ b/mount_root.c
> @@ -101,6 +101,7 @@ stop(int argc, char *argv[1])
>   static int
>   done(int argc, char *argv[1])
>   {
> +	int ret;
>   	struct volume *v = volume_find("rootfs_data");
>  
>   	if (!v)
> @@ -109,7 +110,15 @@ done(int argc, char *argv[1])
>   	switch (volume_identify(v)) {
>   	case FS_NONE:
>   	case FS_DEADCODE:
> -	return jffs2_switch(v);
> +	ret = jffs2_switch(v);
> +	/*
> +	* Devices mounted under /mnt will lost their mount point(see switch2jffs())
> +	* if the filesystem's(/overlay) state is not FS_STATE_READY,
> +	* this action can fix it.
> +	*/
> +	if (!access("/sbin/block", X_OK))
> +	system("/sbin/block mount");
> +	return ret;
>  
>   	case FS_EXT4:
>   	case FS_F2FS:
> --
> 2.13.3

 


More information about the Lede-dev mailing list