diff --git a/lib/scsi/lun.c b/lib/scsi/lun.c index 9a5ba8c3b5..f04b751191 100644 --- a/lib/scsi/lun.c +++ b/lib/scsi/lun.c @@ -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 {