Skip to contentSkip to conversation

JFFS2 deadlock in erase callback

DISCUSSION Adrian Hunter 2 participants 2 messages Oct 8, 2007 – Oct 10, 2007 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hi

We were planning to revert the following:

commit d364fb18cd991734eb54aa8840e70030b0c9f699
Author: Joakim Tjernlund <[email protected]>
Date: Wed Jun 27 01:24:09 2007 +0200

[JFFS2] Reduce time for which erase_free_sem is held during erase.

With current desing erase_free_sem is locked every time the flash block is being erased. For NOR flashes - ~1 second is needed to erase single flash block. In the worst case scenario erase_free_sem may be locked for a couple of seconds when the number of blocks is being erased (e.g. after large file was removed). When erase_free_sem is locked all read/write operations for given JFFS2 partition are locked too - in effect from time to time access to the JFFS2 partition is locked for a number of seconds. This fix makes critical section in flash erasing procedure shorter - now erase_free_sem is locked around erase_completion_lock spinlock only.

Originally from Radoslaw Bisewski

because of the deadlock it caused via the erase callback. Artem, who is away, said you were against moving the callback, but I see you have now done that with the following patch:

commit 49defc015ff58fda46a3afa3462dfdfa69bc8401
Author: David Woodhouse <[email protected]>
Date: Sat Oct 6 15:01:59 2007 -0400

[MTD] [NAND] Avoid deadlock in erase callback; release chip lock first.

When the erase callback performs some other action on the flash, it's highly likely to deadlock unless we actually release the chip lock before calling it.

Can you confirm, that adding the "Avoid deadlock..." patch is better than reverting "Reduce time..." patch.

Note the "Avoid deadlock..." change is needed for OneNAND also.

Regards
Adrian Hunter

#1 lore raw
Quoted 10 lines · Adrian Hunter

[MTD] [NAND] Avoid deadlock in erase callback; release chip lock first.

When the erase callback performs some other action on the flash, it's highly likely to deadlock unless we actually release the chip lock before calling it.

Can you confirm, that adding the "Avoid deadlock..." patch is better than reverting "Reduce time..." patch.

Yep, it's safe and definitely better.

I remember vaguely that we planned/discussed to move the release before the callback some time ago, but the patch never made it into mainline.

tglx