Commit 1e1e0dd7 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Ben Walker
Browse files

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: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/416318


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 0a43fe28
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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 {