linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: fix BUG_ON in btrfs_orphan_add() when delete unused block group
@ 2015-02-02  8:08 Forrest Liu
  2015-02-04 12:28 ` Forrest Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Forrest Liu @ 2015-02-02  8:08 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Forrest Liu

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-06  9:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-02  8:08 [PATCH] Btrfs: fix BUG_ON in btrfs_orphan_add() when delete unused block group Forrest Liu
2015-02-04 12:28 ` Forrest Liu
2015-02-05 10:23   ` Filipe David Manana
2015-02-06  9:24     ` Forrest Liu

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).