From: Emoly Liu Date: Wed, 23 Oct 2024 00:53:00 +0000 (+0800) Subject: LU-17962 mgc: free nidlist correctly X-Git-Tag: 2.16.51~214 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=6ddf46420826cc66263599ba430c5144eabf766e;p=fs%2Flustre-release.git LU-17962 mgc: free nidlist correctly Memory leak was found during interop testing because nidlist was not freed correctly in function mgc_apply_recover_logs(). Test-Parameters: testlist=conf-sanity env=ONLY=29 \ serverversion=2.15 clientdistro=el8.10 serverdistro=el8.10 \ mdscount=2 mdtcount=4 ostcount=8 Fixes: e4d2d4ff74 ("LU-13306 mgc: handle large NID formats") Signed-off-by: Emoly Liu Change-Id: I7a7a1b4b4f3b8c65c7608537e4dca1b9f1b68e77 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56709 Tested-by: Maloo Tested-by: jenkins Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger Reviewed-by: James Simmons --- diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index efb72a0..8d9d03d 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -1345,8 +1345,7 @@ static int mgc_apply_recover_logs(struct obd_device *mgc, CDEBUG(D_INFO, "mgc %s: cannot find obdname %s\n", mgc->obd_name, obdname); rc = 0; - /* this is a safe race, when the ost is starting up...*/ - continue; + goto free_nids; } /* osc.import = "connection=::" */ @@ -1430,6 +1429,10 @@ fail:; bufs.lcfg_buflen)); if (!lcfg) { rc = -ENOMEM; + /* For old NID format case the nidlist was allocated. */ + if (entry->mne_nid_type == 0) + OBD_FREE_PTR_ARRAY(nidlist, + entry->mne_nid_count); break; } lustre_cfg_init(lcfg, LCFG_PARAM, &bufs);