Skip to content

Commit

Permalink
Btrfs: Fix oopsen when dropping empty tree.
Browse files Browse the repository at this point in the history
When dropping a empty tree, walk_down_tree() skips checking
extent information for the tree root. This will triggers a
BUG_ON in walk_up_proc().

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Yan, Zheng authored and Chris Mason committed Feb 4, 2010
1 parent d7ce584 commit 7a7965f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -5402,17 +5402,17 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans,
int ret;

while (level >= 0) {
if (path->slots[level] >=
btrfs_header_nritems(path->nodes[level]))
break;

ret = walk_down_proc(trans, root, path, wc, lookup_info);
if (ret > 0)
break;

if (level == 0)
break;

if (path->slots[level] >=
btrfs_header_nritems(path->nodes[level]))
break;

ret = do_walk_down(trans, root, path, wc, &lookup_info);
if (ret > 0) {
path->slots[level]++;
Expand Down

0 comments on commit 7a7965f

Please sign in to comment.