Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3080880rwb; Mon, 15 Aug 2022 17:39:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR4+QteRwAbuz71Td/InLrSc6tlewlp9jfV+NOjXkqGy3VzcLcINDiGZoIYW65FMnU/QmMXv X-Received: by 2002:a05:6a00:10cf:b0:528:48c3:79e0 with SMTP id d15-20020a056a0010cf00b0052848c379e0mr18516125pfu.18.1660610354769; Mon, 15 Aug 2022 17:39:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610354; cv=none; d=google.com; s=arc-20160816; b=uD1Idu+FpQ/wgxOXKhvWJeTXKUoK4v/mZ27AoOxrSQz5sbJS9tug62kJ8LoeQ4/ooA EqR5LSEHn7dF1RUb1JTR0TgjK+2QaPqbRq5s+4URcof/eLFaKjk1Fb8sfTklMFCMwKd5 wE4CxBBLSIBo8Nr6vFMkO+dK/dvyTHZT44kBhMljxgJvZbj2sLQKtv76WjUEYGu+IjRy 2iKQSmGdjIgJ23x+JzjCz7vA4x3zGJVg6aVlJAclRwU8+hYZz7++XetXKEcK/aVqTVAp 1NGJGjjhuXlNihQsBdGioL09O6QfhhPBdduIbSfHAqWioSzSv94xaNMEeMhYeE2mNklc Z8Pg== 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=3pWJA8rd6VD1Vc4GCLClx6A3s+jgWbrPh+yv690W9nU=; b=MI2SFIKVrm2Q0tKy/auLd4OCI0Cwi+gAMlkCgn3yXqMxMp998pulhI2GNQVefgyPC1 n+Y757uUCU26Ttchbm59Em/7Q0Oxxz4hx2s3hXuiEomPrLk43M9gtrEIoWXR4kpWYEca pU0Xidkujv3klQu/f0iWTcMTJQQ5TPI2X1CxHwlbW6POIuaof7hUPmXIdsTS7FX5jix5 WALjQIwtPBkEpvYovFVS6R3CLcmwKplQAqlsMO7AIT1Yp9MiUP9Te1Yz/ehqEtz4gsN1 i7YNVLUbVc7QmaPPt9Ku8eGG8FXaFcw52QpBU6SX8CeMhkSWKHj8BQIoeo93ssAhuQLC mG/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BXnOuT5K; 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 w2-20020a63d742000000b0041dd0c2ef5asi12303241pgi.421.2022.08.15.17.39.02; Mon, 15 Aug 2022 17:39:14 -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=BXnOuT5K; 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 S1353595AbiHOXff (ORCPT + 99 others); Mon, 15 Aug 2022 19:35:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346106AbiHOXaT (ORCPT ); Mon, 15 Aug 2022 19:30:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3365FBB939; Mon, 15 Aug 2022 13:08:03 -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 125B5B80EA8; Mon, 15 Aug 2022 20:08:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44273C433D7; Mon, 15 Aug 2022 20:08:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594080; bh=5n/75u9yLbFTG8wLPL2EQWKA9GGqPhXQKNdg9xemZ4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BXnOuT5KFe0eONja7kHiiV0eSjnpUJjAIK1p3HXtFWi4dt0cWsGn5WnEqSPhjKT3z AlgEUcNhaDKm/jZME0tb4j4FlJUaAAS1T8ZIdSXNcvKK8G4HrJa/azTxeoxaJFkVc1 jadc/TbQn385Xggq8fOqiCVbjn/WHbTCihT/SJdk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naohiro Aota , Johannes Thumshirn , David Sterba , Sasha Levin Subject: [PATCH 5.18 1023/1095] btrfs: zoned: disable metadata overcommit for zoned Date: Mon, 15 Aug 2022 20:07:02 +0200 Message-Id: <20220815180511.403729523@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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: Naohiro Aota [ Upstream commit 79417d040f4f77b19c701bccc23013b9cdac358d ] The metadata overcommit makes the space reservation flexible but it is also harmful to active zone tracking. Since we cannot finish a block group from the metadata allocation context, we might not activate a new block group and might not be able to actually write out the overcommit reservations. So, disable metadata overcommit for zoned filesystems. We will ensure the reservations are under active_total_bytes in the following patches. CC: stable@vger.kernel.org # 5.16+ Fixes: afba2bc036b0 ("btrfs: zoned: implement active zone tracking") Signed-off-by: Naohiro Aota Reviewed-by: Johannes Thumshirn Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/space-info.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index b87931a458eb..56a7c99fc03e 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -340,7 +340,10 @@ int btrfs_can_overcommit(struct btrfs_fs_info *fs_info, return 0; used = btrfs_space_info_used(space_info, true); - avail = calc_available_free_space(fs_info, space_info, flush); + if (btrfs_is_zoned(fs_info) && (space_info->flags & BTRFS_BLOCK_GROUP_METADATA)) + avail = 0; + else + avail = calc_available_free_space(fs_info, space_info, flush); if (used + bytes < space_info->total_bytes + avail) return 1; -- 2.35.1