JFFS2 deadlock in erase callback

Adrian Hunter ext-adrian.hunter at nokia.com
Mon Oct 8 03:43:10 EDT 2007


Hi

We were planning to revert the following:

    commit d364fb18cd991734eb54aa8840e70030b0c9f699
    Author: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
    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
       Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
       Signed-off-by: David Woodhouse <dwmw2 at infradead.org>


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 <dwmw2 at infradead.org>
    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.
    
        Signed-off-by: David Woodhouse <dwmw2 at infradead.org>


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



More information about the linux-mtd mailing list