1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

snapshots: avoid monitoring of inactive origins

External origins for thin volumes can be also used at the same time
as old(thick) snapshot origins. However in this case it's possible
the LV is only active as being 'external' origin, but old snapshot LVs
are not active. For this case before handling these
LVs for un/monitoring check the active state of origin LV.

This should prevent warnings of monitoring failures.
This commit is contained in:
Zdenek Kabelac 2024-02-23 12:54:54 +01:00
parent d1aacae0f7
commit 9d145c17c3

View File

@ -1867,8 +1867,10 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
* each of its respective snapshots. The origin itself may
* also need to be monitored if it is a mirror, for example,
* so fall through to process it afterwards.
* Before monitoring snapshots verify origin is active as with
* external origin only read-only -real device can be active.
*/
if (!laopts->origin_only && lv_is_origin(lv))
if (!laopts->origin_only && lv_is_origin(lv) && lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0))
dm_list_iterate_safe(snh, snht, &lv->snapshot_segs)
if (!monitor_dev_for_events(cmd, dm_list_struct_base(snh,
struct lv_segment, origin_list)->cow, NULL, monitor)) {