aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiu Xue <liuxueliu.liu@huawei.com>2016-02-26 06:39:23 +0000
committerMister Oyster <oysterized@gmail.com>2017-04-13 12:33:09 +0200
commitb7dfb7d7ad80f8f5c7f083f90e0f738382aff534 (patch)
treef411de221ab20ca34b0a9c718def5f5d182ed003
parent9f306678b47de38799109c875cb6fefa956f6827 (diff)
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: Xue Liu <liuxueliu.liu@huawei.com> Signed-off-by: Yong Sheng <shengyong1@huawei.com> Reviewed-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fs/f2fs/namei.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 34ebebe35..af5e7d4b1 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -261,6 +261,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
struct page *page;
nid_t ino;
int err = 0;
+ unsigned int root_ino = F2FS_ROOT_INO(F2FS_I_SB(dir));
if (dentry->d_name.len > F2FS_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG);
@@ -277,6 +278,12 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
if (IS_ERR(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)) {
err = __recover_dot_dentries(inode, dir->i_ino);
if (err)