[Devel] [PATCH RH9 06/26] connector: take cn_already_initialized from VE

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Thu Oct 7 15:53:46 MSK 2021


From: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>

Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Reviewed-by: Andrey Ryabinin <aryabinin at virtuozzo.com>

(cherry picked from vz8 commit 1f57e9853e84c4ee3c48c3b11697bbef0ba138ce)
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 drivers/connector/connector.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index cc649ec99c8b..ff1d89b2ba5e 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -27,8 +27,6 @@ MODULE_AUTHOR("Evgeniy Polyakov <zbr at ioremap.net>");
 MODULE_DESCRIPTION("Generic userspace <-> kernelspace connector.");
 MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_CONNECTOR);
 
-static int cn_already_initialized;
-
 static struct cn_dev *get_cdev(struct ve_struct *ve)
 {
 	return &ve->cn->cdev;
@@ -212,7 +210,7 @@ int cn_add_callback_ve(struct ve_struct *ve,
 {
 	struct cn_dev *dev = get_cdev(ve);
 
-	if (!cn_already_initialized)
+	if (!ve->cn->cn_already_initialized)
 		return -EAGAIN;
 
 	return cn_queue_add_callback(dev->cbdev, name, id, callback);
@@ -308,7 +306,7 @@ static int cn_init_ve(struct ve_struct *ve)
 		goto net_unlock;
 	}
 
-	cn_already_initialized = 1;
+	ve->cn->cn_already_initialized = 1;
 
 	proc_create_single("connector", S_IRUGO, net->proc_net, cn_proc_show);
 	err = 0;
@@ -322,7 +320,7 @@ static void cn_fini_ve(struct ve_struct *ve)
 	struct cn_dev *dev = get_cdev(ve);
 	struct net *net;
 
-	cn_already_initialized = 0;
+	ve->cn->cn_already_initialized = 0;
 
 	/*
 	 * This is a hook called on ve stop, ve->ve_ns will be destroyed
-- 
2.31.1



More information about the Devel mailing list