diff mbox

Btrfs: make sure to use btrfs_header_owner when freeing tree block V2

Message ID 1403913903-21132-1-git-send-email-jbacik@fb.com (mailing list archive)
State Rejected
Headers show

Commit Message

Josef Bacik June 28, 2014, 12:05 a.m. UTC
Mark noticed that his qgroup accounting for snapshot deletion wasn't working
properly on a particular file system.  Turns out we pass the root->objectid of
the root we are deleting to btrfs_free_extent, and use that root always when we
call btrfs_free_tree_block.  This isn't correct, the owner must match the
btrfs_header_owner() of the eb.  So to fix this we need to use that when we call
btrfs_free_extent, and we also need to use btrfs_header_owner(eb) in
btrfs_free_tree_block as the root we pass in may not be the owner in the case of
snapshot delete (though it is for all the normal cases which is why it wasn't
noticed before.)  With this patch on top of Mark's snapshot delete patch
everything is working a-ok.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
V1->V2: this one actually compiles.

 fs/btrfs/extent-tree.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Josef Bacik June 28, 2014, 12:16 a.m. UTC | #1
On 06/27/2014 05:05 PM, Josef Bacik wrote:
> Mark noticed that his qgroup accounting for snapshot deletion wasn't working
> properly on a particular file system.  Turns out we pass the root->objectid of
> the root we are deleting to btrfs_free_extent, and use that root always when we
> call btrfs_free_tree_block.  This isn't correct, the owner must match the
> btrfs_header_owner() of the eb.  So to fix this we need to use that when we call
> btrfs_free_extent, and we also need to use btrfs_header_owner(eb) in
> btrfs_free_tree_block as the root we pass in may not be the owner in the case of
> snapshot delete (though it is for all the normal cases which is why it wasn't
> noticed before.)  With this patch on top of Mark's snapshot delete patch
> everything is working a-ok.  Thanks,
>
> Signed-off-by: Josef Bacik <jbacik@fb.com>
> ---
> V1->V2: this one actually compiles.
>

Huh I may be completely full of crap here, let's just ignore all post 5pm Friday patches from me for now.  Thanks,

Josef

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 7671b15..abfd05e 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6189,7 +6189,7 @@  void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
 	if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) {
 		ret = btrfs_add_delayed_tree_ref(root->fs_info, trans,
 					buf->start, buf->len,
-					parent, root->root_key.objectid,
+					parent, btrfs_header_owner(buf),
 					btrfs_header_level(buf),
 					BTRFS_DROP_DELAYED_REF, NULL, 0);
 		BUG_ON(ret); /* -ENOMEM */
@@ -7925,7 +7925,8 @@  skip:
 		}
 
 		ret = btrfs_free_extent(trans, root, bytenr, blocksize, parent,
-				root->root_key.objectid, level - 1, 0, 0);
+					btrfs_header_owner(next), level - 1, 0,
+					0);
 		BUG_ON(ret); /* -ENOMEM */
 	}
 	btrfs_tree_unlock(next);