[Devel] [PATCH RHEL7 COMMIT] ve/vznetstat: Don't destroy statistics until explicitly asked

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jul 24 08:25:37 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.27
------>
commit 50f08378df039ffda702d85ae1457876f40cae29
Author: Cyrill Gorcunov <gorcunov at virtuozzo.com>
Date:   Fri Jul 24 19:25:33 2015 +0400

    ve/vznetstat: Don't destroy statistics until explicitly asked
    
    When I've been reworking vznetstat mem management I've added destroying
    of VE's statistics upon containers stop. This is incorrect, we need to
    keep it while module is alive.
    
    Still one can destroy statistics with VZCTL_TC_DESTROY_STAT
    or VZCTL_TC_DESTROY_ALL_STAT (of course it clears it for
    non running VEs only).
    
    https://jira.sw.ru/browse/PSBM-35178
    
    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 | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/kernel/ve/vznetstat/vznetstat.c b/kernel/ve/vznetstat/vznetstat.c
index 91f0a64..7ff431a 100644
--- a/kernel/ve/vznetstat/vznetstat.c
+++ b/kernel/ve/vznetstat/vznetstat.c
@@ -1096,13 +1096,7 @@ static void __net_exit net_exit_acct(struct net *net)
 {
 	struct ve_struct *ve = net->owner_ve;
 
-	if (ve->stat) {
-		venet_acct_put_stat(ve->stat);
-		if (atomic_read(&ve->stat->users) == 0) {
-			venet_acct_destroy_stat(ve->veid);
-			ve->stat = NULL;
-		}
-	}
+	venet_acct_put_stat(ve->stat);
 }
 
 static struct pernet_operations __net_initdata net_acct_ops = {
@@ -1142,10 +1136,17 @@ int __init venetstat_init(void)
 
 void __exit venetstat_exit(void)
 {
+	struct ve_struct *ve;
+
 	unregister_pernet_subsys(&net_acct_ops);
 	vzioctl_unregister(&tc_ioctl_info);
 	venet_acct_destroy_all_stat();
 
+	mutex_lock(&ve_list_lock);
+	for_each_ve(ve)
+		ve->stat = NULL;
+	mutex_unlock(&ve_list_lock);
+
 #if CONFIG_PROC_FS
 	remove_proc_entry("venetstat_v6", proc_vz_dir);
 	remove_proc_entry("venetstat", proc_vz_dir);



More information about the Devel mailing list