diff options
author | David Sterba <dsterba@suse.com> | 2016-09-06 13:39:41 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-09-21 14:12:38 +0200 |
commit | b83e93e65df9e94b15a768ddb19c2526d5095105 (patch) | |
tree | 070e3465fdcb7a6abd010c3cf3f4685412416b51 | |
parent | 1620e2a0421a6e5881a3bb4a739bace929671441 (diff) |
btrfs-progs: chunk-recover: improve error handling in insert_stripe
Switch to negative errnos, the callchain handles errors.
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | chunk-recover.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/chunk-recover.c b/chunk-recover.c index 4a081db2..f1f9849e 100644 --- a/chunk-recover.c +++ b/chunk-recover.c @@ -1947,9 +1947,12 @@ static int insert_stripe(struct list_head *devexts, dev = btrfs_find_device_by_devid(rc->fs_devices, devext->objectid, 0); if (!dev) - return 1; - BUG_ON(btrfs_find_device_by_devid(rc->fs_devices, devext->objectid, - 1)); + return -ENOENT; + if (btrfs_find_device_by_devid(rc->fs_devices, devext->objectid, 1)) { + error("unexpected: found another device with id %llu", + (unsigned long long)devext->objectid); + return -EINVAL; + } chunk->stripes[index].devid = devext->objectid; chunk->stripes[index].offset = devext->offset; |