* Mounting UBIFS readonly - is it really readonly?
@ 2010-07-27 19:05 Sergei Zhirikov
2010-08-05 4:51 ` Artem Bityutskiy
2010-08-23 12:23 ` Artem Bityutskiy
0 siblings, 2 replies; 6+ messages in thread
From: Sergei Zhirikov @ 2010-07-27 19:05 UTC (permalink / raw)
To: linux-mtd
Hi,
I hope someone can help me to resolve the following mystery.
I'm using UBIFS as the root filesystem always mounted readonly.
The kernel boot parameters are:
console=ttyS0,115200 ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs ro loglevel=6
As you can see, there is "ro", which causes UBIFS to be initially mounted readonly. And later it is *never* remounted read-write. Everything seems to work as expected (I get "Read-only file system" error upon a write attempt) except one thing. Somehow the modification time of /dev/console is updated every time the system boots. Note: I'm not talking about the /dev/console located inside the /dev mount (which is tmpfs and is obvously writable), I'm talking about the /dev/console located on the root file system and accessed (probably by init) before /dev is mounted. I'm really puzzled. How is this possible? The root filesystem has been readonly all the time and still the timestamp is somehow updated. Does anyone have an idea what might be going on there?
I'm using kernel 2.6.33.6 and classic sysvinit-2.86.
Thanks and regards,
Sergei.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mounting UBIFS readonly - is it really readonly?
2010-07-27 19:05 Mounting UBIFS readonly - is it really readonly? Sergei Zhirikov
@ 2010-08-05 4:51 ` Artem Bityutskiy
2010-08-23 12:23 ` Artem Bityutskiy
1 sibling, 0 replies; 6+ messages in thread
From: Artem Bityutskiy @ 2010-08-05 4:51 UTC (permalink / raw)
To: Sergei Zhirikov; +Cc: linux-mtd
On Tue, 2010-07-27 at 21:05 +0200, Sergei Zhirikov wrote:
> I hope someone can help me to resolve the following mystery.
>
> I'm using UBIFS as the root filesystem always mounted readonly.
> The kernel boot parameters are:
> console=ttyS0,115200 ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs ro
> loglevel=6
>
> As you can see, there is "ro", which causes UBIFS to be initially
> mounted readonly. And later it is *never* remounted read-write.
> Everything seems to work as expected (I get "Read-only file system"
> error upon a write attempt) except one thing. Somehow the modification
> time of /dev/console is updated every time the system boots. Note: I'm
> not talking about the /dev/console located inside the /dev mount
> (which is tmpfs and is obvously writable), I'm talking about
> the /dev/console located on the root file system and accessed
> (probably by init) before /dev is mounted. I'm really puzzled. How is
> this possible? The root filesystem has been readonly all the time and
> still the timestamp is somehow updated. Does anyone have an idea what
> might be going on there?
>
> I'm using kernel 2.6.33.6 and classic sysvinit-2.86.
Hi,
very brief comment as I have not time now, sorry. Try to hack UBIFS and
add prints to the following functions:
ubifs_remount_rw()
mount_ubifs(), print if 'mounted_read_only != 0'
this way you will check whether UBIFS is really always RO.
Also, add a print to 'ubifs_write_inode()' to make sure no inodes are
ever written. Actually, there is already a 'dbg_gen()' print, just turn
it into
printk(KERN_CRIT "inode %lu, mode %#x, nlink %u\n",
inode->i_ino, (int)inode->i_mode, inode->i_nlink);
Also, add a print in 'ubifs_iget()' and print the timestamp there. Do
this after 'ubifs_tnc_lookup()'. Print timestamp there. You can even
find out inode number for /dev/console, and print this only for this
inode number.
This way you will see what is actually going on in UBIFS and prove that
there is an UBIFS bug, if there is.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mounting UBIFS readonly - is it really readonly?
2010-07-27 19:05 Mounting UBIFS readonly - is it really readonly? Sergei Zhirikov
2010-08-05 4:51 ` Artem Bityutskiy
@ 2010-08-23 12:23 ` Artem Bityutskiy
2010-08-23 12:41 ` Artem Bityutskiy
1 sibling, 1 reply; 6+ messages in thread
From: Artem Bityutskiy @ 2010-08-23 12:23 UTC (permalink / raw)
To: Sergei Zhirikov; +Cc: linux-mtd
On Tue, 2010-07-27 at 21:05 +0200, Sergei Zhirikov wrote:
> As you can see, there is "ro", which causes UBIFS to be initially
> mounted readonly. And later it is *never* remounted read-write.
> Everything seems to work as expected (I get "Read-only file system"
> error upon a write attempt) except one thing. Somehow the modification
> time of /dev/console is updated every time the system boots. Note: I'm
> not talking about the /dev/console located inside the /dev mount
> (which is tmpfs and is obvously writable), I'm talking about
> the /dev/console located on the root file system and accessed
> (probably by init) before /dev is mounted. I'm really puzzled. How is
> this possible? The root filesystem has been readonly all the time and
> still the timestamp is somehow updated. Does anyone have an idea what
> might be going on there?
Did you solve the issue, I'm just curious.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mounting UBIFS readonly - is it really readonly?
2010-08-23 12:23 ` Artem Bityutskiy
@ 2010-08-23 12:41 ` Artem Bityutskiy
2010-08-23 18:33 ` Sergei Zhirikov
0 siblings, 1 reply; 6+ messages in thread
From: Artem Bityutskiy @ 2010-08-23 12:41 UTC (permalink / raw)
To: Sergei Zhirikov; +Cc: linux-mtd
On Mon, 2010-08-23 at 15:23 +0300, Artem Bityutskiy wrote:
> On Tue, 2010-07-27 at 21:05 +0200, Sergei Zhirikov wrote:
> > As you can see, there is "ro", which causes UBIFS to be initially
> > mounted readonly. And later it is *never* remounted read-write.
> > Everything seems to work as expected (I get "Read-only file system"
> > error upon a write attempt) except one thing. Somehow the modification
> > time of /dev/console is updated every time the system boots. Note: I'm
> > not talking about the /dev/console located inside the /dev mount
> > (which is tmpfs and is obvously writable), I'm talking about
> > the /dev/console located on the root file system and accessed
> > (probably by init) before /dev is mounted. I'm really puzzled. How is
> > this possible? The root filesystem has been readonly all the time and
> > still the timestamp is somehow updated. Does anyone have an idea what
> > might be going on there?
>
> Did you solve the issue, I'm just curious.
I think you can use inotify to verify whether the FS is ever changed?
http://en.wikipedia.org/wiki/Inotify
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mounting UBIFS readonly - is it really readonly?
2010-08-23 12:41 ` Artem Bityutskiy
@ 2010-08-23 18:33 ` Sergei Zhirikov
2010-08-23 19:14 ` Artem Bityutskiy
0 siblings, 1 reply; 6+ messages in thread
From: Sergei Zhirikov @ 2010-08-23 18:33 UTC (permalink / raw)
To: dedekind1; +Cc: linux-mtd
> From: Artem Bityutskiy <dedekind1@gmail.com>
> Subject: Re: Mounting UBIFS readonly - is it really readonly?
> To: "Sergei Zhirikov" <sfzhi@yahoo.com>
> Cc: linux-mtd@lists.infradead.org
> Date: Monday, August 23, 2010, 2:41 PM
> On Mon, 2010-08-23 at 15:23 +0300,
> Artem Bityutskiy wrote:
> > On Tue, 2010-07-27 at 21:05 +0200, Sergei Zhirikov
> wrote:
> > > As you can see, there is "ro", which causes UBIFS
> to be initially
> > > mounted readonly. And later it is *never*
> remounted read-write.
> > > Everything seems to work as expected (I get
> "Read-only file system"
> > > error upon a write attempt) except one thing.
> Somehow the modification
> > > time of /dev/console is updated every time the
> system boots. Note: I'm
> > > not talking about the /dev/console located inside
> the /dev mount
> > > (which is tmpfs and is obvously writable), I'm
> talking about
> > > the /dev/console located on the root file system
> and accessed
> > > (probably by init) before /dev is mounted. I'm
> really puzzled. How is
> > > this possible? The root filesystem has been
> readonly all the time and
> > > still the timestamp is somehow updated. Does
> anyone have an idea what
> > > might be going on there?
> >
> > Did you solve the issue, I'm just curious.
>
> I think you can use inotify to verify whether the FS is
> ever changed?
>
> http://en.wikipedia.org/wiki/Inotify
>
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.
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).
--
Sergei.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mounting UBIFS readonly - is it really readonly?
2010-08-23 18:33 ` Sergei Zhirikov
@ 2010-08-23 19:14 ` Artem Bityutskiy
0 siblings, 0 replies; 6+ messages in thread
From: Artem Bityutskiy @ 2010-08-23 19:14 UTC (permalink / raw)
To: Sergei Zhirikov; +Cc: linux-mtd
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
drivers/char/tty_io.c:
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 :-)
Artem.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-08-23 19:14 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-27 19:05 Mounting UBIFS readonly - is it really readonly? Sergei Zhirikov
2010-08-05 4:51 ` Artem Bityutskiy
2010-08-23 12:23 ` Artem Bityutskiy
2010-08-23 12:41 ` Artem Bityutskiy
2010-08-23 18:33 ` Sergei Zhirikov
2010-08-23 19:14 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).