diff options
author | Yan Zheng <zheng.yan@oracle.com> | 2009-07-22 13:59:00 (GMT) |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-07-22 13:59:00 (GMT) |
commit | 33c66f430bfa3a033e70470e4c93f967156b696d (patch) | |
tree | 5af7edc4564aa3f32033b364495828eb32b690a7 /lib/locking-selftest-spin-hardirq.h | |
parent | e457afec60fdbd86b963d36f4a8a9285088c6043 (diff) | |
download | linux-33c66f430bfa3a033e70470e4c93f967156b696d.tar.xz |
Btrfs: fix locking issue in btrfs_find_next_key
When walking up the tree, btrfs_find_next_key assumes the upper level tree
block is properly locked. This isn't always true even path->keep_locks is 1.
This is because btrfs_find_next_key may advance path->slots[] several times
instead of only once.
When 'path->slots[level] >= btrfs_header_nritems(path->nodes[level])' is found,
we can't guarantee the original value of 'path->slots[level]' is
'btrfs_header_nritems(path->nodes[level]) - 1'. If it's not, the tree block at
'level + 1' isn't locked.
This patch fixes the issue by explicitly checking the locking state,
re-searching the tree if it's not locked.
Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'lib/locking-selftest-spin-hardirq.h')
0 files changed, 0 insertions, 0 deletions