This is a note to let you know that I've just added the patch titled

    Btrfs: re-add root to dead root list if we stop dropping it

to the 3.4-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     btrfs-re-add-root-to-dead-root-list-if-we-stop-dropping-it.patch
and it can be found in the queue-3.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From d29a9f629e009c9b90e5859bce581070fd6247fc Mon Sep 17 00:00:00 2001
From: Josef Bacik <[email protected]>
Date: Wed, 17 Jul 2013 19:30:20 -0400
Subject: Btrfs: re-add root to dead root list if we stop dropping it

From: Josef Bacik <[email protected]>

commit d29a9f629e009c9b90e5859bce581070fd6247fc upstream.

If we stop dropping a root for whatever reason we need to add it back to the
dead root list so that we will re-start the dropping next transaction commit.
The other case this happens is if we recover a drop because we will add a root
without adding it to the fs radix tree, so we can leak it's root and commit root
extent buffer, adding this to the dead root list makes this cleanup happen.
Thanks,

Reported-by: Alex Lyakas <[email protected]>
Signed-off-by: Josef Bacik <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 fs/btrfs/extent-tree.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6846,6 +6846,7 @@ int btrfs_drop_snapshot(struct btrfs_roo
        int err = 0;
        int ret;
        int level;
+       bool root_dropped = false;
 
        path = btrfs_alloc_path();
        if (!path) {
@@ -7016,12 +7017,22 @@ int btrfs_drop_snapshot(struct btrfs_roo
                free_extent_buffer(root->commit_root);
                kfree(root);
        }
+       root_dropped = true;
 out_end_trans:
        btrfs_end_transaction_throttle(trans, tree_root);
 out_free:
        kfree(wc);
        btrfs_free_path(path);
 out:
+       /*
+        * So if we need to stop dropping the snapshot for whatever reason we
+        * need to make sure to add it back to the dead root list so that we
+        * keep trying to do the work later.  This also cleans up roots if we
+        * don't have it in the radix (like when we recover after a power fail
+        * or unmount) so we don't leak memory.
+        */
+       if (root_dropped == false)
+               btrfs_add_dead_root(root);
        if (err)
                btrfs_std_error(root->fs_info, err);
        return err;


Patches currently in stable-queue which might be from [email protected] are

queue-3.4/btrfs-fix-lock-leak-when-resuming-snapshot-deletion.patch
queue-3.4/btrfs-re-add-root-to-dead-root-list-if-we-stop-dropping-it.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to