From fc13209d2a15f68c4b96288b3a68d45826abc64d Mon Sep 17 00:00:00 2001 From: Aurelien Degremont Date: Mon, 28 Jan 2019 13:54:14 +0000 Subject: [PATCH] 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 --- lustre/mdt/mdt_coordinator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 */ -- 1.8.3.1