From: Hugh Dickins <hugh@veritas.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: "Robin H. Johnson" <robbat2@gentoo.org>,
Al Viro <viro@zeniv.linux.org.uk>, Andi Kleen <ak@suse.de>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] tmpfs: time granularity fix for [acm]time going backwards
Date: Mon, 12 Jun 2006 21:50:25 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0606122146090.23556@blonde.wat.veritas.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0606122011020.18760@blonde.wat.veritas.com>
From: Robin H. Johnson <robbat2@gentoo.org>
I noticed a strange behavior in a tmpfs file system the other day, while
building packages - occasionally, and seemingly at random, make decided to
rebuild a target. However, only on tmpfs.
A file would be created, and if checked, it had a sub-second timestamp.
However, after an utimes related call where sub-seconds should be set, they
were zeroed instead. In the case that a file was created, and utimes(...,NULL)
was used on it in the same second, the timestamp on the file moved backwards.
After some digging, I found that this was being caused by tmpfs not having a
time granularity set, thus inheriting the default 1 second granularity.
Hugh adds: yes, we missed tmpfs when the s_time_gran mods went into 2.6.11.
Unfortunately, the granularity of CURRENT_TIME, often used in filesystems,
does not match the default granularity set by alloc_super. A few more such
discrepancies have been found, but this is the most important to fix now.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Acked-by: Andi Kleen <ak@suse.de>
Signed-off-by: Hugh Dickins <hugh@veritas.com>
---
This patch should probably be included for 2.6.17, despite how long the
bug has been around. It's a one-liner, with no side-effects.
mm/shmem.c | 1 +
1 file changed, 1 insertion(+)
--- 2.6.17-rc6-git/mm/shmem.c
+++ linux/mm/shmem.c
@@ -2102,6 +2102,7 @@ static int shmem_fill_super(struct super
sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
sb->s_magic = TMPFS_MAGIC;
sb->s_op = &shmem_ops;
+ sb->s_time_gran = 1;
inode = shmem_get_inode(sb, S_IFDIR | mode, 0);
if (!inode)
next prev parent reply other threads:[~2006-06-12 20:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-11 11:54 [PATCH] tmpfs time granularity fix for [acm]time going backwards. Also VFS time granularity bug on creat(). (Repost, more content) Robin H. Johnson
2006-06-11 18:10 ` Hugh Dickins
2006-06-12 5:10 ` Robin H. Johnson
2006-06-12 7:19 ` Jan Engelhardt
2006-06-12 19:24 ` Hugh Dickins
2006-06-12 20:50 ` Hugh Dickins [this message]
2006-06-13 3:38 ` [PATCH] tmpfs: time granularity fix for [acm]time going backwards Andi Kleen
2006-06-12 12:22 ` [PATCH] tmpfs time granularity fix for [acm]time going backwards. Also VFS time granularity bug on creat(). (Repost, more content) Andi Kleen
2006-06-12 19:38 ` Hugh Dickins
2006-06-13 3:49 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0606122146090.23556@blonde.wat.veritas.com \
--to=hugh@veritas.com \
--cc=ak@suse.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robbat2@gentoo.org \
--cc=torvalds@osdl.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®