Bug 6771 - truncate() does not update ctime and mtime when file is extended
Summary: truncate() does not update ctime and mtime when file is extended
Status: CLOSED CODE_FIX
Alias: None
Product: File System
Classification: Unclassified
Component: ReiserFS (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: ReiseFS developers team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-29 23:54 UTC by Michael Kerrisk
Modified: 2008-09-22 16:43 UTC (History)
2 users (show)

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


Attachments
make truncate to update ctime and mtime (796 bytes, patch)
2006-06-30 06:32 UTC, Vladimir V. Saveliev
Details | Diff

Description Michael Kerrisk 2006-06-29 23:54:33 UTC
Most recent kernel where this bug did not occur: don't know
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 change.  On ext2 and ext3, this seems to work as required. 

However, Reiserfs is broken: it only updates the file timestamps if a file is
shrunk.  If the file size remains the same the timestamps are not changed
(correct), but if the file size increases, the timestamps are also not changed
(wrong).

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 Vladimir V. Saveliev 2006-06-30 06:32:28 UTC
Created attachment 8466 [details]
make truncate to update ctime and mtime

The patch should make reiserfs to update ctime/mtime on expanding truncate.
Comment 2 Vladimir V. Saveliev 2006-06-30 07:38:18 UTC
the patch I sent earlier is wrong. Proper fix will be ready a bit later.
Comment 3 Adrian Bunk 2006-11-18 16:26:23 UTC
Vladimir, what is the status of this issue?
Comment 4 Natalie Protasevich 2008-03-25 22:35:07 UTC
The patch above has been incorporated nevertheless..
Any update on this bug, is the problem still there?

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