Whamcloud - gitweb
LU-11032 hsm: memory leak in mdt_hsm_cdt_cleanup 56/32456/3
authorQian Yingjin <qian@ddn.com>
Fri, 18 May 2018 08:55:32 +0000 (16:55 +0800)
committerOleg Drokin <green@whamcloud.com>
Tue, 24 Jul 2018 16:00:52 +0000 (16:00 +0000)
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 <qian@ddn.com>
Change-Id: I40e5fd289419d7c18d5f2c3ebe0d3955229f5517
Reviewed-on: https://review.whamcloud.com/32456
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Quentin Bouget <quentin.bouget@cea.fr>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mdt/mdt_coordinator.c

index 02efdb7..d65e97e 100644 (file)
@@ -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);