do_sys_truncate: call do_truncate with ATTR_MTIME|ATTR_CTIME
RFC PATCH 1/1 do_sys_truncate: call do_truncate with ATTR_MTIME|ATTR_CTIME
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?
From: Vladimir Saveliev <[email protected]>
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.
fs/open.c renamed from fs/open.c~do_truncate-time_attrs +1 -1
@@ -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);
_
Quoted 5 lines · Vladimir V. Saveliev
Hello
do_sys_ftruncatecallsdo_truncatewithtime_attrsset to ATTR_MTIME|ATTR_CTIME. Is there a reason fordo_sys_truncateto not settime_attrsto 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
Quoted 5 lines
email message attachment (do_truncate-time_attrs.patch)
Quoted 4 lines
-------- Forwarded Message --------
Subject: No Subject
Date: Fri, 30 Jun 2006 17:33:29 +0400