Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

jffs2: Fix serious write stall due to erase

Drop the alloc_sem before erasing flash in
jffs2_garbage_collect_pass().
Otherwise writes are put on hold until the erase
has finised.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by

Joakim Tjernlund and committed by
David Woodhouse
81cfc9f1 733daa52

+4 -3
+4 -3
fs/jffs2/gc.c
··· 219 219 if (!list_empty(&c->erase_complete_list) || 220 220 !list_empty(&c->erase_pending_list)) { 221 221 spin_unlock(&c->erase_completion_lock); 222 + mutex_unlock(&c->alloc_sem); 222 223 D1(printk(KERN_DEBUG "jffs2_garbage_collect_pass() erasing pending blocks\n")); 223 - if (jffs2_erase_pending_blocks(c, 1)) { 224 - mutex_unlock(&c->alloc_sem); 224 + if (jffs2_erase_pending_blocks(c, 1)) 225 225 return 0; 226 - } 226 + 227 227 D1(printk(KERN_DEBUG "No progress from erasing blocks; doing GC anyway\n")); 228 228 spin_lock(&c->erase_completion_lock); 229 + mutex_lock(&c->alloc_sem); 229 230 } 230 231 231 232 /* First, work out which block we're garbage-collecting */