Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 81cfc9f1 authored by Joakim Tjernlund's avatar Joakim Tjernlund Committed by David Woodhouse
Browse files

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: default avatarJoakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 733daa52
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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);
		D1(printk(KERN_DEBUG "jffs2_garbage_collect_pass() erasing pending blocks\n"));
		if (jffs2_erase_pending_blocks(c, 1)) {
		mutex_unlock(&c->alloc_sem);
		D1(printk(KERN_DEBUG "jffs2_garbage_collect_pass() erasing pending blocks\n"));
		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 */