<4>[   30.222442s][pid:1,cpu4,init][<ffffff8008357ffc>] 
f2fs_evict_inode+0x850/0xa34
<4>[   30.222442s][pid:1,cpu4,init][<ffffff8008209ec4>] evict+0xa0/0x168
<4>[   30.222442s][pid:1,cpu4,init][<ffffff800820ad34>] iput+0x188/0x220
<4>[   30.222473s][pid:1,cpu4,init][<ffffff800836d050>] 
recover_orphan_inodes+0x2b4/0xa80
<4>[   30.222473s][pid:1,cpu4,init][<ffffff80083648b0>] 
f2fs_fill_super+0xcf4/0x16a0
<4>[   30.222473s][pid:1,cpu4,init][<ffffff80081f2478>] mount_bdev+0x198/0x1c8
<4>[   30.222473s][pid:1,cpu4,init][<ffffff80083608a8>] f2fs_mount+0x14/0x1c
<4>[   30.222503s][pid:1,cpu4,init][<ffffff80081f2f38>] mount_fs+0x3c/0x15c
<4>[   30.222503s][pid:1,cpu4,init][<ffffff800820e9f8>] 
vfs_kern_mount+0x7c/0x16c
<4>[   30.222503s][pid:1,cpu4,init][<ffffff8008212548>] do_mount+0x214/0xcf8
<4>[   30.222503s][pid:1,cpu4,init][<ffffff800821338c>] SyS_mount+0xa8/0x164
<4>[   30.222503s][pid:1,cpu4,init][<ffffff80080831b0>] el0_svc_naked+0x24/0x28

Mount failed with message as blow:
        recover_orphan_inode: orphan failed (ino=1265), run fsck to fix

One orphan directory with inline_dentry flag, but i_addr[0] is not zero.
By the way, sit bitmap of i_addr[0] is also invalidate.

Signed-off-by: Yunlei He <heyun...@huawei.com>
---
 fsck/fsck.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/fsck/fsck.c b/fsck/fsck.c
index 56a47be..17cf6ff 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -601,6 +601,7 @@ void fsck_chk_inode_blk(struct f2fs_sb_info *sbi, u32 nid,
        u32 i_links = le32_to_cpu(node_blk->i.i_links);
        u64 i_size = le64_to_cpu(node_blk->i.i_size);
        u64 i_blocks = le64_to_cpu(node_blk->i.i_blocks);
+       int ofs = get_extra_isize(node_blk);
        unsigned char en[F2FS_NAME_LEN + 1];
        int namelen;
        unsigned int idx = 0;
@@ -660,9 +661,7 @@ void fsck_chk_inode_blk(struct f2fs_sb_info *sbi, u32 nid,
                        ftype == F2FS_FT_FIFO || ftype == F2FS_FT_SOCK)
                goto check;
 
-       if((node_blk->i.i_inline & F2FS_INLINE_DATA)) {
-               int ofs = get_extra_isize(node_blk);
-
+       if ((node_blk->i.i_inline & F2FS_INLINE_DATA)) {
                if (le32_to_cpu(node_blk->i.i_addr[ofs]) != 0) {
                        /* should fix this bug all the time */
                        FIX_MSG("inline_data has wrong 0'th block = %x",
@@ -685,8 +684,18 @@ void fsck_chk_inode_blk(struct f2fs_sb_info *sbi, u32 nid,
                DBG(3, "ino[0x%x] has inline data!\n", nid);
                goto check;
        }
-       if((node_blk->i.i_inline & F2FS_INLINE_DENTRY)) {
+
+       if ((node_blk->i.i_inline & F2FS_INLINE_DENTRY)) {
                DBG(3, "ino[0x%x] has inline dentry!\n", nid);
+               if (le32_to_cpu(node_blk->i.i_addr[ofs]) != 0) {
+                       /* should fix this bug all the time */
+                       FIX_MSG("inline_dentry has wrong 0'th block = %x",
+                                       le32_to_cpu(node_blk->i.i_addr[ofs]));
+                       node_blk->i.i_addr[ofs] = 0;
+                       node_blk->i.i_blocks = cpu_to_le64(*blk_cnt);
+                       need_fix = 1;
+               }
+
                ret = fsck_chk_inline_dentries(sbi, node_blk, &child);
                if (ret < 0) {
                        /* should fix this bug all the time */
@@ -715,7 +724,6 @@ void fsck_chk_inode_blk(struct f2fs_sb_info *sbi, u32 nid,
        /* check data blocks in inode */
        for (idx = 0; idx < ADDRS_PER_INODE(&node_blk->i);
                                                idx++, child.pgofs++) {
-               int ofs = get_extra_isize(node_blk);
                block_t blkaddr = le32_to_cpu(node_blk->i.i_addr[ofs + idx]);
 
                /* check extent info */
-- 
1.9.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to