From 598c82fc077c8a3edfbdb664b41efd89d05b5a10 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 28 Nov 2013 23:22:03 +0100 Subject: [PATCH] vgchange: move detection of remote exlusivness Since activation takes only read-lock, there could be multiple activation running in parallel. So instead of checking before taking any real lock, let the locking resolve the problem and just detect if the reason for failure has been remote exlusive activation. It should be also faster, since each activation does not need to do explicit lock query. --- WHATS_NEW | 1 + tools/vgchange.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 5d417002a..60571ffac 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.105 - ===================================== + Test for remote exclusive activation after activation fails. Support lvconvert --merge for thin snapshots. Add support to read thin device id from table line entry. Drop extra test for origin when testing merging origin in lv_refresh(). diff --git a/tools/vgchange.c b/tools/vgchange.c index b50b444d0..f9811d20f 100644 --- a/tools/vgchange.c +++ b/tools/vgchange.c @@ -121,16 +121,6 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd, struct volume_group *vg, ((lv->status & PVMOVE) )) continue; - /* - * If the LV is active exclusive remotely, - * then ignore it here - */ - if (lv_is_active_exclusive_remotely(lv)) { - log_verbose("%s/%s is exclusively active on" - " a remote node", vg->name, lv->name); - continue; - } - if (lv_activation_skip(lv, activate, arg_count(cmd, ignoreactivationskip_ARG), 0)) { log_verbose("ACTIVATION_SKIP flag set for LV %s/%s, skipping activation.", lv->vg->name, lv->name); @@ -144,7 +134,17 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd, struct volume_group *vg, expected_count++; if (!lv_change_activate(cmd, lv, activate)) { - stack; + if (!lv_is_active_exclusive_remotely(lv)) + stack; + else { + /* + * If the LV is active exclusive remotely, + * then ignore it here + */ + log_verbose("%s/%s is exclusively active on" + " a remote node", vg->name, lv->name); + expected_count--; /* not accounted */ + } continue; }