[ovs-dev] datapath-windows: Fix race condition when deleting internal ports

Message ID 20181221135527.42024-1-aserdean@ovn.org
State Accepted
Headers show
Series
  • [ovs-dev] datapath-windows: Fix race condition when deleting internal ports
Related show

Commit Message

Alin Gabriel Serdean Dec. 21, 2018, 1:55 p.m.
We need to hold the port lock until all the operations with a port are
completed.

Found by inspection.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
---
 datapath-windows/ovsext/Vport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ben Pfaff Dec. 27, 2018, 6:03 p.m. | #1
On Fri, Dec 21, 2018 at 03:55:27PM +0200, Alin Gabriel Serdean wrote:
> We need to hold the port lock until all the operations with a port are
> completed.
> 
> Found by inspection.
> 
> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>

Seems reasonable to me.

Acked-by: Ben Pfaff <blp@ovn.org>
Anand Kumar Dec. 27, 2018, 6:29 p.m. | #2
Acked-by: Anand Kumar <kumaranand@vmware.com>

Thanks,
Anand Kumar

´╗┐On 12/21/18, 5:56 AM, "ovs-dev-bounces@openvswitch.org on behalf of Alin Gabriel Serdean" <ovs-dev-bounces@openvswitch.org on behalf of aserdean@ovn.org> wrote:

    We need to hold the port lock until all the operations with a port are
    completed.
    
    Found by inspection.
    
    Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
    ---
     datapath-windows/ovsext/Vport.c | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/datapath-windows/ovsext/Vport.c b/datapath-windows/ovsext/Vport.c
    index 380870a11..e08cb90ce 100644
    --- a/datapath-windows/ovsext/Vport.c
    +++ b/datapath-windows/ovsext/Vport.c
    @@ -632,13 +632,13 @@ HvDisconnectNic(POVS_SWITCH_CONTEXT switchContext,
             OvsRemoveAndDeleteVport(NULL, switchContext, vport, FALSE, TRUE);
             OvsPostVportEvent(&event);
         }
    -    NdisReleaseRWLock(switchContext->dispatchLock, &lockState);
     
         if (isInternalPort) {
             OvsInternalAdapterDown(vport->portNo, vport->netCfgInstanceId);
             OvsRemoveAndDeleteVport(NULL, switchContext, vport, TRUE, TRUE);
             OvsPostVportEvent(&event);
         }
    +    NdisReleaseRWLock(switchContext->dispatchLock, &lockState);
     
     done:
         VPORT_NIC_EXIT(nicParam);
    -- 
    2.16.1.windows.1
    
    _______________________________________________
    dev mailing list
    dev@openvswitch.org
    https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.openvswitch.org%2Fmailman%2Flistinfo%2Fovs-dev&amp;data=02%7C01%7Ckumaranand%40vmware.com%7Cebdfb5ed4e7a4d43445108d6674c0aa0%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C636809973664095278&amp;sdata=VKRorIGV6IFhZ1kd6PPeQ22nNwzJok9WThrZxU0dedQ%3D&amp;reserved=0
Alin Gabriel Serdean Dec. 28, 2018, 3:09 p.m. | #3
> On 27 Dec 2018, at 20:29, Anand Kumar <kumaranand@vmware.com> wrote:
> 
> Acked-by: Anand Kumar <kumaranand@vmware.com <mailto:kumaranand@vmware.com>>
> 


Thanks both. Applied on master and branch-2.10.


Alin.

Patch

diff --git a/datapath-windows/ovsext/Vport.c b/datapath-windows/ovsext/Vport.c
index 380870a11..e08cb90ce 100644
--- a/datapath-windows/ovsext/Vport.c
+++ b/datapath-windows/ovsext/Vport.c
@@ -632,13 +632,13 @@  HvDisconnectNic(POVS_SWITCH_CONTEXT switchContext,
         OvsRemoveAndDeleteVport(NULL, switchContext, vport, FALSE, TRUE);
         OvsPostVportEvent(&event);
     }
-    NdisReleaseRWLock(switchContext->dispatchLock, &lockState);
 
     if (isInternalPort) {
         OvsInternalAdapterDown(vport->portNo, vport->netCfgInstanceId);
         OvsRemoveAndDeleteVport(NULL, switchContext, vport, TRUE, TRUE);
         OvsPostVportEvent(&event);
     }
+    NdisReleaseRWLock(switchContext->dispatchLock, &lockState);
 
 done:
     VPORT_NIC_EXIT(nicParam);