]>
Commit | Line | Data |
---|---|---|
4d1e5b62 AF |
1 | From: Jan Kara <jack@suse.cz> |
2 | Subject: [PATCH] ext2: Do not update mtime of a move directory when parent has not changed | |
3 | References: bnc#493392 | |
4 | Patch-mainline: 2.6.30 | |
5 | ||
6 | If the parent of the moved directory has not changed, there's no real | |
7 | reason to change mtime. Specs doesn't seem to say anything about this | |
8 | particular case and e.g. ext3 does not change mtime in this case. | |
9 | So we become a tiny bit more consistent. | |
10 | ||
11 | Spotted by ronny.pretzsch@dfs.de, initial fix by Jörn Engel <joern@logfs.org>. | |
12 | ||
13 | Signed-off-by: Jan Kara <jack@suse.cz> | |
14 | --- | |
15 | fs/ext2/namei.c | 5 ++++- | |
16 | 1 file changed, 4 insertions(+), 1 deletion(-) | |
17 | ||
18 | --- a/fs/ext2/namei.c | |
19 | +++ b/fs/ext2/namei.c | |
20 | @@ -355,7 +355,10 @@ static int ext2_rename (struct inode * o | |
21 | inode_dec_link_count(old_inode); | |
22 | ||
23 | if (dir_de) { | |
24 | - ext2_set_link(old_inode, dir_de, dir_page, new_dir); | |
25 | + /* Set link only if parent has changed and thus avoid setting | |
26 | + * of mtime of the moved directory on a pure rename. */ | |
27 | + if (old_dir != new_dir) | |
28 | + ext2_set_link(old_inode, dir_de, dir_page, new_dir); | |
29 | inode_dec_link_count(old_dir); | |
30 | } | |
31 | return 0; |