JFFS2 appears to "freeze" during erase

Joakim Tjernlund Joakim.Tjernlund at transmode.se
Thu Sep 21 07:17:52 EDT 2006

Radoslaw Bisewski wrote:
> This bug is caused by the use of erase_free_sem semaphore. Block erasing
> function jffs2_erase_block is called with erase_free_sem locked, i.e.
> erase_free_sem will be locked for the time needed to erase flash block (
> ~1 s for typical NOR chip), in the worst scenario access to file system
> may be blocked for a numer of seconds when the number of blocks is being
> erased. Workaround for this bug is simple - erase_free_sem cannot be
> locked when jffs2_erase_block function is called. See attached patch.
Me again

I think there is a bug in jffs2_erase_pending_blocks() after applying your patch:
	D1(printk(KERN_DEBUG "jffs2_erase_pending_blocks completed\n"));


the up(&c->erase_free_sem); needs to move to before done:


More information about the linux-mtd mailing list