[RHEL7,COMMIT] venet: do not destroy VE IP on shutdown hook if NFS is allowed

Submitted by Konstantin Khorenko on Oct. 12, 2017, 8:39 a.m.

Details

Message ID 201710120839.v9C8dKui003026@finist_ce7.work
State New
Series "venet: do not destroy VE IP on shutdown hook if NFS is allowed"
Headers show

Commit Message

Konstantin Khorenko Oct. 12, 2017, 8:39 a.m.
The commit is pushed to "branch-rh7-3.10.0-693.1.1.vz7.37.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.1.1.vz7.37.11
------>
commit f22953a8708cf1ba02222da80502406c3d27ddf2
Author: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Date:   Thu Oct 12 11:39:20 2017 +0300

    venet: do not destroy VE IP on shutdown hook if NFS is allowed
    
    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,
 };