vhost: use full path when unregistering sockets on shutdown

This patch properly closes sockets on shutdown.
Previous rte_vhost_driver_unregister calls were returning
immediately due to inexistent sockets at given paths.

Change-Id: I5e4d64f04fc8b6bef914c2eb4c4d2220be9ca9ec
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377165
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-09-05 17:13:50 +02:00 committed by Jim Harris
parent 9f8efd8708
commit 4f4f397502

View File

@ -712,6 +712,7 @@ static void *
session_shutdown(void *arg)
{
struct spdk_vhost_dev *vdev = NULL;
char path[PATH_MAX];
int i;
for (i = 0; i < MAX_VHOST_DEVICES; i++) {
@ -719,7 +720,15 @@ session_shutdown(void *arg)
if (vdev == NULL) {
continue;
}
rte_vhost_driver_unregister(vdev->name);
if (snprintf(path, sizeof(path), "%s%s", dev_dirname, vdev->name) >= (int)sizeof(path)) {
SPDK_ERRLOG("Resulting socket path for controller %s is too long: %s%s\n", vdev->name, dev_dirname,
vdev->name);
assert(false);
continue;
}
rte_vhost_driver_unregister(path);
}
SPDK_NOTICELOG("Exiting\n");