From 26889b3bb636b5655620f25c38db2c6759bf708d Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 27 May 2016 13:49:30 +0200 Subject: [PATCH] snapshot: check merging_cow is cow Check first the LV is cow before even checking it's a merging COW. Note: previosly merging_cow was also merging origin, so without this explicit check it used to return '1' also when passed LV has been merging origin. --- WHATS_NEW | 1 + lib/metadata/snapshot_manip.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW b/WHATS_NEW index 2b6e0fb66..aa352a213 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.155 - ================================ + When checking LV is a merging COW, validate its a COW LV first. Correcting value in copy_percent() for 100%. Update vgreduce to use process_each_vg. Update lvconvert to use process_each_lv. diff --git a/lib/metadata/snapshot_manip.c b/lib/metadata/snapshot_manip.c index 29b851f22..2f13ac9fa 100644 --- a/lib/metadata/snapshot_manip.c +++ b/lib/metadata/snapshot_manip.c @@ -139,7 +139,12 @@ int lv_is_visible(const struct logical_volume *lv) int lv_is_merging_cow(const struct logical_volume *cow) { - struct lv_segment *snap_seg = find_snapshot(cow); + struct lv_segment *snap_seg; + + if (!lv_is_cow(cow)) + return 0; + + snap_seg = find_snapshot(cow); /* checks lv_segment's status to see if snapshot is merging */ return (snap_seg && (snap_seg->status & MERGING)) ? 1 : 0;