Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp300984ybb; Wed, 15 Apr 2020 01:32:43 -0700 (PDT) X-Google-Smtp-Source: APiQypLtShMnrts1OvCm9221zVEvKbUzSJNbZtCAy+dBOZeDD06rT1rgBKQNC2i4gK1/uOudzSu+ X-Received: by 2002:a50:c40b:: with SMTP id v11mr23339186edf.25.1586939563645; Wed, 15 Apr 2020 01:32:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586939563; cv=none; d=google.com; s=arc-20160816; b=CEnszGhpxbvvDkKPDDaCBqW5XHl1vpeUzGcezfbrn1eCLxe216Q0pl7I2sdHoDDfYy EcDoNPP7blX64DHB7otIn3gcbUTOtdZZAnQUxbpX74hhokQ1KXhc3cDIpgijq0Eh8pFt cMBqOJUQ/wOyluQVeOlbAhdnqKLPzlV4pPdbwpItF/mJe5m4+0sI0emojfZACvLEQ1IZ BuwZMu1l1xzntKDTPwMkCHst7iSVFKswRAlDGMc2l6IHePOjURRJhfQlVXhOCqiq86+q cM+h985hocNHuO+A7Iwlg3+sgjgJWvV88NTe0rEic0T8zqZOSBIUEXd0o3ebYXlKKgfG mT1w== 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 :message-id:date:subject:cc:to:from; bh=ga0Vu0MjAp8Os0Vv9K3/SwWY0Fgj6g8RGRTxa/D8L4Q=; b=sRKYlSdmc1o9GRRWkM6aE5D9787bIc65//mcRceivMyMz4gTJ/oiEPSo8ANKULUw/S GswVjjw0tBLwu2oJ0dWNKZOfGvjFyIkb5uSQGy9M5aHHWLtq+TfneuKAbCCV7WWX/4Qp S/bBDTo4iaL6usK1ylak/hnzt4zQG6RVhGSG2tg03x0XW1okkemm2XHVDP3q2A+TfEsA OYLXYKKpMFMDVg8m4MCb96cqs5Mi2OKJDsVPg6B9wlNPLIeLAcxapPTDjTEucCUS5OGW ZtfEkm6iEk7SFdt6HXtiysv1TcP3aPvIdyW5TzDLWI34sdVBQCyw5aX32kVdP+PtTq6S u0tA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 r24si4574426edm.269.2020.04.15.01.32.07; Wed, 15 Apr 2020 01:32:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728939AbgDND45 (ORCPT + 99 others); Mon, 13 Apr 2020 23:56:57 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:57810 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728295AbgDND44 (ORCPT ); Mon, 13 Apr 2020 23:56:56 -0400 Received: from callcc.thunk.org (pool-72-93-95-157.bstnma.fios.verizon.net [72.93.95.157]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 03E3uqR3027841 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Apr 2020 23:56:52 -0400 Received: by callcc.thunk.org (Postfix, from userid 15806) id 0758E42013D; Mon, 13 Apr 2020 23:56:52 -0400 (EDT) From: "Theodore Ts'o" To: Ext4 Developers List Cc: "Theodore Ts'o" Subject: [PATCH] ext4: convert BUG_ON's to WARN_ON's in mballoc.c Date: Mon, 13 Apr 2020 23:56:49 -0400 Message-Id: <20200414035649.293164-1-tytso@mit.edu> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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. Google-Bug-Id: 34811296 Google-Bug-Id: 34639169 Signed-off-by: Theodore Ts'o --- 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 87c85be4c12e..30d5d97548c4 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -1943,7 +1943,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; @@ -1966,7 +1967,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.24.1