linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH 1/4] fsck.f2fs: fix to recover out-of-border inline size
@ 2019-08-12 11:45 Chao Yu
  2019-08-12 11:45 ` [f2fs-dev] [PATCH 2/4] fsck.f2fs: fix to check c.fix_on before repair Chao Yu
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Chao Yu @ 2019-08-12 11:45 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel

It tries to let fsck be noticed wrong inline size, and do the fix.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fsck/fsck.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fsck/fsck.c b/fsck/fsck.c
index d53317c..7eb599d 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 || 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));
-- 
2.18.0.rc1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-08-20 11:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-12 11:45 [f2fs-dev] [PATCH 1/4] fsck.f2fs: fix to recover out-of-border inline size Chao Yu
2019-08-12 11:45 ` [f2fs-dev] [PATCH 2/4] fsck.f2fs: fix to check c.fix_on before repair Chao Yu
2019-08-16  1:06   ` Jaegeuk Kim
2019-08-16  1:20     ` Chao Yu
2019-08-20 11:34       ` Chao Yu
2019-08-12 11:45 ` [f2fs-dev] [PATCH 3/4] fsck.f2fs: fix to show removed x_nid correctly Chao Yu
2019-08-12 11:45 ` [f2fs-dev] [PATCH 4/4] fsck.f2fs: fix symlink correctly Chao Yu
2019-08-15 22:39 ` [f2fs-dev] [PATCH 1/4] fsck.f2fs: fix to recover out-of-border inline size Jaegeuk Kim
2019-08-16  1:03   ` Jaegeuk Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).