[PATCH] [JFFS2] Sibley non-contiguous write bug fix

Alexander Belyakov abelyako at googlemail.com
Wed Sep 5 05:35:25 EDT 2007


Hi David,

some time ago we have fixed one Sibley non-contiguous write bug:
http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=3fddb6c985e3823c991399840d2d5ef5940e1b60

But it seems there is the same bug in another place.
jffs2_flash_writev() sets 'wbuf_ofs' to the first page in block
causing a BUG(). Please look at this patch.



Don't leave the wbuf 'offset' field pointing at the start of the next
physical eraseblock. This is causing a BUG() on NOR-ECC (Sibley)
flash.

Signed-off-by: Alexander Belyakov <alexander.belyakov at intel.com>
---
diff -uNr a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
--- a/fs/jffs2/wbuf.c	2007-07-09 03:32:17.000000000 +0400
+++ b/fs/jffs2/wbuf.c	2007-07-09 16:55:29.000000000 +0400
@@ -846,6 +846,10 @@
 		donelen += wbuf_retlen;
 	}

+	/* adjust write buffer offset, else we get a non contiguous write bug */
+	if (!(c->wbuf_ofs % c->sector_size) && !c->wbuf_len)
+		c->wbuf_ofs = 0xffffffff;
+
 	/*
 	 * If there's a remainder in the wbuf and it's a non-GC write,
 	 * remember that the wbuf affects this ino



More information about the linux-mtd mailing list