On Wed, Jul 17, 2013 at 05:46:01PM -0700, Ansis Atteka wrote: > On Wed, Jul 17, 2013 at 5:03 PM, Ansis Atteka <aatt...@nicira.com> wrote: > > > > > > > > > On Fri, Jul 12, 2013 at 2:54 PM, Ben Pfaff <b...@nicira.com> wrote: > > > >> The uses of vlog in this module are not thread-safe, because vlog itself > >> is not yet thread-safe. > >> > >> Signed-off-by: Ben Pfaff <b...@nicira.com> > >> --- > >> lib/netlink-socket.c | 24 +++++++++++++++++++----- > >> lib/netlink-socket.h | 6 ++++++ > >> 2 files changed, 25 insertions(+), 5 deletions(-) > >> > >> diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c > >> index 8e08841..da32284 100644 > >> --- a/lib/netlink-socket.c > >> +++ b/lib/netlink-socket.c > >> @@ -1,5 +1,5 @@ > >> /* > >> - * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc. > >> + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc. > >> * > >> * Licensed under the Apache License, Version 2.0 (the "License"); > >> * you may not use this file except in compliance with the License. > >> @@ -29,6 +29,7 @@ > >> #include "netlink.h" > >> #include "netlink-protocol.h" > >> #include "ofpbuf.h" > >> +#include "ovs-thread.h" > >> #include "poll-loop.h" > >> #include "socket-util.h" > >> #include "util.h" > >> @@ -85,13 +86,14 @@ static void nl_pool_release(struct nl_sock *); > >> int > >> nl_sock_create(int protocol, struct nl_sock **sockp) > >> { > >> + static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; > >> struct nl_sock *sock; > >> struct sockaddr_nl local, remote; > >> socklen_t local_size; > >> int rcvbuf; > >> int retval = 0; > >> > >> - if (!max_iovs) { > >> + if (ovsthread_once_start(&once)) { > >> > > > > I could be wrong, but isn't max_iovs shared among all threads and hence > > should be protected too? I guess the code in this "if" statement could > > potentially be executed simultaneously by multiple threads until > > ovsthread_once_done() is called? is that right? > > > > Nevermind, I guess I misunderstood ovsthread_once* API in a silly way. > > Looks good to me.
Thanks for the reviews, I applied these two patches to master. _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev