diff options
author | Sheng Yong <shengyong1@huawei.com> | 2016-06-04 22:01:28 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-06-15 15:32:35 -0700 |
commit | 8be0fea9c09d5be1693e50d1439f14878837fa4f (patch) | |
tree | 9f6d9815115d995c317b70e8a4c58ddff2e3e57c /fs/f2fs/dir.c | |
parent | c92737ceecaf24643cc58182afdf9b13074cfb0d (diff) | |
download | blackbird-obmc-linux-8be0fea9c09d5be1693e50d1439f14878837fa4f.tar.gz blackbird-obmc-linux-8be0fea9c09d5be1693e50d1439f14878837fa4f.zip |
f2fs: find parent dentry correctly
If dotdot directory is corrupted, its slot may be ocupied by another
file. In this case, dentry[1] is not the parent directory. Rename and
cross-rename will update the inode in dentry[1] incorrectly. This
patch finds dotdot dentry by name.
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
[Jaegeuk Kim: remove wron bug_on]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/dir.c')
-rw-r--r-- | fs/f2fs/dir.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 486482468abb..72a0207f56a1 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -267,22 +267,9 @@ out: struct f2fs_dir_entry *f2fs_parent_dir(struct inode *dir, struct page **p) { - struct page *page; - struct f2fs_dir_entry *de; - struct f2fs_dentry_block *dentry_blk; - - if (f2fs_has_inline_dentry(dir)) - return f2fs_parent_inline_dir(dir, p); - - page = get_lock_data_page(dir, 0, false); - if (IS_ERR(page)) - return NULL; + struct qstr dotdot = QSTR_INIT("..", 2); - dentry_blk = kmap(page); - de = &dentry_blk->dentry[1]; - *p = page; - unlock_page(page); - return de; + return f2fs_find_entry(dir, &dotdot, p); } ino_t f2fs_inode_by_name(struct inode *dir, struct qstr *qstr) |