JFFS2 deadlock, kernel 3.4.11

Thomas.Betker at rohde-schwarz.com Thomas.Betker at rohde-schwarz.com
Thu Oct 4 12:51:58 EDT 2012


Hello Joakim:

> Try Reply With Internet-style History (We use Notes here too)

Got it. Thanks!

> > jffs2_reserve_space() must not be called with f->sem held because it
> > acquires c->alloc_sem.
> 
> hmm, are you sure? Did it fail?
> As far as I can see jffs2_garbage_collect_live() does this.

jffs2_reserve_space() does mutex_lock(&c->alloc_sem) first thing, and 
README.Locking says "Never attempt to allocate space or lock alloc_sem 
with any f->sem held.". So I didn't even try; yes, I am a coward. (:-) 
Also, all the code I checked carefully releases f->sem before calling 
jffs2_reserve_space().

jffs2_garbage_collect_live() doesn't call jffs2_reserve_space() directly. 
Is it called indirectly somehow?

> > So I have moved mutex_lock(&f->sem) and grab_cache_page_write_begin()
> > after jffs2_reserve_space(). Attached is my 3.4.11 patch (which is 
based
> > on your patch) for review; I hope it is not mangled by Lotus Notes ...
> 
> don't have time to look ATM

Okay. When the tests succeed, I will simply mail it to the list as a 
regular patch, for general review.

Best regards,
Thomas




More information about the linux-mtd mailing list