lib/vhost: move pending_async_op_num from generic vhost
pending_async_op_num is specific to vhost_user. To prepare for virtio_blk transport abstraction, checking for the pending operations is moved to vhost_user specific code from vhost_blk. Ideally the vhost_user_dev_unregister() should be the only function that checks this field, but due to order of calls in vhost_scsi it needs to remain there separetly. This should not pose any issue, as vhost_scsi is still dependent directly on vhost_user. Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: I53dde73766dcf8596715560f6909a4679f8da930 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11811 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
0c97e22ccc
commit
c706c20c50
@ -1756,6 +1756,10 @@ vhost_user_dev_register(struct spdk_vhost_dev *vdev, const char *name, struct sp
|
||||
int
|
||||
vhost_user_dev_unregister(struct spdk_vhost_dev *vdev)
|
||||
{
|
||||
if (vdev->pending_async_op_num) {
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
if (!TAILQ_EMPTY(&vdev->vsessions)) {
|
||||
SPDK_ERRLOG("Controller %s has still valid connection.\n", vdev->name);
|
||||
return -EBUSY;
|
||||
|
@ -196,10 +196,6 @@ vhost_dump_info_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_ctx *w)
|
||||
int
|
||||
spdk_vhost_dev_remove(struct spdk_vhost_dev *vdev)
|
||||
{
|
||||
if (vdev->pending_async_op_num) {
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
return vdev->backend->remove_device(vdev);
|
||||
}
|
||||
|
||||
|
@ -895,6 +895,10 @@ vhost_scsi_dev_remove(struct spdk_vhost_dev *vdev)
|
||||
struct spdk_vhost_scsi_dev *svdev = to_scsi_dev(vdev);
|
||||
int rc, i;
|
||||
|
||||
if (vdev->pending_async_op_num) {
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
assert(svdev != NULL);
|
||||
for (i = 0; i < SPDK_VHOST_SCSI_CTRLR_MAX_DEVS; ++i) {
|
||||
if (svdev->scsi_dev_state[i].dev) {
|
||||
|
Loading…
Reference in New Issue
Block a user