diff --git a/tools/toollib.c b/tools/toollib.c index 841acfee2..cdd62589c 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -1261,6 +1261,18 @@ int lv_refresh(struct cmd_context *cmd, struct logical_volume *lv) if (!r) goto_out; + /* + * check if snapshot merge should be polled + * - unfortunately: even though the dev_manager will clear + * the lv's merge attributes if a merge is not possible; + * it is clearing a different instance of the lv (as + * retrieved with lv_from_lvid) + * - fortunately: polldaemon will immediately shutdown if the + * origin doesn't have a status with a snapshot percentage + */ + if (background_polling() && lv_is_origin(lv) && lv->merging_snapshot) + lv_spawn_background_polling(cmd, lv); + out: return r; } @@ -1295,7 +1307,7 @@ void lv_spawn_background_polling(struct cmd_context *cmd, pvmove_poll(cmd, pvname, 1); } - if (lv->status & CONVERTING) { + if (lv->status & CONVERTING || lv->merging_snapshot) { log_verbose("Spawning background lvconvert process for %s", lv->name); lvconvert_poll(cmd, lv, 1); diff --git a/tools/vgchange.c b/tools/vgchange.c index e425f14ca..6a3420af3 100644 --- a/tools/vgchange.c +++ b/tools/vgchange.c @@ -68,12 +68,12 @@ static int _poll_lvs_in_vg(struct cmd_context *cmd, else lv_active = info.exists; - if (!lv_active || - !(lv->status & (PVMOVE|CONVERTING))) - continue; - - lv_spawn_background_polling(cmd, lv); - count++; + if (lv_active && + (lv->status & (PVMOVE|CONVERTING) || + lv->merging_snapshot)) { + lv_spawn_background_polling(cmd, lv); + count++; + } } /* @@ -140,7 +140,8 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd, if (background_polling() && activate != CHANGE_AN && activate != CHANGE_ALN && - (lv->status & (PVMOVE|CONVERTING))) + (lv->status & (PVMOVE|CONVERTING) || + lv->merging_snapshot)) lv_spawn_background_polling(cmd, lv); count++;