[PATCH v2 0/5] UBIFS: fix recovery on CFI NOR

Artem Bityutskiy dedekind1 at gmail.com
Mon Feb 7 11:58:59 EST 2011


On Mon, 2011-02-07 at 17:25 +0100, Anatolij Gustschin wrote:
> I dropped the lines containing ffffffff in the dump above (verified
> that these were all ffffffff).
> 
> The UBIFS data node before the dumped area seems to be okay
> and contains "ABC123ABC123ABC123..." data block.
> 
> The corrupted area seems to contain data from an interrupted
> write operation. 

It looks like I missed the no_more_nodes() function. I think this should
fix the issue you have found. If you still have the flash which ubifs
refuses to mount, you can apply this patch, and ubifs should mount that
media.

diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c
index 4278ae7..65e4664 100644
--- a/fs/ubifs/recovery.c
+++ b/fs/ubifs/recovery.c
@@ -430,7 +430,7 @@ static int no_more_nodes(const struct ubifs_info *c, void *buf, int len,
 	int skip, dlen = le32_to_cpu(ch->len);
 
 	/* Check for empty space after the corrupt node's common header */
-	skip = ALIGN(offs + UBIFS_CH_SZ, c->min_io_size) - offs;
+	skip = ALIGN(offs + UBIFS_CH_SZ, c->max_write_size) - offs;
 	if (is_empty(buf + skip, len - skip))
 		return 1;
 	/*
@@ -442,7 +442,7 @@ static int no_more_nodes(const struct ubifs_info *c, void *buf, int len,
 		return 0;
 	}
 	/* Now we know the corrupt node's length we can skip over it */
-	skip = ALIGN(offs + dlen, c->min_io_size) - offs;
+	skip = ALIGN(offs + dlen, c->max_write_size) - offs;
 	/* After which there should be empty space */
 	if (is_empty(buf + skip, len - skip))
 		return 1;

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)




More information about the linux-mtd mailing list