mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-15 23:25:07 +00:00
Btrfs: deal with bad mappings in btrfs_map_block
Martin Steigerwald reported a BUG_ON() in btrfs_map_block where we didn't find a chunk for a particular block we were trying to map. This happened because the block was bogus. We shouldn't be BUG_ON()'ing in this case, just print a message and return an error. This came from reada_add_block and it appears to deal with an error fine so we should be good there. Thanks, Reported-by: Martin Steigerwald <Martin@lichtvoll.de> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
This commit is contained in:
parent
d4c7ca86b5
commit
9bb91873e3
1 changed files with 8 additions and 2 deletions
|
@ -4406,10 +4406,16 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
|
||||||
btrfs_crit(fs_info, "unable to find logical %llu len %llu",
|
btrfs_crit(fs_info, "unable to find logical %llu len %llu",
|
||||||
(unsigned long long)logical,
|
(unsigned long long)logical,
|
||||||
(unsigned long long)*length);
|
(unsigned long long)*length);
|
||||||
BUG();
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (em->start > logical || em->start + em->len < logical) {
|
||||||
|
btrfs_crit(fs_info, "found a bad mapping, wanted %Lu, "
|
||||||
|
"found %Lu-%Lu\n", logical, em->start,
|
||||||
|
em->start + em->len);
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BUG_ON(em->start > logical || em->start + em->len < logical);
|
|
||||||
map = (struct map_lookup *)em->bdev;
|
map = (struct map_lookup *)em->bdev;
|
||||||
offset = logical - em->start;
|
offset = logical - em->start;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue