Spdk/lib/vhost
Jim Harris 327d1c988d vhost: defer vhost_dev_unregister until scsi tgts removed
Currently when a vhost-scsi controller is removed, it
calls spdk_vhost_scsi_dev_remove_tgt on all remaining
targets, and then immediately calls vhost_dev_unregister.
But this path goes into vhost_user_dev_unregister which
immediately returns with error if there are any pending
async operations - and there are since scsi_dev_remove_tgt
is asynchronous.

So instead add the vhost_dev_unregister call to
remove_scsi_tgt, so that the unregister only happens
after the last ref goes away.

This requires changing vhost_fini() to no longer
assume that spdk_vhost_dev_remove() will immediately
unregister the device, since it now happens
asynchronously.  Previously vhost_fini() was making
this assumption erroneously - it would call g_fini_cb
without actually checking that the devices had been
unregistered.  Because of that incorrect assumption,
we need to do both the vhost and vhost-scsi changes
in the same patch.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I9577901266975447f9acfe53475221113f02fea3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15510
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2022-11-23 08:22:04 +00:00
..
Makefile update Intel copyright notices 2022-11-10 08:28:53 +00:00
rte_vhost_user.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
spdk_vhost.map event/vhost: separate vhost subsystem to scsi and blk 2022-05-20 09:20:07 +00:00
vhost_blk.c include/bdev_module.h: add SPDK_ prefix to macros 2022-11-22 10:03:57 +00:00
vhost_internal.h update Intel copyright notices 2022-11-10 08:28:53 +00:00
vhost_rpc.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
vhost_scsi.c vhost: defer vhost_dev_unregister until scsi tgts removed 2022-11-23 08:22:04 +00:00
vhost.c vhost: defer vhost_dev_unregister until scsi tgts removed 2022-11-23 08:22:04 +00:00