diff mbox

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

Message ID 1297097939.5938.26.camel@localhost
State New, archived
Headers show

Commit Message

Artem Bityutskiy Feb. 7, 2011, 4:58 p.m. UTC
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.

Comments

Anatolij Gustschin Feb. 7, 2011, 6:06 p.m. UTC | #1
On Mon, 07 Feb 2011 18:58:59 +0200
Artem Bityutskiy <dedekind1@gmail.com> wrote:

> 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.

I did a dump of the corrupted flash and now re-flashed it and
tested with this patch. This patch doesn't help. The debug log
produced while mounting looks similar.

Thanks,
Anatolij
diff mbox

Patch

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;