[Devel,RHEL7,COMMIT] venet: split veip_stop() into protected and unprotected versions

Submitted by Konstantin Khorenko on April 22, 2017, 11:47 a.m.

Details

Message ID 201704221147.v3MBl38Z028089@finist_cl7.x64_64.work.ct
State New
Series "Fix VEIP object handling on container destroy"
Headers show

Commit Message

Konstantin Khorenko April 22, 2017, 11:47 a.m.
The commit is pushed to "branch-rh7-3.10.0-514.16.1.vz7.30.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.16.1.vz7.30.4
------>
commit 085263c2748cc75bf48873807cf4acae2f31f808
Author: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Date:   Sat Apr 22 15:47:03 2017 +0400

    venet: split veip_stop() into protected and unprotected versions
    
    Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
---
 drivers/net/venetdev.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/net/venetdev.c b/drivers/net/venetdev.c
index 192ca3c..5a09575 100644
--- a/drivers/net/venetdev.c
+++ b/drivers/net/venetdev.c
@@ -252,13 +252,10 @@  static int veip_start(struct ve_struct *ve)
 	return err;
 }
 
-static void veip_stop(struct ve_struct *ve)
+static void __veip_stop(struct ve_struct *ve)
 {
 	struct list_head *p, *tmp;
 
-	spin_lock(&veip_lock);
-	if (ve->veip == NULL)
-		goto unlock;
 	list_for_each_safe(p, tmp, &ve->veip->ip_lh) {
 		struct ip_entry_struct *ptr;
 		ptr = list_entry(p, struct ip_entry_struct, ve_list);
@@ -271,7 +268,13 @@  static void veip_stop(struct ve_struct *ve)
 	veip_pool_ops->veip_release(ve);
 	if (!ve_is_super(ve))
 		module_put(THIS_MODULE);
-unlock:
+}
+
+static void veip_stop(struct ve_struct *ve)
+{
+	spin_lock(&veip_lock);
+	if (ve->veip)
+		__veip_stop(ve);
 	spin_unlock(&veip_lock);
 }