* [PATCH] Btrfs: update drop progress before stopping snapshot dropping
@ 2013-07-15 15:59 Josef Bacik
2013-07-30 7:14 ` Alex Lyakas
0 siblings, 1 reply; 2+ messages in thread
From: Josef Bacik @ 2013-07-15 15:59 UTC (permalink / raw)
To: linux-btrfs, alex.btrfs, dsterba
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>
---
fs/btrfs/extent-tree.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index bc00b24..8c204e1 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -7584,11 +7584,6 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
wc->reada_count = BTRFS_NODEPTRS_PER_BLOCK(root);
while (1) {
- if (!for_reloc && btrfs_need_cleaner_sleep(root)) {
- pr_debug("btrfs: drop snapshot early exit\n");
- err = -EAGAIN;
- goto out_end_trans;
- }
ret = walk_down_tree(trans, root, path, wc);
if (ret < 0) {
@@ -7616,7 +7611,8 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
}
BUG_ON(wc->level == 0);
- if (btrfs_should_end_transaction(trans, tree_root)) {
+ if (btrfs_should_end_transaction(trans, tree_root) ||
+ (!for_reloc && btrfs_need_cleaner_sleep(root))) {
ret = btrfs_update_root(trans, tree_root,
&root->root_key,
root_item);
@@ -7627,6 +7623,12 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
}
btrfs_end_transaction_throttle(trans, tree_root);
+ if (!for_reloc && btrfs_need_cleaner_sleep(root)) {
+ pr_debug("btrfs: drop snapshot early exit\n");
+ err = -EAGAIN;
+ goto out_free;
+ }
+
trans = btrfs_start_transaction(tree_root, 0);
if (IS_ERR(trans)) {
err = PTR_ERR(trans);
--
1.7.7.6
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] Btrfs: update drop progress before stopping snapshot dropping
2013-07-15 15:59 [PATCH] Btrfs: update drop progress before stopping snapshot dropping Josef Bacik
@ 2013-07-30 7:14 ` Alex Lyakas
0 siblings, 0 replies; 2+ messages in thread
From: Alex Lyakas @ 2013-07-30 7:14 UTC (permalink / raw)
To: Josef Bacik; +Cc: linux-btrfs, dsterba
Thanks for posting that patch, Josef.
On Mon, Jul 15, 2013 at 6:59 PM, Josef Bacik <jbacik@fusionio.com> wrote:
>
> 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>
> ---
> fs/btrfs/extent-tree.c | 14 ++++++++------
> 1 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index bc00b24..8c204e1 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -7584,11 +7584,6 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
> wc->reada_count = BTRFS_NODEPTRS_PER_BLOCK(root);
>
> while (1) {
> - if (!for_reloc && btrfs_need_cleaner_sleep(root)) {
> - pr_debug("btrfs: drop snapshot early exit\n");
> - err = -EAGAIN;
> - goto out_end_trans;
> - }
>
> ret = walk_down_tree(trans, root, path, wc);
> if (ret < 0) {
> @@ -7616,7 +7611,8 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
> }
>
> BUG_ON(wc->level == 0);
> - if (btrfs_should_end_transaction(trans, tree_root)) {
> + if (btrfs_should_end_transaction(trans, tree_root) ||
> + (!for_reloc && btrfs_need_cleaner_sleep(root))) {
> ret = btrfs_update_root(trans, tree_root,
> &root->root_key,
> root_item);
> @@ -7627,6 +7623,12 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
> }
>
> btrfs_end_transaction_throttle(trans, tree_root);
> + if (!for_reloc && btrfs_need_cleaner_sleep(root))
> {
> + pr_debug("btrfs: drop snapshot early
> exit\n");
> + err = -EAGAIN;
> + goto out_free;
> + }
> +
> trans = btrfs_start_transaction(tree_root, 0);
> if (IS_ERR(trans)) {
> err = PTR_ERR(trans);
> --
> 1.7.7.6
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-07-30 7:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-15 15:59 [PATCH] Btrfs: update drop progress before stopping snapshot dropping Josef Bacik
2013-07-30 7:14 ` Alex Lyakas
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).