[Devel] [PATCH RHEL7 COMMIT] ve/vznetstat: Fix potential exit race

Konstantin Khorenko khorenko at virtuozzo.com
Fri Aug 28 03:31:18 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.6.3
------>
commit 9a440f22380933dd3547de7d83c553924c6ce284
Author: Cyrill Gorcunov <gorcunov at virtuozzo.com>
Date:   Fri Aug 28 14:31:18 2015 +0400

    ve/vznetstat: Fix potential exit race
    
    When container is exiting another task may be doing operations
    with statistics incrementing/decrementing stat counter, which
    may lead to situation where counter is not zero, thus we don't
    zap @ve->stat member.
    
    Fix it by testing if the net is the last one belonging
    to a container.
    
    https://jira.sw.ru/browse/PSBM-35178
    
    Fixes: 505f8aacf95dce27fad66c90d4e1cd64adcb5432
    (ve/vznetstat: Don't destroy statistics until explicitly asked)
    
    Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
    
    CC: Andrey Vagin <avagin at virtuozzo.com>
    CC: Vladimir Davydov <vdavydov at virtuozzo.com>
    CC: Konstantin Khorenko <khorenko at virtuozzo.com>
    CC: Pavel Emelyanov <xemul at virtuozzo.com>
    CC: Igor Sukhih <igor at parallels.com>
---
 kernel/ve/vznetstat/vznetstat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/ve/vznetstat/vznetstat.c b/kernel/ve/vznetstat/vznetstat.c
index 9a25dea..99feafb 100644
--- a/kernel/ve/vznetstat/vznetstat.c
+++ b/kernel/ve/vznetstat/vznetstat.c
@@ -1098,7 +1098,7 @@ static void __net_exit net_exit_acct(struct net *net)
 
 	if (ve->stat) {
 		venet_acct_put_stat(ve->stat);
-		if (atomic_read(&ve->stat->users) == 0)
+		if (ve->ve_netns == net)
 			ve->stat = NULL;
 	}
 }



More information about the Devel mailing list