From cf1ff48377bd1ec328c4eb891b81ed1baf66c051 Mon Sep 17 00:00:00 2001 From: Qian Yingjin Date: Fri, 18 May 2018 16:55:32 +0800 Subject: [PATCH] LU-11032 hsm: memory leak in mdt_hsm_cdt_cleanup Release the alloced memory of archive id in mdt_hsm_cdt_cleanup when free hsm_agent data structure, avoiding memroy leak problem. Signed-off-by: Qian Yingjin Change-Id: I40e5fd289419d7c18d5f2c3ebe0d3955229f5517 Reviewed-on: https://review.whamcloud.com/32456 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Quentin Bouget Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- lustre/mdt/mdt_coordinator.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lustre/mdt/mdt_coordinator.c b/lustre/mdt/mdt_coordinator.c index 02efdb7..d65e97e 100644 --- a/lustre/mdt/mdt_coordinator.c +++ b/lustre/mdt/mdt_coordinator.c @@ -469,6 +469,9 @@ static void mdt_hsm_cdt_cleanup(struct mdt_device *mdt) down_write(&cdt->cdt_agent_lock); list_for_each_entry_safe(ha, tmp2, &cdt->cdt_agents, ha_list) { list_del(&ha->ha_list); + if (ha->ha_archive_cnt != 0) + OBD_FREE(ha->ha_archive_id, ha->ha_archive_cnt * + sizeof(*ha->ha_archive_id)); OBD_FREE_PTR(ha); } up_write(&cdt->cdt_agent_lock); -- 1.8.3.1