Re: [ovs-dev] [PATCH] dpif-netdev: Fix a race.

2014-12-01 Thread Alex Wang
Thx, applied to master, On Wed, Nov 26, 2014 at 2:51 PM, Jarno Rajahalme wrote: > > On Nov 26, 2014, at 2:25 PM, Alex Wang wrote: > > Yeah, > > If we take a ref count, then, there is possibility that threads like > 'monitor' > thread can take a reference when main thread is deleting the 'port'

Re: [ovs-dev] [PATCH] dpif-netdev: Fix a race.

2014-11-26 Thread Jarno Rajahalme
On Nov 26, 2014, at 2:25 PM, Alex Wang wrote: > Yeah, > > If we take a ref count, then, there is possibility that threads like > 'monitor' > thread can take a reference when main thread is deleting the 'port' > => delay the netdev_close > => if main thread want to immediately recreate the por

Re: [ovs-dev] [PATCH] dpif-netdev: Fix a race.

2014-11-26 Thread Alex Wang
Yeah, If we take a ref count, then, there is possibility that threads like 'monitor' thread can take a reference when main thread is deleting the 'port' => delay the netdev_close => if main thread want to immediately recreate the port, it will fail... So, it is most safe to just acquire the lock

Re: [ovs-dev] [PATCH] dpif-netdev: Fix a race.

2014-11-26 Thread Jarno Rajahalme
Alex, Did you consider simply taking a reference instead of the mutex? pros/cons? Jarno On Nov 25, 2014, at 4:01 PM, Alex Wang wrote: > On current master, the 'struct dp_netdev_port' is destroyed > immediately when the ref count reaches 0. However, non-pmd > threads calling the dpif_netdev

Re: [ovs-dev] [PATCH] dpif-netdev: Fix a race.

2014-11-26 Thread Pravin Shelar
On Tue, Nov 25, 2014 at 4:01 PM, Alex Wang wrote: > On current master, the 'struct dp_netdev_port' is destroyed > immediately when the ref count reaches 0. However, non-pmd > threads calling the dpif_netdev_execute() for sending packets > could hold pointer to 'port' that is not ref-counted. Thu

Re: [ovs-dev] [PATCH] dpif-netdev: Fix a race.

2014-11-25 Thread Alex Wang
On Tue, Nov 25, 2014 at 4:02 PM, Ben Pfaff wrote: > On Tue, Nov 25, 2014 at 04:01:40PM -0800, Alex Wang wrote: > > On current master, the 'struct dp_netdev_port' is destroyed > > immediately when the ref count reaches 0. However, non-pmd > > threads calling the dpif_netdev_execute() for sending

Re: [ovs-dev] [PATCH] dpif-netdev: Fix a race.

2014-11-25 Thread Ben Pfaff
On Tue, Nov 25, 2014 at 04:01:40PM -0800, Alex Wang wrote: > On current master, the 'struct dp_netdev_port' is destroyed > immediately when the ref count reaches 0. However, non-pmd > threads calling the dpif_netdev_execute() for sending packets > could hold pointer to 'port' that is not ref-count

[ovs-dev] [PATCH] dpif-netdev: Fix a race.

2014-11-25 Thread Alex Wang
On current master, the 'struct dp_netdev_port' is destroyed immediately when the ref count reaches 0. However, non-pmd threads calling the dpif_netdev_execute() for sending packets could hold pointer to 'port' that is not ref-counted. Thusly those threads could possibly access freed memory when t