[ovs-dev] [PATCH] netlink-socket: Do not make flow_dump block on netlink socket.

Alex Wang alexw at nicira.com
Fri Jul 18 21:45:47 UTC 2014


Commit 93295354 (netlink-socket: Simplify multithreaded dumping
to match Linux reality.) makes the call to recvmsg() block if no
messages are available.  This can cause revalidator threads hanging
for long time or even deadlock when main thread tries to stop the
revalidator threads.

This commit fixes the issue by enabling the MSG_DONTWAIT flag in
the call to recvmsg().

Signed-off-by: Alex Wang <alexw at nicira.com>
---
 lib/netlink-socket.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
index b1e6804..5a38938 100644
--- a/lib/netlink-socket.c
+++ b/lib/netlink-socket.c
@@ -724,7 +724,7 @@ nl_dump_refill(struct nl_dump *dump, struct ofpbuf *buffer)
     int error;
 
     while (!ofpbuf_size(buffer)) {
-        error = nl_sock_recv__(dump->sock, buffer, true);
+        error = nl_sock_recv__(dump->sock, buffer, false);
         if (error) {
             /* The kernel shouldn't return EAGAIN while there's data left. */
             return error == EAGAIN ? EOF : error;
-- 
1.7.9.5




More information about the dev mailing list