f2fs: recovery missing dot dentries in root directory
authorLiu Xue <liuxueliu.liu@huawei.com>
Fri, 26 Feb 2016 06:39:23 +0000 (06:39 +0000)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 2 Mar 2016 17:25:33 +0000 (09:25 -0800)
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>
fs/f2fs/namei.c

index 01b9ef6ac5814cb21d7375d7df340e0de9b41eed..b3c423a645bc84b97c46433ac05a718dd19892e1 100644 (file)
@@ -260,6 +260,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);
@@ -276,6 +277,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)
This page took 0.027887 seconds and 5 git commands to generate.