jffs2: Fix serious write stall due to erase

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sun Oct 24 20:59:10 EDT 2010


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=81cfc9f1f4ad8d335367bb393bd042cc45b00047
Commit:     81cfc9f1f4ad8d335367bb393bd042cc45b00047
Parent:     733daa52b8d358e7c18be7fb9f82afc0619408f4
Author:     Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
AuthorDate: Thu Oct 7 18:01:44 2010 +0200
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Mon Oct 25 01:06:22 2010 +0100

    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 at transmode.se>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 fs/jffs2/gc.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c
index 846a794..31dce61 100644
--- a/fs/jffs2/gc.c
+++ b/fs/jffs2/gc.c
@@ -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 */



More information about the linux-mtd-cvs mailing list