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 <[email protected]>
Signed-off-by: Yong Sheng <[email protected]>
---
 fs/f2fs/namei.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 55a7362..7b07a47 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -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 (f2fs_encrypted_inode(dir)) {
                int res = fscrypt_get_encryption_info(dir);
@@ -291,6 +292,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)
-- 
1.8.5.2


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to