From patchwork Tue Jun 12 09:53:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 928255 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 414myp0Q8nz9s1B for ; Tue, 12 Jun 2018 20:56:18 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933429AbeFLK4J (ORCPT ); Tue, 12 Jun 2018 06:56:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:40093 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933350AbeFLK4H (ORCPT ); Tue, 12 Jun 2018 06:56:07 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E6139AB37; Tue, 12 Jun 2018 10:56:05 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 406441E11E3; Tue, 12 Jun 2018 11:53:35 +0200 (CEST) From: Jan Kara To: Cc: Ted Tso , Jan Kara Subject: [PATCH 09/10] ext2fs: Don't check s_inodes_count with EXT2_FLAG_IGNORE_SB_ERRORS Date: Tue, 12 Jun 2018 11:53:27 +0200 Message-Id: <20180612095328.5215-10-jack@suse.cz> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20180612095328.5215-1-jack@suse.cz> References: <20180612095328.5215-1-jack@suse.cz> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 --- lib/ext2fs/openfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c index e9ad0cd1a2c6..d046b2517505 100644 --- a/lib/ext2fs/openfs.c +++ b/lib/ext2fs/openfs.c @@ -386,7 +386,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;