Commit 0c72191d authored by Mike Christie's avatar Mike Christie Committed by Martin K. Petersen

scsi: qedi: Fix cleanup session block/unblock use

Drivers shouldn't be calling block/unblock session for cmd cleanup because
the functions can change the session state from under libiscsi.  This adds
a new a driver level bit so it can block all I/O the host while it drains
the card.

Link: https://lore.kernel.org/r/20210525181821.7617-26-michael.christie@oracle.comReviewed-by: default avatarManish Rangankar <mrangankar@marvell.com>
Signed-off-by: default avatarMike Christie <michael.christie@oracle.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 2819b4ae
...@@ -284,6 +284,7 @@ struct qedi_ctx { ...@@ -284,6 +284,7 @@ struct qedi_ctx {
#define QEDI_IN_RECOVERY 5 #define QEDI_IN_RECOVERY 5
#define QEDI_IN_OFFLINE 6 #define QEDI_IN_OFFLINE 6
#define QEDI_IN_SHUTDOWN 7 #define QEDI_IN_SHUTDOWN 7
#define QEDI_BLOCK_IO 8
u8 mac[ETH_ALEN]; u8 mac[ETH_ALEN];
u32 src_ip[4]; u32 src_ip[4];
......
...@@ -330,12 +330,22 @@ qedi_conn_create(struct iscsi_cls_session *cls_session, uint32_t cid) ...@@ -330,12 +330,22 @@ qedi_conn_create(struct iscsi_cls_session *cls_session, uint32_t cid)
void qedi_mark_device_missing(struct iscsi_cls_session *cls_session) void qedi_mark_device_missing(struct iscsi_cls_session *cls_session)
{ {
iscsi_block_session(cls_session); struct iscsi_session *session = cls_session->dd_data;
struct qedi_conn *qedi_conn = session->leadconn->dd_data;
spin_lock_bh(&session->frwd_lock);
set_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags);
spin_unlock_bh(&session->frwd_lock);
} }
void qedi_mark_device_available(struct iscsi_cls_session *cls_session) void qedi_mark_device_available(struct iscsi_cls_session *cls_session)
{ {
iscsi_unblock_session(cls_session); struct iscsi_session *session = cls_session->dd_data;
struct qedi_conn *qedi_conn = session->leadconn->dd_data;
spin_lock_bh(&session->frwd_lock);
clear_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags);
spin_unlock_bh(&session->frwd_lock);
} }
static int qedi_bind_conn_to_iscsi_cid(struct qedi_ctx *qedi, static int qedi_bind_conn_to_iscsi_cid(struct qedi_ctx *qedi,
...@@ -800,6 +810,9 @@ static int qedi_task_xmit(struct iscsi_task *task) ...@@ -800,6 +810,9 @@ static int qedi_task_xmit(struct iscsi_task *task)
if (test_bit(QEDI_IN_SHUTDOWN, &qedi_conn->qedi->flags)) if (test_bit(QEDI_IN_SHUTDOWN, &qedi_conn->qedi->flags))
return -ENODEV; return -ENODEV;
if (test_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags))
return -EACCES;
cmd->state = 0; cmd->state = 0;
cmd->task = NULL; cmd->task = NULL;
cmd->use_slowpath = false; cmd->use_slowpath = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment