[ovs-dev] [threads 20/23] netdev-vport: Make pid checking in set_tunnel_config() thread-safe

Ben Pfaff blp at nicira.com
Tue Jul 23 18:42:09 UTC 2013


Thanks, I applied all of these.

On Tue, Jul 23, 2013 at 11:28:58AM -0700, Andy Zhou wrote:
> patch 11-20,
> acked-by: Andy Zhou <azhou at nicira.com>
> 
> 
> 
> On Thu, Jul 18, 2013 at 4:15 PM, Ben Pfaff <blp at nicira.com> wrote:
> 
> > Signed-off-by: Ben Pfaff <blp at nicira.com>
> > ---
> >  lib/netdev-vport.c |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> >
> > diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
> > index 885bf5e..4214b38 100644
> > --- a/lib/netdev-vport.c
> > +++ b/lib/netdev-vport.c
> > @@ -413,13 +413,17 @@ set_tunnel_config(struct netdev *dev_, const struct
> > smap *args)
> >      }
> >
> >      if (tnl_cfg.ipsec) {
> > +        static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
> >          static pid_t pid = 0;
> > +
> > +        pthread_mutex_lock(&mutex);
> >          if (pid <= 0) {
> >              char *file_name = xasprintf("%s/%s", ovs_rundir(),
> >                                          "ovs-monitor-ipsec.pid");
> >              pid = read_pidfile(file_name);
> >              free(file_name);
> >          }
> > +        pthread_mutex_unlock(&mutex);
> >
> >          if (pid < 0) {
> >              VLOG_ERR("%s: IPsec requires the ovs-monitor-ipsec daemon",
> > --
> > 1.7.2.5
> >
> > _______________________________________________
> > dev mailing list
> > dev at openvswitch.org
> > http://openvswitch.org/mailman/listinfo/dev
> >



More information about the dev mailing list