From 8831a541a831a2d25cb96ee09f6739526d29e5c1 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Sat, 10 Dec 2016 20:00:32 +0100 Subject: [PATCH] raid: fix delete on clustered vg For clustered VG ensure lock is grabbed first, so later deactivation works. TODO: fix tree to solve device removal automatically. --- WHATS_NEW | 1 + lib/metadata/raid_manip.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index 74627bae0..b6f74ec43 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.169 - ===================================== + Fix deactivation of raid orphan devices for clustered VG. Fix lvconvert raid1 to mirror table reload order. Add internal function for separate mirror log preparation. Fix segfault in lvmetad from missing NULL in daemon_reply_simple. diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c index 5cbd8198a..661c39b4d 100644 --- a/lib/metadata/raid_manip.c +++ b/lib/metadata/raid_manip.c @@ -248,6 +248,12 @@ static int _deactivate_and_remove_lvs(struct volume_group *vg, struct dm_list *r { struct lv_list *lvl; + if (vg_is_clustered(vg)) + /* Need to take lock for proper deactivation */ + dm_list_iterate_items(lvl, removal_lvs) + if (!activate_lv_excl_local(vg->cmd, lvl->lv)) + return_0; + dm_list_iterate_items(lvl, removal_lvs) { if (!deactivate_lv(vg->cmd, lvl->lv)) return_0; @@ -2968,6 +2974,12 @@ static int _clear_meta_lvs(struct logical_volume *lv) !lv_update_and_reload(lv)) return_0; + /* Note: detached rmeta are NOT renamed */ + /* Grab locks first in case of clustered VG */ + if (vg_is_clustered(lv->vg)) + dm_list_iterate_items(lvl, &meta_lvs) + if (!activate_lv_excl_local(lv->vg->cmd, lvl->lv)) + return_0; /* * Now deactivate the MetaLVs before clearing, so * that _clear_lvs() will activate them visible.