Skip to content

Commit

Permalink
Btrfs: remove unnecessary btrfs_mark_buffer_dirty in split_leaf
Browse files Browse the repository at this point in the history
When we're not able to get enough space through splitting leaf,
we'd create a new sibling leaf instead, and it's possible that we return
 a zero-nritem sibling leaf and mark it dirty before it's in a consistent
state.  With CONFIG_BTRFS_FS_CHECK_INTEGRITY=y, the integrity check of
check_leaf will report panic due to this zero-nritem non-root leaf.

This removes the unnecessary btrfs_mark_buffer_dirty.

Reported-by: Filipe Manana <[email protected]>
Signed-off-by: Liu Bo <[email protected]>
Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
Liu Bo authored and kdave committed Sep 26, 2016
1 parent 4867268 commit 196e024
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -4311,7 +4311,11 @@ static noinline int split_leaf(struct btrfs_trans_handle *trans,
if (path->slots[1] == 0)
fixup_low_keys(fs_info, path, &disk_key, 1);
}
btrfs_mark_buffer_dirty(right);
/*
* We create a new leaf 'right' for the required ins_len and
* we'll do btrfs_mark_buffer_dirty() on this leaf after copying
* the content of ins_len to 'right'.
*/
return ret;
}

Expand Down

0 comments on commit 196e024

Please sign in to comment.