From: Anton Altaparmakov <aia21@cam.ac.uk>
To: Linus Torvalds <torvalds@osdl.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
fsdevel <linux-fsdevel@vger.kernel.org>,
Andrew Morton <akpm@osdl.org>,
Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Subject: [PATCH 2.6] Do not set ATTR_CTIME in do_truncate(). - was: Re: truncate(2) sometimes updates ctime and sometimes ctime and mtime!
Date: Tue, 04 Oct 2005 11:31:19 +0100 [thread overview]
Message-ID: <1128421880.3785.0.camel@imp.csi.cam.ac.uk> (raw)
In-Reply-To: <1128095994.3584.12.camel@imp.csi.cam.ac.uk>
Hi Linus,
Here is a (tested) patch to remove the setting of ATTR_CTIME in
do_truncate() as you suggested.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
---
On Fri, 2005-09-30 at 08:36 -0700, Linus Torvalds wrote:
> On Fri, 30 Sep 2005, Anton Altaparmakov wrote:
> > There is an inconsistency in the way truncate works which was introduced
> > (relatively) recently.
> >
> > fs/open.c::sys_truncate
> > -> do_sys_truncate
> > -> do_truncate does:
> >
> > newattrs.ia_size = length;
> > newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
> >
> > Hmm.. That looks wrong, partly because I don't think it should even set
> > ATTR_CTIME _either_. However, I don't see any recent changes to that code,
> > so it must have been logn for a long time. That line in do_truncate() has
> > been like that since at _least_ 2002.
Having gone through looking at ext2/3 and having made ntfs_truncate()
behave the same way as ext2/3_truncate() wrt m/ctime, I now agree with
you. do_truncate() should only set ATTR_SIZE, not ATTR_CTIME. The file
system will set ATTR_CTIME and ATTR_MTIME anyway so it's a waste for the
attribute to also set ATTR_CTIME. That way it happens twice.
Below is a patch to remove it...
Best regards,
Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
diff --git a/fs/open.c b/fs/open.c
--- a/fs/open.c
+++ b/fs/open.c
@@ -204,7 +204,7 @@ int do_truncate(struct dentry *dentry, l
return -EINVAL;
newattrs.ia_size = length;
- newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
+ newattrs.ia_valid = ATTR_SIZE;
down(&dentry->d_inode->i_sem);
err = notify_change(dentry, &newattrs);
next prev parent reply other threads:[~2005-10-04 10:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-30 15:04 Anton Altaparmakov
2005-09-30 15:36 ` Linus Torvalds
2005-09-30 15:59 ` Anton Altaparmakov
2005-10-04 10:31 ` Anton Altaparmakov [this message]
2005-10-04 10:55 ` [PATCH 2.6] Do not set ATTR_CTIME in do_truncate(). - was: " Miklos Szeredi
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=1128421880.3785.0.camel@imp.csi.cam.ac.uk \
--to=aia21@cam.ac.uk \
--cc=akpm@osdl.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
--cc=viro@parcelfarce.linux.theplanet.co.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®