[Devel] [PATCH rh7] ve/accounting: Make sure the statistics is present

Cyrill Gorcunov gorcunov at virtuozzo.com
Fri Jul 10 07:24:10 PDT 2015


In particular if one unload ip6_vznetstat then run container
and ping from inside the node get panicing.

https://jira.sw.ru/browse/PSBM-34837

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: Igor Sukhih <igor at parallels.com>
---

This is a fast fix to not block testings. I'm investigating
ways for more proper fix (until I'm sure in contrary).

 kernel/ve/vznetstat/ip6_vznetstat.c |    6 ++++--
 kernel/ve/vznetstat/ip_vznetstat.c  |    6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

Index: linux-pcs7.git/kernel/ve/vznetstat/ip6_vznetstat.c
===================================================================
--- linux-pcs7.git.orig/kernel/ve/vznetstat/ip6_vznetstat.c
+++ linux-pcs7.git/kernel/ve/vznetstat/ip6_vznetstat.c
@@ -33,7 +33,8 @@ venet_acct_in_hook_v6(const struct nf_ho
 	if (in->flags & IFF_LOOPBACK)
 		goto out;
 
-	venet_acct_classify_add_incoming(in->nd_net->owner_ve->stat, skb);
+	if (in->nd_net->owner_ve->stat)
+		venet_acct_classify_add_incoming(in->nd_net->owner_ve->stat, skb);
 out:
 	return res;
 }
@@ -51,7 +52,8 @@ venet_acct_out_hook_v6(const struct nf_h
 		goto out;
 
 	skb->protocol = __constant_htons(ETH_P_IPV6);
-	venet_acct_classify_add_outgoing(out->nd_net->owner_ve->stat, skb);
+	if (out->nd_net->owner_ve->stat)
+		venet_acct_classify_add_outgoing(out->nd_net->owner_ve->stat, skb);
 out:
 	return res;
 }
Index: linux-pcs7.git/kernel/ve/vznetstat/ip_vznetstat.c
===================================================================
--- linux-pcs7.git.orig/kernel/ve/vznetstat/ip_vznetstat.c
+++ linux-pcs7.git/kernel/ve/vznetstat/ip_vznetstat.c
@@ -57,7 +57,8 @@ static unsigned int venet_acct_in_hook(c
 	if (unlikely(!pskb_may_pull(skb, sizeof(struct iphdr))))
 		goto out_hdr_error;
 
-	venet_acct_classify_add_incoming(in->nd_net->owner_ve->stat, skb);
+	if (in->nd_net->owner_ve->stat)
+		venet_acct_classify_add_incoming(in->nd_net->owner_ve->stat, skb);
 
 out:
 	return res;
@@ -108,7 +109,8 @@ static unsigned int venet_acct_out_hook(
 	 * different from traffic amount between VE and kproxy.
 	 */
 	skb->protocol = __constant_htons(ETH_P_IP);
-	venet_acct_classify_add_outgoing(out->nd_net->owner_ve->stat, skb);
+	if (out->nd_net->owner_ve->stat)
+		venet_acct_classify_add_outgoing(out->nd_net->owner_ve->stat, skb);
 
 out:
 	return res;



More information about the Devel mailing list