Commit 8c2b1435 authored by Liu Xue's avatar Liu Xue Committed by Jaegeuk Kim
Browse files

f2fs: recovery missing dot dentries in root directory



If f2fs was corrupted with missing dot dentries in root dirctory,
it needs to recover them after fsck.f2fs set F2FS_INLINE_DOTS flag
in directory inode when fsck.f2fs detects missing dot dentries.
Signed-off-by: default avatarXue Liu <liuxueliu.liu@huawei.com>
Signed-off-by: default avatarYong Sheng <shengyong1@huawei.com>
Reviewed-by: default avatarChao Yu <chao2.yu@samsung.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 19c7377b
...@@ -260,6 +260,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, ...@@ -260,6 +260,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
struct page *page; struct page *page;
nid_t ino; nid_t ino;
int err = 0; int err = 0;
unsigned int root_ino = F2FS_ROOT_INO(F2FS_I_SB(dir));
if (dentry->d_name.len > F2FS_NAME_LEN) if (dentry->d_name.len > F2FS_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG); return ERR_PTR(-ENAMETOOLONG);
...@@ -276,6 +277,12 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, ...@@ -276,6 +277,12 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
if (IS_ERR(inode)) if (IS_ERR(inode))
return ERR_CAST(inode); return ERR_CAST(inode);
if ((dir->i_ino == root_ino) && f2fs_has_inline_dots(dir)) {
err = __recover_dot_dentries(dir, root_ino);
if (err)
goto err_out;
}
if (f2fs_has_inline_dots(inode)) { if (f2fs_has_inline_dots(inode)) {
err = __recover_dot_dentries(inode, dir->i_ino); err = __recover_dot_dentries(inode, dir->i_ino);
if (err) if (err)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment