scsi: Don't free IO channel at LUN removal not by allocator

IO channel is freed unexpectedly at LUN removal. This hides
error due to uncorrect implementation of LUN hot removal.

IO channel of LUN must be freed only by its allocator.

Change-Id: Id3721180422364dfc4d9309f3a22ce0a3f766f82
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/416318
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Shuhei Matsumoto 2018-06-21 16:40:03 +09:00 committed by Ben Walker
parent 0a43fe282a
commit 1e1e0dd70c

View File

@ -184,8 +184,6 @@ spdk_scsi_lun_execute_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *tas
static void
spdk_scsi_lun_remove(struct spdk_scsi_lun *lun)
{
spdk_scsi_lun_free_io_channel(lun);
spdk_bdev_close(lun->bdev_desc);
spdk_scsi_dev_delete_lun(lun->dev, lun);
@ -197,7 +195,8 @@ spdk_scsi_lun_hot_remove_poll(void *arg)
{
struct spdk_scsi_lun *lun = (struct spdk_scsi_lun *)arg;
if (spdk_scsi_lun_has_pending_tasks(lun)) {
if (spdk_scsi_lun_has_pending_tasks(lun) ||
lun->io_channel != NULL) {
return -1;
}
@ -216,7 +215,8 @@ _spdk_scsi_lun_hot_remove(void *arg1)
lun->hotremove_cb(lun, lun->hotremove_ctx);
}
if (spdk_scsi_lun_has_pending_tasks(lun)) {
if (spdk_scsi_lun_has_pending_tasks(lun) ||
lun->io_channel != NULL) {
lun->hotremove_poller = spdk_poller_register(spdk_scsi_lun_hot_remove_poll,
lun, 10);
} else {