diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2016-09-14 20:23:39 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-09-26 12:04:01 -0400 |
commit | a42cbec9c662ced87f1d0f22a1c114de4cf6e352 (patch) | |
tree | dff3e55af355e9ce4e28e7a28ec3ad5f1e6dd2e5 /fs | |
parent | a43f7f82064220082eba7075c5a844d773fdef1b (diff) |
Btrfs: add error handling for extent buffer in print tree
Somehow we missed btrfs_print_tree when last time we
updated error handling for read_extent_block().
This keeps us from getting a NULL pointer panic when
btrfs_print_tree's read_extent_block() fails.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/print-tree.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c index 147dc6ca5de1..aaeee45d917d 100644 --- a/fs/btrfs/print-tree.c +++ b/fs/btrfs/print-tree.c | |||
@@ -356,6 +356,13 @@ void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *c) | |||
356 | struct extent_buffer *next = read_tree_block(root, | 356 | struct extent_buffer *next = read_tree_block(root, |
357 | btrfs_node_blockptr(c, i), | 357 | btrfs_node_blockptr(c, i), |
358 | btrfs_node_ptr_generation(c, i)); | 358 | btrfs_node_ptr_generation(c, i)); |
359 | if (IS_ERR(next)) { | ||
360 | continue; | ||
361 | } else if (!extent_buffer_uptodate(next)) { | ||
362 | free_extent_buffer(next); | ||
363 | continue; | ||
364 | } | ||
365 | |||
359 | if (btrfs_is_leaf(next) && | 366 | if (btrfs_is_leaf(next) && |
360 | level != 1) | 367 | level != 1) |
361 | BUG(); | 368 | BUG(); |