JFFS2 not honouring MS_RDONLY flag on mount?
Richard_Theil at dadebehring.com
Richard_Theil at dadebehring.com
Tue Mar 30 05:55:06 EST 2004
(Try 2, hopefully _without_ html section this time) Hello everyone!
We're using JFFS2 on a custom MPC8250 board (with 8 or 32 MB Flash) and
the experience has been pleasant so far (*). I am in the process of
migrating our
suite to Kernel 2.6 and ran into a (little) problem with the mounting of
the root
(mtd) partition. I want to mount it read-only, so we can reliably detect
whether
the original image is still in flash, and only enable writing for testing
or possible
updates.
Although the mount flags are set to 0x8001 (MS_VERBOSE | MS_RDONLY),
jffs2 mounts as read/write. I have put a few printk's in, so you can see
what
happens:
...
do_kern_mount(sysfs,0x00000000,sysfs,0x00000000)
mount_root creating /dev/root as mtdblock2
mount_block_root: fs jffs2
do_kern_mount(jffs2,0x00008001,/dev/root,0x00000000)
jffs2_get_sb(..,0x00008001,/dev/root,0x00000000)
do_mount_root(/dev/root,jffs2,0x 8001,data) -> 0
VFS: Mounted root (jffs2 filesystem).
init started: BusyBox v1.00
...
Now. according to the flags, init/do_mounts.c:do_mount_root() should say
"VFS: ... readonly" as a first indicator.
It seems that somewhere on the path into jffs2_get_sb_mtd(), the flags
passed
as parameter _should_ be honoured, but are not. This would have to happen
before jffs2_do_fill_super is called, because in there, the collector
thread is
started if the fs is flagged r/w. Wouldn't it be appropriate to have a
line like
in jffs2_remount_fs:
sb->s_flags = (sb->s_flags & ~MS_RDONLY)|(*flags & MS_RDONLY);
after "sb->s_op = &jffs2_super_operations;" in jffs2_get_sb_mtd? While at
that,
it might be appropriate to apply the MS_VERBOSE flag to sb->s_flags as
well
(jffs2_do_fill_super doesn't use its 'silent' parameter, btw).
Or did I miss something where that rdonly stuff should happen at a larger
scope and it's broken for some other reason?
All work is being done on stock 2.6.3, but I cross-checked against
CVS-snapshot.
Rich
(*) Well, I had to find out the "rootfstype" thing the hard way...
More information about the linux-mtd
mailing list