From patchwork Thu Aug 30 17:42:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10582483 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0748F5A4 for ; Thu, 30 Aug 2018 17:43:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB2B628676 for ; Thu, 30 Aug 2018 17:43:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF8262C363; Thu, 30 Aug 2018 17:43:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B18E28676 for ; Thu, 30 Aug 2018 17:43:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727733AbeH3Vqi (ORCPT ); Thu, 30 Aug 2018 17:46:38 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:42494 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726878AbeH3Vqi (ORCPT ); Thu, 30 Aug 2018 17:46:38 -0400 Received: by mail-qt0-f194.google.com with SMTP id z8-v6so11280964qto.9 for ; Thu, 30 Aug 2018 10:43:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=l11WaW/DYx1K0SX0a4CXfC5K2UbiabuVvcP8mlSURVg=; b=c3lSC9q5kW/eVIqceW4irdEFmWUWqaB+EiKX/wa+e3QTX1XJilUzeDhNhg7RI9R2Rp 5DrQxUR83Lp8NRk/Ab/45f6SGCnCsdknExmyUYnqVHCJwdXHUYuLLh+Fz+N2Tr1q19tr KRlDXczWK0oUWXuk2axBt9YRLllsUMSeV4uUAoyXiYHaMx/gGEtelCURTyTCC7ewIF+v 1nnyb54niSoFskzQWUhO+7qlB01u/OgiB6qgnlkXa77HQNPIZUy9A96+NzGTqyBxkbsU ccHU7zV8LBTebfYvVbmlPwSS53PgQ4A38PL9NSKmRSDKa7MwrbnrNh7fOakVdVytikdb cXOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=l11WaW/DYx1K0SX0a4CXfC5K2UbiabuVvcP8mlSURVg=; b=k7bZ/JO1IC/UXkudJ+/LXyUuafr12zjsmgv4O7KqkDQGyUZhwvAgES3h3UCN4nM3y8 fSxt68L5XJRwsaAbQRdjeecdjNTJx8sh/PXd+gUA8q4spkW14FktCU6MKhsAkcQxODUr Mr06cCCdi8fJfPczwkx8Kx6miHASysvj+zkvs6aQfPogzGGf8+hDzmgtZwWfwWrWFtHF 1LapTu2yLal8qx5mQIYgzBQCGyx1fZbZ/3cukitpTBuggoj1mid+LdApYwPznJ+VEYu6 cck5X/uNt+/rya/Pb9eQA9KwxNpteeUoaPcy2RkN+KyK/FtBhqmEZIjOoj1nkGXfMkk2 37dA== X-Gm-Message-State: APzg51BACqvkYdpYcS7DDUBCxJnTDPLIxcoO2xHSHsyNk5VV/Gv3rkQh KudVXAjuwTDoWasGTGGOsAPn35VpS3OQgA== X-Google-Smtp-Source: ANB0Vdakki2F2XEvuZ8mA6crLtm2OX1qZV2vSQZ3QVdscTTlSgUIb1bGI62Jw3Zty3v5iaJOPzKjNQ== X-Received: by 2002:a0c:fb42:: with SMTP id b2-v6mr12529145qvq.215.1535651002299; Thu, 30 Aug 2018 10:43:22 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id n8-v6sm4758731qtk.38.2018.08.30.10.43.21 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 Aug 2018 10:43:21 -0700 (PDT) From: Josef Bacik To: linux-btrfs@vger.kernel.org Subject: [PATCH 30/35] btrfs: cleanup pending bgs on transaction abort Date: Thu, 30 Aug 2018 13:42:20 -0400 Message-Id: <20180830174225.2200-31-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180830174225.2200-1-josef@toxicpanda.com> References: <20180830174225.2200-1-josef@toxicpanda.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We may abort the transaction during a commit and not have a chance to run the pending bgs stuff, which will leave block groups on our list and cause us accounting issues and leaked memory. Fix this by running the pending bgs when we cleanup a transaction. Signed-off-by: Josef Bacik Reviewed-by: Omar Sandoval --- fs/btrfs/transaction.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 89d14f135837..0f39a0d302d3 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -2273,6 +2273,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) btrfs_scrub_continue(fs_info); cleanup_transaction: btrfs_trans_release_metadata(trans); + btrfs_create_pending_block_groups(trans); btrfs_trans_release_chunk_metadata(trans); trans->block_rsv = NULL; btrfs_warn(fs_info, "Skipping commit of aborted transaction.");