Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp693083ybz; Fri, 1 May 2020 06:56:46 -0700 (PDT) X-Google-Smtp-Source: APiQypIWmvVvahB/GY+eVely7Ry+9252S2LJVWDy0vOubquwA6JFMggdS8yllaXAwIysH04YT+L8 X-Received: by 2002:a17:907:20b5:: with SMTP id pw21mr3161243ejb.227.1588341406713; Fri, 01 May 2020 06:56:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588341406; cv=none; d=google.com; s=arc-20160816; b=CHOxBig6BG/vigE0uFry/QQ0uTmZTMKiqQbqxUVA/hSFVfMYX2X0RlKbguPsokY3Br +Fqbmlr1Sk4YJIJYN12qn9I4/zmUwFcG7R/tbUuI40/tBjgoJuEF7dZZvT7XJkrrNaKx AkWGuOfqxgqOUNqfTpjCG1SnmDIhX9xo1aIYOUoCQCB85p2JJwtx9ezqjN9WZpqbQjiJ DOZN31FOmv5WHr2N61Ucgxtv1i7c93rUtLOCNAOkH3F0SACqiU1qaQju0bkhPTTKy5Ca 7R9bpcW/6xuFNWY1EHyMALFXUmTDPZ7ygIEPsOuA6Qq/UfiYNdcc3Xt6gDoK8hV8hOIU DfAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=j/b5KhqW5djdQV1DmoFZrvwL/aeJMZj6D5B8cwVS/Nc=; b=gBVh+LqdW/tddbqdMDeosHFry9ruTVmaJROKSOoPUMCdJCaiE05IN7GWCT0PjnoBan UTUu0jtM4ImGlstOagrk0px16Lilnm0fcTWJDmY7Ex3PVCJkScVmyAc0N2KMARGguDDx TQUnV6eJNNoadgX1CaIyE5PsL6WJfk3BpYGQjZW/8OdGjk8gOhQChkworGh9Ve1NmGeS I/nYIj7bHwnBEjJ8pBbA+Ymsn4/voOxyWABAPt0VIFVMLlPXBEIQdNi7plZ6Ldypd0e+ Vw+JXQBjmJBqM/LUgnkKauYI+Okb6xvwfLTH52j1LDt5VRODvniSaDchiHzr9j87zhX0 DZjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=L+yC9n6H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k15si1903406edk.194.2020.05.01.06.56.23; Fri, 01 May 2020 06:56:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=L+yC9n6H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731314AbgEANwi (ORCPT + 99 others); Fri, 1 May 2020 09:52:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:36656 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730277AbgEANhc (ORCPT ); Fri, 1 May 2020 09:37:32 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 AC2A0208DB; Fri, 1 May 2020 13:37:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588340252; bh=wOuKPrjxBqIWiZszReIQZcoXpdptGYDNhKxL4TUtiEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L+yC9n6HN0in8lOfLBE/XAbpnaowjdEmtKW5w5CvJjXWWKcn0XpyPuG7ciX5Ni5XB ObPzuKYTAZ+WFYPoRYxhn5ubHo07KFrnR/rXYTG6VmzeYCbI6JhcZqyV4tx120fC7Y nRz6tO9l7P5QUEIU4WzQTbs98c26PaDlTccweKZU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso , Sasha Levin Subject: [PATCH 4.19 42/46] ext4: convert BUG_ONs to WARN_ONs in mballoc.c Date: Fri, 1 May 2020 15:23:07 +0200 Message-Id: <20200501131513.390465961@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200501131457.023036302@linuxfoundation.org> References: <20200501131457.023036302@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Theodore Ts'o [ Upstream commit 907ea529fc4c3296701d2bfc8b831dd2a8121a34 ] If the in-core buddy bitmap gets corrupted (or out of sync with the block bitmap), issue a WARN_ON and try to recover. In most cases this involves skipping trying to allocate out of a particular block group. We can end up declaring the file system corrupted, which is fair, since the file system probably should be checked before we proceed any further. Link: https://lore.kernel.org/r/20200414035649.293164-1-tytso@mit.edu Google-Bug-Id: 34811296 Google-Bug-Id: 34639169 Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin --- fs/ext4/mballoc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 71121fcf9e8cc..8dd54a8a03610 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -1936,7 +1936,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, int free; free = e4b->bd_info->bb_free; - BUG_ON(free <= 0); + if (WARN_ON(free <= 0)) + return; i = e4b->bd_info->bb_first_free; @@ -1959,7 +1960,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, } mb_find_extent(e4b, i, ac->ac_g_ex.fe_len, &ex); - BUG_ON(ex.fe_len <= 0); + if (WARN_ON(ex.fe_len <= 0)) + break; if (free < ex.fe_len) { ext4_grp_locked_error(sb, e4b->bd_group, 0, 0, "%d free clusters as per " -- 2.20.1