]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: add check for changed leaves in setup_leaf_for_split
authorChris Mason <chris.mason@oracle.com>
Fri, 2 Apr 2010 13:20:18 +0000 (09:20 -0400)
committerChris Mason <chris.mason@oracle.com>
Mon, 5 Apr 2010 18:42:01 +0000 (14:42 -0400)
commitc01a1a008f4f082dea7cf0e47b50b1580952ff84
tree645cf1752f2c62579f6dfe028d8a5d918c6b6f45
parentc3d3cfd8e69070303336b95f6fc46274dc3daf9f
Btrfs: add check for changed leaves in setup_leaf_for_split

setup_leaf_for_split needs to drop the path and search again, and has
checks to see if the item we want to split changed size.  But, it misses
the case where the leaf changed and now has enough room for the item
we want to insert.

This adds an extra check to make sure the leaf really needs splitting
before we call btrfs_split_leaf(), which keeps us from trying to split
a leaf with a single item.

btrfs_split_leaf() will blindly split the single item leaf, leaving us
with one good leaf and one empty leaf and then a crash.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/ctree.c