* ext4 bug? last write time precedes last mount time on a writable volume!
@ 2012-03-02 12:39 Neil Clarkson
2012-03-02 20:45 ` Ted Ts'o
0 siblings, 1 reply; 3+ messages in thread
From: Neil Clarkson @ 2012-03-02 12:39 UTC (permalink / raw)
To: linux-kernel
Isn't the s_wtime field of the ext4 superblock supposed to show the
time, in seconds since the epoch, of the last write? It isn't
happening!
This line suggests the s_wtime is updated on a superblock commit
unless the volume is read only.
static int ext4_commit_super(struct super_block *sb, int sync)'
/*
* If the file system is mounted read-only, don't update the
* superblock write time. This avoids updating the superblock
* write time when we are mounting the root file system
* read/only but we need to replay the journal; at that point,
* for people who are east of GMT and who make their clock
* tick in localtime for Windows bug-for-bug compatibility,
* the clock is set in the future, and this will cause e2fsck
* to complain and force a full file system check.
*/
if (!(sb->s_flags & MS_RDONLY))
es->s_wtime = cpu_to_le32(get_seconds());
Yet a dumpe2fs on my ubuntu box gives the output below. Last write
time just a half hour after the volume was created!
Filesystem created: Wed Nov 23 13:42:18 2011
Last mount time: Tue Feb 21 09:07:54 2012
Last write time: Wed Nov 23 14:12:57 2011
/dev/sda1 on / type ext4 (rw,errors=remount-ro,commit=0)
Linux Wallace 3.0.0-16-generic #28-Ubuntu SMP Fri Jan 27 17:44:39 UTC
2012 x86_64 x86_64 x86_64 GNU/Linux (Ubuntu 11.10)
OpenSuse and Fedora show something slightly different, but still
wrong: last write time same as last mount time.
Linux VM-OpenSUSE2 2.6.37.1-1.2-desktop #1 SMP PREEMPT 2011-02-21
10:34:10 +0100 x86_64 x86_64 x86_64 GNU/Linux (Open SUSE 11.4)
Filesystem created: Fri Sep 23 18:04:27 2011
Last mount time: Fri Jan 27 09:34:55 2012
Last write time: Fri Jan 27 09:34:55 2012
Linux fedoraVM 2.6.35.6-45.fc14.i686 #1 SMP Mon Oct 18 23:56:17 UTC
2010 i686 i686 i386 GNU/Linux (Fedora 14)
Filesystem created: Wed Nov 3 07:24:17 2010
Last mount time: Fri Feb 3 13:04:41 2012
Last write time: Fri Feb 3 13:04:41 2012
Could someone please help me understand this? If this isn't the
correct forum to be querying apparently wayward ext4 functionality,
please point me at a better one.
Neil Clarkson
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ext4 bug? last write time precedes last mount time on a writable volume!
2012-03-02 12:39 ext4 bug? last write time precedes last mount time on a writable volume! Neil Clarkson
@ 2012-03-02 20:45 ` Ted Ts'o
2012-03-02 21:35 ` Neil Clarkson
0 siblings, 1 reply; 3+ messages in thread
From: Ted Ts'o @ 2012-03-02 20:45 UTC (permalink / raw)
To: Neil Clarkson; +Cc: linux-kernel
On Fri, Mar 02, 2012 at 12:39:57PM +0000, Neil Clarkson wrote:
> Isn't the s_wtime field of the ext4 superblock supposed to show the
> time, in seconds since the epoch, of the last write? It isn't
> happening!
It shows the last time the superblock has been modified, and one of
the things that we've been doing lately has been to optimize ext4 so
that it writes to the superblock *much* less often. It was a
performance bottleneck to be constantly updating the number of free
blocks in the superblock each time we write to a new block, for
example --- or update the superblock to update the number of free
inodes each time we allocate a new inode.
Is there a reason why you particularly care about s_wtime being
updated?
- Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ext4 bug? last write time precedes last mount time on a writable volume!
2012-03-02 20:45 ` Ted Ts'o
@ 2012-03-02 21:35 ` Neil Clarkson
0 siblings, 0 replies; 3+ messages in thread
From: Neil Clarkson @ 2012-03-02 21:35 UTC (permalink / raw)
To: Ted Ts'o, Neil Clarkson, linux-kernel
Thanks for responding Ted.
That would all make sense, if it weren't for the last write time on
the Ubuntu box being earlier than the last mount time, when clearly
the superblock *must* have got modified. Clearly that isn't what
Ubuntu is doing with it. But I guess, given that Ubuntu is different
from OpenSuse and Fedora in this regard, perhaps that's just something
Canonical have changed, intentionally or otherwise.
Andi Kleen was right then, when he offered much the same explanation
to me last week on the list.
> Is there a reason why you particularly care about s_wtime being updated?
Yes and no ;)
It was interesting to me when it seemed like it might be a way to find
the time of the last write to the file system, bugs notwithstanding. A
few public domain info sources suggest this is what it is. I could
have made good use of that in some work I'm doing. But if its not
meant to do that, which certainly makes sense from a performance
perspective, then no.
On 2 March 2012 20:45, Ted Ts'o <tytso@mit.edu> wrote:
> It shows the last time the superblock has been modified, and one of
> the things that we've been doing lately has been to optimize ext4 so
> that it writes to the superblock *much* less often. It was a
> performance bottleneck to be constantly updating the number of free
> blocks in the superblock each time we write to a new block, for
> example --- or update the superblock to update the number of free
> inodes each time we allocate a new inode.
>
> Is there a reason why you particularly care about s_wtime being
> updated?
>
> - Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-02 21:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-02 12:39 ext4 bug? last write time precedes last mount time on a writable volume! Neil Clarkson
2012-03-02 20:45 ` Ted Ts'o
2012-03-02 21:35 ` Neil Clarkson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox