summaryrefslogtreecommitdiff
path: root/volumes.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-09-07 15:57:41 +0200
committerDavid Sterba <dsterba@suse.com>2016-10-03 11:33:15 +0200
commitdf36cbdad291104d49158df47916e187a8989bbb (patch)
treecd8c0bd560ead77004a89fed25dc89afacb27125 /volumes.c
parent1424a9b4d9055818df0915f40e94306f72a2c426 (diff)
btrfs-progs: improve error handling in btrfs_alloc_data_chunk
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'volumes.c')
-rw-r--r--volumes.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/volumes.c b/volumes.c
index e022c16e..b0edbacb 100644
--- a/volumes.c
+++ b/volumes.c
@@ -1070,7 +1070,11 @@ int btrfs_alloc_data_chunk(struct btrfs_trans_handle *trans,
key.objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID;
key.type = BTRFS_CHUNK_ITEM_KEY;
if (convert) {
- BUG_ON(*start != round_down(*start, extent_root->sectorsize));
+ if (*start != round_down(*start, extent_root->sectorsize)) {
+ error("DATA chunk start not sectorsize aligned: %llu",
+ (unsigned long long)*start);
+ return -EINVAL;
+ }
key.offset = *start;
dev_offset = *start;
} else {