Bug 6772 - truncate() updates timestamps even if file size does not change
Summary: truncate() updates timestamps even if file size does not change
Status: CLOSED CODE_FIX
Alias: None
Product: File System
Classification: Unclassified
Component: XFS (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: XFS Guru
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-29 23:58 UTC by Michael Kerrisk
Modified: 2008-09-22 16:45 UTC (History)
1 user (show)

See Also:
Kernel Version: 2.6.17
Subsystem:
Regression: ---
Bisected commit-id:


Attachments

Description Michael Kerrisk 2006-06-29 23:58:24 UTC
Most recent kernel where this bug did not occur: unknown
Distribution: SUSE 10.0
Hardware Environment: x86
Software Environment:
Problem Description:

POSIX requires that truncate() only change the ctime and mtime on the file if
the file size actually changes (see "man 3p truncate").  On ext2 and ext3, this
seems to work as required. 

However, ox XFS, truncate() changes the timestamps of the file even if the file
size remains unchanged.  This should not happen.

Steps to reproduce:

Something like the following can be used to test:
...

int main(int argc, char *argv[])
{
    if (truncate(argv[1], atoi(argv[2])) == -1) 
        perror("truncate")
}
Comment 1 Natalie Protasevich 2008-03-25 22:47:07 UTC
Is the problem still there with the recent kernel?
Thanks.
Comment 2 Dave Chinner 2008-03-26 03:10:31 UTC
This commit:

http://oss.sgi.com/cgi-bin/gitweb.cgi?p=xfs/xfs-2.6.git;a=commit;h=170c815e88c41859c9d79c9454c92dd9dd455bbe

is in the XFS git tree that will be merged into 2.6.26. So it's fixed,
just not yet in mainline.
Comment 3 Alan 2008-09-22 16:45:49 UTC
Verified present, closing

Note You need to log in before you can comment on or make changes to this bug.