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,URIBL_BLOCKED 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 33401C2BA19 for ; Tue, 14 Apr 2020 14:22:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 10AD5206D5 for ; Tue, 14 Apr 2020 14:22:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586874123; bh=NwlMG6B70cqo23MVhi+rR5HuFSw1oUAHxbY3IwTVQQw=; h=Subject:To:Cc:From:Date:List-ID:From; b=G4CXAhZt4UIfUXWUuIxSzz05z37qBx1oEIYJcnQw5jd/xgUmuvK7AXVu8BOxYnNSl DvfrE8mjWaePqWYu6vcy0aZB6LpXSfuitlw3+3j2kjBzV2Xs/V/QE3xV98XSXP4XOR 0e4kt0+eVPRpauhh5LnmaoaPpLJkismhLce2CL9M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389894AbgDNOWA (ORCPT ); Tue, 14 Apr 2020 10:22:00 -0400 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:44195 "EHLO wout1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389892AbgDNOVz (ORCPT ); Tue, 14 Apr 2020 10:21:55 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 9EDC4AC0; Tue, 14 Apr 2020 10:21:54 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 14 Apr 2020 10:21:55 -0400 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=fm2; bh=+f/7Tj kh7H80mN/fJm67z/ux9nw3NHvGSzmJOiiRB2A=; b=WXX0yN18hiSiebepItD9G8 rVNzkmRDudgY+5bNSRL1cQ1j4spoufi0XqjRl3h/yggrJT1KvXMB+lQtS3i+wwjb x4N+1Fgfwe+FhnfoBa4G8nTui/el5nHbgQSlGItzjDpjAzNvDm4Pph4dVppCD/VJ hfvc2WfG5zd/eoL7pXxaPkekQ1E4hcZDXW+Spx5OiBf7Gj45Mo7lMu9mVhrHDVv4 NaRLmW0TsuP6DJ9AM7HLB0C9Dl5ei9FzqL3qrV7FxpKB6NstaL/6Olceds8ZEsYJ XmiglC7TaGuAcJQaMvvYN667gHp2v6CS5M55XricYv0vCiCORBWDePQwKLMPjFug == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrfedugdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvhfffkfggtgfgsehtkeertddttd flnecuhfhrohhmpeeoghhrvghgkhhhsehlihhnuhigfhhouhhnuggrthhiohhnrdhorhhg qeenucfkphepkeefrdekiedrkeelrddutdejnecuvehluhhsthgvrhfuihiivgepudenuc frrghrrghmpehmrghilhhfrhhomhepghhrvghgsehkrhhorghhrdgtohhm 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 E215C306005E; Tue, 14 Apr 2020 10:21:53 -0400 (EDT) Subject: FAILED: patch "[PATCH] btrfs: handle logged extent failure properly" failed to apply to 5.5-stable tree To: josef@toxicpanda.com, dsterba@suse.com, johannes.thumshirn@wdc.com, nborisov@suse.com, wqu@suse.com Cc: From: Date: Tue, 14 Apr 2020 16:21:44 +0200 Message-ID: <1586874104169209@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 5.5-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 ab9b2c7b32e6be53cac2e23f5b2db66815a7d972 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Thu, 13 Feb 2020 10:47:30 -0500 Subject: [PATCH] btrfs: handle logged extent failure properly If we're allocating a logged extent we attempt to insert an extent record for the file extent directly. We increase space_info->bytes_reserved, because the extent entry addition will call btrfs_update_block_group(), which will convert the ->bytes_reserved to ->bytes_used. However if we fail at any point while inserting the extent entry we will bail and leave space on ->bytes_reserved, which will trigger a WARN_ON() on umount. Fix this by pinning the space if we fail to insert, which is what happens in every other failure case that involves adding the extent entry. CC: stable@vger.kernel.org # 5.4+ Reviewed-by: Johannes Thumshirn Reviewed-by: Nikolay Borisov Reviewed-by: Qu Wenruo Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 136fffb76428..7eef91d6c2b6 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -4422,7 +4422,7 @@ int btrfs_alloc_logged_file_extent(struct btrfs_trans_handle *trans, ret = alloc_reserved_file_extent(trans, 0, root_objectid, 0, owner, offset, ins, 1); if (ret) - btrfs_pin_extent(fs_info, ins->objectid, ins->offset, 1); + btrfs_pin_extent(trans, ins->objectid, ins->offset, 1); btrfs_put_block_group(block_group); return ret; }