> -----Original Message----- > From: Mike Christie <michael.christie@xxxxxxxxxx> > Sent: Sunday, April 11, 2021 12:10 AM > To: lduncan@xxxxxxxx; martin.petersen@xxxxxxxxxx; Manish Rangankar > <mrangankar@xxxxxxxxxxx>; Santosh Vernekar <svernekar@xxxxxxxxxxx>; > linux-scsi@xxxxxxxxxxxxxxx; jejb@xxxxxxxxxxxxx > Cc: Mike Christie <michael.christie@xxxxxxxxxx> > Subject: [EXT] [PATCH 10/13] scsi: qedi: fix session block/unblock abuse during > cleanup > > External Email > > ---------------------------------------------------------------------- > 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 IO the host while it drains the > card. > > Signed-off-by: Mike Christie <michael.christie@xxxxxxxxxx> > --- > drivers/scsi/qedi/qedi.h | 1 + > drivers/scsi/qedi/qedi_iscsi.c | 17 +++++++++++++++-- > 2 files changed, 16 insertions(+), 2 deletions(-) > > diff --git a/drivers/scsi/qedi/qedi.h b/drivers/scsi/qedi/qedi.h index > c342defc3f52..ce199a7a16b8 100644 > --- a/drivers/scsi/qedi/qedi.h > +++ b/drivers/scsi/qedi/qedi.h > @@ -284,6 +284,7 @@ struct qedi_ctx { > #define QEDI_IN_RECOVERY 5 > #define QEDI_IN_OFFLINE 6 > #define QEDI_IN_SHUTDOWN 7 > +#define QEDI_BLOCK_IO 8 > > u8 mac[ETH_ALEN]; > u32 src_ip[4]; > diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c index > 821225f9beb0..536d6653ef8e 100644 > --- a/drivers/scsi/qedi/qedi_iscsi.c > +++ b/drivers/scsi/qedi/qedi_iscsi.c > @@ -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) { > - 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) { > - 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, @@ -789,6 +799,9 > @@ static int qedi_task_xmit(struct iscsi_task *task) > if (test_bit(QEDI_IN_SHUTDOWN, &qedi_conn->qedi->flags)) > return -ENODEV; > > + if (test_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags)) > + return -EACCES; > + > cmd->state = 0; > cmd->task = NULL; > cmd->use_slowpath = false; > -- > 2.25.1 Thanks, Reviewed-by: Manish Rangankar <mrangankar@xxxxxxxxxxx>