diff --git a/WHATS_NEW b/WHATS_NEW index 41251b81d..119463b23 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.105 - ===================================== + Move test for target present from init_snapshot_merge() to lvconvert. Check for failure of lvmcache_add_mda() when writing pv. Check for failure of dev_get_size() when reporting device size. Drop extra unneeded '/' when scanning sysfs directory. diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h index ed1ec8d73..33c534fff 100644 --- a/lib/metadata/metadata-exported.h +++ b/lib/metadata/metadata-exported.h @@ -880,7 +880,7 @@ struct logical_volume *origin_from_cow(const struct logical_volume *lv); void init_snapshot_seg(struct lv_segment *seg, struct logical_volume *origin, struct logical_volume *cow, uint32_t chunk_size, int merge); -int init_snapshot_merge(struct lv_segment *snap_seg, struct logical_volume *origin); +void init_snapshot_merge(struct lv_segment *snap_seg, struct logical_volume *origin); void clear_snapshot_merge(struct logical_volume *origin); diff --git a/lib/metadata/snapshot_manip.c b/lib/metadata/snapshot_manip.c index fc1273e31..c491918f9 100644 --- a/lib/metadata/snapshot_manip.c +++ b/lib/metadata/snapshot_manip.c @@ -19,7 +19,6 @@ #include "toolcontext.h" #include "lv_alloc.h" #include "activate.h" -#include "segtype.h" int lv_is_origin(const struct logical_volume *lv) { @@ -152,8 +151,8 @@ void init_snapshot_seg(struct lv_segment *seg, struct logical_volume *origin, dm_list_add(&origin->snapshot_segs, &seg->origin_list); } -int init_snapshot_merge(struct lv_segment *snap_seg, - struct logical_volume *origin) +void init_snapshot_merge(struct lv_segment *snap_seg, + struct logical_volume *origin) { /* * Even though lv_is_visible(snap_seg->lv) returns 0, @@ -169,13 +168,6 @@ int init_snapshot_merge(struct lv_segment *snap_seg, snap_seg->status |= MERGING; origin->snapshot = snap_seg; origin->status |= MERGING; - - if (snap_seg->segtype->ops->target_present && - !snap_seg->segtype->ops->target_present(snap_seg->lv->vg->cmd, - snap_seg, NULL)) - return 0; - - return 1; } void clear_snapshot_merge(struct logical_volume *origin) diff --git a/tools/lvconvert.c b/tools/lvconvert.c index 92a2022cd..6a7281b94 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -1919,10 +1919,14 @@ static int lvconvert_merge(struct cmd_context *cmd, } } - if (!init_snapshot_merge(snap_seg, origin)) { + init_snapshot_merge(snap_seg, origin); + + if (snap_seg->segtype->ops->target_present && + !snap_seg->segtype->ops->target_present(snap_seg->lv->vg->cmd, + snap_seg, NULL)) { log_error("Can't initialize snapshot merge. " "Missing support in kernel?"); - return_0; + return 0; } /* store vg on disk(s) */