From patchwork Thu Oct 11 19:54: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: 10637349 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 CD054112B for ; Thu, 11 Oct 2018 19:55:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B99062C09B for ; Thu, 11 Oct 2018 19:55:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE4B62C0A2; Thu, 11 Oct 2018 19:55:34 +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 5B1742C09B for ; Thu, 11 Oct 2018 19:55:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727148AbeJLDYS (ORCPT ); Thu, 11 Oct 2018 23:24:18 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:36382 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726831AbeJLDYS (ORCPT ); Thu, 11 Oct 2018 23:24:18 -0400 Received: by mail-qt1-f193.google.com with SMTP id u34-v6so11347004qth.3 for ; Thu, 11 Oct 2018 12:55:32 -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=esyabqCBu+9iDj6gymgoZZfIo7W+xlWCseOBiKeoQzQ=; b=yDiT1o+5fzw+4rnmqdumVE/VMjvjTp4ow5PoUTlsmN0o7qZhlW/MTuPVoDguXQAzxs YCOiDKcDIwy9iSnHEe2PMVcYa91id5G/GEWV+1PF4NjpWW5LKBIAK1vqZ7ubJHndo442 ZuIkftt79lAAjgyGoHVmjPIP51s2w0L7xIlO3P+XapGM7ETAyEzy44jDyHGrW2KMEtdb dxZy4XbKs35rXIT0RQBOUZ05nUjUFPn5jqjFqigT1IWU/e1xD7/zEcBak2iA5H8PWhy5 vLzyTuKm+aNBc+a6DSQLtSHgII/QSaOa54PoRwxolbszpnE7/4/wbUFN7fEXkqIQQE95 sTtQ== 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=esyabqCBu+9iDj6gymgoZZfIo7W+xlWCseOBiKeoQzQ=; b=WYzW6AmZ92NvXAaJ14T3QJrln8OGxtDvyzfHhhylt29BJNPUKptjqJvPLh/LG4qB3+ dmxH/CLMruBiwBeyZQEPpnY1IadUKb3PboCmATy/uNV/yhOUwBcBmbiyHgy17TVzUXjS jAr7pwX+PVUpDQjxZjHB9pQzPyjqSPCCLRaeQp+Jbh/LhuXpFycEXh5dz4kbpcy1hwb5 hgLOqhV6ixYPH1laIWdE4BZgCaYGdxyFFRlaOzLOu7TPUroCE6SOzlQhxglU8RSZ4Nq4 yEGw7BuBpJi0I9Pl1IFWSohqVjuCBxtVfLxYmTKq/GMr4GeYPQ5EedxvEBnICa+B7izI 3uUg== X-Gm-Message-State: ABuFfohBbZ+HSg4OeZ1KjKVIare8B+Ounefb8avYEuxhJMRWcIKYPWLf QIIU1+rKQkGJSEmD++K0b5r2fw== X-Google-Smtp-Source: ACcGV61JYMFDZs3W+InRR9hwVp9tkCJEMdYGGqVNw1eEKWNoFhPhWxRrhXQcg+GMCMUoZSNF2/70hQ== X-Received: by 2002:aed:34e1:: with SMTP id x88-v6mr3074559qtd.156.1539287731904; Thu, 11 Oct 2018 12:55:31 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id 144-v6sm14006883qkk.63.2018.10.11.12.55.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Oct 2018 12:55:31 -0700 (PDT) From: Josef Bacik To: kernel-team@fb.com, linux-btrfs@vger.kernel.org Subject: [PATCH 31/42] btrfs: cleanup pending bgs on transaction abort Date: Thu, 11 Oct 2018 15:54:20 -0400 Message-Id: <20181011195431.3441-32-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181011195431.3441-1-josef@toxicpanda.com> References: <20181011195431.3441-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. Reviewed-by: Omar Sandoval Signed-off-by: Josef Bacik --- fs/btrfs/transaction.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 46ca775a709e..9168efaca37e 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -2280,6 +2280,10 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) btrfs_scrub_continue(fs_info); cleanup_transaction: btrfs_trans_release_metadata(trans); + /* This cleans up the pending block groups list properly. */ + if (!trans->aborted) + trans->aborted = ret; + 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.");