Mounting UBIFS readonly - is it really readonly?
dedekind1 at gmail.com
Mon Aug 23 15:14:21 EDT 2010
On Mon, 2010-08-23 at 11:33 -0700, Sergei Zhirikov wrote:
> I made the changes you suggested earlier to see if/when something is
> written and the results were quite unexpected. Just as I assumed,
> UBIFS remains mounted read-only all the time. But contrary to what I
> expected, none of the functions related to writing is ever called.
> Nevertheless, the timestamp still changes.
> I have also managed to reproduce the issue without involving system
> reboot. If I create a device node equivalent to /dev/console (major 5,
> minor 1) in any directory (on the root UBIFS) and then remount the FS
> read-only, the timestamp of the device node keeps changing upon any
> write operation to the device. The same thing happens when I
> try /dev/tty (major 5, minor 0), but with /dev/null (1,3) or /dev/zero
> (1,5) the timestamp does not change.
This suggests this is not VFS but tty-specific.
> I'm now even more puzzled than I was in the beginning. It looks like
> the VFS decides to update the timestamp for some reason, but does not
> pass that change to UBIFS (perhaps, because it knows the latter is
> read-only). So the updated timestamp exists only cached in memory and
> is never actually written to the FS. I haven't tried to verify that
> theory yet (which shouldn't be difficult).
It's late here and I'm heading to the bed, but while passing by my
computer I've quickly took a look and I can see the following in
tty_write() cales do_tty_write() which changes mtime:
inode->i_mtime = current_fs_time(inode->i_sb);
So it looks like this is a feature - ever write to /dev/console changes
mtime. It looks like [amc]time for device nodes are not always FS inode
times, but they may belong to the _driver_ which is represented by the
character device. I guess tty is just very special and this might be
just legacy stuff.
I might be mistaking though, good night :-)
More information about the linux-mtd