[ovs-dev] [PATCHv2] netlink-socket: Simplify multithreaded dumping to match Linux reality.

Ben Pfaff blp at nicira.com
Wed Jul 16 16:49:11 UTC 2014


On Wed, Jul 16, 2014 at 05:14:27PM +1200, Joe Stringer wrote:
> On 16 July 2014 05:58, Ben Pfaff <blp at nicira.com> wrote:
> 
> > 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 at nicira.com>
> >
> 
> Up to you whether the EAGAIN assumption is worth mentioning in the code
> (might not be, given the kernel behaviour is decoupled from this code).
> 
> Acked-by: Joe Stringer <joestringer at nicira.com>

Oh, I didn't see the ack to this version.  I pushed the patch without
adding the ack.  My apologies.



More information about the dev mailing list