An error from nl_sock_recv() could mean that there are some issues with the netlink socket (EBADF, ENOTSOCK, ...). Calling nl_sock_recv() in this case is harmful: nln_run() will never return and since we are calling it from the main thread, vswitchd becomes unresponsive. Also, with this commit we avoid calling the notifier callback in case of error (except for ENOBUFS, which means that there could be too many notifications)
Suggested-by: Alex Wang <[email protected]> Signed-off-by: Daniele Di Proietto <[email protected]> --- lib/netlink-notifier.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/netlink-notifier.c b/lib/netlink-notifier.c index 9aa185d..0be8518 100644 --- a/lib/netlink-notifier.c +++ b/lib/netlink-notifier.c @@ -182,12 +182,15 @@ nln_run(struct nln *nln) return; } else { if (error == ENOBUFS) { + /* The socket buffer might be full, there could be too many + * notifications, so it makes sense to call nln_report() */ + nln_report(nln, NULL); VLOG_WARN_RL(&rl, "netlink receive buffer overflowed"); } else { VLOG_WARN_RL(&rl, "error reading netlink socket: %s", ovs_strerror(error)); } - nln_report(nln, NULL); + return; } } } -- 2.0.0 _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
