From nobody Fri Oct 17 13:25:57 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6556C433FE for ; Wed, 19 Oct 2022 09:11:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232749AbiJSJLY (ORCPT ); Wed, 19 Oct 2022 05:11:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232557AbiJSJIi (ORCPT ); Wed, 19 Oct 2022 05:08:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 488F02EF5E; Wed, 19 Oct 2022 02:00:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D130661838; Wed, 19 Oct 2022 08:59:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA91AC433C1; Wed, 19 Oct 2022 08:59:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169964; bh=HJDN//PAUPr5qeuWQTD76jRmZZf65242mBt/Nyf+xQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=igIpOlMeGRXbBSPlHCpi293vR/qkKFdrLrGgW8pH5xFGMmhWcVc2ynQlqsaqNnpDX pDYLx9jM/7mFIxLNrlPLyzhhBhRdmbyJ56IBEYXrCME++mVbJ7tQlPE/y5Ge8eLrTT wKrmZnoo44NTrE1FC6BHvK+pcCQG1YlrunLvgX/U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jerry Lee , Theodore Tso Subject: [PATCH 6.0 448/862] ext4: continue to expand file system when the target size doesnt reach Date: Wed, 19 Oct 2022 10:28:55 +0200 Message-Id: <20221019083309.767133515@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jerry Lee =E6=9D=8E=E4=BF=AE=E8=B3=A2 commit df3cb754d13d2cd5490db9b8d536311f8413a92e upstream. When expanding a file system from (16TiB-2MiB) to 18TiB, the operation exits early which leads to result inconsistency between resize2fs and Ext4 kernel driver. =3D=3D=3D before =3D=3D=3D =E2=97=8B =E2=86=92 resize2fs /dev/mapper/thin resize2fs 1.45.5 (07-Jan-2020) Filesystem at /dev/mapper/thin is mounted on /mnt/test; on-line resizing re= quired old_desc_blocks =3D 2048, new_desc_blocks =3D 2304 The filesystem on /dev/mapper/thin is now 4831837696 (4k) blocks long. [ 865.186308] EXT4-fs (dm-5): mounted filesystem with ordered data mode. O= pts: (null). Quota mode: none. [ 912.091502] dm-4: detected capacity change from 34359738368 to 386547056= 64 [ 970.030550] dm-5: detected capacity change from 34359734272 to 386547015= 68 [ 1000.012751] EXT4-fs (dm-5): resizing filesystem from 4294966784 to 48318= 37696 blocks [ 1000.012878] EXT4-fs (dm-5): resized filesystem to 4294967296 =3D=3D=3D after =3D=3D=3D [ 129.104898] EXT4-fs (dm-5): mounted filesystem with ordered data mode. O= pts: (null). Quota mode: none. [ 143.773630] dm-4: detected capacity change from 34359738368 to 386547056= 64 [ 198.203246] dm-5: detected capacity change from 34359734272 to 386547015= 68 [ 207.918603] EXT4-fs (dm-5): resizing filesystem from 4294966784 to 48318= 37696 blocks [ 207.918754] EXT4-fs (dm-5): resizing filesystem from 4294967296 to 48318= 37696 blocks [ 207.918758] EXT4-fs (dm-5): Converting file system to meta_bg [ 207.918790] EXT4-fs (dm-5): resizing filesystem from 4294967296 to 48318= 37696 blocks [ 221.454050] EXT4-fs (dm-5): resized to 4658298880 blocks [ 227.634613] EXT4-fs (dm-5): resized filesystem to 4831837696 Signed-off-by: Jerry Lee Link: https://lore.kernel.org/r/PU1PR04MB22635E739BD21150DC182AC6A18C9@PU1P= R04MB2263.apcprd04.prod.outlook.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/resize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -2122,7 +2122,7 @@ retry: goto out; } =20 - if (ext4_blocks_count(es) =3D=3D n_blocks_count) + if (ext4_blocks_count(es) =3D=3D n_blocks_count && n_blocks_count_retry = =3D=3D 0) goto out; =20 err =3D ext4_alloc_flex_bg_array(sb, n_group + 1);