Skip to content

Commit

Permalink
jffs2: Fix serious write stall due to erase
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Artem Bityutskiy <[email protected]>
Signed-off-by: David Woodhouse <[email protected]>
  • Loading branch information
joakim-tjernlund authored and David Woodhouse committed Oct 25, 2010
1 parent 733daa5 commit 81cfc9f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fs/jffs2/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,14 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
if (!list_empty(&c->erase_complete_list) ||
!list_empty(&c->erase_pending_list)) {
spin_unlock(&c->erase_completion_lock);
mutex_unlock(&c->alloc_sem);
D1(printk(KERN_DEBUG "jffs2_garbage_collect_pass() erasing pending blocks\n"));
if (jffs2_erase_pending_blocks(c, 1)) {
mutex_unlock(&c->alloc_sem);
if (jffs2_erase_pending_blocks(c, 1))
return 0;
}

D1(printk(KERN_DEBUG "No progress from erasing blocks; doing GC anyway\n"));
spin_lock(&c->erase_completion_lock);
mutex_lock(&c->alloc_sem);
}

/* First, work out which block we're garbage-collecting */
Expand Down

0 comments on commit 81cfc9f

Please sign in to comment.