Re: [ovs-dev] [branch 2.1] ipfix, sflow: Fix a race.

2015-07-16 Thread Alex Wang
On Thu, Jul 16, 2015 at 4:03 PM, Jarno Rajahalme jrajaha...@nicira.com wrote: Alex, Not a review, but a comment: Isn’t it unnecessary to use atomics when the refcount is protected with a mutex? That's very true, now atomics is unnecessary. Also, in general, a thread should not release

Re: [ovs-dev] [branch 2.1] ipfix, sflow: Fix a race.

2015-07-16 Thread Jarno Rajahalme
Alex, Not a review, but a comment: Isn’t it unnecessary to use atomics when the refcount is protected with a mutex? Also, in general, a thread should not release the last reference if other threads can still find the object. Why does this happen here? Jarno On Jul 16, 2015, at 3:48 PM,

[ovs-dev] [branch 2.1] ipfix, sflow: Fix a race.

2015-07-16 Thread Alex Wang
In ovs 2.1, the unref functions for ipfix and sflow are called in ofproto/ofproto-dpif-upcall.c without the protection of any lock. If the unprotected call of unref function removes the last reference, and at the same time, other thread is trying to ref the same struct, the race could cause