netdev-dpdk: Unlink vhost-user sockets on fatal signals.
authorIlya Maximets <i.maximets@samsung.com>
Tue, 2 Feb 2016 11:02:15 +0000 (14:02 +0300)
committerBen Pfaff <blp@ovn.org>
Tue, 2 Feb 2016 18:30:25 +0000 (10:30 -0800)
While killing OVS may not call rte_vhost_driver_unregister()
for vhost-user ports. As a result corresponding socket will
remain in a system and opening of that port after restart
will fail.

(Even after this patch this remains a problem for signals
that OVS does not or cannot catch, such as SIGSEGV and
SIGKILL.)

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
lib/netdev-dpdk.c

index 09ccc2c..1e43dae 100644 (file)
@@ -33,6 +33,7 @@
 #include "dirs.h"
 #include "dp-packet.h"
 #include "dpif-netdev.h"
+#include "fatal-signal.h"
 #include "list.h"
 #include "netdev-dpdk.h"
 #include "netdev-provider.h"
@@ -687,7 +688,10 @@ netdev_dpdk_vhost_user_construct(struct netdev *netdev_)
     if (err) {
         VLOG_ERR("vhost-user socket device setup failure for socket %s\n",
                  netdev->vhost_id);
+    } else {
+        fatal_signal_add_file_to_unlink(netdev->vhost_id);
     }
+
     VLOG_INFO("Socket %s created for vhost-user port %s\n", netdev->vhost_id, netdev_->name);
     err = vhost_construct_helper(netdev_);
     ovs_mutex_unlock(&dpdk_mutex);
@@ -745,6 +749,8 @@ netdev_dpdk_vhost_destruct(struct netdev *netdev_)
 
     if (rte_vhost_driver_unregister(dev->vhost_id)) {
         VLOG_ERR("Unable to remove vhost-user socket %s", dev->vhost_id);
+    } else {
+        fatal_signal_remove_file_to_unlink(dev->vhost_id);
     }
 
     ovs_mutex_lock(&dpdk_mutex);