[PATCH] [JFFS2] Non-contiguous write bug fix (Sibley)

Alexander Belyakov abelyako at googlemail.com
Wed May 2 09:49:02 EDT 2007


On 4/18/07, David Woodhouse <dwmw2 at infradead.org> wrote:
>
> Sorry, I missed (or have forgotten) this. Can you explain in a little
> more detail?
>
> The following condition (SECTOR_ADDR(to) != SECTOR_ADDR(wbuf_ofs)) is
> supposed to handle this, surely? In what circumstances is it
> insufficient?
>

David,

I just perform random length writes to JFFS2 and bug _always_ appears
at some point.

Currently it is possible to get 'wbuf_ofs' pointing to the beginning
of the eraseblock, meanwhile 'to' points one page ahead (cleanmarker
on Sibley) and 'wbuf_len' equals to zero. Both 'wbuf_ofs' and 'to'
belong to the same eraseblock and condition (SECTOR_ADDR(to) !=
SECTOR_ADDR(wbuf_ofs)) fails. So we hit BUG() in jffs2_flash_writev()
with non-contiguous write error.

>
> Hm, is this because the cleanmarker size in Sibley is also the wbuf
> size? So you were hitting the BUG() after writing the cleanmarker to a
> newly-erased block (hence setting wbuf_ofs to point there), but then
> moving on to actually _write_ elsewhere?
>
> If that's the case, perhaps the code which writes the cleanmarker
> shouldn't be using jffs2_flash_writev() to write it -- perhaps it should
> be bypassing the wbuf handling altogether?
>

Cleanmarker is written with jffs2_flash_direct_writev() and thus
doesn't affect wbuf.

David, do you have something in mind about fixing the bug without
applying the patch suggested?

Thanks,
Alexander




More information about the linux-mtd mailing list