All of lore.kernel.org
 help / color / mirror / Atom feed
From: Forrest Liu <forrestl@synology.com>
To: linux-btrfs@vger.kernel.org
Cc: Forrest Liu <forrestl@synology.com>
Subject: [PATCH] Btrfs: fix BUG_ON in btrfs_orphan_add() when delete unused block group
Date: Mon,  2 Feb 2015 16:08:48 +0800	[thread overview]
Message-ID: <1422864528-8625-1-git-send-email-forrestl@synology.com> (raw)

btrfs_orphan_reserve_metadata() will grab metadata reservation from
transaction handle, and the transaction handle was passed from
btrfs_delete_unused_bgs() when delete unused block group.

Repace btrfs_join_transaction() with btrfs_start_transaction() in
btrfs_delete_unused_bgs() to prevent BUG_ON() in btrfs_orphan_add()

Signed-off-by: Forrest Liu <forrestl@synology.com>
---
 fs/btrfs/extent-tree.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 53294da..61a3255 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -9548,7 +9548,8 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
 		 * Want to do this before we do anything else so we can recover
 		 * properly if we fail to join the transaction.
 		 */
-		trans = btrfs_join_transaction(root);
+		/* 1 for btrfs_orphan_reserve_metadata() */
+		trans = btrfs_start_transaction(root, 1);
 		if (IS_ERR(trans)) {
 			btrfs_set_block_group_rw(root, block_group);
 			ret = PTR_ERR(trans);
-- 
1.9.1


             reply	other threads:[~2015-02-02  8:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-02  8:08 Forrest Liu [this message]
2015-02-04 12:28 ` [PATCH] Btrfs: fix BUG_ON in btrfs_orphan_add() when delete unused block group Forrest Liu
2015-02-05 10:23   ` Filipe David Manana
2015-02-06  9:24     ` Forrest Liu

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=1422864528-8625-1-git-send-email-forrestl@synology.com \
    --to=forrestl@synology.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.