vhost-scsi: don't return SCSI device if it under removal

spdk_vhost_scsi_dev_get_tgt() shouldn't return devices that are under
removal process.

Change-Id: I22a3f5e811c90244e9640d8d9c65cd7a65a6ecbf
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447071
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Pawel Wodkowski 2019-03-04 17:05:29 +01:00 committed by Jim Harris
parent b1a6197068
commit 05085f6645

View File

@ -882,8 +882,12 @@ spdk_vhost_scsi_dev_get_tgt(struct spdk_vhost_dev *vdev, uint8_t num)
assert(num < SPDK_VHOST_SCSI_CTRLR_MAX_DEVS);
svdev = to_scsi_dev(vdev);
if (svdev == NULL || svdev->scsi_dev_state[num].status != VHOST_SCSI_DEV_PRESENT) {
return NULL;
}
return svdev ? svdev->scsi_dev_state[num].dev : NULL;
assert(svdev->scsi_dev_state[num].dev != NULL);
return svdev->scsi_dev_state[num].dev;
}
static void