vhost/scsi: don't send hotremove sense codes after session restart

Always unset the VHOST_SCSI_DEV_REMOVED status on
session stop, so that we won't send hotremove SCSI
sense codes after e.g. a VM gets rebooted. The VM
should generally enumerate the SCSI devices again
in such case. We already unset the REMOVED status
for devices which were still attached at the time
of the session stop, but the devices hotremoved
before the session stop retained their REMOVED
status, giving us inconsistent behavior.

Change-Id: I7c5876e29f4bdc99cc060f1d891e24ac57051f37
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449709
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Darek Stojaczyk 2019-04-01 00:11:56 +02:00 committed by Jim Harris
parent e1c0c4c785
commit 0389c9f9e0

View File

@ -1416,14 +1416,15 @@ destroy_session_poller_cb(void *arg)
enum spdk_scsi_dev_vhost_status prev_status;
state = &svsession->scsi_dev_state[i];
/* clear the REMOVED status so that we won't send hotremove events anymore */
prev_status = state->status;
state->status = VHOST_SCSI_DEV_EMPTY;
if (state->dev == NULL) {
continue;
}
spdk_scsi_dev_free_io_channels(state->dev);
prev_status = state->status;
state->status = VHOST_SCSI_DEV_EMPTY;
state->dev = NULL;
if (prev_status == VHOST_SCSI_DEV_REMOVING) {