diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 3ad1215e0..c0020e2cc 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -4194,8 +4194,12 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l init_dmeventd_monitor(lp->activation_monitoring); - if (seg_is_thin_pool(lp) || seg_is_thin(lp)) { - if (!activate_lv_excl(cmd, lv)) { + if (seg_is_thin(lp)) { + if ((lp->activate == CHANGE_AY) || + (lp->activate == CHANGE_ALY)) + lp->activate = CHANGE_AE; + if ((lp->activate == CHANGE_AE) && + !activate_lv_excl(cmd, lv)) { log_error("Aborting. Failed to activate thin %s.", lv->name); goto deactivate_and_revert_new_lv; @@ -4222,7 +4226,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l lp->snapshot ? "snapshot exception store" : "start of new LV"); goto deactivate_and_revert_new_lv; - } else if (seg_is_thin_volume(lp)) { + } else if (seg_is_thin_volume(lp) && (lp->activate == CHANGE_AE)) { /* FIXME: for now we may drop any queued thin messages * since we are sure everything was activated already */ if (!detach_pool_messages(first_seg(lv)->pool_lv)) { diff --git a/tools/lvchange.c b/tools/lvchange.c index c58a9e380..42933b626 100644 --- a/tools/lvchange.c +++ b/tools/lvchange.c @@ -142,6 +142,10 @@ static int lvchange_availability(struct cmd_context *cmd, "exclusively", lv->name); if (!activate_lv_excl(cmd, lv)) return_0; + /* Drop any left thin messages after activation */ + if (lv_is_thin_volume(lv) && + !detach_pool_messages(first_seg(lv)->pool_lv)) + return_0; } else if (activate == CHANGE_ALY) { log_verbose("Activating logical volume \"%s\" locally", lv->name); diff --git a/tools/vgchange.c b/tools/vgchange.c index 39d58f146..6004371db 100644 --- a/tools/vgchange.c +++ b/tools/vgchange.c @@ -157,6 +157,12 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd, stack; continue; } + /* Drop any left thin messages after activation */ + if (lv_is_thin_volume(lv) && + !detach_pool_messages(first_seg(lv)->pool_lv)) { + stack; + continue; + } } else if (activate == CHANGE_ALY) { if (!activate_lv_local(cmd, lv)) { stack;