diff --git a/WHATS_NEW b/WHATS_NEW index 0689b1842..fa9796210 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.105 - ===================================== + Replace open_count check with lv_check_not_in_use() for snapshot open test. Add error messages with LV names for failing lv refresh. Compile/link daemons with RELRO and PIE options to harden daemon security. Support per-object compilation cflags via CFLAGS_object.o. diff --git a/lib/activate/activate.c b/lib/activate/activate.c index 44dfeb60d..f75f1cf5c 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -1910,19 +1910,14 @@ static int _lv_has_open_snapshots(struct logical_volume *lv) struct lvinfo info; int r = 0; - dm_list_iterate_items_gen(snap_seg, &lv->snapshot_segs, origin_list) { - if (!lv_info(lv->vg->cmd, snap_seg->cow, 0, &info, 1, 0)) { - r = 1; - continue; - } + dm_list_iterate_items_gen(snap_seg, &lv->snapshot_segs, origin_list) + if (!lv_info(lv->vg->cmd, snap_seg->cow, 0, &info, 1, 0) || + !lv_check_not_in_use(lv->vg->cmd, snap_seg->cow, &info)) + r++; - if (info.exists && info.open_count) { - log_error("LV %s/%s has open snapshot %s: " - "not deactivating", lv->vg->name, lv->name, - snap_seg->cow->name); - r = 1; - } - } + if (r) + log_error("LV %s/%s has open %d snapshot(s), not deactivating.", + lv->vg->name, lv->name, r); return r; }