JFFS2 Corruption.

David Woodhouse dwmw2 at infradead.org
Tue Feb 24 07:00:10 EST 2004


On Tue, 2004-02-24 at 09:48 +0000, simon at baydel.com wrote:
> Comitted the sin of posting a reply with the reply text first, sorry.

And this time you committed the sin of including _far_ more of the
previous mail(s) than was necessary. But I'm not feeling cruel today so
I'll not continue to ignore you :)

> I have only managed to get this to fail if the jffs2 filesystem is mounted as root. I do 
> not seem to be able to get it to close and unmount the filesystem at shutdown. I 
> guess the BLKFLSBUF I do only flushes the buffer that is created when I open the 
> device and not the one that was created when the kernel opened the device. 

JFFS2 doesn't actually _use_ the mtdblock device. If you look closely at
the code, you'll see we never read or write to/from it, we just use the
minor number as an argument to get_mtd_device(). 

In fact, it's perfectly possible to use any _other_ device driver
instead of the mtdblock device, as long as it has the major number which
JFFS2 is looking for. 

I wonder if the rootfs-mounting is opening the _actual_ block device and
doing some I/O, and that's later getting flushed, causing corruption.
Although I can't comprehend why a failed attempt to mount, for example,
ext2 would cause the mtdblock device to consider its buffer _dirty_ and
try to write it back on close.

What happens if you use the 'mtdblock_ro' device instead? That shares
the major number, but doesn't share the caching.


-- 
dwmw2




More information about the linux-mtd mailing list