All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] Btrfs: insert orphan roots into fs radix tree
@ 2013-09-25 13:47 Miao Xie
  2013-09-25 13:47 ` [PATCH 2/3] Btrfs: fix oops caused by the space balance and dead roots Miao Xie
  2013-09-25 13:47 ` [PATCH 3/3] Btrfs: fix BUG_ON() casued by the reserved space migration Miao Xie
  0 siblings, 2 replies; 5+ messages in thread
From: Miao Xie @ 2013-09-25 13:47 UTC (permalink / raw)
  To: linux-btrfs

Now we don't drop all the deleted snapshots/subvolumes before the space
balance. It means we have to relocate the space which is held by the dead
snapshots/subvolumes. So we must into them into fs radix tree, or we would
forget to commit the change of them when doing transaction commit, and it
would corrupt the metadata.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
 fs/btrfs/root-tree.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index 0b1f4ef..ec71ea4 100644
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -299,11 +299,6 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root)
 			continue;
 		}
 
-		if (btrfs_root_refs(&root->root_item) == 0) {
-			btrfs_add_dead_root(root);
-			continue;
-		}
-
 		err = btrfs_init_fs_root(root);
 		if (err) {
 			btrfs_free_fs_root(root);
@@ -318,6 +313,9 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root)
 			btrfs_free_fs_root(root);
 			break;
 		}
+
+		if (btrfs_root_refs(&root->root_item) == 0)
+			btrfs_add_dead_root(root);
 	}
 
 	btrfs_free_path(path);
-- 
1.8.3.1


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

end of thread, other threads:[~2013-09-26  9:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-25 13:47 [PATCH 1/3] Btrfs: insert orphan roots into fs radix tree Miao Xie
2013-09-25 13:47 ` [PATCH 2/3] Btrfs: fix oops caused by the space balance and dead roots Miao Xie
2013-09-25 14:11   ` Josef Bacik
2013-09-26  9:29     ` Miao Xie
2013-09-25 13:47 ` [PATCH 3/3] Btrfs: fix BUG_ON() casued by the reserved space migration Miao Xie

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.