From: Aurelien Degremont Date: Mon, 28 Jan 2019 13:54:14 +0000 (+0000) Subject: LU-11892 hsm: fix memory leak when scheduling HSM requests X-Git-Tag: 2.12.52~97 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=fc13209d2a15f68c4b96288b3a68d45826abc64d;p=fs%2Flustre-release.git LU-11892 hsm: fix memory leak when scheduling HSM requests After creating a big HSM request candidate list, coordinator thread allocates an update list which is 16 bytes times the number of candidates files. In some cases, they could be more than 300,000 candidate files and so several MB will be needed. Memory allocation failure was skipping candidate list freeing which led to memory leak. Test-Parameters: trivial testlist=sanity-hsm Signed-off-by: Aurelien Degremont Change-Id: Ibb4833f4430cc50cc014f6d14caf0551e0fce161 Reviewed-on: https://review.whamcloud.com/34123 Tested-by: Jenkins Reviewed-by: Patrick Farrell Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdt/mdt_coordinator.c b/lustre/mdt/mdt_coordinator.c index 6795c7d..51708d1 100644 --- a/lustre/mdt/mdt_coordinator.c +++ b/lustre/mdt/mdt_coordinator.c @@ -722,10 +722,10 @@ static int mdt_coordinator(void *data) updates_sz = updates_cnt * sizeof(*updates); OBD_ALLOC_LARGE(updates, updates_sz); if (updates == NULL) { - CERROR("%s: Cannot allocate memory (%d o) " - "for %d updates\n", + CERROR("%s: Cannot allocate memory (%d bytes) " + "for %d updates. Too many HSM requests?\n", mdt_obd_name(mdt), updates_sz, updates_cnt); - continue; + goto clean_cb_alloc; } /* here hsd contains a list of requests to be started */