linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH 6/7] btrfs: cleanup pending bgs on transaction abort
Date: Wed, 21 Nov 2018 14:05:44 -0500	[thread overview]
Message-ID: <20181121190545.24798-7-josef@toxicpanda.com> (raw)
In-Reply-To: <20181121190545.24798-1-josef@toxicpanda.com>

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 <osandov@fb.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/transaction.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 826a15a07fce..3c1be9db897c 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -2269,6 +2269,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.");
-- 
2.14.3


  parent reply	other threads:[~2018-11-21 19:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-21 19:05 [PATCH 0/7] Abort cleanup fixes Josef Bacik
2018-11-21 19:05 ` [PATCH 1/7] btrfs: make btrfs_destroy_delayed_refs use btrfs_delayed_ref_lock Josef Bacik
2018-11-21 19:05 ` [PATCH 2/7] btrfs: make btrfs_destroy_delayed_refs use btrfs_delete_ref_head Josef Bacik
2018-11-21 19:05 ` [PATCH 3/7] btrfs: handle delayed ref head accounting cleanup in abort Josef Bacik
2018-11-21 19:05 ` [PATCH 4/7] btrfs: call btrfs_create_pending_block_groups unconditionally Josef Bacik
2018-11-21 19:05 ` [PATCH 5/7] btrfs: just delete pending bgs if we are aborted Josef Bacik
2019-01-16 14:59   ` David Sterba
2019-01-16 15:22     ` David Sterba
2019-01-17 14:56       ` David Sterba
2019-01-17 14:58         ` Josef Bacik
2019-01-17 15:40         ` Nikolay Borisov
2018-11-21 19:05 ` Josef Bacik [this message]
2018-11-21 19:05 ` [PATCH 7/7] btrfs: wait on ordered extents on abort cleanup Josef Bacik
2019-01-14 11:55 ` [PATCH 0/7] Abort cleanup fixes David Sterba
2019-01-28 22:06 ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181121190545.24798-7-josef@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).