From f486eb60d5cfb72f084b9e2c02e4dc962f26bb69 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Tue, 10 Jan 2023 18:09:51 +0100 Subject: [PATCH] lvresize: use standard extent conversion function We need to validate whether the requested resizing size can be expressed with given extent_size. --- lib/metadata/lv_manip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index f8eae0447..305be8578 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -5197,7 +5197,8 @@ static int _lvresize_adjust_size(struct volume_group *vg, display_size(vg->cmd, size)); } - *extents = size / extent_size; + if (!(*extents = extents_from_size(vg->cmd, size, extent_size))) + return_0; return 1; }