vhost: Don't panic if the task count isn't 0

Instead of crashing if the task count isn't 0 when
shutting down, just print an error and allow the
tasks to leak.

This isn't the long term solution, but it's a lot better than
crashing.

Change-Id: I5d388c759b563953dce8239e9a4e62c3e3db16c4
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/364490
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Ben Walker 2017-06-07 09:14:09 -07:00
parent 8f371c7d64
commit 86f215f38d
2 changed files with 6 additions and 11 deletions

View File

@ -506,6 +506,12 @@ spdk_vhost_dev_unload(struct spdk_vhost_dev *vdev)
spdk_vhost_free_reactor(vdev->lcore);
vdev->lcore = -1;
if (vdev->task_cnt > 0) {
SPDK_ERRLOG("%s: Leaked %u tasks when shutting down\n", vdev->name, vdev->task_cnt);
}
vdev->task_cnt = 0;
vdev->vid = -1;
vdev->num_queues = 0;
}
struct spdk_vhost_dev *

View File

@ -826,7 +826,6 @@ destroy_device(int vid)
struct spdk_vhost_scsi_dev *svdev;
struct spdk_vhost_dev *vdev;
struct spdk_vhost_timed_event event = {0};
uint32_t i;
vdev = spdk_vhost_dev_find_by_vid(vid);
if (vdev == NULL) {
@ -843,16 +842,6 @@ destroy_device(int vid)
spdk_poller_unregister(&svdev->controlq_poller, event.spdk_event);
spdk_vhost_timed_event_wait(&event, "unregister controll queue poller");
/* Wait for all tasks to finish */
for (i = 1000; i && vdev->task_cnt > 0; i--) {
usleep(1000);
}
if (vdev->task_cnt > 0) {
rte_panic("%s: pending tasks did not finish in 1s.\n", vdev->name);
}
spdk_vhost_timed_event_send(vdev->lcore, remove_vdev_cb, svdev, 1, "remove scsi vdev");
spdk_vhost_dev_unload(vdev);