From patchwork Tue Sep 29 10:59:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 263308 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B983C4741F for ; Tue, 29 Sep 2020 11:33:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E8A2323B23 for ; Tue, 29 Sep 2020 11:33:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601379225; bh=QJg12Q1/sQjz9SybGbCpVHykRlDULubY5Ryc9tLIlb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=k0WG6GwAfRxeSvyzqvLib/A/6WePLYbceJFEtvFP5uEOVvJYdoCUbCflwYfJE8UBP iHhwEZfb/PBfA6pog+GIWVJp35jG4mBDIEBB3JuOY2QNilltkC9xHbIRuG8uPnDfW0 azkOa+IjjHZtnjBdkBboy6BfiqqQplSndnO2CuWM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729682AbgI2Ldm (ORCPT ); Tue, 29 Sep 2020 07:33:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:50310 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729559AbgI2Ld0 (ORCPT ); Tue, 29 Sep 2020 07:33:26 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2ED0B23B8C; Tue, 29 Sep 2020 11:26:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601378789; bh=QJg12Q1/sQjz9SybGbCpVHykRlDULubY5Ryc9tLIlb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NhYbb20RDKA5q4XZmzcQyRCCqVlhjcnmKuxkEjKkc3r37MeWMGy6NsJopWBXXLojS holfON+5aRmJFw5WbybzXPcUJChenuP7iAN6GxI1VUUvnEB9R+XE6f3oVz2KL1rxQs 9+nagndiQjaX7pKUtNdE4EnR+BF+/OuCE2MLqzkM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Dilger , Dmitry Monakhov , Theodore Tso , Sasha Levin Subject: [PATCH 4.19 109/245] ext4: mark block bitmap corrupted when found instead of BUGON Date: Tue, 29 Sep 2020 12:59:20 +0200 Message-Id: <20200929105952.295179924@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105946.978650816@linuxfoundation.org> References: <20200929105946.978650816@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dmitry Monakhov [ Upstream commit eb5760863fc28feab28b567ddcda7e667e638da0 ] We already has similar code in ext4_mb_complex_scan_group(), but ext4_mb_simple_scan_group() still affected. Other reports: https://www.spinics.net/lists/linux-ext4/msg60231.html Reviewed-by: Andreas Dilger Signed-off-by: Dmitry Monakhov Link: https://lore.kernel.org/r/20200310150156.641-1-dmonakhov@gmail.com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin --- fs/ext4/mballoc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 8dd54a8a03610..054cfdd007d69 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -1901,8 +1901,15 @@ void ext4_mb_simple_scan_group(struct ext4_allocation_context *ac, BUG_ON(buddy == NULL); k = mb_find_next_zero_bit(buddy, max, 0); - BUG_ON(k >= max); - + if (k >= max) { + ext4_grp_locked_error(ac->ac_sb, e4b->bd_group, 0, 0, + "%d free clusters of order %d. But found 0", + grp->bb_counters[i], i); + ext4_mark_group_bitmap_corrupted(ac->ac_sb, + e4b->bd_group, + EXT4_GROUP_INFO_BBITMAP_CORRUPT); + break; + } ac->ac_found++; ac->ac_b_ex.fe_len = 1 << i;