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

This reverts commit 86f215f38d.

Change-Id: Id3d18ffb44586ac38c5bc080a0550e5825d5ef3a
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/364947
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-06-12 12:17:50 +02:00 committed by Jim Harris
parent cc439ec2eb
commit db751c1625
2 changed files with 11 additions and 6 deletions

View File

@ -506,12 +506,6 @@ 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

@ -762,6 +762,7 @@ 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) {
@ -778,6 +779,16 @@ 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);