From: Hannes Reinecke <hare@suse.de>
To: Christoph Hellwig <hch@lst.de>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
James Bottomley <james.bottomley@hansenpartnership.com>,
linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>
Subject: [PATCH 10/17] scsi_transport_iscsi: use session as argument for iscsi_block_scsi_eh()
Date: Mon, 16 Oct 2023 11:24:23 +0200 [thread overview]
Message-ID: <20231016092430.55557-11-hare@suse.de> (raw)
In-Reply-To: <20231016092430.55557-1-hare@suse.de>
We should be passing in the session directly instead of deriving it
from the scsi command.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
drivers/scsi/qla4xxx/ql4_os.c | 34 ++++++++++++++++++-----------
drivers/scsi/scsi_transport_iscsi.c | 6 ++---
include/scsi/scsi_transport_iscsi.h | 2 +-
3 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 675332e49a7b..961fe65bbe65 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -9272,15 +9272,18 @@ static int qla4xxx_eh_abort(struct scsi_cmnd *cmd)
**/
static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd)
{
- struct scsi_qla_host *ha = to_qla_host(cmd->device->host);
- struct ddb_entry *ddb_entry = cmd->device->hostdata;
+ struct scsi_device *sdev = cmd->device;
+ struct scsi_qla_host *ha = to_qla_host(sdev->host);
+ struct iscsi_cls_session *session;
+ struct ddb_entry *ddb_entry = sdev->hostdata;
int ret = FAILED, stat;
int rval;
if (!ddb_entry)
return ret;
- ret = iscsi_block_scsi_eh(cmd);
+ session = starget_to_session(scsi_target(sdev));
+ ret = iscsi_block_scsi_eh(session);
if (ret)
return ret;
ret = FAILED;
@@ -9341,19 +9344,25 @@ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd)
**/
static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd)
{
- struct scsi_qla_host *ha = to_qla_host(cmd->device->host);
- struct ddb_entry *ddb_entry = cmd->device->hostdata;
+ struct scsi_target *starget = scsi_target(cmd->device);
+ struct iscsi_cls_session *cls_session = starget_to_session(starget);
+ struct iscsi_session *sess;
+ struct scsi_qla_host *ha;
+ struct ddb_entry *ddb_entry;
int stat, ret;
int rval;
+ sess = cls_session->dd_data;
+ ddb_entry = sess->dd_data;
if (!ddb_entry)
return FAILED;
+ ha = ddb_entry->ha;
- ret = iscsi_block_scsi_eh(cmd);
+ ret = iscsi_block_scsi_eh(cls_session);
if (ret)
return ret;
- starget_printk(KERN_INFO, scsi_target(cmd->device),
+ starget_printk(KERN_INFO, starget,
"WARM TARGET RESET ISSUED.\n");
DEBUG2(printk(KERN_INFO
@@ -9370,14 +9379,13 @@ static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd)
stat = qla4xxx_reset_target(ha, ddb_entry);
if (stat != QLA_SUCCESS) {
- starget_printk(KERN_INFO, scsi_target(cmd->device),
+ starget_printk(KERN_INFO, starget,
"WARM TARGET RESET FAILED.\n");
return FAILED;
}
- if (qla4xxx_eh_wait_for_commands(ha, scsi_target(cmd->device),
- NULL)) {
- starget_printk(KERN_INFO, scsi_target(cmd->device),
+ if (qla4xxx_eh_wait_for_commands(ha, starget, NULL)) {
+ starget_printk(KERN_INFO, starget,
"WARM TARGET DEVICE RESET FAILED - "
"waiting for commands.\n");
return FAILED;
@@ -9386,13 +9394,13 @@ static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd)
/* Send marker. */
if (qla4xxx_send_marker_iocb(ha, ddb_entry, cmd->device->lun,
MM_TGT_WARM_RESET) != QLA_SUCCESS) {
- starget_printk(KERN_INFO, scsi_target(cmd->device),
+ starget_printk(KERN_INFO, starget,
"WARM TARGET DEVICE RESET FAILED - "
"marker iocb failed.\n");
return FAILED;
}
- starget_printk(KERN_INFO, scsi_target(cmd->device),
+ starget_printk(KERN_INFO, starget,
"WARM TARGET RESET SUCCEEDED.\n");
return SUCCESS;
}
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 3075b2ddf7a6..4e81ef882a49 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -1838,17 +1838,15 @@ static void iscsi_scan_session(struct work_struct *work)
/**
* iscsi_block_scsi_eh - block scsi eh until session state has transistioned
- * @cmd: scsi cmd passed to scsi eh handler
+ * @session: iscsi session derived from scsi eh handler argument
*
* If the session is down this function will wait for the recovery
* timer to fire or for the session to be logged back in. If the
* recovery timer fires then FAST_IO_FAIL is returned. The caller
* should pass this error value to the scsi eh.
*/
-int iscsi_block_scsi_eh(struct scsi_cmnd *cmd)
+int iscsi_block_scsi_eh(struct iscsi_cls_session *session)
{
- struct iscsi_cls_session *session =
- starget_to_session(scsi_target(cmd->device));
unsigned long flags;
int ret = 0;
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index fb3399e4cd29..8ec36de5d236 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -466,7 +466,7 @@ extern struct iscsi_endpoint *iscsi_create_endpoint(int dd_size);
extern void iscsi_destroy_endpoint(struct iscsi_endpoint *ep);
extern struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle);
extern void iscsi_put_endpoint(struct iscsi_endpoint *ep);
-extern int iscsi_block_scsi_eh(struct scsi_cmnd *cmd);
+extern int iscsi_block_scsi_eh(struct iscsi_cls_session *session);
extern struct iscsi_iface *iscsi_create_iface(struct Scsi_Host *shost,
struct iscsi_transport *t,
uint32_t iface_type,
--
2.35.3
next prev parent reply other threads:[~2023-10-16 9:25 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-16 9:24 [PATCHv6 00/17] scsi: EH rework prep patches, part 2 Hannes Reinecke
2023-10-16 9:24 ` [PATCH 01/17] pmcraid: add missing scsi_device_put() in pmcraid_eh_target_reset_handler() Hannes Reinecke
2023-10-16 13:29 ` Christoph Hellwig
2023-10-16 13:37 ` Hannes Reinecke
2023-10-16 9:24 ` [PATCH 02/17] zfcp: do not wait for rports to become unblocked after host reset Hannes Reinecke
2023-10-16 9:24 ` [PATCH 03/17] bfa: Do not use scsi command to signal TMF status Hannes Reinecke
2023-10-16 13:35 ` Christoph Hellwig
2023-10-16 9:24 ` [PATCH 04/17] aha152x: look for stuck command when resetting device Hannes Reinecke
2023-10-16 13:35 ` Christoph Hellwig
2023-10-16 9:24 ` [PATCH 05/17] a1000u2w: do not rely on the command for inia100_device_reset() Hannes Reinecke
2023-10-16 13:36 ` Christoph Hellwig
2023-10-16 9:24 ` [PATCH 06/17] fas216: Rework device reset to not rely on SCSI command pointer Hannes Reinecke
2023-10-16 9:24 ` [PATCH 07/17] xen-scsifront: add scsi device as argument to scsifront_do_request() Hannes Reinecke
2023-10-16 9:24 ` [PATCH 08/17] xen-scsifront: rework scsifront_action_handler() Hannes Reinecke
2023-10-16 13:36 ` Christoph Hellwig
2023-10-16 9:24 ` [PATCH 09/17] libiscsi: use cls_session as argument for target and session reset Hannes Reinecke
2023-10-19 20:02 ` Mike Christie
2023-10-20 5:53 ` Hannes Reinecke
2023-10-20 16:55 ` michael.christie
2023-10-16 9:24 ` Hannes Reinecke [this message]
2023-10-16 9:24 ` [PATCH 11/17] snic: reserve tag for TMF Hannes Reinecke
2023-10-16 13:37 ` Christoph Hellwig
2023-10-16 9:24 ` [PATCH 12/17] snic: allocate device reset command Hannes Reinecke
2023-10-16 13:38 ` Christoph Hellwig
2023-10-16 14:58 ` Hannes Reinecke
2023-10-16 9:24 ` [PATCH 13/17] snic: Use scsi_host_busy_iter() to traverse commands Hannes Reinecke
2023-10-16 9:24 ` [PATCH 14/17] fnic: allocate device reset command on the fly Hannes Reinecke
2023-10-17 6:37 ` Christoph Hellwig
2023-10-16 9:24 ` [PATCH 15/17] fnic: use fc_block_rport() correctly Hannes Reinecke
2023-10-16 9:24 ` [PATCH 16/17] csiostor: use separate TMF command Hannes Reinecke
2023-10-17 6:37 ` Christoph Hellwig
2023-10-16 9:24 ` [PATCH 17/17] dc395x: Remove 'scmd' parameter from doing_srb_done() Hannes Reinecke
2023-10-17 6:38 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231016092430.55557-11-hare@suse.de \
--to=hare@suse.de \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox