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

2018-04-05 Thread rosys...@rosinson.com
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).

rosys...@rosinson.com
 
From: John Crispin
Date: 2018-04-02 23:48
To: rosys...@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, rosys...@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@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@OpenWrt:~# mount
> ..
> /dev/sda1 on /mnt/sda1 type exfat 
> (rw,relatime,fmask=,dmask=,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@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@OpenWrt:~# mount
> ..
> **no /mnt/sda1 found**
> ..
>
> Signed-off-by: Rosy Song <rosys...@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

 
___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


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

2018-04-02 Thread John Crispin



On 29/03/18 10:25, rosys...@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@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@OpenWrt:~# mount
..
/dev/sda1 on /mnt/sda1 type exfat 
(rw,relatime,fmask=,dmask=,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@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@OpenWrt:~# mount
..
**no /mnt/sda1 found**
..

Signed-off-by: Rosy Song 


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



Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev
___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev