venet: do not destroy VE IP on shutdown hook if NFS is allowed

Submitted by Stanislav Kinsburskiy on Oct. 5, 2017, 5:32 p.m.

Details

Message ID 20171005173217.6829.77905.stgit@localhost.localdomain
State New
Series "venet: do not destroy VE IP on shutdown hook if NFS is allowed"
Headers show

Commit Message

Stanislav Kinsburskiy Oct. 5, 2017, 5:32 p.m.
Mounts are destroyed asynchroniously and thus can race with VE IP destruction
leading to dead lock in kernel: NFS can'n be unmounted.
Fix it by skipping VE IP desctruction, is NFS feature is enabled in the
container.

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

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
---
 drivers/net/venetdev.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/net/venetdev.c b/drivers/net/venetdev.c
index 5710792..7a546cc 100644
--- a/drivers/net/venetdev.c
+++ b/drivers/net/venetdev.c
@@ -744,10 +744,8 @@  static void venet_setup(struct net_device *dev)
 	SET_ETHTOOL_OPS(dev, &venet_ethtool_ops);
 }
 
-static void veip_shutdown(void *data)
+static void veip_shutdown(struct ve_struct *ve)
 {
-	struct ve_struct *ve = data;
-
 	spin_lock(&veip_lock);
 	if (ve->veip) {
 		__venet_ext_clean(ve);
@@ -1178,8 +1176,18 @@  static struct rtnl_link_ops venet_link_ops = {
 	.maxtype	= VENET_INFO_MAX,
 };
 
+static void veip_shutdown_fini(void *data)
+{
+	struct ve_struct *ve = data;
+
+	if (ve->features & VE_FEATURE_NFS)
+		return;
+
+	veip_shutdown(ve);
+}
+
 static struct ve_hook veip_shutdown_hook = {
-	.fini		= veip_shutdown,
+	.fini		= veip_shutdown_fini,
 	.priority	= HOOK_PRIO_FINISHING,
 	.owner		= THIS_MODULE,
 };