From: Lee Duncan <lduncan@suse.com>
Date: Sat 28 May 2022 09:44:39 AM PDT
Subject: [PATCH] kABI: fix change of iscsi_host_remove() arguments
Patch-mainline: Never, kABI fix
References: bsc#1198410
Patch 0007-scsi-iscsi-Fix-session-removal-on-shutdown.patch
modified iscsi_host_remove() by adding another argument. To make
the kABI happy (and to be safe), leave the existing function
and create a new one that has the new argument.
[lduncan: hand applied one hunk from iscsi_tcp.c]
---
drivers/infiniband/ulp/iser/iscsi_iser.c | 4 ++--
drivers/scsi/be2iscsi/be_main.c | 2 +-
drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +-
drivers/scsi/cxgbi/libcxgbi.c | 2 +-
drivers/scsi/iscsi_tcp.c | 4 ++--
drivers/scsi/libiscsi.c | 19 +++++++++++++++++--
drivers/scsi/qedi/qedi_main.c | 6 +++---
include/scsi/libiscsi.h | 8 +++++++-
8 files changed, 34 insertions(+), 13 deletions(-)
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -584,7 +584,7 @@ iscsi_iser_session_destroy(struct iscsi_
struct Scsi_Host *shost = iscsi_session_to_shost(cls_session);
iscsi_session_teardown(cls_session);
- iscsi_host_remove(shost, false);
+ iscsi_host_remove_new(shost, false);
iscsi_host_free(shost);
}
@@ -702,7 +702,7 @@ iscsi_iser_session_create(struct iscsi_e
return cls_session;
remove_host:
- iscsi_host_remove(shost, false);
+ iscsi_host_remove_new(shost, false);
free_host:
iscsi_host_free(shost);
return NULL;
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -5741,7 +5741,7 @@ static void beiscsi_remove(struct pci_de
cancel_work_sync(&phba->sess_work);
beiscsi_iface_destroy_default(phba);
- iscsi_host_remove(phba->shost, false);
+ iscsi_host_remove_new(phba->shost, false);
beiscsi_disable_port(phba, 1);
/* after cancelling boot_work */
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -909,7 +909,7 @@ void bnx2i_free_hba(struct bnx2i_hba *hb
{
struct Scsi_Host *shost = hba->shost;
- iscsi_host_remove(shost, false);
+ iscsi_host_remove_new(shost, false);
INIT_LIST_HEAD(&hba->ep_ofld_list);
INIT_LIST_HEAD(&hba->ep_active_list);
INIT_LIST_HEAD(&hba->ep_destroy_list);
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -328,7 +328,7 @@ void cxgbi_hbas_remove(struct cxgbi_devi
chba = cdev->hbas[i];
if (chba) {
cdev->hbas[i] = NULL;
- iscsi_host_remove(chba->shost, false);
+ iscsi_host_remove_new(chba->shost, false);
pci_dev_put(cdev->pdev);
iscsi_host_free(chba->shost);
}
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -970,7 +970,7 @@ iscsi_sw_tcp_session_create(struct iscsi
remove_session:
iscsi_session_teardown(cls_session);
remove_host:
- iscsi_host_remove(shost, false);
+ iscsi_host_remove_new(shost, false);
free_host:
iscsi_host_free(shost);
return NULL;
@@ -990,7 +990,7 @@ static void iscsi_sw_tcp_session_destroy
* host from sysfs before freeing the session to make sure userspace
* is no longer accessing the callout.
*/
- iscsi_host_remove(shost, false);
+ iscsi_host_remove_new(shost, false);
iscsi_tcp_r2tpool_free(cls_session->dd_data);
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -2853,14 +2853,14 @@ static void iscsi_notify_host_removed(st
}
/**
- * iscsi_host_remove - remove host and sessions
+ * iscsi_host_remove_new - remove host and sessions
* @shost: scsi host
* @is_shutdown: true if called from a driver shutdown callout
*
* If there are any sessions left, this will initiate the removal and wait
* for the completion.
*/
-void iscsi_host_remove(struct Scsi_Host *shost, bool is_shutdown)
+void iscsi_host_remove_new(struct Scsi_Host *shost, bool is_shutdown)
{
struct iscsi_host *ihost = shost_priv(shost);
unsigned long flags;
@@ -2881,6 +2881,21 @@ void iscsi_host_remove(struct Scsi_Host
scsi_remove_host(shost);
}
+EXPORT_SYMBOL_GPL(iscsi_host_remove_new);
+
+/**
+ * iscsi_host_remove - remove host and sessions
+ * @shost: scsi host
+ *
+ * If there are any sessions left, this will initiate the removal and wait
+ * for the completion.
+ *
+ * keep this older version around, for kABI compatability
+ */
+void iscsi_host_remove(struct Scsi_Host *shost)
+{
+ iscsi_host_remove_new(shost, false);
+}
EXPORT_SYMBOL_GPL(iscsi_host_remove);
void iscsi_host_free(struct Scsi_Host *shost)
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -2419,9 +2419,9 @@ static void __qedi_remove(struct pci_dev
u16 retry = 10;
if (mode == QEDI_MODE_NORMAL)
- iscsi_host_remove(qedi->shost, false);
+ iscsi_host_remove_new(qedi->shost, false);
else if (mode == QEDI_MODE_SHUTDOWN)
- iscsi_host_remove(qedi->shost, true);
+ iscsi_host_remove_new(qedi->shost, true);
if (mode == QEDI_MODE_NORMAL || mode == QEDI_MODE_SHUTDOWN) {
if (qedi->tmf_thread) {
@@ -2800,7 +2800,7 @@ remove_host:
#ifdef CONFIG_DEBUG_FS
qedi_dbg_host_exit(&qedi->dbg_ctx);
#endif
- iscsi_host_remove(qedi->shost, false);
+ iscsi_host_remove_new(qedi->shost, false);
stop_iscsi_func:
qedi_ops->stop(qedi->cdev);
stop_slowpath:
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -409,7 +409,13 @@ extern int iscsi_host_add(struct Scsi_Ho
extern struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht,
int dd_data_size,
bool xmit_can_sleep);
-extern void iscsi_host_remove(struct Scsi_Host *shost, bool is_shutdown);
+
+/*
+ * these two go together, for kABI compatability
+ */
+extern void iscsi_host_remove_new(struct Scsi_Host *shost, bool is_shutdown);
+extern void iscsi_host_remove(struct Scsi_Host *shost);
+
extern void iscsi_host_free(struct Scsi_Host *shost);
extern int iscsi_target_alloc(struct scsi_target *starget);
extern int iscsi_host_get_max_scsi_cmds(struct Scsi_Host *shost,