diff options
author | Chao Yu <chao2.yu@samsung.com> | 2013-12-21 05:03:28 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-12-22 20:42:51 -0500 |
commit | deead09009fc5136185fe95026c395b5c2337e1f (patch) | |
tree | eceef53f619241155d03a75ac2aa53981f96a73f /fs/f2fs/namei.c | |
parent | 4f4124d0b99682efa7307191a28ec050872d2079 (diff) |
f2fs: avoid to set wrong pino of inode when rename dir
When we rename a dir to new name which is not exist previous,
we will set pino of parent inode with ino of child inode in f2fs_set_link.
It destroy consistency of pino, it should be fixed.
Thanks for previous work of Shu Tan.
Signed-off-by: Shu Tan <shu.tan@samsung.com>
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/namei.c')
-rw-r--r-- | fs/f2fs/namei.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 575adac17f8b..a68838dae335 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c | |||
@@ -424,6 +424,7 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
424 | } | 424 | } |
425 | 425 | ||
426 | f2fs_set_link(new_dir, new_entry, new_page, old_inode); | 426 | f2fs_set_link(new_dir, new_entry, new_page, old_inode); |
427 | F2FS_I(old_inode)->i_pino = new_dir->i_ino; | ||
427 | 428 | ||
428 | new_inode->i_ctime = CURRENT_TIME; | 429 | new_inode->i_ctime = CURRENT_TIME; |
429 | if (old_dir_entry) | 430 | if (old_dir_entry) |
@@ -457,6 +458,7 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
457 | if (old_dir != new_dir) { | 458 | if (old_dir != new_dir) { |
458 | f2fs_set_link(old_inode, old_dir_entry, | 459 | f2fs_set_link(old_inode, old_dir_entry, |
459 | old_dir_page, new_dir); | 460 | old_dir_page, new_dir); |
461 | F2FS_I(old_inode)->i_pino = new_dir->i_ino; | ||
460 | } else { | 462 | } else { |
461 | kunmap(old_dir_page); | 463 | kunmap(old_dir_page); |
462 | f2fs_put_page(old_dir_page, 0); | 464 | f2fs_put_page(old_dir_page, 0); |