linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anton Altaparmakov <aia21@cam.ac.uk>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: truncate and {m,c}time on ntfs
Date: Sun, 12 Mar 2006 17:00:51 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0603121651360.29271@hermes-2.csi.cam.ac.uk> (raw)
In-Reply-To: <Pine.LNX.4.64.0603121641380.29271@hermes-2.csi.cam.ac.uk>

On Sun, 12 Mar 2006, Anton Altaparmakov wrote:
> Hi Christoph,
> 
> A patch of yours modified fs/ntfs/inode.c::ntfs_truncate() and inserted 
> this comment:
> 
> [snip]
> 	/* normally ->truncate shouldn't update ctime or mtime,
> 	 * but ntfs did before so it got a copy & paste version
> 	 * of file_update_time.  one day someone should fix this
> 	 * for real.
> 	 */
> [snip]
> 
> Did you realise that all (local) file systems in Linux kernel set both 
> {m,c}time in their ->truncate function.  E.g. from 
> fs/ext3.c/inode.c::ext3_truncate():
> 
> inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
> 
> Would you be so kind to explain what is your problem with ntfs doing it, 
> too?  And if your statement is correct and no file system should touch 
> {m,c}time in their ->truncate() method, could you explain to me how the 
> {m,c}time would be set otherwise when open(O_TRUNC) or {f,}truncate() is 
> executed on a file?

Sorry, I know how open(O_TRUNC) sets it as it calls do_truncate(,, 
ATTR_MTIME|ATTR_CTIME,) but at present both {f,}truncate() call 
do_truncate(,, 0,) and I do not see anywhere else where the setting 
would/could be done, other than in the file system ->truncate method.

In fact if I take the setting of {m,c}time out of ntfs_truncate(), doing:

touch
stat foo
truncate foo 10
stat foo

Does not result in a change in the {m,c}time...

Given posix/sus3 requires setting of {m,c}time on truncate, it would 
appear that a file system ->truncate function needs to set {m,c}time 
itself...

Please explain why you added your comment to ntfs...

Thanks a lot in advance.

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/

      reply	other threads:[~2006-03-12 17:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-12 16:50 truncate and {m,c}time on ntfs Anton Altaparmakov
2006-03-12 17:00 ` Anton Altaparmakov [this message]

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.0603121651360.29271@hermes-2.csi.cam.ac.uk \
    --to=aia21@cam.ac.uk \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).