JFFS2 wbuf non-contiguous write bug

Alexander Belyakov abelyako at googlemail.com
Thu Jun 29 08:00:05 EDT 2006


Hello,

"Non-contiguous write" bug appears in jffs2_flash_writev() function
(JFFS2 mounted on Sibley). It seems the reason is "wbuf fixup" code
removed from wbuf.c with this commit

"[MTD] Merge STMicro NOR_ECC code with Intel Sibley code"
http://kernel.org/git/?p=linux/kernel/git/dwmw2/mtd-2.6.git;a=commit;h=c8b229de2b05c2b3e8d282ce260935a88ac030ca

The following lines were removed there

		if (((c->wbuf_ofs % c->sector_size) == 0) && !c->wbuf_len) {
			c->wbuf_ofs = PAGE_DIV(to);
			c->wbuf_len = PAGE_MOD(to);
			memset(c->wbuf,0xff,c->wbuf_pagesize);
		}

Getting that code back fixes the problem.

One may notice that there is another "new eraseblock" check left in
jffs2_flash_writev()

	if (SECTOR_ADDR(to) != SECTOR_ADDR(c->wbuf_ofs)) { ...

But it is not enough since SECTOR_ADDR(to) and
SECTOR_ADDR(c->wbuf_ofs) could be the same here even in case of moving
to a new eraseblock.

Am I missing something or "wbuf fixup" code should be indeed restored?

Thanks,
Alexander Belyakov




More information about the linux-mtd mailing list