Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp64365pxv; Thu, 24 Jun 2021 02:56:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+FHjcYfA51x1aLPn0yQtdZkXnhMnKbZEBcFvwZWv+HfA6zmr/T3MU71dqCZakZSj7a2Fh X-Received: by 2002:a05:6638:3789:: with SMTP id w9mr3824150jal.77.1624528594597; Thu, 24 Jun 2021 02:56:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624528594; cv=none; d=google.com; s=arc-20160816; b=ZKzgvEI3pZeIOxHf09ZbSufs0qetdpex+xN3YLpA0XHHYXmQkHfJ4quHW0fk3kMk1K 846awozQVX+dbNfrqFEu+JO7qWIFKv2X1n2uZJ/X0rlCTyvgsS4nYtvqocQ6kuxbSfBk ooPurG1NB7zGsyh5gL2oKrCVTdiDPKVrAPLDiy8tZp9TD1kve6lPlCue6I4ogyNvtAyC gusCfW/F9GtxAWDh62ONv90m0jzBhD2BtoFroZfXWw++QsOj5e8kNySTEjGQHuvcahdE akecuCgHSj1XlkG3+d1+xtTKYzCBxgv41cLM/kVDERBpVZnBgPICfAnCBMCiEXhxfNrL grTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=iTSSAgK7aaghb7ToUQUO/0vYqBsE2JOeFkxWgsEco9g=; b=sJYYGIzIDv0FrXTWoV6zmHOyxDjNE1tLJ6FV2E0f1D08eAVw9NdN7skY5Cn3sX9A6j +tAt5wAk+u6WSdK3j/b8f7Hjk4ZBz62Hq8xareue4YPu0kGbhOktBpkDJJoTqptTyg1O 4mBwVjTOH1uvjr1Yaq/Id38gRy6Efg5WYcR52LzrP02Srv+/B8U4/3rHWL0klWDEB5QH qt/kI5r9CFnsfXjw6Fb+jhzGL5ea7HE2iE3lYTzPDsOJDg7Rrl5p1KJSo4yJrmgs2duR wAKVEG1BsRofsM0/bscMrIfq4g3Or5HEZbHk4sUFLNc6BysswG6rS5NTHd0UwBiL9hxL PK1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gNTs9CmJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g2si2747359ioo.75.2021.06.24.02.56.23; Thu, 24 Jun 2021 02:56:34 -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=@redhat.com header.s=mimecast20190719 header.b=gNTs9CmJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232171AbhFXJ5j (ORCPT + 99 others); Thu, 24 Jun 2021 05:57:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:27739 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232178AbhFXJ5b (ORCPT ); Thu, 24 Jun 2021 05:57:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624528512; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iTSSAgK7aaghb7ToUQUO/0vYqBsE2JOeFkxWgsEco9g=; b=gNTs9CmJO+TRe1dyQCDAsPsghzAwC7W6d29LJ1l29HMqCu4lB/3MvTpdkx8qO26iivj2zZ HrMpp3KvGyxcl4zg6tzxo3CZSnQzzlv7NpBr+vh2kSccxZZ5dVSDhKlR/xaCdJKpJwSaWf brnqcyTB7QbRM+88M5cy/tnFJbmLeKc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-144-5SSWgA9GPSCnSLccV1-bUg-1; Thu, 24 Jun 2021 05:55:08 -0400 X-MC-Unique: 5SSWgA9GPSCnSLccV1-bUg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 49D218C5EC2; Thu, 24 Jun 2021 09:55:07 +0000 (UTC) Received: from work (unknown [10.40.193.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 549CF5C1BB; Thu, 24 Jun 2021 09:55:05 +0000 (UTC) Date: Thu, 24 Jun 2021 11:55:01 +0200 From: Lukas Czerner To: Stephen Brennan Cc: Theodore Ts'o , Andreas Dilger , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, Junxiao Bi Subject: Re: [PATCH] ext4: use ext4_grp_locked_error in mb_find_extent Message-ID: <20210624095501.jkd7iwu5bljw7xao@work> References: <20210623232114.34457-1-stephen.s.brennan@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210623232114.34457-1-stephen.s.brennan@oracle.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 23, 2021 at 04:21:14PM -0700, Stephen Brennan wrote: > Commit 5d1b1b3f492f ("ext4: fix BUG when calling ext4_error with locked > block group") introduces ext4_grp_locked_error to handle unlocking a > group in error cases. Otherwise, there is a possibility of a sleep while > atomic. However, since 43c73221b3b1 ("ext4: replace BUG_ON with WARN_ON > in mb_find_extent()"), mb_find_extent() has contained a ext4_error() > call while a group spinlock is held. Replace this with > ext4_grp_locked_error. > > Fixes: 43c73221b3b1 ("ext4: replace BUG_ON with WARN_ON in mb_find_extent()") > Cc: # 4.14+ > Signed-off-by: Stephen Brennan > Reviewed-by: Junxiao Bi Good catch, looks good to me. Reviewed-by: Lukas Czerner Thanks! -Lukas > --- > fs/ext4/mballoc.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c > index c2c22c2baac0..089c958aa2c3 100644 > --- a/fs/ext4/mballoc.c > +++ b/fs/ext4/mballoc.c > @@ -1909,10 +1909,11 @@ static int mb_find_extent(struct ext4_buddy *e4b, int block, > if (ex->fe_start + ex->fe_len > EXT4_CLUSTERS_PER_GROUP(e4b->bd_sb)) { > /* Should never happen! (but apparently sometimes does?!?) */ > WARN_ON(1); > - ext4_error(e4b->bd_sb, "corruption or bug in mb_find_extent " > - "block=%d, order=%d needed=%d ex=%u/%d/%d@%u", > - block, order, needed, ex->fe_group, ex->fe_start, > - ex->fe_len, ex->fe_logical); > + ext4_grp_locked_error(e4b->bd_sb, e4b->bd_group, 0, 0, > + "corruption or bug in mb_find_extent " > + "block=%d, order=%d needed=%d ex=%u/%d/%d@%u", > + block, order, needed, ex->fe_group, ex->fe_start, > + ex->fe_len, ex->fe_logical); > ex->fe_len = 0; > ex->fe_start = 0; > ex->fe_group = 0; > -- > 2.30.2 >