diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c index d50237926..5c2ca95ae 100644 --- a/lib/metadata/raid_manip.c +++ b/lib/metadata/raid_manip.c @@ -1563,9 +1563,9 @@ static int _avoid_pvs_of_lv(struct logical_volume *lv, void *data) * by setting the internal PV_ALLOCATION_PROHIBITED flag to use it to avoid generating * pv maps for those PVs. */ -static void _avoid_pvs_with_other_images_of_lv(struct logical_volume *lv, struct dm_list *allocate_pvs) +static int _avoid_pvs_with_other_images_of_lv(struct logical_volume *lv, struct dm_list *allocate_pvs) { - for_each_sub_lv(lv, _avoid_pvs_of_lv, allocate_pvs); + return for_each_sub_lv(lv, _avoid_pvs_of_lv, allocate_pvs); } /* @@ -1667,7 +1667,11 @@ int lv_raid_replace(struct logical_volume *lv, } /* Prevent any PVs holding image components from being used for allocation */ - _avoid_pvs_with_other_images_of_lv(lv, allocate_pvs); + if (!_avoid_pvs_with_other_images_of_lv(lv, allocate_pvs)) { + log_error("Failed to prevent PVs holding image components " + "from being used for allocation."); + return 0; + } /* * Allocate the new image components first