Btrfs: avoid potential super block corruption
[safe/jmp/linux-2.6] / fs / btrfs / tree-defrag.c
index b3bb5bb..a6a3956 100644 (file)
 #include "transaction.h"
 #include "locking.h"
 
+/* defrag all the leaves in a given btree.  If cache_only == 1, don't read things
+ * from disk, otherwise read all the leaves and try to get key order to
+ * better reflect disk order
+ */
 int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
                        struct btrfs_root *root, int cache_only)
 {
@@ -121,9 +125,6 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
        if (is_extent)
                btrfs_extent_post_op(trans, root);
 out:
-       if (is_extent)
-               mutex_unlock(&root->fs_info->alloc_mutex);
-
        if (path)
                btrfs_free_path(path);
        if (ret == -EAGAIN) {