From b14c5af76d0c3f6017f825981b9749324ed70fd8 Mon Sep 17 00:00:00 2001 From: Milan Broz Date: Wed, 13 May 2009 21:25:45 +0000 Subject: [PATCH] Fix lv_is_visible to handle virtual origin. Snapshot is visible if its origin is marked visible, or if the origin is virtual. --- WHATS_NEW | 1 + lib/metadata/snapshot_manip.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 6df377862..c1060822a 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Fix lv_is_visible to handle virtual origin. Introduce link_lv_to_vg and unlink_lv_from_vg functions. Remove lv_count from VG and use counter function instead. Fix snapshot segment import to not use duplicate segments & replace. diff --git a/lib/metadata/snapshot_manip.c b/lib/metadata/snapshot_manip.c index e186dffb9..0509fe0a0 100644 --- a/lib/metadata/snapshot_manip.c +++ b/lib/metadata/snapshot_manip.c @@ -30,8 +30,15 @@ int lv_is_cow(const struct logical_volume *lv) int lv_is_visible(const struct logical_volume *lv) { - if (lv_is_cow(lv)) - return lv_is_visible(find_cow(lv)->lv); + if (lv->status & SNAPSHOT) + return 0; + + if (lv_is_cow(lv)) { + if (lv_is_virtual_origin(origin_from_cow(lv))) + return 1; + + return lv_is_visible(origin_from_cow(lv)); + } return lv->status & VISIBLE_LV ? 1 : 0; }