Return-Path: Received: from mout.gmx.net ([212.227.17.20]:48959 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725613AbeLDKPh (ORCPT ); Tue, 4 Dec 2018 05:15:37 -0500 Subject: Re: [PATCH] btrfs: tree-checker: Don't check max block group size as current max chunk size limit is unreliable To: Qu Wenruo , linux-btrfs@vger.kernel.org, David Sterba Cc: stable@vger.kernel.org References: <20181123010636.19363-1-wqu@suse.com> From: Qu Wenruo Message-ID: <3cd7ba2f-377f-604e-5996-fbf5086b9843@gmx.com> Date: Tue, 4 Dec 2018 18:15:13 +0800 MIME-Version: 1.0 In-Reply-To: <20181123010636.19363-1-wqu@suse.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="g6rgBG7u2rhmhBjNrgTdwXHeKcAxJkypS" Sender: stable-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --g6rgBG7u2rhmhBjNrgTdwXHeKcAxJkypS Content-Type: multipart/mixed; boundary="fOWB6VPNpiNZHP2DTCDxVojnoGH7ACVCX"; protected-headers="v1" From: Qu Wenruo To: Qu Wenruo , linux-btrfs@vger.kernel.org, David Sterba Cc: stable@vger.kernel.org Message-ID: <3cd7ba2f-377f-604e-5996-fbf5086b9843@gmx.com> Subject: Re: [PATCH] btrfs: tree-checker: Don't check max block group size as current max chunk size limit is unreliable References: <20181123010636.19363-1-wqu@suse.com> In-Reply-To: <20181123010636.19363-1-wqu@suse.com> --fOWB6VPNpiNZHP2DTCDxVojnoGH7ACVCX Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Gentle ping. Please put this patch into current release as the new block group size limit check introduced in v4.19 is causing at least 2 reports in mail lis= t. Thanks, Qu On 2018/11/23 =E4=B8=8A=E5=8D=889:06, Qu Wenruo wrote: > [BUG] > A completely valid btrfs will refuse to mount, with error message like:= > BTRFS critical (device sdb2): corrupt leaf: root=3D2 block=3D23968153= 6 slot=3D172 \ > bg_start=3D12018974720 bg_len=3D10888413184, invalid block group si= ze, \ > have 10888413184 expect (0, 10737418240] >=20 > Btrfs check returns no error, and all kernels used on this fs is later > than 2011, which should all have the 10G size limit commit. >=20 > [CAUSE] > For a 12 devices btrfs, we could allocate a chunk larger than 10G due t= o > stripe stripe bump up. >=20 > __btrfs_alloc_chunk() > |- max_stripe_size =3D 1G > |- max_chunk_size =3D 10G > |- data_stripe =3D 11 > |- if (1G * 11 > 10G) { > stripe_size =3D 976128930; > stripe_size =3D round_up(976128930, SZ_16M) =3D 989855744 >=20 > However the final stripe_size (989855744) * 11 =3D 10888413184, which i= s > still larger than 10G. >=20 > [FIX] > For the comprehensive check, we need to do the full check at chunk > read time, and rely on bg <-> chunk mapping to do the check. >=20 > We could just skip the length check for now. >=20 > Fixes: fce466eab7ac ("btrfs: tree-checker: Verify block_group_item") > Cc: stable@vger.kernel.org # v4.19+ > Reported-by: Wang Yugui > Signed-off-by: Qu Wenruo > --- > fs/btrfs/tree-checker.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) >=20 > diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c > index cab0b1f1f741..d8bd5340fbbc 100644 > --- a/fs/btrfs/tree-checker.c > +++ b/fs/btrfs/tree-checker.c > @@ -389,13 +389,11 @@ static int check_block_group_item(struct btrfs_fs= _info *fs_info, > =20 > /* > * Here we don't really care about alignment since extent allocator c= an > - * handle it. We care more about the size, as if one block group is > - * larger than maximum size, it's must be some obvious corruption. > + * handle it. We care more about the size. > */ > - if (key->offset > BTRFS_MAX_DATA_CHUNK_SIZE || key->offset =3D=3D 0) = { > + if (key->offset =3D=3D 0) { > block_group_err(fs_info, leaf, slot, > - "invalid block group size, have %llu expect (0, %llu]", > - key->offset, BTRFS_MAX_DATA_CHUNK_SIZE); > + "invalid block group size 0"); > return -EUCLEAN; > } > =20 >=20 --fOWB6VPNpiNZHP2DTCDxVojnoGH7ACVCX-- --g6rgBG7u2rhmhBjNrgTdwXHeKcAxJkypS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEELd9y5aWlW6idqkLhwj2R86El/qgFAlwGU7EACgkQwj2R86El /qgdPwf9EPA12WBTWXVEN3rxAjfSQlOJ6uakcIjWKeoK3AF2VhHVz3GZhx9zdh8C BB49NP3bPl/avj78R2l/3dfpZ5hajmMBqfbzt1VxiTcV1S5TuY+vr633OlrwGZeQ Y6UiDqBm0oSCpy4PQ94eBNBKnkp/L5CYCNaGgm4BgmzT6vIffTjGoSVdqyabjKew I8G0w+Gn59LeKVQ4Pv4GGYU30HL1TRKu7kfSpUP6EIZLAZ1f+v7d44uiXmiJEFhS AaodqHnqf2dzVCDFD70zgMBoCk7CxFF7PzZ/I47QKb+SXk/iyJNBuGSzchRLjhhc iXzF23QFL5KsXqRl/r0oYI9M1HHykg== =mNUs -----END PGP SIGNATURE----- --g6rgBG7u2rhmhBjNrgTdwXHeKcAxJkypS--