Commit db91cfe0 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

lib/scsi: Stop submitting new task and abort pending tasks for LUN hotplug



Previously iSCSI LUN hotplug had critical bugs and we had no choice but
accept submitting new tasks as late as possible. We fixed the bug now and
we can stop submitting new task immediately after starting LUN removal
process.

By this change, no task is submitted to the LUN and previously queued
tasks have no chance to be kicked. Hence we execute them instead after
stopping new task submission.

This change simplifies LUN hotplug process and reproduce LUN hotplug
issues solidly if we don't have the fix.

Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9a33e6a217978b0863d15aaff3d35880dbdccfd4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/473596


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 74ab9f90
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -411,11 +411,19 @@ spdk_scsi_dev_get_id(const struct spdk_scsi_dev *dev)
struct spdk_scsi_lun *
spdk_scsi_dev_get_lun(struct spdk_scsi_dev *dev, int lun_id)
{
	struct spdk_scsi_lun *lun;

	if (lun_id < 0 || lun_id >= SPDK_SCSI_DEV_MAX_LUN) {
		return NULL;
	}

	return dev->lun[lun_id];
	lun = dev->lun[lun_id];

	if (lun != NULL && !spdk_scsi_lun_is_removing(lun)) {
		return lun;
	} else {
		return NULL;
	}
}

bool
+8 −0
Original line number Diff line number Diff line
@@ -326,6 +326,14 @@ _scsi_lun_hot_remove(void *arg1)
{
	struct spdk_scsi_lun *lun = arg1;

	/* If lun->removed is set, no new task can be submitted to the LUN.
	 * Execute previously queued tasks, which will be immediately aborted.
	 */
	scsi_lun_execute_tasks(lun);

	/* Then we only need to wait for all outstanding tasks to be completed
	 * before notifying the upper layer about the removal.
	 */
	if (scsi_lun_has_pending_tasks(lun) ||
	    scsi_lun_has_pending_mgmt_tasks(lun)) {
		lun->hotremove_poller = spdk_poller_register(scsi_lun_check_pending_tasks,