* [PATCH] Btrfs-progs: make btrfs-map-logical handle error gracefully
@ 2013-07-19 6:31 Wang Shilong
0 siblings, 0 replies; only message in thread
From: Wang Shilong @ 2013-07-19 6:31 UTC (permalink / raw)
To: Linux Btrfs; +Cc: wangshilong1991
If an overflow logical address is passed(for example),the original
code will cause segmentation, this is unfriendly to users,fix it.
Signed-off-by: Wang Shilong<wangsl.fnst@cn.fujitsu.com>
---
btrfs-map-logical.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/btrfs-map-logical.c b/btrfs-map-logical.c
index b9635f7..fce6504 100644
--- a/btrfs-map-logical.c
+++ b/btrfs-map-logical.c
@@ -57,7 +57,14 @@ struct extent_buffer *debug_read_block(struct btrfs_root *root, u64 bytenr,
ret = btrfs_map_block(&root->fs_info->mapping_tree, READ,
eb->start, &length, &multi,
mirror_num, NULL);
- BUG_ON(ret);
+ if (ret) {
+ fprintf(info_file,
+ "Error: fails to map mirror%d logical %llu: %s\n",
+ mirror_num, (unsigned long long)eb->start,
+ strerror(-ret));
+ free_extent_buffer(eb);
+ return NULL;
+ }
device = multi->stripes[0].dev;
eb->fd = device->fd;
device->total_ios++;
-- 1.8.0.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-07-19 6:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-19 6:31 [PATCH] Btrfs-progs: make btrfs-map-logical handle error gracefully Wang Shilong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).