diff options
author | Chao Yu <yuchao0@huawei.com> | 2019-08-14 16:44:26 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2019-08-27 14:51:05 -0700 |
commit | db84e73777c2656095d37c768a89923b2bc8e3d6 (patch) | |
tree | 7c682193eab4f6de700529c8cc662a18a461eada | |
parent | dd9c372646ed849f143b3bd9f40cf13c784675fe (diff) | |
download | f2fs-tools-db84e73777c2656095d37c768a89923b2bc8e3d6.tar.gz |
fsck.f2fs: fix to recover out-of-border inline size
It tries to let fsck be noticed wrong inline size, and do the fix.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | fsck/fsck.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fsck/fsck.c b/fsck/fsck.c index b4431de..22cd6ea 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -771,6 +771,8 @@ void fsck_chk_inode_blk(struct f2fs_sb_info *sbi, u32 nid, ofs = get_extra_isize(node_blk); if ((node_blk->i.i_inline & F2FS_INLINE_DATA)) { + unsigned int inline_size = MAX_INLINE_DATA(node_blk); + 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", @@ -779,6 +781,12 @@ void fsck_chk_inode_blk(struct f2fs_sb_info *sbi, u32 nid, node_blk->i.i_blocks = cpu_to_le64(*blk_cnt); need_fix = 1; } + if (i_size > inline_size) { + node_blk->i.i_size = cpu_to_le64(inline_size); + FIX_MSG("inline_data has wrong i_size %lu", + (unsigned long)i_size); + need_fix = 1; + } if (!(node_blk->i.i_inline & F2FS_DATA_EXIST)) { char buf[MAX_INLINE_DATA(node_blk)]; memset(buf, 0, MAX_INLINE_DATA(node_blk)); |