diff mbox

[OpenWrt-Devel,fstools,2/2] jffs2reset: use jffs2_mark if rootfs_data isn't mounted

Message ID 1428693685-11716-2-git-send-email-zajec5@gmail.com
State Changes Requested
Headers show

Commit Message

Rafał Miłecki April 10, 2015, 7:21 p.m. UTC
Erasing all rootfs_data blocks may cause some problems with partition
identification. It won't contain MAGIC, but will be successfully mounted
with delayed blocks marking. This may be really confusing when user
reboots before JFFS2 finishes its blocks management. During the next
boot rootfs_data will be a valid partition (possibly with data) but
libblkid won't detect it.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 jffs2reset.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/jffs2reset.c b/jffs2reset.c
index d634386..c8795ea 100644
--- a/jffs2reset.c
+++ b/jffs2reset.c
@@ -27,6 +27,8 @@ 
 #include "libfstools/libfstools.h"
 #include "libfstools/volume.h"
 
+static int jffs2_mark(struct volume *v);
+
 static int
 ask_user(int argc, char **argv)
 {
@@ -50,8 +52,8 @@  static int jffs2_reset(struct volume *v)
 		overlay_delete(mp, false);
 		mount(mp, "/", NULL, MS_REMOUNT, 0);
 	} else {
-		ULOG_INFO("%s is not mounted, erasing it\n", v->blk);
-		volume_erase_all(v);
+		ULOG_INFO("%s is not mounted, its files can't be simply erased\n", v->blk);
+		return jffs2_mark(v);
 	}
 
 	return 0;