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

David Woodhouse dwmw2 at infradead.org
Wed May 2 09:58:34 EDT 2007


On Wed, 2007-05-02 at 17:49 +0400, Alexander Belyakov wrote:
> 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. But _how_ do we get into that state? If it isn't through writing the
cleanmarker (and it looks like you're right; it isn't), then _how_ is
c->wbuf_ofs ever setting set to point to the first page in the block?

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

I'm concerned by the patch, because I think it's "protecting" against a
situation which should never happen. I want to understand _why_ we get
into this state, not just apply the symptomatic fix.

Can you add something like a WARN_ON(!(c->wbuf_ofs % c->sector_size))
whereever we set c->wbuf_ofs, and see where it's happening?

-- 
dwmw2                       09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0





More information about the linux-mtd mailing list