From 497997bc6033399fc7ad33fa191472c11925d0ba Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Fri, 10 May 2019 15:32:54 +0900 Subject: [PATCH] SCSI: Stop I/O flooding to hot-removing LUN from iSCSI target We have observed unexpcted timeout when we remove LUNs from the active iSCSI target dynamically during FIO workload. By making destroy_raid_bdev RPC wait for its completion, we could know the destroy_raid_bdev RPC caused timeout because LUN hot removal didn't complete. By investigating the log, incoming I/Os from the host had not stopped even after hot removal process was started. The reason was that iSCSI target had continued to accept incoming I/Os from the host. By removing LUN from the SCSI device at the start of the LUN hot removal process, iSCSI target will be able to stop incoming I/Os and LUN hot removal will complete in finite time. LUN itself can be accessible even after it is removed from the SCSI device. LUN hot removal is for not I_T nexus but I_T_L nexus and so we cannot start connection exiting in this case because connection can have multiple LUNs. So this fix requires few changes and will be practical. Fixes #715 Change-Id: I17d7a1f6c6557297289c3bd148a62db46da48ec5 Signed-off-by: Shuhei Matsumoto Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453959 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Changpeng Liu --- lib/scsi/lun.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/scsi/lun.c b/lib/scsi/lun.c index aa732b0b41..d64a4b5221 100644 --- a/lib/scsi/lun.c +++ b/lib/scsi/lun.c @@ -216,7 +216,6 @@ scsi_lun_remove(struct spdk_scsi_lun *lun) { spdk_bdev_close(lun->bdev_desc); - spdk_scsi_dev_delete_lun(lun->dev, lun); free(lun); } @@ -299,6 +298,8 @@ scsi_lun_hot_remove(void *remove_ctx) } lun->removed = true; + spdk_scsi_dev_delete_lun(lun->dev, lun); + if (lun->io_channel == NULL) { _scsi_lun_hot_remove(lun); return;