[RFC PATCH] ubifs: do not write master node if recovery needed

Sheng Yong shengyong1 at huawei.com
Thu Feb 5 01:54:40 PST 2015


If unclean umount happens, ubifs may fail when mounting. Trying to mount
it will write new master nodes on the flash. This is useless but wasting
space and increasing sqnum. So check need_recovery before writing master
node, and don't create new master node if filesystem needs recovery.

Signed-off-by: Sheng Yong <shengyong1 at huawei.com>
---
 fs/ubifs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index e642067..17e3016 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1287,7 +1287,7 @@ static int mount_ubifs(struct ubifs_info *c)
 			goto out_lpt;
 	}
 
-	if (!c->ro_mount) {
+	if (!c->ro_mount && !c->need_recovery) {
 		/*
 		 * Set the "dirty" flag so that if we reboot uncleanly we
 		 * will notice this immediately on the next mount.
-- 
1.8.3.4




More information about the linux-mtd mailing list