linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: Fix error log cluster size warning in sanity_check_inode()
@ 2022-11-15  8:46 Zhang Qilong via Linux-f2fs-devel
  2022-11-16  1:24 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Qilong via Linux-f2fs-devel @ 2022-11-15  8:46 UTC (permalink / raw)
  To: jaegeuk, chao; +Cc: linux-f2fs-devel

Mounting f2fs with following issue:
sanity_check_inode: inode (ino=4827) has unsupported log cluster size: 0, run fsck to fix

->find_fsync_dnodes
 ->add_fsync_inode
  ->f2fs_iget_retry
   ->f2fs_iget
    ->do_read_inode
     ->sanity_check_inode

It is triggered when entering recovery mode after a system crash.
The root cause is 'i_log_cluster_size' is zero in f2fs inode with
F2FS_COMPR_FL flag. It will resulted in mounting failed, and the
filesystem need to be fscked.

We fix it by adding copying compresion information to f2fs inode
page when recover inode page in f2fs_recover_inode_page().

Cc: stable@vger.kernel.org
Fixes: 4c8ff7095bef ("f2fs: support data compression")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
 fs/f2fs/node.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 83cc8a9e4982..2c4031ed71c9 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -2799,6 +2799,14 @@ int f2fs_recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)
 			dst->i_crtime = src->i_crtime;
 			dst->i_crtime_nsec = src->i_crtime_nsec;
 		}
+		if (f2fs_sb_has_compression(sbi) &&
+			F2FS_FITS_IN_INODE(src, le16_to_cpu(src->i_extra_isize),
+						i_log_cluster_size)) {
+			dst->i_compr_blocks = src->i_compr_blocks;
+			dst->i_compress_algorithm = src->i_compress_algorithm;
+			dst->i_log_cluster_size = src->i_log_cluster_size;
+			dst->i_compress_flag = src->i_compress_flag;
+		}
 	}
 
 	new_ni = old_ni;
-- 
2.25.1



_______________________________________________
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] 2+ messages in thread

end of thread, other threads:[~2022-11-16  1:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-15  8:46 [f2fs-dev] [PATCH] f2fs: Fix error log cluster size warning in sanity_check_inode() Zhang Qilong via Linux-f2fs-devel
2022-11-16  1:24 ` Chao Yu

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).