netlink-socket: Simplify multithreaded dumping to match Linux reality.
authorBen Pfaff <blp@nicira.com>
Wed, 16 Jul 2014 16:39:49 +0000 (09:39 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 16 Jul 2014 16:39:49 +0000 (09:39 -0700)
commit93295354dfd0c1eb890b9f5be4246625b652bfe2
tree8052d9803b3f3741e4d2b9d93bd111e85b476182
parent513a3f64b63856b93032e2147bf3cbb074c5da94
netlink-socket: Simplify multithreaded dumping to match Linux reality.

Commit 0791315e4d (netlink-socket: Work around kernel Netlink dump thread
races.) introduced a simple workaround for Linux kernel races in Netlink
dumps.  However, the code remained more complicated than needed.  This
commit simplifies it.

The main reason for complication in the code was 'status_seq' in nl_dump.
This member was there to allow a thread to wait for some other thread to
refill the socket buffer with another dump message (although we did not
understand the reason at the time it was introduced).  Now that we know
that Netlink dumps properly need to be serialized to work in existing
Linux kernels, there's no additional value in having 'status_seq',
because serialized recvmsg() calls always refill the socket buffer
properly.

This commit updates nl_msg_next() to clear its buffer argument on error.
This is a more convenient interface for the new version of the Netlink
dump code.  nl_msg_next() doesn't have any other callers.

Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/netlink-socket.c
lib/netlink-socket.h
lib/netlink.c