Commit 31500e90 authored by Mike Christie's avatar Mike Christie Committed by Martin K. Petersen
Browse files

scsi: iscsi: Fix session removal on shutdown

When the system is shutting down, iscsid is not running so we will not get
a response to the ISCSI_ERR_INVALID_HOST error event. The system shutdown
will then hang waiting on userspace to remove the session.

This has libiscsi force the destruction of the session from the kernel when
iscsi_host_remove() is called from a driver's shutdown callout.

This fixes a regression added in qedi boot with commit d1f2ce77 ("scsi:
qedi: Fix host removal with running sessions") which made qedi use the
common session removal function that waits on userspace instead of rolling
its own kernel based removal.

Link: https://lore.kernel.org/r/20220616222738.5722-7-michael.christie@oracle.com


Fixes: d1f2ce77 ("scsi: qedi: Fix host removal with running sessions")
Tested-by: default avatarNilesh Javali <njavali@marvell.com>
Reviewed-by: default avatarLee Duncan <lduncan@suse.com>
Reviewed-by: default avatarNilesh Javali <njavali@marvell.com>
Signed-off-by: default avatarMike Christie <michael.christie@oracle.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 7bf01eb0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -568,7 +568,7 @@ static void iscsi_iser_session_destroy(struct iscsi_cls_session *cls_session)
	struct Scsi_Host *shost = iscsi_session_to_shost(cls_session);

	iscsi_session_teardown(cls_session);
	iscsi_host_remove(shost);
	iscsi_host_remove(shost, false);
	iscsi_host_free(shost);
}

@@ -685,7 +685,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
	return cls_session;

remove_host:
	iscsi_host_remove(shost);
	iscsi_host_remove(shost, false);
free_host:
	iscsi_host_free(shost);
	return NULL;
+1 −1
Original line number Diff line number Diff line
@@ -5745,7 +5745,7 @@ static void beiscsi_remove(struct pci_dev *pcidev)
	cancel_work_sync(&phba->sess_work);

	beiscsi_iface_destroy_default(phba);
	iscsi_host_remove(phba->shost);
	iscsi_host_remove(phba->shost, false);
	beiscsi_disable_port(phba, 1);

	/* after cancelling boot_work */
+1 −1
Original line number Diff line number Diff line
@@ -909,7 +909,7 @@ void bnx2i_free_hba(struct bnx2i_hba *hba)
{
	struct Scsi_Host *shost = hba->shost;

	iscsi_host_remove(shost);
	iscsi_host_remove(shost, false);
	INIT_LIST_HEAD(&hba->ep_ofld_list);
	INIT_LIST_HEAD(&hba->ep_active_list);
	INIT_LIST_HEAD(&hba->ep_destroy_list);
+1 −1
Original line number Diff line number Diff line
@@ -328,7 +328,7 @@ void cxgbi_hbas_remove(struct cxgbi_device *cdev)
		chba = cdev->hbas[i];
		if (chba) {
			cdev->hbas[i] = NULL;
			iscsi_host_remove(chba->shost);
			iscsi_host_remove(chba->shost, false);
			pci_dev_put(cdev->pdev);
			iscsi_host_free(chba->shost);
		}
+2 −2
Original line number Diff line number Diff line
@@ -898,7 +898,7 @@ iscsi_sw_tcp_session_create(struct iscsi_endpoint *ep, uint16_t cmds_max,
remove_session:
	iscsi_session_teardown(cls_session);
remove_host:
	iscsi_host_remove(shost);
	iscsi_host_remove(shost, false);
free_host:
	iscsi_host_free(shost);
	return NULL;
@@ -915,7 +915,7 @@ static void iscsi_sw_tcp_session_destroy(struct iscsi_cls_session *cls_session)
	iscsi_tcp_r2tpool_free(cls_session->dd_data);
	iscsi_session_teardown(cls_session);

	iscsi_host_remove(shost);
	iscsi_host_remove(shost, false);
	iscsi_host_free(shost);
}

Loading