Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3463036rwa; Tue, 23 Aug 2022 05:18:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR4N+z2y/3LhWEtM8eRLjHd/0uGMEySzGhgt5FSty0naMajWzSMspqAuzJ99BbNw1wMHxGjc X-Received: by 2002:a17:902:8d83:b0:172:c4f6:aa84 with SMTP id v3-20020a1709028d8300b00172c4f6aa84mr18750155plo.67.1661257080938; Tue, 23 Aug 2022 05:18:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661257080; cv=none; d=google.com; s=arc-20160816; b=Sp2l6WVZ+nKCVQtD7y/XqjHTiW1+E1545ntDMYC/0dKZc0HzfBdEuw3KcanMM2D/1n skJz7DLNsn2sn9FIMadrVbK50btRoP7WNVNa+xRuRd4XZn+zVJ8qAIVlVcLszQgwf5Mk Je1/RWkINWffetLByfZCLiy9UsZ8reHHPbwqSQjanpqJvfmReRSswQK7e2/X1M8hg675 JY7qaBSTW96XbSQ+Q/xGuA01h3VLvFN/NKc+m0SGAvSVgYas93OtFdukSPxRIbH6lFqM ssH8ps/1l+ZFOB9slwN7rLLYvGpzR+ByAfUdLSlCLIPPRlcdZUYKh4BzXqMrYlQQs9fU Z4Aw== 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=aOteLWFwsNejcpHFdPWFr4sU42n9IE+lMJAJrLSctDc=; b=y+lSebWuvVaTy0yPm/M0qn31Wwo+TD+0ntOAyM71ZKyWgab64hrsfcnkAzDQk3rmo7 HS2tXLEk4sDd96i+8V1+7W99KbWpG28s09IrLbZAaj+gXSpIMvdA/IyY+o/daPklOdeW Y5xvX0lejII0zfmsGLud0ZFxWFqWiRnPqgv48syaKAbZYFnqok2ivcvBb6SBpTSKXWxt xQ1D09Q2w+vt5X7US999rf7+PFSJkFU7vcELSgLmYrt4jopxZ49HvvmyeQ1iLkZcC0ms kEk2GmGf15Ljl1RtQrraWZLU1jvz89gdHpjhZCNizvVLSTF53Ko7WiitkPTtq9hHCljY rclQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OwQr2xjw; 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 d62-20020a636841000000b0042aff6e2846si693477pgc.251.2022.08.23.05.17.50; Tue, 23 Aug 2022 05:18:00 -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=OwQr2xjw; 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 S240966AbiHWKGf (ORCPT + 99 others); Tue, 23 Aug 2022 06:06:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352322AbiHWKBl (ORCPT ); Tue, 23 Aug 2022 06:01:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13F127B7B0; Tue, 23 Aug 2022 01:49:21 -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 198046122F; Tue, 23 Aug 2022 08:49:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3BEEC433D6; Tue, 23 Aug 2022 08:49:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244559; bh=7o9wGdshU5JpHoJS4v5+Ldi10mCK71DBv3aRF5U5Y9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OwQr2xjwdwIEDhl0F2/2xg5dVXaQbk46eBmLzkcTZWlaxvDiOuqeAgzW9vGLcSDbG CXmj9xL0pyo7Bd9RVE13fbQ6l20Kt8Dl7L2LWRB4QJpbvnhiuZUNnYofc+rm6ljtCi w0Y77nlG8fAJrbJ41Ly4Or4Y35Cdzetpdm/aXAjM= 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 4.14 155/229] ext4: update s_overhead_clusters in the superblock during an on-line resize Date: Tue, 23 Aug 2022 10:25:16 +0200 Message-Id: <20220823080059.208458416@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080053.202747790@linuxfoundation.org> References: <20220823080053.202747790@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 @@ -1456,6 +1456,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:"