From: Qian Yingjin Date: Fri, 18 May 2018 08:55:32 +0000 (+0800) Subject: LU-11032 hsm: memory leak in mdt_hsm_cdt_cleanup X-Git-Tag: 2.11.54~61 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F56%2F32456%2F3;p=fs%2Flustre-release.git 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 --- 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);