summaryrefslogtreecommitdiff
path: root/fs/f2fs/dir.c
diff options
context:
space:
mode:
authorSheng Yong <shengyong1@huawei.com>2016-06-04 17:01:28 +0300
committerJaegeuk Kim <jaegeuk@kernel.org>2016-06-16 01:32:35 +0300
commit8be0fea9c09d5be1693e50d1439f14878837fa4f (patch)
tree9f6d9815115d995c317b70e8a4c58ddff2e3e57c /fs/f2fs/dir.c
parentc92737ceecaf24643cc58182afdf9b13074cfb0d (diff)
downloadlinux-8be0fea9c09d5be1693e50d1439f14878837fa4f.tar.xz
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.c17
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)