[ovs-dev] [thread-safety 02/11] stp: Make the STP module thread safe.

Ben Pfaff blp at nicira.com
Thu Aug 1 18:05:14 UTC 2013


On Tue, Jul 30, 2013 at 05:50:02PM -0700, Ethan Jackson wrote:
> > There are definitely ways around the thread safety analysis.  My
> > feeling is that we should be pretty strict about it except in modules
> > where contention is a real problem.
> >
> >> Why does stp need a recursive mutex?  I don't see any natural
> >> recursion here.
> 
> So looking back at this, I'd like to keep the recursive mutex.
> stp_send_bpdu() uses a call back function to send a packet through
> ofproto-dpif.  If this packet is going through a patch port it could
> loop back into the stp module causing a dead lock.  I don't think
> there's a clean thread safe way to do this without the recursive mutex
> short of ditching the call back function.  I'd be all for doing that
> in future, but for now I'd prefer to keep the patch as-is (with the
> possible addition of a comment explaining why the recursive mutex is
> necessary).

Thanks for the explanation, I'll look at the reposted version now.



More information about the dev mailing list