aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext2/namei.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2009-06-17 19:26:20 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-18 16:03:44 -0400
commit39fe7557b4d6ab82bafaa7b92b98b806afe6ad0d (patch)
tree7bdf2b80fd720cf31a1f855ed19255641f35e6d9 /fs/ext2/namei.c
parent10dfb54cd59a18786e43137a935277ca743bb54b (diff)
ext2: Do not update mtime of a moved directory
One of our users is complaining that his backup tool is upset on ext2 (while it's happy on ext3, xfs, ...) because of the mtime change. The problem is: mkdir foo mkdir bar mkdir foo/a Now under ext2: mv foo/a foo/b changes mtime of 'foo/a' (foo/b after the move). That does not really make sense and it does not happen under any other filesystem I've seen. More complicated is: mv foo/a bar/a This changes mtime of foo/a (bar/a after the move) and it makes some sense since we had to update parent directory pointer of foo/a. But again, no other filesystem does this. So after some thoughts I'd vote for consistency and change ext2 to behave the same as other filesystems. Do not update mtime of a moved directory. Specs don't say anything about it (neither that it should, nor that it should not be updated) and other common filesystems (ext3, ext4, xfs, reiserfs, fat, ...) don't do it. So let's become more consistent. Spotted by ronny.pretzsch@dfs.de, initial fix by Jörn Engel. Reported-by: <ronny.pretzsch@dfs.de> Cc: <hare@suse.de> Cc: Jörn Engel <joern@logfs.org> Signed-off-by: Jan Kara <jack@suse.cz> Cc: <linux-ext4@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ext2/namei.c')
-rw-r--r--fs/ext2/namei.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index 90ea17998a73..6524ecaebb7a 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -320,7 +320,7 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
320 if (!new_de) 320 if (!new_de)
321 goto out_dir; 321 goto out_dir;
322 inode_inc_link_count(old_inode); 322 inode_inc_link_count(old_inode);
323 ext2_set_link(new_dir, new_de, new_page, old_inode); 323 ext2_set_link(new_dir, new_de, new_page, old_inode, 1);
324 new_inode->i_ctime = CURRENT_TIME_SEC; 324 new_inode->i_ctime = CURRENT_TIME_SEC;
325 if (dir_de) 325 if (dir_de)
326 drop_nlink(new_inode); 326 drop_nlink(new_inode);
@@ -352,7 +352,8 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
352 inode_dec_link_count(old_inode); 352 inode_dec_link_count(old_inode);
353 353
354 if (dir_de) { 354 if (dir_de) {
355 ext2_set_link(old_inode, dir_de, dir_page, new_dir); 355 if (old_dir != new_dir)
356 ext2_set_link(old_inode, dir_de, dir_page, new_dir, 0);
356 inode_dec_link_count(old_dir); 357 inode_dec_link_count(old_dir);
357 } 358 }
358 return 0; 359 return 0;