From 455cf10856bdf82e3f26d8bedf00d3a2a3a0df1b Mon Sep 17 00:00:00 2001 From: wangjufeng Date: Wed, 11 Mar 2020 16:16:53 +0800 Subject: [PATCH] backport patch to fix heap memory leak --- 6054-lvmetad-fix-heap-memory-leak.patch | 32 +++++++++++++++++++++++++ lvm2.spec | 9 ++++++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 6054-lvmetad-fix-heap-memory-leak.patch diff --git a/6054-lvmetad-fix-heap-memory-leak.patch b/6054-lvmetad-fix-heap-memory-leak.patch new file mode 100644 index 0000000..d983649 --- /dev/null +++ b/6054-lvmetad-fix-heap-memory-leak.patch @@ -0,0 +1,32 @@ +From 00e750b9e645f7a7fab9ce464419c72bd8535df0 Mon Sep 17 00:00:00 2001 +From: wangjufeng +Date: Wed, 5 Feb 2020 13:39:39 +0800 +Subject: [PATCH] lvmetad: fix heap memory leak + +When lvmetad make reponse for clent request, it should add all +new chunk for the dm_config_tree of reponse, not the cft of +global s->vgid_to_metadata, or, it will keep malloc new chunk +for s->vgid_to_metadata, that will lead to RSS memory keep +growing. + +Signed-off-by: wangjufeng +--- + daemons/lvmetad/lvmetad-core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c +index ef43b47..659d85c 100644 +--- a/daemons/lvmetad/lvmetad-core.c ++++ b/daemons/lvmetad/lvmetad-core.c +@@ -730,7 +730,7 @@ static response vg_lookup(lvmetad_state *s, request r) + if (!(res.cft->root = n = dm_config_create_node(res.cft, "response"))) + goto nomem_un; + +- if (!(n->v = dm_config_create_value(cft))) ++ if (!(n->v = dm_config_create_value(res.cft))) + goto nomem_un; + + n->parent = res.cft->root; +-- +1.8.3.1 + diff --git a/lvm2.spec b/lvm2.spec index 4aba9a6..5a02fde 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -43,7 +43,7 @@ Name: lvm2 Version: 2.02.181 -Release: 6 +Release: 7 Epoch: 8 Summary: Tools for logical volume management License: GPLv2 and LGPLv2 @@ -106,6 +106,7 @@ Patch6050: 6050-cov-ensure-read_ahead-is-available.patch Patch6051: 6051-lvmcache-free-resource-on-error-path.patch Patch6052: 6052-daemons-check-for-non-zero-thread_id.patch Patch6053: 6053-revert-label_scan-remove-extra-label-scan-and-read-f.patch +Patch6054: 6054-lvmetad-fix-heap-memory-leak.patch Patch9000: 9000-bugfix-lvm2-add-SSD.patch Patch9001: 9001-bugfix-add-timeout-when-fail-to-wait-udev.patch @@ -551,6 +552,12 @@ fi %changelog +* Wed Mar 11 2020 wangjufeng - 8:2.02.181-7 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix heap memory leak + * Wed Jan 15 2020 openEuler Buildteam - 8:2.02.181-6 - Type:bugfix - ID:NA -- Gitee