From edc91caffb0119141db2331dcd70da77c139b1b9 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 23 Feb 2024 20:52:51 +0100 Subject: [PATCH] thin: external origins across thin-pool Fix/support creation and usage of the external origin across thin-pools - so thin LV can use thin LV from some other thin-pool as external origin (read-only). --- lib/metadata/lv_manip.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index e4ab1b86f..bd70fdaa1 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -9587,8 +9587,11 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, /* Cache pool cannot be actived and zeroed */ log_very_verbose("Cache pool is prepared."); } else if (lv_is_thin_volume(lv)) { - /* For snapshot, suspend active thin origin first */ - if (origin_lv && lv_is_thin_volume(origin_lv) && lv_is_active(origin_lv)) { + /* Optimize the case when taking a snapshot within same pool and thin origin + * is an active LV, so we can pass thin message with suspend/resume of this LV. */ + if (origin_lv && lv_is_thin_volume(origin_lv) && + (first_seg(origin_lv)->pool_lv == pool_lv) && + lv_is_active(origin_lv)) { if (!(ret = suspend_lv_origin(cmd, origin_lv))) { log_error("Failed to suspend thin snapshot origin %s.", display_lvname(origin_lv));