linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* truncate and {m,c}time on ntfs
@ 2006-03-12 16:50 Anton Altaparmakov
  2006-03-12 17:00 ` Anton Altaparmakov
  0 siblings, 1 reply; 2+ messages in thread
From: Anton Altaparmakov @ 2006-03-12 16:50 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-fsdevel, linux-kernel

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?

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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: truncate and {m,c}time on ntfs
  2006-03-12 16:50 truncate and {m,c}time on ntfs Anton Altaparmakov
@ 2006-03-12 17:00 ` Anton Altaparmakov
  0 siblings, 0 replies; 2+ messages in thread
From: Anton Altaparmakov @ 2006-03-12 17:00 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-fsdevel, linux-kernel

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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-03-12 17:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-12 16:50 truncate and {m,c}time on ntfs Anton Altaparmakov
2006-03-12 17:00 ` Anton Altaparmakov

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).