summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2011-07-13 15:03:50 +0000
committerChris Mason <chris.mason@oracle.com>2011-08-01 14:30:45 -0400
commitb783e62d9620445d1ca3de76badf0468cdd329ba (patch)
treea97b81f62f0b431a4c3e5c4f6346ca890e535cb6
parentbf5f32ecb6caac52b4d1c083251b3dd4f40a0b7a (diff)
downloadblackbird-op-linux-b783e62d9620445d1ca3de76badf0468cdd329ba.tar.gz
blackbird-op-linux-b783e62d9620445d1ca3de76badf0468cdd329ba.zip
Btrfs: don't print the leaf if we had an error
In __btrfs_free_extent we will print the leaf if we fail to find the extent we wanted, but the problem is if we get an error we won't have a leaf so often this leads to a NULL pointer dereference and we lose the error that actually occurred. So only print the leaf if ret > 0, which means we didn't find the item we were looking for but we didn't error either. This way the error is preserved. Signed-off-by: Josef Bacik <josef@redhat.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r--fs/btrfs/extent-tree.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index b172b7fa4889..66bac226944e 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4462,7 +4462,9 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
printk(KERN_ERR "umm, got %d back from search"
", was looking for %llu\n", ret,
(unsigned long long)bytenr);
- btrfs_print_leaf(extent_root, path->nodes[0]);
+ if (ret > 0)
+ btrfs_print_leaf(extent_root,
+ path->nodes[0]);
}
BUG_ON(ret);
extent_slot = path->slots[0];
OpenPOWER on IntegriCloud