From 9d145c17c31686fb11ef65c67f75107b2a9bd82d Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 23 Feb 2024 12:54:54 +0100 Subject: [PATCH] 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. --- lib/activate/activate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/activate/activate.c b/lib/activate/activate.c index a96bf4019..76cac4540 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -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)) {