Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3515126rwa; Tue, 23 Aug 2022 06:06:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR5MlfV4QuuKUqnRcRU6r2C0Z4kh5ALDvMjK3392baE4zLeGiG7J4ZG5Uu9pL8FVrlY1fb16 X-Received: by 2002:a63:89c6:0:b0:429:a28d:7b4 with SMTP id v189-20020a6389c6000000b00429a28d07b4mr20352872pgd.42.1661260005258; Tue, 23 Aug 2022 06:06:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661260005; cv=none; d=google.com; s=arc-20160816; b=nuas6hw+1qy3IL9PURgHFWQjtN6UcGT4ClRbSfQqBVD2Z7X2QBX4IvzrRhQPIq/g8e rTEs4L0P6uK9Oy1/lo7GC1YeK/aFHOb1Mg1mUeiTqdEBxrNfAslxkv+il84NyoxY8yyj XuOlHWJ952ImNaw4jF2sgzJfGGgDPq6rtLBzROehquFgWxDQ+kR7ICbc4+g3lvt4K3vW X2QZHhaXsn35SdYf3bJotp/tVpigLwNN5FtNl2ZyvK27kKSm729vhFFU2Ip467cNcLkt zCUU8eAjs1hk6DKJTrAQlRI1xelxTspW/DiJc4bEYbP8ci4J6XqLlvQ8/EsaMmLAsYxb nmjA== 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=3xTeWv/H76J9GIlil3s4eI65Lj/hvXx5oEAY/5SjygE=; b=nXKASWc/r1jIBArOMI76WVXVbRQLlVHQ3ou31thbEhxtXDZEKdq/tmKS9iUwWkr2DW zFSVxxkSWyDiz/t7qMNKjxMKwKNSrSixmIGamrXL9Imp0mgMAB0CmIW9HdObp+DSNLLg bKN+0FWWXq6QWT+e6Rk6Q/chpRaJcGFB7lsq4HeMyOG23A08f6fPYyotkroJT4kIPgXz fea5Gv4OKneA5DmpHHfy73uIrCsA5AbF8zyYhkRmuwY0c5tBjCX0RmP/lBScph4y31QA V2cUONXluQqrMsMg+I/6TRI7slkJifvruR68uuvBGE39PhhhnBok1svFzJH3xVZPDAbD 91kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D2YkJmks; 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 q11-20020a65684b000000b0041ccbc553d9si15744245pgt.485.2022.08.23.06.06.33; Tue, 23 Aug 2022 06:06:45 -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=D2YkJmks; 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 S1358359AbiHWLtX (ORCPT + 99 others); Tue, 23 Aug 2022 07:49:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358336AbiHWLrm (ORCPT ); Tue, 23 Aug 2022 07:47:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 011A5D2905; Tue, 23 Aug 2022 02:30:46 -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 ams.source.kernel.org (Postfix) with ESMTPS id 8A277B81C85; Tue, 23 Aug 2022 09:30:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D33CCC433D7; Tue, 23 Aug 2022 09:30:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661247043; bh=ueeu1O7WxTB5W7eT1aqQvjP1jaD0aS1iXFRsRpMLeAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D2YkJmksqqHgZ6tQOqji0LOqUIua6uCWWh0chcQjspomZDIvJfSiwL2HM1PfYUe9S /4g/WIJGLco68P71D3q12x9xGlMvcpqn/Fvk0JX6UKrp68dVY0zYDucr6gM7cdoTnX DB0OeJ5InmudmJ7Dt0MA7OT+oG3Lc8KV4GL1QJuA= 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.4 260/389] ext4: update s_overhead_clusters in the superblock during an on-line resize Date: Tue, 23 Aug 2022 10:25:38 +0200 Message-Id: <20220823080126.446266632@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080115.331990024@linuxfoundation.org> References: <20220823080115.331990024@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 @@ -1483,6 +1483,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:"