[PATCH] Fix hanging close for /dev/mtd

Joakim Tjernlund joakim.tjernlund at transmode.se
Wed Jun 13 05:53:31 EDT 2007


Figured I should send this on its own.

Stracing a process using /dev/mtd shows that
it sometimes hangs for a long time when pdflush is erasing
sectors. /dev/mtd* close method calls the mtd->sync method
which can hang for a long time(minutes).

Futher, the sync method "syncs" all flash chips. It should
only sync the chips that a /dev/mtd* spans.
Also, the mtdchar/mtdblock drivers does not need to
call sync for readonly mappings.

>From c39777d86aa1bef8e053c3f78a5df0981e3a45a9 Mon Sep 17 00:00:00 2001
From: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
Date: Tue, 12 Jun 2007 19:25:56 +0200
Subject: [PATCH] Fix hanging close for /dev/mtd
When pdflush is erasing lots of sectors, drivers calling
mtd->sync will hang until all blocks are erased.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
---
 fs/jffs2/erase.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
index 24a48e9..33e5f13 100644
--- a/fs/jffs2/erase.c
+++ b/fs/jffs2/erase.c
@@ -150,7 +150,7 @@ void jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count)
 		}
 
 		/* Be nice */
-		cond_resched();
+		yield();
 		down(&c->erase_free_sem);
 		spin_lock(&c->erase_completion_lock);
 	}
-- 
1.5.2.1





More information about the linux-mtd mailing list