From: Jan Kara Date: Tue, 19 Jun 2018 15:33:11 +0000 (-0400) Subject: ext2fs: don't check s_inodes_count with EXT2_FLAG_IGNORE_SB_ERRORS X-Git-Tag: v1.44.3-rc1~56 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=c93b383c578ed78b56d721aeb37ab44f00beabf7;p=tools%2Fe2fsprogs.git ext2fs: don't check s_inodes_count with EXT2_FLAG_IGNORE_SB_ERRORS Don't verify s_inodes_count is correct with EXT2_FLAG_IGNORE_SB_ERRORS flag set. This allows e2fsck and debugfs to fix this value. Reviewed-by: Andreas Dilger Signed-off-by: Jan Kara Signed-off-by: Theodore Ts'o --- diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c index 93d41b3..902d69e 100644 --- a/lib/ext2fs/openfs.c +++ b/lib/ext2fs/openfs.c @@ -380,7 +380,8 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, goto cleanup; } fs->group_desc_count = groups_cnt; - if ((__u64)fs->group_desc_count * EXT2_INODES_PER_GROUP(fs->super) != + if (!(flags & EXT2_FLAG_IGNORE_SB_ERRORS) && + (__u64)fs->group_desc_count * EXT2_INODES_PER_GROUP(fs->super) != fs->super->s_inodes_count) { retval = EXT2_ET_CORRUPT_SUPERBLOCK; goto cleanup;