From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72151C43603 for ; Sun, 15 Dec 2019 11:08:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 45D00206D3 for ; Sun, 15 Dec 2019 11:08:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576408129; bh=Z8TCwgs2AYsNNoXoiqfNUaYFMXcwKrBiTiXJ+MPsJUc=; h=Subject:To:Cc:From:Date:List-ID:From; b=tYw0H6NS//+gXqGBvy7gcq6dqS3W0B2PdYkDKu2+SkCZkC+TYTrUJfDCYQ6vyFeoq sdPPeu2CxxXWfIUMyJXUEto0A5SYk4BgbEgcETA7vaX/hQg/V0ha3pAYd+R+8eEMsO OnH0NU47lb5wc/FrxOYrooK2Zl9ZhC99WRLbG6SA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726083AbfLOLIt (ORCPT ); Sun, 15 Dec 2019 06:08:49 -0500 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:50935 "EHLO wout4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726094AbfLOLIs (ORCPT ); Sun, 15 Dec 2019 06:08:48 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id A89A266B; Sun, 15 Dec 2019 06:08:47 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 15 Dec 2019 06:08:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=dsV8p5 0zJiReHLpn3gqYP8gg22HCLBMxYzhEhOqX+ew=; b=fGqlZPtt5Sl+dqD3hpv4r/ 8t7zvnTY1pcCMrWwD2Dd73yv7PuVxsqghsA2ZijPmB1OtsSIHYm3vTuBTE8aa+Zf S+tXfA+84ShRL11XzDOl832qnLe4kD+W5fw064nzilgMwQ7RMgayEqheB31PJpXV PYhq+qaYQLNd1hLJKhD6U/m+wcOvBmBg7VHpHwD+uZ2H11L32rdYMvxOWUD5i+gW mY4M/k/K2GyNbhwS007b9vArQ9BG0PTzHeFn636HlKToME2DwOpB8pbJ1z59eAhf bC/3HYnh5de6YELB3+HSLR1Grcn8tv6dd+1w7mdWW3oBLk49WwfQsi3RKELd+ERw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvddtfedgvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecukfhppeekfedrkeeirdekledruddtjeenucfrrghrrghmpehmrghilhhfrhhomh epghhrvghgsehkrhhorghhrdgtohhmnecuvehluhhsthgvrhfuihiivgepfe X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id E697830600AB; Sun, 15 Dec 2019 06:08:46 -0500 (EST) Subject: FAILED: patch "[PATCH] btrfs: use btrfs_block_group_cache_done in update_block_group" failed to apply to 4.9-stable tree To: josef@toxicpanda.com, dsterba@suse.com, nborisov@suse.com Cc: From: Date: Sun, 15 Dec 2019 12:08:45 +0100 Message-ID: <15764081255064@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.9-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From a60adce85f4bb5c1ef8ffcebadd702cafa2f3696 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Tue, 24 Sep 2019 16:50:44 -0400 Subject: [PATCH] btrfs: use btrfs_block_group_cache_done in update_block_group When free'ing extents in a block group we check to see if the block group is not cached, and then cache it if we need to. However we'll just carry on as long as we're loading the cache. This is problematic because we are dirtying the block group here. If we are fast enough we could do a transaction commit and clear the free space cache while we're still loading the space cache in another thread. This truncates the free space inode, which will keep it from loading the space cache. Fix this by using the btrfs_block_group_cache_done helper so that we try to load the space cache unconditionally here, which will result in the caller waiting for the fast caching to complete and keep us from truncating the free space inode. CC: stable@vger.kernel.org # 4.4+ Signed-off-by: Josef Bacik Reviewed-by: Nikolay Borisov Signed-off-by: David Sterba diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index 384659dc7818..540a7a63601e 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -2661,7 +2661,7 @@ int btrfs_update_block_group(struct btrfs_trans_handle *trans, * is because we need the unpinning stage to actually add the * space back to the block group, otherwise we will leak space. */ - if (!alloc && cache->cached == BTRFS_CACHE_NO) + if (!alloc && !btrfs_block_group_cache_done(cache)) btrfs_cache_block_group(cache, 1); byte_in_group = bytenr - cache->key.objectid;