aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-07-15 11:57:06 -0400
committerJosef Bacik <jbacik@fusionio.com>2013-07-19 15:07:03 -0400
commit3c8f24225752fba30f7265202ce6092318ed9fac (patch)
tree203f2d8658a50529179d9e976e4fd93a263b90c8 /fs
parentb8a33fc7258f9e6e42b15571d0284b7c0ef0d0a9 (diff)
Btrfs: update drop progress before stopping snapshot dropping
Alex pointed out a problem and fix that exists in the drop one snapshot at a time patch. If we decide we need to exit for whatever reason (umount for example) we will just exit the snapshot dropping without updating the drop progress. So the next time we go to resume we will BUG_ON() because we can't find the extent we left off at because we never updated it. This patch fixes the problem. Cc: stable@vger.kernel.org Reported-by: Alex Lyakas <alex.btrfs@zadarastorage.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/extent-tree.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 0236de711989..a429704dd95f 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -7552,11 +7552,6 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
7552 wc->reada_count = BTRFS_NODEPTRS_PER_BLOCK(root); 7552 wc->reada_count = BTRFS_NODEPTRS_PER_BLOCK(root);
7553 7553
7554 while (1) { 7554 while (1) {
7555 if (!for_reloc && btrfs_need_cleaner_sleep(root)) {
7556 pr_debug("btrfs: drop snapshot early exit\n");
7557 err = -EAGAIN;
7558 goto out_end_trans;
7559 }
7560 7555
7561 ret = walk_down_tree(trans, root, path, wc); 7556 ret = walk_down_tree(trans, root, path, wc);
7562 if (ret < 0) { 7557 if (ret < 0) {
@@ -7584,7 +7579,8 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
7584 } 7579 }
7585 7580
7586 BUG_ON(wc->level == 0); 7581 BUG_ON(wc->level == 0);
7587 if (btrfs_should_end_transaction(trans, tree_root)) { 7582 if (btrfs_should_end_transaction(trans, tree_root) ||
7583 (!for_reloc && btrfs_need_cleaner_sleep(root))) {
7588 ret = btrfs_update_root(trans, tree_root, 7584 ret = btrfs_update_root(trans, tree_root,
7589 &root->root_key, 7585 &root->root_key,
7590 root_item); 7586 root_item);
@@ -7595,6 +7591,12 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
7595 } 7591 }
7596 7592
7597 btrfs_end_transaction_throttle(trans, tree_root); 7593 btrfs_end_transaction_throttle(trans, tree_root);
7594 if (!for_reloc && btrfs_need_cleaner_sleep(root)) {
7595 pr_debug("btrfs: drop snapshot early exit\n");
7596 err = -EAGAIN;
7597 goto out_free;
7598 }
7599
7598 trans = btrfs_start_transaction(tree_root, 0); 7600 trans = btrfs_start_transaction(tree_root, 0);
7599 if (IS_ERR(trans)) { 7601 if (IS_ERR(trans)) {
7600 err = PTR_ERR(trans); 7602 err = PTR_ERR(trans);