summaryrefslogtreecommitdiff
path: root/fs/ext2
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2010-06-03 16:01:46 +0400
committerAl Viro <viro@zeniv.linux.org.uk>2010-06-05 01:16:30 +0400
commitaf5a30d8cfcfc561336f982b06345d6b815e0bb3 (patch)
treeeb4e6fb6873355a2a96b698aeb371eb058a88c87 /fs/ext2
parent8718d36cf99f5acf0f37487557ec25aee54b930b (diff)
downloadlinux-af5a30d8cfcfc561336f982b06345d6b815e0bb3.tar.xz
fix truncate inode time modification breakage
mtime and ctime should be changed only if the file size has actually changed. Patches changing ext2 and tmpfs from vmtruncate to new truncate sequence has caused regressions where they always update timestamps. There is some strange cases in POSIX where truncate(2) must not update times unless the size has acutally changed, see 6e656be89. This area is all still rather buggy in different ways in a lot of filesystems and needs a cleanup and audit (ideally the vfs will provide a simple attribute or call to direct all filesystems exactly which attributes to change). But coming up with the best solution will take a while and is not appropriate for rc anyway. So fix recent regression for now. Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/inode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 19214435b752..3675088cb88c 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -1552,7 +1552,7 @@ int ext2_setattr(struct dentry *dentry, struct iattr *iattr)
if (error)
return error;
}
- if (iattr->ia_valid & ATTR_SIZE) {
+ if (iattr->ia_valid & ATTR_SIZE && iattr->ia_size != inode->i_size) {
error = ext2_setsize(inode, iattr->ia_size);
if (error)
return error;