From 3fc34ac7ee85f4522eb34479baf1dd152f877991 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Fri, 26 Apr 2024 19:10:04 +0200
Subject: [PATCH] vdo: fix setting VDO size when stacked

When VDO is used as data LV for thin-pool, we need
to use correct function to propagate this through
the stack of volumes.
---
 lib/metadata/lv_manip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 12265cb06..42a6c0d87 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -3516,8 +3516,8 @@ static int _lv_add_vdo_segment(struct logical_volume *lv, uint64_t status,
 		dm_list_add(&lv->segments, &seg->list);
 	}
 
-	lv->le_count += extents;
-	lv->size += (uint64_t) extents * lv->vg->extent_size;
+	if (!_setup_lv_size(lv, lv->le_count + extents))
+		return_0;
 
 	if (seg_lv(seg, 0) &&
 	    !update_vdo_pool_virtual_size(first_seg(seg_lv(seg, 0))))