[PATCH] Fix hanging close for /dev/mtd

Joakim Tjernlund joakim.tjernlund at transmode.se
Wed Jun 13 09:29:38 EDT 2007


On Wed, 2007-06-13 at 13:54 +0200, Jörn Engel wrote:
> On Wed, 13 June 2007 13:48:21 +0200, Joakim Tjernlund wrote:
> > On Wed, 2007-06-13 at 06:44 -0500, Josh Boyer wrote:
> > > On Wed, 2007-06-13 at 11:53 +0200, Joakim Tjernlund wrote:
> > > > 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.
> > > 
> > > So were you going to submit a separate patch for those issues?
> > 
> > Wow, someone is reading my mails :)
> 
> I read most of them.
> 
> In this case you made me wonder.  What is the mtd->sync method supposed
> to accomplish anyway?  mtd->write is synchronous, mtd->erase de-facto
> also is.  So it cannot be a sync in the sense of "flush all dirty data
> to flash and don't return before you're finished".  Or can it?
> 
> Jörn

Yes, this is also my view(for NOR flash, NAND is diffrent).
mtd->erase can be suspended though, but it doesn't matter
in this case. However, I don't know enough to be 100% sure

 Jocke



More information about the linux-mtd mailing list