Whamcloud - gitweb
LU-17687 utils: Netlink doesn't return for missing MGS device 81/55881/2
authorJames Simmons <jsimmons@infradead.org>
Mon, 29 Jul 2024 15:30:56 +0000 (11:30 -0400)
committerOleg Drokin <green@whamcloud.com>
Fri, 23 Aug 2024 22:00:23 +0000 (22:00 +0000)
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 <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55881
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/utils/lustre_cfg.c

index fc53e5f..29d235a 100644 (file)
@@ -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;