vhost/scsi: allow scsi target hotremove even without F_HOTPLUG feature
Failing the hotremove request will become more tricky once we allow creating multiple sessions per device, so we try to get rid of any unnecessary error checks. VIRTIO_SCSI_F_HOTPLUG tells us just if the host is capable of receiving hotplug events, but the scsi target can be hotremoved even without them. The hotremoval will be still reported through SCSI sense codes. All I/O to a hotremoved target will be failed with sense key ILLEGAL REQUEST, asc 0x25, ascq 0x00 (LOGICAL UNIT NOT SUPPORTED). Change-Id: I2be4e0167eb06804112758a5825cd91745128408 Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/439316 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
13a58c41ad
commit
c1579c9bbe
@ -230,15 +230,9 @@ struct spdk_scsi_dev *spdk_vhost_scsi_dev_get_tgt(struct spdk_vhost_dev *vdev, u
|
||||
/**
|
||||
* Detach and destruct SCSI target from a vhost SCSI device.
|
||||
*
|
||||
* If vhost SCSI device has an active socket connection, it is
|
||||
* required that it has negotiated \c VIRTIO_SCSI_F_HOTPLUG feature
|
||||
* flag.Otherwise an -ENOTSUP error code is returned. If the flag has
|
||||
* been negotiated, the device will be marked to be deleted. Actual
|
||||
* deletion is deferred until after all pending I/O to this device
|
||||
* has finished.
|
||||
*
|
||||
* Once the target has been deleted (whether or not vhost SCSI
|
||||
* device is in use) given callback will be called.
|
||||
* The device will be deleted after all pending I/O is finished.
|
||||
* If the driver supports VIRTIO_SCSI_F_HOTPLUG, then a hotremove
|
||||
* notification will be sent.
|
||||
*
|
||||
* \param vdev vhost SCSI device
|
||||
* \param scsi_tgt_num slot id to delete target from
|
||||
|
@ -923,12 +923,6 @@ spdk_vhost_scsi_dev_remove_tgt(struct spdk_vhost_dev *vdev, unsigned scsi_tgt_nu
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (!spdk_vhost_dev_has_feature(vdev->session, VIRTIO_SCSI_F_HOTPLUG)) {
|
||||
SPDK_WARNLOG("%s: 'Target %u' is in use and hot-detach is not enabled for this controller.\n",
|
||||
svdev->vdev.name, scsi_tgt_num);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
scsi_dev_state = &svdev->scsi_dev_state[scsi_tgt_num];
|
||||
if (scsi_dev_state->removed) {
|
||||
SPDK_WARNLOG("%s: 'Target %u' has been already marked to hotremove.\n", svdev->vdev.name,
|
||||
@ -939,7 +933,11 @@ spdk_vhost_scsi_dev_remove_tgt(struct spdk_vhost_dev *vdev, unsigned scsi_tgt_nu
|
||||
scsi_dev_state->remove_cb = cb_fn;
|
||||
scsi_dev_state->remove_ctx = cb_arg;
|
||||
scsi_dev_state->removed = true;
|
||||
eventq_enqueue(svdev, scsi_tgt_num, VIRTIO_SCSI_T_TRANSPORT_RESET, VIRTIO_SCSI_EVT_RESET_REMOVED);
|
||||
|
||||
if (spdk_vhost_dev_has_feature(vdev->session, VIRTIO_SCSI_F_HOTPLUG)) {
|
||||
eventq_enqueue(svdev, scsi_tgt_num, VIRTIO_SCSI_T_TRANSPORT_RESET,
|
||||
VIRTIO_SCSI_EVT_RESET_REMOVED);
|
||||
}
|
||||
|
||||
SPDK_INFOLOG(SPDK_LOG_VHOST, "%s: queued 'Target %u' for hot-detach.\n", vdev->name, scsi_tgt_num);
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user