aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_transport_iscsi.c
diff options
context:
space:
mode:
authorMike Christie <michael.christie@oracle.com>2022-06-16 17:27:35 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2022-06-21 21:14:53 -0400
commitda2f132d00d93ba015286b5e8fdcd85cf0346339 (patch)
tree44e329157060c86e22d04cc597bcc45199ec9216 /drivers/scsi/scsi_transport_iscsi.c
parentscsi: iscsi: Allow iscsi_if_stop_conn() to be called from kernel (diff)
downloadlinux-dev-da2f132d00d93ba015286b5e8fdcd85cf0346339.tar.xz
linux-dev-da2f132d00d93ba015286b5e8fdcd85cf0346339.zip
scsi: iscsi: Clean up bound endpoints during shutdown
In the next patch we allow drivers to drive session removal during shutdown. In this case iscsid will not be running, so we need to detect bound endpoints and disconnect them. This moves the bound ep check so we now always check. Link: https://lore.kernel.org/r/20220616222738.5722-4-michael.christie@oracle.com Tested-by: Nilesh Javali <njavali@marvell.com> Reviewed-by: Nilesh Javali <njavali@marvell.com> Signed-off-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/scsi_transport_iscsi.c')
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 237830fb4d54..c9de0acdccee 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -2261,6 +2261,16 @@ static int iscsi_if_stop_conn(struct iscsi_cls_conn *conn, int flag)
{
ISCSI_DBG_TRANS_CONN(conn, "iscsi if conn stop.\n");
/*
+ * For offload, iscsid may not know about the ep like when iscsid is
+ * restarted or for kernel based session shutdown iscsid is not even
+ * up. For these cases, we do the disconnect now.
+ */
+ mutex_lock(&conn->ep_mutex);
+ if (conn->ep)
+ iscsi_if_disconnect_bound_ep(conn, conn->ep, true);
+ mutex_unlock(&conn->ep_mutex);
+
+ /*
* If this is a termination we have to call stop_conn with that flag
* so the correct states get set. If we haven't run the work yet try to
* avoid the extra run.
@@ -2270,16 +2280,6 @@ static int iscsi_if_stop_conn(struct iscsi_cls_conn *conn, int flag)
iscsi_stop_conn(conn, flag);
} else {
/*
- * For offload, when iscsid is restarted it won't know about
- * existing endpoints so it can't do a ep_disconnect. We clean
- * it up here for userspace.
- */
- mutex_lock(&conn->ep_mutex);
- if (conn->ep)
- iscsi_if_disconnect_bound_ep(conn, conn->ep, true);
- mutex_unlock(&conn->ep_mutex);
-
- /*
* Figure out if it was the kernel or userspace initiating this.
*/
spin_lock_irq(&conn->lock);