Skip to content

Commit

Permalink
Btrfs: don't run __tree_mod_log_free_eb on leaves
Browse files Browse the repository at this point in the history
When we split a leaf, we may end up inserting a new root on top of that
leaf.  The reflog code was incorrectly assuming the old root was always
a node.  This makes sure we skip over leaves.

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
  • Loading branch information
Chris Mason authored and Chris Mason committed Aug 28, 2012
1 parent 6fc823b commit b12a3b1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,9 @@ __tree_mod_log_free_eb(struct btrfs_fs_info *fs_info, struct extent_buffer *eb)
u32 nritems;
int ret;

if (btrfs_header_level(eb) == 0)
return;

nritems = btrfs_header_nritems(eb);
for (i = nritems - 1; i >= 0; i--) {
ret = tree_mod_log_insert_key_locked(fs_info, eb, i,
Expand Down

0 comments on commit b12a3b1

Please sign in to comment.