mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC] [PATCH] do_sys_truncate: call do_truncate with ATTR_MTIME|ATTR_CTIME
@ 2006-06-30 13:33 Vladimir V. Saveliev
  2006-06-30 13:59 ` Trond Myklebust
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir V. Saveliev @ 2006-06-30 13:33 UTC (permalink / raw)
  To: lkml

[-- Attachment #1: Type: text/plain, Size: 186 bytes --]

Hello

do_sys_ftruncate calls do_truncate with time_attrs set to ATTR_MTIME|
ATTR_CTIME. Is there a reason for do_sys_truncate to not set time_attrs
to the same value or it is a bug?




[-- Attachment #2: do_truncate-time_attrs.patch --]
[-- Type: message/rfc822, Size: 972 bytes --]

From: 
Subject: No Subject
Date: Fri, 30 Jun 2006 17:33:29 +0400
Message-ID: <1151674409.6499.53.camel@tribesman.namesys.com>

From: Vladimir Saveliev <vs@namesys.com>

When do_truncate is called from do_sys_truncate it is not given
ATTR_MTIME|ATTR_CTIME as in case when it is called from
do_sys_ftruncate. The patch fixes this unfairness.

Signed-off-by: Vladimir Saveliev <vs@namesys.com>



diff -puN fs/open.c~do_truncate-time_attrs fs/open.c
--- linux-2.6.17-mm3/fs/open.c~do_truncate-time_attrs	2006-06-30 16:41:21.000000000 +0400
+++ linux-2.6.17-mm3-root/fs/open.c	2006-06-30 16:49:54.000000000 +0400
@@ -270,7 +270,7 @@ static long do_sys_truncate(const char _
 	error = locks_verify_truncate(inode, NULL, length);
 	if (!error) {
 		DQUOT_INIT(inode);
-		error = do_truncate(nd.dentry, length, 0, NULL);
+		error = do_truncate(nd.dentry, length, ATTR_MTIME|ATTR_CTIME, NULL);
 	}
 	put_write_access(inode);
 

_

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

* Re: [RFC] [PATCH] do_sys_truncate: call do_truncate with ATTR_MTIME|ATTR_CTIME
  2006-06-30 13:33 [RFC] [PATCH] do_sys_truncate: call do_truncate with ATTR_MTIME|ATTR_CTIME Vladimir V. Saveliev
@ 2006-06-30 13:59 ` Trond Myklebust
  0 siblings, 0 replies; 2+ messages in thread
From: Trond Myklebust @ 2006-06-30 13:59 UTC (permalink / raw)
  To: Vladimir V. Saveliev; +Cc: lkml

On Fri, 2006-06-30 at 17:33 +0400, Vladimir V. Saveliev wrote:
> Hello
> 
> do_sys_ftruncate calls do_truncate with time_attrs set to ATTR_MTIME|
> ATTR_CTIME. Is there a reason for do_sys_truncate to not set time_attrs
> to the same value or it is a bug?

It would be a bug.

In the case of truncate(), the filesystem has to decide if the file size
will actually change. If it does, then it has to update mtime/ctime. In
the case of ftruncate(), it would appear that the filesystem always has
to update mtime/ctime on success, so it is appropriate to call
do_truncate with ATTR_MTIME/ATTR_CTIME.

Cheers,
  Trond

> email message attachment (do_truncate-time_attrs.patch)
> > -------- Forwarded Message --------
> > Subject: No Subject
> > Date: Fri, 30 Jun 2006 17:33:29 +0400
> > 


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

end of thread, other threads:[~2006-06-30 13:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-30 13:33 [RFC] [PATCH] do_sys_truncate: call do_truncate with ATTR_MTIME|ATTR_CTIME Vladimir V. Saveliev
2006-06-30 13:59 ` Trond Myklebust

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome