[ovs-dev] [PATCHv4 2/7] netlink: Make nl_dump_next() thread-safe.

Ben Pfaff blp at nicira.com
Thu Feb 27 22:27:27 UTC 2014

On Thu, Feb 27, 2014 at 02:13:06PM -0800, Joe Stringer wrote:
> This patch modifies 'struct nl_dump' and nl_dump_next() to allow
> multiple threads to share the same nl_dump. These changes are targeted
> around synchronizing dump status between multiple callers, and
> allowing callers to fully process their existing buffers before
> determining whether to stop fetching flows.
> The 'status' field of 'struct nl_dump' becomes atomic, so that multiple
> threads may check and/or update it to communicate when there is an error
> or the netlink dump is finished. The low bit holds whether the final
> message was seen, while the higher bits hold an errno value.
> nl_dump_next() will now read all messages from the given buffer before
> checking the shared error status and attempting to fetch more. Multiple
> threads may call this with the same nl_dump, but must provide
> independent buffers. As previously, the final dump status can be
> determined by calling nl_dump_done() from a single thread.
> Signed-off-by: Joe Stringer <joestringer at nicira.com>

The comment on nl_dump_next() talks about flows, but really it should
just talk about replies (since Netlink is used for many purposes).

I'll fold that in.

More information about the dev mailing list