From e67edc5fc9ed83aa140ab2ce798db154a450c0a0 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Mon, 29 Jul 2024 11:30:56 -0400 Subject: [PATCH] LU-17687 utils: Netlink doesn't return for missing MGS device If the MGS is down then yaml_get_device_index() will fail to contact the Netlink layer on the MGS server. When it fails the bool done is still set to true which causes it to go into a loop. The proper solution is to break on emitter failure of any kind to the end of the function to cleanup the parser and netlink socket. Change-Id: Ia25000dd86fd2c5f46f5de24f9a5f391c373fea4 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55881 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Arshad Hussain Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- lustre/utils/lustre_cfg.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lustre/utils/lustre_cfg.c b/lustre/utils/lustre_cfg.c index fc53e5f..29d235a 100644 --- a/lustre/utils/lustre_cfg.c +++ b/lustre/utils/lustre_cfg.c @@ -747,7 +747,9 @@ static int yaml_get_device_index(char *source) error: if (rc == 0) { yaml_emitter_log_error(&request, stderr); + yaml_emitter_delete(&request); rc = -EINVAL; + goto free_reply; } yaml_emitter_delete(&request); @@ -773,14 +775,15 @@ error: yaml_event_delete(&event); rc = -errno; } - return rc; + goto free_reply; } } } done = (event.type == YAML_STREAM_END_EVENT); yaml_event_delete(&event); } - +free_reply: + yaml_parser_delete(&reply); nl_socket_free(sk); return rc; -- 1.8.3.1