All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] fsck.f2fs: relocate chksum verification step during f2fs_do_mount()
@ 2023-02-02  7:56 Chao Yu
  0 siblings, 0 replies; only message in thread
From: Chao Yu @ 2023-02-02  7:56 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel

Keep sanity_check_raw_super flow in fsck.f2fs being consistent w/
sanity_check_raw_super() in f2fs kernel module, otherwise, it outputs
different error information when mounting/fscking the same image which
contains corrupted superblock.

Signed-off-by: Chao Yu <chao@kernel.org>
---
 fsck/mount.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fsck/mount.c b/fsck/mount.c
index 25b7f3b..2a87759 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -866,16 +866,16 @@ int sanity_check_raw_super(struct f2fs_super_block *sb, enum SB_ADDR sb_addr)
 	unsigned int segment_count, segs_per_sec, secs_per_zone, segs_per_zone;
 	unsigned int total_sections, blocks_per_seg;
 
-	if ((get_sb(feature) & F2FS_FEATURE_SB_CHKSUM) &&
-					verify_sb_chksum(sb))
-		return -1;
-
 	if (F2FS_SUPER_MAGIC != get_sb(magic)) {
 		MSG(0, "Magic Mismatch, valid(0x%x) - read(0x%x)\n",
 			F2FS_SUPER_MAGIC, get_sb(magic));
 		return -1;
 	}
 
+	if ((get_sb(feature) & F2FS_FEATURE_SB_CHKSUM) &&
+					verify_sb_chksum(sb))
+		return -1;
+
 	blocksize = 1 << get_sb(log_blocksize);
 	if (F2FS_BLKSIZE != blocksize) {
 		MSG(0, "Invalid blocksize (%u), supports only 4KB\n",
-- 
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] only message in thread

only message in thread, other threads:[~2023-02-02  7:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-02  7:56 [f2fs-dev] [PATCH] fsck.f2fs: relocate chksum verification step during f2fs_do_mount() Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.