Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1860283rwb; Fri, 19 Aug 2022 10:35:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR4PNOTQ3Plwkw6TVxsLNs0R3PfeXCeqd+jOzf3pflZOC2xJB2GyfEHxcfdTiJmuK8sFeon2 X-Received: by 2002:a65:6953:0:b0:42a:4612:2d7b with SMTP id w19-20020a656953000000b0042a46122d7bmr2483585pgq.253.1660930503204; Fri, 19 Aug 2022 10:35:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930503; cv=none; d=google.com; s=arc-20160816; b=h1Y4fNyAZDz3uIYOob0kIBKFnDI1X1GADdpyN/X5Bk1XEDyIM58wcf+XfLZf3g1tKc vdXTrZk15D3+opeY3gD5ItEiFPuaMlFqKWIcZ2bQ2ENGzPdJ1c3Hgz995opPMrzfVa9v 0jGS3411a37SxivFlX4Z7+JFwXRotmUNLnm8Jz9LD7NKABfDd3Ok9x+mLgywYc0zmEP6 r6I5sQr0DJcjE67PttPBefMimUl/zWiHm8wXVTaftEAMAOqjNfSR8MKQQGSFhjVHU8qs pMEBOblvSyWjlSZWbCmDbxI+oSX/xtCjVJ1IgrFQ+JSyb5wGHz2Px0UKh5EBBGUhbEOI TahQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MiCB8YBhZkLt5U9BOYvH0tZcuM62SSVDawWvYmSUJ7k=; b=ALb6I4Adm2W1pcYtOTLPIuYfoo9IbFnRkuxmMntAFHmxzZYxcVcn7XwbgwkNzuU/NK IzzRJ/TV9DKvads5f5XONfYtUsJjv43PRTJkdIncYMi9hKujr6VVdCrlJi64LsIjfklP neeJ6UbnCSDujOvIZqfLfTFSId/kJunrh6ofxXrO/f+ehl9CocFJ/rX/hN2CdhaXYdRq h/CWpZKRLljANSK/b8XO2r394aJ1GaRa0E/w0EphaNN1wvVRI6MzHDlFlN2nXCyKTkFH dXRJroc4xIDi+abjOiv+xfc+ghdNnZL8NQtgCaP55d3Mx76zJu3IrWZPEux2vwks7GQ/ v9ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HvP2V+F7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h24-20020a63df58000000b0041a11845a19si2548809pgj.703.2022.08.19.10.34.51; Fri, 19 Aug 2022 10:35:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HvP2V+F7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354237AbiHSQth (ORCPT + 99 others); Fri, 19 Aug 2022 12:49:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353983AbiHSQr5 (ORCPT ); Fri, 19 Aug 2022 12:47:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1F00112F81; Fri, 19 Aug 2022 09:13:04 -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 585C0612DF; Fri, 19 Aug 2022 16:12:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F8E2C433D6; Fri, 19 Aug 2022 16:12:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660925531; bh=jA/mBvGai79bW7LGK0aSmDu1XO3csevvtOtZ7HQSAvQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HvP2V+F73UGD1pMFZMTa5QGjkDXO1Q6MYgClSOqiamfARKtYRa3wmJg0Wjerq4mQ/ r5/0F6D8uJXcdQsQvqZdXmiMUDPtab9vPxZUP+spKOC2CWwhLxiMphRVMMPrYk3WPi rUijT/2dRoXiPFhclyAEfK2PHo+0UgBTx3Ipq+B0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso , stable@kernel.org, Andreas Dilger Subject: [PATCH 5.10 521/545] ext4: update s_overhead_clusters in the superblock during an on-line resize Date: Fri, 19 Aug 2022 17:44:51 +0200 Message-Id: <20220819153852.859330401@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Theodore Ts'o commit de394a86658ffe4e89e5328fd4993abfe41b7435 upstream. When doing an online resize, the on-disk superblock on-disk wasn't updated. This means that when the file system is unmounted and remounted, and the on-disk overhead value is non-zero, this would result in the results of statfs(2) to be incorrect. This was partially fixed by Commits 10b01ee92df5 ("ext4: fix overhead calculation to account for the reserved gdt blocks"), 85d825dbf489 ("ext4: force overhead calculation if the s_overhead_cluster makes no sense"), and eb7054212eac ("ext4: update the cached overhead value in the superblock"). However, since it was too expensive to forcibly recalculate the overhead for bigalloc file systems at every mount, this didn't fix the problem for bigalloc file systems. This commit should address the problem when resizing file systems with the bigalloc feature enabled. Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Reviewed-by: Andreas Dilger Link: https://lore.kernel.org/r/20220629040026.112371-1-tytso@mit.edu Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/resize.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -1461,6 +1461,7 @@ static void ext4_update_super(struct sup * Update the fs overhead information */ ext4_calculate_overhead(sb); + es->s_overhead_clusters = cpu_to_le32(sbi->s_overhead); if (test_opt(sb, DEBUG)) printk(KERN_DEBUG "EXT4-fs: added group %u:"