From d88354e23ad3375e56be415f2c6c2ab11eef5837 Mon Sep 17 00:00:00 2001 From: workingwei Date: Wed, 12 Nov 2025 10:14:09 +0800 Subject: [PATCH 1/2] Add internal error for missing vg --- 0029-add-internal-error-for-missing-vg.patch | 38 ++++++++++++++++++++ lvm2.spec | 6 +++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 0029-add-internal-error-for-missing-vg.patch diff --git a/0029-add-internal-error-for-missing-vg.patch b/0029-add-internal-error-for-missing-vg.patch new file mode 100644 index 0000000..67495e1 --- /dev/null +++ b/0029-add-internal-error-for-missing-vg.patch @@ -0,0 +1,38 @@ +From 57ab219d9b2eea107b59b2fb7ef3bd114ca29b72 Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Thu, 25 Apr 2024 23:51:58 +0200 +Subject: [PATCH] cov: validation + +Add internal error for missing vg. +--- + tools/pvmove.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/tools/pvmove.c b/tools/pvmove.c +index dd68e33d1..c5f9d545e 100644 +--- a/tools/pvmove.c ++++ b/tools/pvmove.c +@@ -620,11 +620,6 @@ static int _pvmove_setup_single(struct cmd_context *cmd, + unsigned exclusive; + int r = ECMD_FAILED; + ++ if (!vg) { ++ log_error(INTERNAL_ERROR "Missing volume group."); ++ return r; ++ } ++ + pp->found_pv = 1; + pp->setup_result = ECMD_FAILED; + +@@ -754,6 +759,11 @@ static int _pvmove_read_single(struct cmd_context *cmd, + struct logical_volume *lv; + int ret = ECMD_FAILED; + ++ if (!vg) { ++ log_error(INTERNAL_ERROR "Missing volume group."); ++ return ret; ++ } ++ + pp->found_pv = 1; + + if (!(lv = find_pvmove_lv(vg, pv_dev(pv), PVMOVE))) { diff --git a/lvm2.spec b/lvm2.spec index 40b2d82..c4ba031 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -43,7 +43,7 @@ Name: lvm2 Version: 2.03.21 -Release: 19 +Release: 20 Epoch: 8 Summary: Tools for logical volume management License: GPLv2+ and LGPLv2.1 and BSD @@ -77,6 +77,7 @@ Patch25: 0025-fix-multiple-mounts-in-lvextend.patch Patch26: 0026-fix-pv_major-and-pv_minor-report-field-type.patch Patch27: 0027-vgsplit-fix-check-for-not-splitting-an-LV-between-tw.patch Patch28: 0028-vgsplit-fix-check-for-not-splitting-an-LV-between-tw.patch +Patch29: 0029-add-internal-error-for-missing-vg.patch BuildRequires: gcc BuildRequires: gcc-c++ @@ -503,6 +504,9 @@ fi %changelog +* Wed Nov 12 2025 weishuaihao - 8:2.03.21-20 +- add internal error for missing vg + * Mon Nov 10 2025 liuh - 8:2.03.21-19 - vgsplit: fix check for not splitting an LV between two VGs for cachevol -- Gitee From cf4dda2eb178d899a2e7a6e7958a92be0b94075b Mon Sep 17 00:00:00 2001 From: workingwei Date: Wed, 12 Nov 2025 10:14:09 +0800 Subject: [PATCH 2/2] Add internal error for missing vg --- 0029-add-internal-error-for-missing-vg.patch | 38 ++++++++++++++++++++ lvm2.spec | 6 +++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 0029-add-internal-error-for-missing-vg.patch diff --git a/0029-add-internal-error-for-missing-vg.patch b/0029-add-internal-error-for-missing-vg.patch new file mode 100644 index 0000000..8cc008c --- /dev/null +++ b/0029-add-internal-error-for-missing-vg.patch @@ -0,0 +1,38 @@ +From 57ab219d9b2eea107b59b2fb7ef3bd114ca29b72 Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Thu, 25 Apr 2024 23:51:58 +0200 +Subject: [PATCH] cov: validation + +Add internal error for missing vg. +--- + tools/pvmove.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/tools/pvmove.c b/tools/pvmove.c +index dd68e33d1..c5f9d545e 100644 +--- a/tools/pvmove.c ++++ b/tools/pvmove.c +@@ -620,6 +620,11 @@ static int _pvmove_setup_single(struct cmd_context *cmd, + unsigned exclusive; + int r = ECMD_FAILED; + ++ if (!vg) { ++ log_error(INTERNAL_ERROR "Missing volume group."); ++ return r; ++ } ++ + pp->found_pv = 1; + pp->setup_result = ECMD_FAILED; + +@@ -754,6 +759,11 @@ static int _pvmove_read_single(struct cmd_context *cmd, + struct logical_volume *lv; + int ret = ECMD_FAILED; + ++ if (!vg) { ++ log_error(INTERNAL_ERROR "Missing volume group."); ++ return ret; ++ } ++ + pp->found_pv = 1; + + if (!(lv = find_pvmove_lv(vg, pv_dev(pv), PVMOVE))) { diff --git a/lvm2.spec b/lvm2.spec index 40b2d82..c4ba031 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -43,7 +43,7 @@ Name: lvm2 Version: 2.03.21 -Release: 19 +Release: 20 Epoch: 8 Summary: Tools for logical volume management License: GPLv2+ and LGPLv2.1 and BSD @@ -77,6 +77,7 @@ Patch25: 0025-fix-multiple-mounts-in-lvextend.patch Patch26: 0026-fix-pv_major-and-pv_minor-report-field-type.patch Patch27: 0027-vgsplit-fix-check-for-not-splitting-an-LV-between-tw.patch Patch28: 0028-vgsplit-fix-check-for-not-splitting-an-LV-between-tw.patch +Patch29: 0029-add-internal-error-for-missing-vg.patch BuildRequires: gcc BuildRequires: gcc-c++ @@ -503,6 +504,9 @@ fi %changelog +* Wed Nov 12 2025 weishuaihao - 8:2.03.21-20 +- add internal error for missing vg + * Mon Nov 10 2025 liuh - 8:2.03.21-19 - vgsplit: fix check for not splitting an LV between two VGs for cachevol -- Gitee