Skip to contentSkip to conversation

Use 'Scsi_Host' as argument for host reset

PATCH In review Hannes Reinecke 5 participants 23 messages Jun 27, 2014 – Sep 8, 2014

Subsystems (37)
Documentation SCSI USB PowerPC +33 more subsystems
lore
Share & tools
lore

Hannes Reinecke

author maintainer
#0 lore raw

cover Use 'Scsi_Host' as argument for host reset

eh_host_reset_handler can only depend on the Scsi_Host, so we should make that explicit by using 'struct Scsi_Host' as argument for it.

This uncovered issues with some FC HBAs; calling 'fc_block_scsi_eh' _before_ host reset is not only pointless (the host reset will reset the rport state anyway), but downright wrong as the rport might have been vanished altogether, and indeed be the cause for the host reset in the first place.

Hannes Reinecke (7):
scsi: fix comment in scsi_device_set_state()
mptfc: Do not call fc_block_scsi_eh() on host reset
ibmvfc: Do not call fc_block_scsi_eh() on host reset
libfc: Do not call fc_block_scsi_eh() on host reset
scsi_transport_fc: Use fc_rport as argument for fc_block_scsi_eh
scsi: Use Scsi_Host as argument for eh_host_reset_handler
scsi_error: do not use command list for host reset

 Documentation/scsi/scsi_eh.txt            |  2 +-
 Documentation/scsi/scsi_mid_low_api.txt   |  4 +--
 arch/ia64/hp/sim/simscsi.c                |  2 +-
 drivers/infiniband/ulp/srp/ib_srp.c       |  4 +--
 drivers/message/fusion/mptfc.c            | 10 +------
 drivers/message/fusion/mptscsih.c         | 18 ++++++------
 drivers/message/fusion/mptscsih.h         |  2 +-
 drivers/s390/scsi/zfcp_scsi.c             | 12 +++++---
 drivers/scsi/3w-9xxx.c                    | 11 ++++----
 drivers/scsi/3w-sas.c                     | 11 ++++----
 drivers/scsi/3w-xxxx.c                    | 11 ++++----
 drivers/scsi/53c700.c                     | 15 +++++-----
 drivers/scsi/BusLogic.c                   | 13 +++------
 drivers/scsi/NCR53c406a.c                 |  6 ++--
 drivers/scsi/aacraid/linit.c              | 14 ++++-----
 drivers/scsi/aha152x.c                    | 11 +-------
 drivers/scsi/aha152x.h                    |  2 +-
 drivers/scsi/aha1542.c                    | 22 +++++++--------
 drivers/scsi/arm/fas216.c                 |  8 +++---
 drivers/scsi/arm/fas216.h                 |  2 +-
 drivers/scsi/bnx2fc/bnx2fc_io.c           |  4 +--
 drivers/scsi/csiostor/csio_scsi.c         |  4 +--
 drivers/scsi/dpt_i2o.c                    | 14 ++++-----
 drivers/scsi/dpti.h                       |  2 +-
 drivers/scsi/eata.c                       | 19 +++----------
 drivers/scsi/eata_pio.c                   | 29 +++++++++----------
 drivers/scsi/esas2r/esas2r.h              |  2 +-
 drivers/scsi/esas2r/esas2r_main.c         | 16 ++++++-----
 drivers/scsi/esp_scsi.c                   |  4 +--
 drivers/scsi/fnic/fnic.h                  |  2 +-
 drivers/scsi/fnic/fnic_scsi.c             | 21 ++++++++------
 drivers/scsi/ibmvscsi/ibmvfc.c            | 17 ++++++-----
 drivers/scsi/ibmvscsi/ibmvscsi.c          |  4 +--
 drivers/scsi/imm.c                        |  7 ++---
 drivers/scsi/ipr.c                        |  4 +--
 drivers/scsi/ips.c                        | 40 ++++++--------------------
 drivers/scsi/libfc/fc_fcp.c               | 12 ++++----
 drivers/scsi/lpfc/lpfc_scsi.c             | 15 ++++++----
 drivers/scsi/mac53c94.c                   |  8 +++---
 drivers/scsi/megaraid.c                   | 16 +++++------
 drivers/scsi/megaraid.h                   |  2 +-
 drivers/scsi/megaraid/megaraid_mbox.c     | 16 +++--------
 drivers/scsi/megaraid/megaraid_sas_base.c | 32 +++++----------------
 drivers/scsi/mesh.c                       | 10 +++----
 drivers/scsi/mpt2sas/mpt2sas_scsih.c      | 13 ++++-----
 drivers/scsi/mpt3sas/mpt3sas_scsih.c      | 13 ++++-----
 drivers/scsi/mvumi.c                      |  7 ++---
 drivers/scsi/nsp32.c                      | 14 ++++-----
 drivers/scsi/pcmcia/aha152x_stub.c        |  2 +-
 drivers/scsi/pcmcia/nsp_cs.c              |  4 +--
 drivers/scsi/pcmcia/sym53c500_cs.c        |  8 +++---
 drivers/scsi/pmcraid.c                    |  4 +--
 drivers/scsi/ppa.c                        |  7 ++---
 drivers/scsi/qla1280.c                    | 23 ++++++++++++---
 drivers/scsi/qla2xxx/qla_os.c             | 38 ++++++++++++-------------
 drivers/scsi/qla4xxx/ql4_os.c             | 16 +++++------
 drivers/scsi/scsi_debug.c                 |  2 +-
 drivers/scsi/scsi_error.c                 | 42 ++++++++++-----------------
 drivers/scsi/scsi_lib.c                   |  2 +-
 drivers/scsi/scsi_transport_fc.c          |  7 ++---
 drivers/scsi/sgiwd93.c                    | 15 ----------
 drivers/scsi/stex.c                       |  5 ++--
 drivers/scsi/storvsc_drv.c                |  4 +--
 drivers/scsi/sym53c416.c                  |  6 ++--
 drivers/scsi/sym53c8xx_2/sym_glue.c       | 47 +++++++++++++++++++++----------
 drivers/scsi/u14-34f.c                    | 17 ++++-------
 drivers/scsi/ultrastor.c                  |  7 ++---
 drivers/scsi/vmw_pvscsi.c                 |  5 ++--
 drivers/scsi/wd33c93.c                    |  7 ++---
 drivers/scsi/wd33c93.h                    |  2 +-
 drivers/scsi/wd7000.c                     | 10 +++----
 drivers/usb/image/microtek.c              |  4 +--
 include/scsi/libfc.h                      |  2 +-
 include/scsi/scsi_host.h                  |  2 +-
 include/scsi/scsi_transport_fc.h          |  2 +-
 75 files changed, 361 insertions(+), 456 deletions(-)
Signature · 1 line
1.7.12.4
author maintainer
#1 lore raw

PATCH 1/7 scsi: fix comment in scsi_device_set_state()

The function returns '0' if successful; with the original comment the function doesn't have a way to indicate success ...

---
 drivers/scsi/scsi_lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_lib.c +1 -1
index d5d22e4..a9d4f65 100644
@@ -2029,7 +2029,7 @@ EXPORT_SYMBOL(scsi_test_unit_ready);
  *	@sdev:	scsi device to change the state of.
  *	@state:	state to change to.
  *
- *	Returns zero if unsuccessful or an error if the requested 
+ *	Returns zero if successful or an error if the requested
  *	transition is illegal.
  */
 int
Signature · 1 line
1.7.12.4
author maintainer
#2 lore raw

PATCH 2/7 mptfc: Do not call fc_block_scsi_eh() on host reset

In reply to Hannes Reinecke

When we're resetting the host any remote port states will be reset anyway, so it's pointless to wait for dev_loss_tmo during host reset.

---
 drivers/message/fusion/mptfc.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/message/fusion/mptfc.c +1 -9
index bf2a2ce..b84dc26 100644
@@ -104,7 +104,6 @@ static void mptfc_remove(struct pci_dev *pdev);
 static int mptfc_abort(struct scsi_cmnd *SCpnt);
 static int mptfc_dev_reset(struct scsi_cmnd *SCpnt);
 static int mptfc_bus_reset(struct scsi_cmnd *SCpnt);
-static int mptfc_host_reset(struct scsi_cmnd *SCpnt);
 
 static struct scsi_host_template mptfc_driver_template = {
 	.module				= THIS_MODULE,
@@ -122,7 +121,7 @@ static struct scsi_host_template mptfc_driver_template = {
 	.eh_abort_handler		= mptfc_abort,
 	.eh_device_reset_handler	= mptfc_dev_reset,
 	.eh_bus_reset_handler		= mptfc_bus_reset,
-	.eh_host_reset_handler		= mptfc_host_reset,
+	.eh_host_reset_handler		= mptscsih_host_reset,
 	.bios_param			= mptscsih_bios_param,
 	.can_queue			= MPT_FC_CAN_QUEUE,
 	.this_id			= -1,
@@ -253,13 +252,6 @@ mptfc_bus_reset(struct scsi_cmnd *SCpnt)
 	    mptfc_block_error_handler(SCpnt, mptscsih_bus_reset, __func__);
 }
 
-static int
-mptfc_host_reset(struct scsi_cmnd *SCpnt)
-{
-	return
-	    mptfc_block_error_handler(SCpnt, mptscsih_host_reset, __func__);
-}
-
 static void
 mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout)
 {
Signature · 1 line
1.7.12.4
author maintainer
#3 lore raw

PATCH 3/7 ibmvfc: Do not call fc_block_scsi_eh() on host reset

In reply to Hannes Reinecke

When we're resetting the host any remote port states will be reset anyway, so it's pointless to wait for dev_loss_tmo during host reset.

---
 drivers/scsi/ibmvscsi/ibmvfc.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/scsi/ibmvscsi/ibmvfc.c +0 -4
index 6eb47b6..e258594 100644
@@ -2530,13 +2530,9 @@ static int ibmvfc_eh_host_reset_handler(struct scsi_cmnd *cmd)
 	int rc, block_rc;
 	struct ibmvfc_host *vhost = shost_priv(cmd->device->host);
 
-	block_rc = fc_block_scsi_eh(cmd);
 	dev_err(vhost->dev, "Resetting connection due to error recovery\n");
 	rc = ibmvfc_issue_fc_host_lip(vhost->host);
 
-	if (block_rc == FAST_IO_FAIL)
-		return FAST_IO_FAIL;
-
 	return rc ? FAILED : SUCCESS;
 }
 
Signature · 1 line
1.7.12.4
author maintainer
#4 lore raw

PATCH 4/7 libfc: Do not call fc_block_scsi_eh() on host reset

In reply to Hannes Reinecke

When we're resetting the host any remote port states will be reset anyway, so it's pointless to wait for dev_loss_tmo during host reset.

---
 drivers/scsi/libfc/fc_fcp.c | 2 --
 1 file changed, 2 deletions(-)
drivers/scsi/libfc/fc_fcp.c +0 -2
index 1d7e76e..89749d8 100644
@@ -2125,8 +2125,6 @@ int fc_eh_host_reset(struct scsi_cmnd *sc_cmd)
 
 	FC_SCSI_DBG(lport, "Resetting host\n");
 
-	fc_block_scsi_eh(sc_cmd);
-
 	lport->tt.lport_reset(lport);
 	wait_tmo = jiffies + FC_HOST_RESET_TIMEOUT;
 	while (!fc_fcp_lport_queue_ready(lport) && time_before(jiffies,
Signature · 1 line
1.7.12.4
author maintainer
#5 lore raw

PATCH 5/7 scsi_transport_fc: Use fc_rport as argument for fc_block_scsi_eh

In reply to Hannes Reinecke

fc_block_scsi_eh() works on a remote port, so we should be using that as an argument and not the scsi command.

---
 drivers/s390/scsi/zfcp_scsi.c     |  9 ++++++---
 drivers/scsi/bnx2fc/bnx2fc_io.c   |  4 ++--
 drivers/scsi/csiostor/csio_scsi.c |  4 ++--
 drivers/scsi/fnic/fnic_scsi.c     | 18 ++++++++++++------
 drivers/scsi/ibmvscsi/ibmvfc.c    |  9 ++++++---
 drivers/scsi/libfc/fc_fcp.c       |  5 +++--
 drivers/scsi/lpfc/lpfc_scsi.c     | 12 ++++++++----
 drivers/scsi/qla2xxx/qla_os.c     | 21 +++++++++++++--------
 drivers/scsi/scsi_transport_fc.c  |  7 +++----
 include/scsi/scsi_transport_fc.h  |  2 +-
 10 files changed, 56 insertions(+), 35 deletions(-)
drivers/s390/scsi/zfcp_scsi.c +6 -3
index 7b35364..dc42c93 100644
@@ -173,6 +173,7 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
 	struct zfcp_adapter *adapter =
 		(struct zfcp_adapter *) scsi_host->hostdata[0];
 	struct zfcp_fsf_req *old_req, *abrt_req;
+	struct fc_rport *rport = starget_to_rport(scsi_target(scpnt->device));
 	unsigned long flags;
 	unsigned long old_reqid = (unsigned long) scpnt->host_scribble;
 	int retval = SUCCESS, ret;
@@ -199,7 +200,7 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
 			break;
 
 		zfcp_erp_wait(adapter);
-		ret = fc_block_scsi_eh(scpnt);
+		ret = fc_block_scsi_eh(rport);
 		if (ret) {
 			zfcp_dbf_scsi_abort("abrt_bl", scpnt, NULL);
 			return ret;
@@ -234,6 +235,7 @@ static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags)
 {
 	struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);
 	struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;
+	struct fc_port *rport = zfcp_sdev->port->rport;
 	struct zfcp_fsf_req *fsf_req = NULL;
 	int retval = SUCCESS, ret;
 	int retry = 3;
@@ -244,7 +246,7 @@ static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags)
 			break;
 
 		zfcp_erp_wait(adapter);
-		ret = fc_block_scsi_eh(scpnt);
+		ret = fc_block_scsi_eh(rport);
 		if (ret)
 			return ret;
 
@@ -283,11 +285,12 @@ static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
 {
 	struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);
 	struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;
+	struct fc_rport *rport = zfcp_sdev->port->rport;
 	int ret;
 
 	zfcp_erp_adapter_reopen(adapter, 0, "schrh_1");
 	zfcp_erp_wait(adapter);
-	ret = fc_block_scsi_eh(scpnt);
+	ret = fc_block_scsi_eh(rport);
 	if (ret)
 		return ret;
 
drivers/scsi/bnx2fc/bnx2fc_io.c +2 -2
index 32a5e0a..4833c50 100644
@@ -716,7 +716,7 @@ static int bnx2fc_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags)
 	}
 	rp = rport->dd_data;
 
-	rc = fc_block_scsi_eh(sc_cmd);
+	rc = fc_block_scsi_eh(rport);
 	if (rc)
 		return rc;
 
@@ -1165,7 +1165,7 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
 	int rc = FAILED;
 
 
-	rc = fc_block_scsi_eh(sc_cmd);
+	rc = fc_block_scsi_eh(rport);
 	if (rc)
 		return rc;
 
drivers/scsi/csiostor/csio_scsi.c +2 -2
index 86103c8..fe7046d 100644
@@ -1944,7 +1944,7 @@ csio_eh_abort_handler(struct scsi_cmnd *cmnd)
 	int rv;
 	struct csio_rnode *rn = (struct csio_rnode *)(cmnd->device->hostdata);
 
-	ret = fc_block_scsi_eh(cmnd);
+	ret = fc_block_scsi_eh(rn->rport);
 	if (ret)
 		return ret;
 
@@ -2112,7 +2112,7 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd)
 	}
 
 	/* Lnode is ready, now wait on rport node readiness */
-	ret = fc_block_scsi_eh(cmnd);
+	ret = fc_block_scsi_eh(rn->rport);
 	if (ret)
 		return ret;
 
drivers/scsi/fnic/fnic_scsi.c +12 -6
index 3f88f56..1fa1a87 100644
@@ -1728,7 +1728,7 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)
 	spinlock_t *io_lock;
 	unsigned long flags;
 	unsigned long start_time = 0;
-	int ret = SUCCESS;
+	int ret;
 	u32 task_req = 0;
 	struct scsi_lun fc_lun;
 	struct fnic_stats *fnic_stats;
@@ -1739,8 +1739,12 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)
 	DECLARE_COMPLETION_ONSTACK(tm_done);
 
 	/* Wait for rport to unblock */
-	fc_block_scsi_eh(sc);
+	rport = starget_to_rport(scsi_target(sc->device));
+	ret = fc_block_scsi_eh(rport);
+	if (ret)
+		return ret;
 
+	ret = SUCCESS;
 	/* Get local-port, check ready and link up */
 	lp = shost_priv(sc->device->host);
 
@@ -1749,7 +1753,6 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)
 	abts_stats = &fnic->fnic_stats.abts_stats;
 	term_stats = &fnic->fnic_stats.term_stats;
 
-	rport = starget_to_rport(scsi_target(sc->device));
 	tag = sc->request->tag;
 	FNIC_SCSI_DBG(KERN_DEBUG,
 		fnic->lport->host,
@@ -2182,7 +2185,7 @@ int fnic_device_reset(struct scsi_cmnd *sc)
 	struct fnic_io_req *io_req = NULL;
 	struct fc_rport *rport;
 	int status;
-	int ret = FAILED;
+	int ret;
 	spinlock_t *io_lock;
 	unsigned long flags;
 	unsigned long start_time = 0;
@@ -2194,8 +2197,12 @@ int fnic_device_reset(struct scsi_cmnd *sc)
 	int tag_gen_flag = 0;   /*to track tags allocated by fnic driver*/
 
 	/* Wait for rport to unblock */
-	fc_block_scsi_eh(sc);
+	rport = starget_to_rport(scsi_target(sc->device));
+	ret = fc_block_scsi_eh(rport);
+	if (ret)
+		return ret;
 
+	ret = FAILED;
 	/* Get local-port, check ready and link up */
 	lp = shost_priv(sc->device->host);
 
@@ -2205,7 +2212,6 @@ int fnic_device_reset(struct scsi_cmnd *sc)
 
 	atomic64_inc(&reset_stats->device_resets);
 
-	rport = starget_to_rport(scsi_target(sc->device));
 	FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
 		      "Device reset called FCID 0x%x, LUN 0x%llx sc 0x%p\n",
 		      rport->port_id, sc->device->lun, sc);
drivers/scsi/ibmvscsi/ibmvfc.c +6 -3
index e258594..fee80fa 100644
@@ -2405,11 +2405,12 @@ static int ibmvfc_eh_abort_handler(struct scsi_cmnd *cmd)
 {
 	struct scsi_device *sdev = cmd->device;
 	struct ibmvfc_host *vhost = shost_priv(sdev->host);
+	struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
 	int cancel_rc, block_rc;
 	int rc = FAILED;
 
 	ENTER;
-	block_rc = fc_block_scsi_eh(cmd);
+	block_rc = fc_block_scsi_eh(rport);
 	ibmvfc_wait_while_resetting(vhost);
 	if (block_rc != FAST_IO_FAIL) {
 		cancel_rc = ibmvfc_cancel_all(sdev, IBMVFC_TMF_ABORT_TASK_SET);
@@ -2438,11 +2439,12 @@ static int ibmvfc_eh_device_reset_handler(struct scsi_cmnd *cmd)
 {
 	struct scsi_device *sdev = cmd->device;
 	struct ibmvfc_host *vhost = shost_priv(sdev->host);
+	struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
 	int cancel_rc, block_rc, reset_rc = 0;
 	int rc = FAILED;
 
 	ENTER;
-	block_rc = fc_block_scsi_eh(cmd);
+	block_rc = fc_block_scsi_eh(rport);
 	ibmvfc_wait_while_resetting(vhost);
 	if (block_rc != FAST_IO_FAIL) {
 		cancel_rc = ibmvfc_cancel_all(sdev, IBMVFC_TMF_LUN_RESET);
@@ -2496,13 +2498,14 @@ static int ibmvfc_eh_target_reset_handler(struct scsi_cmnd *cmd)
 	struct scsi_device *sdev = cmd->device;
 	struct ibmvfc_host *vhost = shost_priv(sdev->host);
 	struct scsi_target *starget = scsi_target(sdev);
+	struct fc_rport *rport = starget_to_rport(starget);
 	int block_rc;
 	int reset_rc = 0;
 	int rc = FAILED;
 	unsigned long cancel_rc = 0;
 
 	ENTER;
-	block_rc = fc_block_scsi_eh(cmd);
+	block_rc = fc_block_scsi_eh(rport);
 	ibmvfc_wait_while_resetting(vhost);
 	if (block_rc != FAST_IO_FAIL) {
 		starget_for_each_device(starget, &cancel_rc, ibmvfc_dev_cancel_all_reset);
drivers/scsi/libfc/fc_fcp.c +3 -2
index 89749d8..40f26ea 100644
@@ -2021,11 +2021,12 @@ int fc_eh_abort(struct scsi_cmnd *sc_cmd)
 	struct fc_fcp_pkt *fsp;
 	struct fc_lport *lport;
 	struct fc_fcp_internal *si;
+	struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device));
 	int rc = FAILED;
 	unsigned long flags;
 	int rval;
 
-	rval = fc_block_scsi_eh(sc_cmd);
+	rval = fc_block_scsi_eh(rport);
 	if (rval)
 		return rval;
 
@@ -2077,7 +2078,7 @@ int fc_eh_device_reset(struct scsi_cmnd *sc_cmd)
 	int rc = FAILED;
 	int rval;
 
-	rval = fc_block_scsi_eh(sc_cmd);
+	rval = fc_block_scsi_eh(rport);
 	if (rval)
 		return rval;
 
drivers/scsi/lpfc/lpfc_scsi.c +8 -4
index 7862c55..832cb9f 100644
@@ -4781,6 +4781,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd)
 	struct lpfc_iocbq *iocb;
 	struct lpfc_iocbq *abtsiocb;
 	struct lpfc_scsi_buf *lpfc_cmd;
+	struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device));
 	IOCB_t *cmd, *icmd;
 	int ret = SUCCESS, status = 0;
 	struct lpfc_sli_ring *pring_s4;
@@ -4788,7 +4789,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd)
 	unsigned long flags, iflags;
 	DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waitq);
 
-	status = fc_block_scsi_eh(cmnd);
+	status = fc_block_scsi_eh(rport);
 	if (status != 0 && status != SUCCESS)
 		return status;
 
@@ -5240,6 +5241,7 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd)
 	unsigned tgt_id = cmnd->device->id;
 	uint64_t lun_id = cmnd->device->lun;
 	struct lpfc_scsi_event_header scsi_event;
+	struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device));
 	int status;
 
 	rdata = lpfc_rport_data_from_scsi_device(cmnd->device);
@@ -5249,7 +5251,7 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd)
 		return FAILED;
 	}
 	pnode = rdata->pnode;
-	status = fc_block_scsi_eh(cmnd);
+	status = fc_block_scsi_eh(rport);
 	if (status != 0 && status != SUCCESS)
 		return status;
 
@@ -5310,6 +5312,7 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd)
 	unsigned tgt_id = cmnd->device->id;
 	uint64_t lun_id = cmnd->device->lun;
 	struct lpfc_scsi_event_header scsi_event;
+	struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device));
 	int status;
 
 	rdata = lpfc_rport_data_from_scsi_device(cmnd->device);
@@ -5319,7 +5322,7 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd)
 		return FAILED;
 	}
 	pnode = rdata->pnode;
-	status = fc_block_scsi_eh(cmnd);
+	status = fc_block_scsi_eh(rport);
 	if (status != 0 && status != SUCCESS)
 		return status;
 
@@ -5376,6 +5379,7 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd)
 	struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
 	struct lpfc_nodelist *ndlp = NULL;
 	struct lpfc_scsi_event_header scsi_event;
+	struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device));
 	int match;
 	int ret = SUCCESS, status, i;
 
@@ -5388,7 +5392,7 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd)
 	fc_host_post_vendor_event(shost, fc_get_event_number(),
 		sizeof(scsi_event), (char *)&scsi_event, LPFC_NL_VENDOR_ID);
 
-	status = fc_block_scsi_eh(cmnd);
+	status = fc_block_scsi_eh(rport);
 	if (status != 0 && status != SUCCESS)
 		return status;
 
drivers/scsi/qla2xxx/qla_os.c +13 -8
index be9698d..cd30445 100644
@@ -918,6 +918,7 @@ static int
 qla2xxx_eh_abort(struct scsi_cmnd *cmd)
 {
 	scsi_qla_host_t *vha = shost_priv(cmd->device->host);
+	struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device));
 	srb_t *sp;
 	int ret;
 	unsigned int id;
@@ -929,7 +930,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
 	if (!CMD_SP(cmd))
 		return SUCCESS;
 
-	ret = fc_block_scsi_eh(cmd);
+	ret = fc_block_scsi_eh(rport);
 	if (ret != 0)
 		return ret;
 	ret = SUCCESS;
@@ -1071,9 +1072,11 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type,
 		return FAILED;
 	}
 
-	err = fc_block_scsi_eh(cmd);
-	if (err != 0)
-		return err;
+	if (fcport->rport) {
+		err = fc_block_scsi_eh(fcport->rport);
+		if (err != 0)
+			return err;
+	}
 
 	ql_log(ql_log_info, vha, 0x8009,
 	    "%s RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", name, vha->host_no,
@@ -1165,10 +1168,12 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
 		return ret;
 	}
 
-	ret = fc_block_scsi_eh(cmd);
-	if (ret != 0)
-		return ret;
-	ret = FAILED;
+	if (fcport->rport) {
+		ret = fc_block_scsi_eh(fcport->rport);
+		if (ret != 0)
+			return ret;
+		ret = FAILED;
+	}
 
 	ql_log(ql_log_info, vha, 0x8012,
 	    "BUS RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun);
drivers/scsi/scsi_transport_fc.c +3 -4
index 6b65b03..f9939c8 100644
@@ -3293,7 +3293,7 @@ fc_scsi_scan_rport(struct work_struct *work)
 
 /**
  * fc_block_scsi_eh - Block SCSI eh thread for blocked fc_rport
- * @cmnd: SCSI command that scsi_eh is trying to recover
+ * @rport: remote port to be checked
  *
  * This routine can be called from a FC LLD scsi_eh callback. It
  * blocks the scsi_eh thread until the fc_rport leaves the
@@ -3305,10 +3305,9 @@ fc_scsi_scan_rport(struct work_struct *work)
  *	    FAST_IO_FAIL if the fast_io_fail_tmo fired, this should be
  *	    passed back to scsi_eh.
  */
-int fc_block_scsi_eh(struct scsi_cmnd *cmnd)
+int fc_block_scsi_eh(struct fc_rport *rport)
 {
-	struct Scsi_Host *shost = cmnd->device->host;
-	struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device));
+	struct Scsi_Host *shost = rport_to_shost(rport);
 	unsigned long flags;
 
 	spin_lock_irqsave(shost->host_lock, flags);
include/scsi/scsi_transport_fc.h +1 -1
index 8c79980..4d4f21f 100644
@@ -851,6 +851,6 @@ void fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,
 struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel,
 		struct fc_vport_identifiers *);
 int fc_vport_terminate(struct fc_vport *vport);
-int fc_block_scsi_eh(struct scsi_cmnd *cmnd);
+int fc_block_scsi_eh(struct fc_rport *rport);
 
 #endif /* SCSI_TRANSPORT_FC_H */
Signature · 1 line
1.7.12.4
#6 lore raw

Re: [PATCH 5/7] scsi_transport_fc: Use fc_rport as argument for fc_block_scsi_eh

Quoted 32 lines · Hannes Reinecke

fc_block_scsi_eh() works on a remote port, so we should be using that as an argument and not the scsi command.

---
  drivers/s390/scsi/zfcp_scsi.c     |  9 ++++++---
  10 files changed, 56 insertions(+), 35 deletions(-)
drivers/s390/scsi/zfcp_scsi.c +2 -1
index 7b35364..dc42c93 100644
@@ -173,6 +173,7 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
  	struct zfcp_adapter *adapter =
  		(struct zfcp_adapter *) scsi_host->hostdata[0];
  	struct zfcp_fsf_req *old_req, *abrt_req;
+	struct fc_rport *rport = starget_to_rport(scsi_target(scpnt->device));
  	unsigned long flags;
  	unsigned long old_reqid = (unsigned long) scpnt->host_scribble;
  	int retval = SUCCESS, ret;
@@ -199,7 +200,7 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
  			break;
 
  		zfcp_erp_wait(adapter);
-		ret = fc_block_scsi_eh(scpnt);
+		ret = fc_block_scsi_eh(rport);
  		if (ret) {
  			zfcp_dbf_scsi_abort("abrt_bl", scpnt, NULL);
  			return ret;

drivers/s390/scsi/zfcp_scsi.c static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags) · line 238

Quoted 4 lines
drivers/s390/scsi/zfcp_scsi.c +1 -0
@@ -234,6 +235,7 @@ static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags)
  {
  	struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);
  	struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;
+	struct fc_port *rport = zfcp_sdev->port->rport;

typo: struct fc_port => struct fc_rport

Quoted 26 lines
drivers/s390/scsi/zfcp_scsi.c +3 -2
  	struct zfcp_fsf_req *fsf_req = NULL;
  	int retval = SUCCESS, ret;
  	int retry = 3;
@@ -244,7 +246,7 @@ static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags)
  			break;
 
  		zfcp_erp_wait(adapter);
-		ret = fc_block_scsi_eh(scpnt);
+		ret = fc_block_scsi_eh(rport);
  		if (ret)
  			return ret;
 
@@ -283,11 +285,12 @@ static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
  {
  	struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);
  	struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;
+	struct fc_rport *rport = zfcp_sdev->port->rport;
  	int ret;
 
  	zfcp_erp_adapter_reopen(adapter, 0, "schrh_1");
  	zfcp_erp_wait(adapter);
-	ret = fc_block_scsi_eh(scpnt);
+	ret = fc_block_scsi_eh(rport);
  	if (ret)
  		return ret;
 
Signature · 15 lines
Mit freundlichen Grüßen / Kind regards
Steffen Maier

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#7 lore raw

PATCH 6/7 scsi: Use Scsi_Host as argument for eh_host_reset_handler

In reply to Hannes Reinecke

Issuing a host reset should not rely on any commands. So use Scsi_Host as argument for eh_host_reset_handler.

---
 Documentation/scsi/scsi_eh.txt            |  2 +-
 Documentation/scsi/scsi_mid_low_api.txt   |  4 +--
 arch/ia64/hp/sim/simscsi.c                |  2 +-
 drivers/infiniband/ulp/srp/ib_srp.c       |  4 +--
 drivers/message/fusion/mptscsih.c         | 18 ++++++------
 drivers/message/fusion/mptscsih.h         |  2 +-
 drivers/s390/scsi/zfcp_scsi.c             |  3 +-
 drivers/scsi/3w-9xxx.c                    | 11 ++++----
 drivers/scsi/3w-sas.c                     | 11 ++++----
 drivers/scsi/3w-xxxx.c                    | 11 ++++----
 drivers/scsi/53c700.c                     | 15 +++++-----
 drivers/scsi/BusLogic.c                   | 13 +++------
 drivers/scsi/NCR53c406a.c                 |  6 ++--
 drivers/scsi/aacraid/linit.c              | 14 ++++-----
 drivers/scsi/aha152x.c                    | 11 +-------
 drivers/scsi/aha152x.h                    |  2 +-
 drivers/scsi/aha1542.c                    | 22 +++++++--------
 drivers/scsi/arm/fas216.c                 |  8 +++---
 drivers/scsi/arm/fas216.h                 |  2 +-
 drivers/scsi/dpt_i2o.c                    | 14 ++++-----
 drivers/scsi/dpti.h                       |  2 +-
 drivers/scsi/eata.c                       | 19 +++----------
 drivers/scsi/eata_pio.c                   | 29 +++++++++----------
 drivers/scsi/esas2r/esas2r.h              |  2 +-
 drivers/scsi/esas2r/esas2r_main.c         | 16 ++++++-----
 drivers/scsi/esp_scsi.c                   |  4 +--
 drivers/scsi/fnic/fnic.h                  |  2 +-
 drivers/scsi/fnic/fnic_scsi.c             |  3 +-
 drivers/scsi/ibmvscsi/ibmvfc.c            |  4 +--
 drivers/scsi/ibmvscsi/ibmvscsi.c          |  4 +--
 drivers/scsi/imm.c                        |  7 ++---
 drivers/scsi/ipr.c                        |  4 +--
 drivers/scsi/ips.c                        | 40 ++++++--------------------
 drivers/scsi/libfc/fc_fcp.c               |  5 ++--
 drivers/scsi/lpfc/lpfc_scsi.c             |  3 +-
 drivers/scsi/mac53c94.c                   |  8 +++---
 drivers/scsi/megaraid.c                   | 16 +++++------
 drivers/scsi/megaraid.h                   |  2 +-
 drivers/scsi/megaraid/megaraid_mbox.c     | 16 +++--------
 drivers/scsi/megaraid/megaraid_sas_base.c | 32 +++++----------------
 drivers/scsi/mesh.c                       | 10 +++----
 drivers/scsi/mpt2sas/mpt2sas_scsih.c      | 13 ++++-----
 drivers/scsi/mpt3sas/mpt3sas_scsih.c      | 13 ++++-----
 drivers/scsi/mvumi.c                      |  7 ++---
 drivers/scsi/nsp32.c                      | 14 ++++-----
 drivers/scsi/pcmcia/aha152x_stub.c        |  2 +-
 drivers/scsi/pcmcia/nsp_cs.c              |  4 +--
 drivers/scsi/pcmcia/sym53c500_cs.c        |  8 +++---
 drivers/scsi/pmcraid.c                    |  4 +--
 drivers/scsi/ppa.c                        |  7 ++---
 drivers/scsi/qla1280.c                    | 23 ++++++++++++---
 drivers/scsi/qla2xxx/qla_os.c             | 17 ++++-------
 drivers/scsi/qla4xxx/ql4_os.c             | 16 +++++------
 drivers/scsi/scsi_debug.c                 |  2 +-
 drivers/scsi/scsi_error.c                 |  2 +-
 drivers/scsi/sgiwd93.c                    | 15 ----------
 drivers/scsi/stex.c                       |  5 ++--
 drivers/scsi/storvsc_drv.c                |  4 +--
 drivers/scsi/sym53c416.c                  |  6 ++--
 drivers/scsi/sym53c8xx_2/sym_glue.c       | 47 +++++++++++++++++++++----------
 drivers/scsi/u14-34f.c                    | 17 ++++-------
 drivers/scsi/ultrastor.c                  |  7 ++---
 drivers/scsi/vmw_pvscsi.c                 |  5 ++--
 drivers/scsi/wd33c93.c                    |  7 ++---
 drivers/scsi/wd33c93.h                    |  2 +-
 drivers/scsi/wd7000.c                     | 10 +++----
 drivers/usb/image/microtek.c              |  4 +--
 include/scsi/libfc.h                      |  2 +-
 include/scsi/scsi_host.h                  |  2 +-
 69 files changed, 289 insertions(+), 379 deletions(-)
Documentation/scsi/scsi_eh.txt +1 -1
index a0c8511..c530296 100644
@@ -210,7 +210,7 @@ considered to fail always.
 int (* eh_abort_handler)(struct scsi_cmnd *);
 int (* eh_device_reset_handler)(struct scsi_cmnd *);
 int (* eh_bus_reset_handler)(struct scsi_cmnd *);
-int (* eh_host_reset_handler)(struct scsi_cmnd *);
+int (* eh_host_reset_handler)(struct Scsi_Host *);
 
  Higher-severity actions are taken only when lower-severity actions
 cannot recover some of failed scmds.  Also, note that failure of the
Documentation/scsi/scsi_mid_low_api.txt +2 -2
index d6a9bde..efed980 100644
@@ -931,7 +931,7 @@ Details:
 
 /**
  *      eh_host_reset_handler - reset host (host bus adapter)
- *      @scp: SCSI host that contains this device should be reset
+ *      @shost: SCSI host that contains this device should be reset
  *
  *      Returns SUCCESS if command aborted else FAILED
  *
@@ -948,7 +948,7 @@ Details:
  *
  *      Optionally defined in: LLD
  **/
-     int eh_host_reset_handler(struct scsi_cmnd * scp)
+     int eh_host_reset_handler(struct Scsi_Host * shost)
 
 
 /**
arch/ia64/hp/sim/simscsi.c +1 -1
index 3a428f1..4dbe6b3 100644
@@ -329,7 +329,7 @@ simscsi_queuecommand_lck (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)
 static DEF_SCSI_QCMD(simscsi_queuecommand)
 
 static int
-simscsi_host_reset (struct scsi_cmnd *sc)
+simscsi_host_reset (struct Scsi_Host *sh)
 {
 	printk(KERN_ERR "simscsi_host_reset: not implemented\n");
 	return 0;
drivers/infiniband/ulp/srp/ib_srp.c +2 -2
index e3c2c5b..177039b 100644
@@ -2405,9 +2405,9 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
 	return SUCCESS;
 }
 
-static int srp_reset_host(struct scsi_cmnd *scmnd)
+static int srp_reset_host(struct Scsi_Host *shost)
 {
-	struct srp_target_port *target = host_to_target(scmnd->device->host);
+	struct srp_target_port *target = host_to_target(shost);
 
 	shost_printk(KERN_ERR, target->scsi_host, PFX "SRP reset_host called\n");
 
drivers/message/fusion/mptscsih.c +9 -9
index 39e5668..7a7d03a6 100644
@@ -1913,14 +1913,14 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt)
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /**
  *	mptscsih_host_reset - Perform a SCSI host adapter RESET (new_eh variant)
- *	@SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to
+ *	@shost: Pointer to Scsi_Host structure to be reset
  *
  *	(linux scsi_host_template.eh_host_reset_handler routine)
  *
  *	Returns SUCCESS or FAILED.
  */
 int
-mptscsih_host_reset(struct scsi_cmnd *SCpnt)
+mptscsih_host_reset(struct Scsi_Host *shost)
 {
 	MPT_SCSI_HOST *  hd;
 	int              status = SUCCESS;
@@ -1928,9 +1928,9 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt)
 	int		retval;
 
 	/*  If we can't locate the host to reset, then we failed. */
-	if ((hd = shost_priv(SCpnt->device->host)) == NULL){
+	if ((hd = shost_priv(shost)) == NULL){
 		printk(KERN_ERR MYNAM ": host reset: "
-		    "Can't locate host! (sc=%p)\n", SCpnt);
+		    "Can't locate host!\n");
 		return FAILED;
 	}
 
@@ -1938,20 +1938,20 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt)
 	mptscsih_flush_running_cmds(hd);
 
 	ioc = hd->ioc;
-	printk(MYIOC_s_INFO_FMT "attempting host reset! (sc=%p)\n",
-	    ioc->name, SCpnt);
+	printk(MYIOC_s_INFO_FMT "attempting host reset!\n",
+	    ioc->name);
 
 	/*  If our attempts to reset the host failed, then return a failed
 	 *  status.  The host will be taken off line by the SCSI mid-layer.
 	 */
-    retval = mpt_Soft_Hard_ResetHandler(ioc, CAN_SLEEP);
+	retval = mpt_Soft_Hard_ResetHandler(ioc, CAN_SLEEP);
 	if (retval < 0)
 		status = FAILED;
 	else
 		status = SUCCESS;
 
-	printk(MYIOC_s_INFO_FMT "host reset: %s (sc=%p)\n",
-	    ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
+	printk(MYIOC_s_INFO_FMT "host reset: %s\n",
+	    ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ));
 
 	return status;
 }
drivers/message/fusion/mptscsih.h +1 -1
index e1b1a19..32067bc 100644
@@ -121,7 +121,7 @@ extern int mptscsih_slave_configure(struct scsi_device *device);
 extern int mptscsih_abort(struct scsi_cmnd * SCpnt);
 extern int mptscsih_dev_reset(struct scsi_cmnd * SCpnt);
 extern int mptscsih_bus_reset(struct scsi_cmnd * SCpnt);
-extern int mptscsih_host_reset(struct scsi_cmnd *SCpnt);
+extern int mptscsih_host_reset(struct Scsi_Host *shost);
 extern int mptscsih_bios_param(struct scsi_device * sdev, struct block_device *bdev, sector_t capacity, int geom[]);
 extern int mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r);
 extern int mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r);
drivers/s390/scsi/zfcp_scsi.c +2 -1
index dc42c93..fe50f69 100644
@@ -281,13 +281,14 @@ static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt)
 	return zfcp_task_mgmt_function(scpnt, FCP_TMF_TGT_RESET);
 }
 
-static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
+static int zfcp_scsi_eh_host_reset_handler(struct Scsi_Host *host)
 {
 	struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);
 	struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;
 	struct fc_rport *rport = zfcp_sdev->port->rport;
 	int ret;
 
+	adapter = (struct zfcp_adapter *)host->hostdata[0];
 	zfcp_erp_adapter_reopen(adapter, 0, "schrh_1");
 	zfcp_erp_wait(adapter);
 	ret = fc_block_scsi_eh(rport);
drivers/scsi/3w-9xxx.c +6 -5
index 0a73253..d3f4147 100644
@@ -1736,18 +1736,19 @@ static int twa_scsi_biosparam(struct scsi_device *sdev, struct block_device *bde
 } /* End twa_scsi_biosparam() */
 
 /* This is the new scsi eh reset function */
-static int twa_scsi_eh_reset(struct scsi_cmnd *SCpnt)
+static int twa_scsi_eh_reset(struct Scsi_Host *shost)
 {
 	TW_Device_Extension *tw_dev = NULL;
 	int retval = FAILED;
 
-	tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata;
+	tw_dev = (TW_Device_Extension *)shost->hostdata;
 
 	tw_dev->num_resets++;
 
-	sdev_printk(KERN_WARNING, SCpnt->device,
-		"WARNING: (0x%02X:0x%04X): Command (0x%x) timed out, resetting card.\n",
-		TW_DRIVER, 0x2c, SCpnt->cmnd[0]);
+	shost_printk(KERN_WARNING, shost,
+		     "WARNING: (0x%02X:0x%04X): "
+		     "Command timed out, resetting card.\n",
+		     TW_DRIVER, 0x2c);
 
 	/* Make sure we are not issuing an ioctl or resetting from ioctl */
 	mutex_lock(&tw_dev->ioctl_lock);
drivers/scsi/3w-sas.c +6 -5
index 4de3460..d54c197 100644
@@ -1472,18 +1472,19 @@ static int twl_scsi_biosparam(struct scsi_device *sdev, struct block_device *bde
 } /* End twl_scsi_biosparam() */
 
 /* This is the new scsi eh reset function */
-static int twl_scsi_eh_reset(struct scsi_cmnd *SCpnt)
+static int twl_scsi_eh_reset(struct Scsi_Host *shost)
 {
 	TW_Device_Extension *tw_dev = NULL;
 	int retval = FAILED;
 
-	tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata;
+	tw_dev = (TW_Device_Extension *)shost->hostdata;
 
 	tw_dev->num_resets++;
 
-	sdev_printk(KERN_WARNING, SCpnt->device,
-		"WARNING: (0x%02X:0x%04X): Command (0x%x) timed out, resetting card.\n",
-		TW_DRIVER, 0x2c, SCpnt->cmnd[0]);
+	shost_printk(KERN_WARNING, shost,
+		     "WARNING: (0x%02X:0x%04X): "
+		     "Command timed out, resetting card.\n",
+		     TW_DRIVER, 0x2c);
 
 	/* Make sure we are not issuing an ioctl or resetting from ioctl */
 	mutex_lock(&tw_dev->ioctl_lock);
drivers/scsi/3w-xxxx.c +5 -6
index 752624e..31b8d25 100644
@@ -1394,25 +1394,24 @@ static int tw_scsi_biosparam(struct scsi_device *sdev, struct block_device *bdev
 } /* End tw_scsi_biosparam() */
 
 /* This is the new scsi eh reset function */
-static int tw_scsi_eh_reset(struct scsi_cmnd *SCpnt) 
+static int tw_scsi_eh_reset(struct Scsi_Host *shost)
 {
 	TW_Device_Extension *tw_dev=NULL;
 	int retval = FAILED;
 
-	tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata;
+	tw_dev = (TW_Device_Extension *)shost->hostdata;
 
 	tw_dev->num_resets++;
 
-	sdev_printk(KERN_WARNING, SCpnt->device,
-		"WARNING: Command (0x%x) timed out, resetting card.\n",
-		SCpnt->cmnd[0]);
+	shost_printk(KERN_WARNING, shost,
+		"WARNING: Command timed out, resetting card.\n");
 
 	/* Make sure we are not issuing an ioctl or resetting from ioctl */
 	mutex_lock(&tw_dev->ioctl_lock);
 
 	/* Now reset the card and some of the device extension data */
 	if (tw_reset_device_extension(tw_dev)) {
-		printk(KERN_WARNING "3w-xxxx: scsi%d: Reset failed.\n", tw_dev->host->host_no);
+		shost_printk(KERN_WARNING, shost, "Reset failed.\n");
 		goto out;
 	}
 
drivers/scsi/53c700.c +7 -8
index a3adfb4..166a4e9 100644
@@ -169,7 +169,7 @@ MODULE_LICENSE("GPL");
 STATIC int NCR_700_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *);
 STATIC int NCR_700_abort(struct scsi_cmnd * SCpnt);
 STATIC int NCR_700_bus_reset(struct scsi_cmnd * SCpnt);
-STATIC int NCR_700_host_reset(struct scsi_cmnd * SCpnt);
+STATIC int NCR_700_host_reset(struct Scsi_Host *host);
 STATIC void NCR_700_chip_setup(struct Scsi_Host *host);
 STATIC void NCR_700_chip_reset(struct Scsi_Host *host);
 STATIC int NCR_700_slave_alloc(struct scsi_device *SDpnt);
@@ -1975,17 +1975,16 @@ NCR_700_bus_reset(struct scsi_cmnd * SCp)
 }
 
 STATIC int
-NCR_700_host_reset(struct scsi_cmnd * SCp)
+NCR_700_host_reset(struct Scsi_Host * host)
 {
-	scmd_printk(KERN_INFO, SCp, "New error handler wants HOST reset\n\t");
-	scsi_print_command(SCp);
+	shost_printk(KERN_INFO, shost, "SCSI EH wants HOST reset\n\t");
 
-	spin_lock_irq(SCp->device->host->host_lock);
+	spin_lock_irq(host->host_lock);
 
-	NCR_700_internal_bus_reset(SCp->device->host);
-	NCR_700_chip_reset(SCp->device->host);
+	NCR_700_internal_bus_reset(host);
+	NCR_700_chip_reset(host);
 
-	spin_unlock_irq(SCp->device->host->host_lock);
+	spin_unlock_irq(host->host_lock);
 
 	return SUCCESS;
 }
drivers/scsi/BusLogic.c +4 -9
index 972f817..8bb5fa2 100644
@@ -2998,21 +2998,16 @@ static bool blogic_write_outbox(struct blogic_adapter *adapter,
 
 /* Error Handling (EH) support */
 
-static int blogic_hostreset(struct scsi_cmnd *SCpnt)
+static int blogic_hostreset(struct Scsi_Host *shost)
 {
 	struct blogic_adapter *adapter =
-		(struct blogic_adapter *) SCpnt->device->host->hostdata;
-
-	unsigned int id = SCpnt->device->id;
-	struct blogic_tgt_stats *stats = &adapter->tgt_stats[id];
+		(struct blogic_adapter *) shost->hostdata;
 	int rc;
 
-	spin_lock_irq(SCpnt->device->host->host_lock);
-
-	blogic_inc_count(&stats->adatper_reset_req);
+	spin_lock_irq(shost->host_lock);
 
 	rc = blogic_resetadapter(adapter, false);
-	spin_unlock_irq(SCpnt->device->host->host_lock);
+	spin_unlock_irq(shost->host_lock);
 	return rc;
 }
 
drivers/scsi/NCR53c406a.c +3 -3
index c91888a..32363a3 100644
@@ -728,11 +728,11 @@ static int NCR53c406a_queue_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
 
 static DEF_SCSI_QCMD(NCR53c406a_queue)
 
-static int NCR53c406a_host_reset(Scsi_Cmnd * SCpnt)
+static int NCR53c406a_host_reset(struct Scsi_Host * shost)
 {
 	DEB(printk("NCR53c406a_reset called\n"));
 
-	spin_lock_irq(SCpnt->device->host->host_lock);
+	spin_lock_irq(shost->host_lock);
 
 	outb(C4_IMG, CONFIG4);	/* Select reg set 0 */
 	outb(CHIP_RESET, CMD_REG);
@@ -742,7 +742,7 @@ static int NCR53c406a_host_reset(Scsi_Cmnd * SCpnt)
 
 	rtrc(2);
 
-	spin_unlock_irq(SCpnt->device->host->host_lock);
+	spin_unlock_irq(shost->host_lock);
 
 	return SUCCESS;
 }
drivers/scsi/aacraid/linit.c +6 -8
index 63f576c..29396bf 100644
@@ -598,11 +598,10 @@ static int aac_eh_abort(struct scsi_cmnd* cmd)
  *	@scsi_cmd:	SCSI command block causing the reset
  *
  */
-static int aac_eh_reset(struct scsi_cmnd* cmd)
+static int aac_eh_reset(struct Scsi_Host * host)
 {
-	struct scsi_device * dev = cmd->device;
-	struct Scsi_Host * host = dev->host;
 	struct scsi_cmnd * command;
+	struct scsi_device *dev;
 	int count;
 	struct aac_dev * aac = (struct aac_dev *)host->hostdata;
 	unsigned long flags;
@@ -611,10 +610,10 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)
 	for (count = 0; count < (host->can_queue + AAC_NUM_MGT_FIB); ++count) {
 		struct fib * fib = &aac->fibs[count];
 		if (fib->hw_fib_va->header.XferState &&
-		  (fib->flags & FIB_CONTEXT_FLAG) &&
-		  (fib->callback_data == cmd)) {
+		    (fib->flags & FIB_CONTEXT_FLAG)) {
 			fib->flags |= FIB_CONTEXT_FLAG_TIMED_OUT;
-			cmd->SCp.phase = AAC_OWNER_ERROR_HANDLER;
+			command = fib->callback_data;
+			command->SCp.phase = AAC_OWNER_ERROR_HANDLER;
 		}
 	}
 	printk(KERN_ERR "%s: Host adapter reset request. SCSI hang ?\n",
@@ -633,8 +632,7 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)
 		__shost_for_each_device(dev, host) {
 			spin_lock_irqsave(&dev->list_lock, flags);
 			list_for_each_entry(command, &dev->cmd_list, list) {
-				if ((command != cmd) &&
-				    (command->SCp.phase == AAC_OWNER_FIRMWARE)) {
+				if (command->SCp.phase == AAC_OWNER_FIRMWARE) {
 					active++;
 					break;
 				}
drivers/scsi/aha152x.c +1 -10
index e77b72f..fc78bb1 100644
@@ -1331,7 +1331,7 @@ static void reset_ports(struct Scsi_Host *shpnt)
  * Reset the host (bus and controller)
  *
  */
-int aha152x_host_reset_host(struct Scsi_Host *shpnt)
+int aha152x_host_reset(struct Scsi_Host *shpnt)
 {
 	DPRINTK(debug_eh, KERN_DEBUG "scsi%d: host reset\n", shpnt->host_no);
 
@@ -1344,15 +1344,6 @@ int aha152x_host_reset_host(struct Scsi_Host *shpnt)
 }
 
 /*
- * Reset the host (bus and controller)
- * 
- */
-static int aha152x_host_reset(Scsi_Cmnd *SCpnt)
-{
-	return aha152x_host_reset_host(SCpnt->device->host);
-}
-
-/*
  * Return the "logical geometry"
  *
  */
drivers/scsi/aha152x.h +1 -1
index ac4bfa438b..3ccf724 100644
@@ -332,6 +332,6 @@ struct aha152x_setup {
 
 struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *);
 void aha152x_release(struct Scsi_Host *);
-int aha152x_host_reset_host(struct Scsi_Host *);
+int aha152x_host_reset(struct Scsi_Host *);
 
 #endif /* _AHA152X_H */
drivers/scsi/aha1542.c +11 -11
index 770c48d..dd92308 100644
@@ -1379,7 +1379,7 @@ fail:
 	return FAILED;
 }
 
-static int aha1542_host_reset(Scsi_Cmnd * SCpnt)
+static int aha1542_host_reset(struct Scsi_Host * shost)
 {
 	int i;
 
@@ -1389,7 +1389,7 @@ static int aha1542_host_reset(Scsi_Cmnd * SCpnt)
 	 * we do this?  Try this first, and we can add that later
 	 * if it turns out to be useful.
 	 */
-	outb(HRST | SCRST, CONTROL(SCpnt->device->host->io_port));
+	outb(HRST | SCRST, CONTROL(shost->io_port));
 
 	/*
 	 * Wait for the thing to settle down a bit.  Unfortunately
@@ -1399,16 +1399,16 @@ static int aha1542_host_reset(Scsi_Cmnd * SCpnt)
 	 * we are pretty desperate anyways.
 	 */
 	ssleep(4);
-	spin_lock_irq(SCpnt->device->host->host_lock);
+	spin_lock_irq(shost->host_lock);
 
-	WAIT(STATUS(SCpnt->device->host->io_port),
+	WAIT(STATUS(shost->io_port),
 	     STATMASK, INIT | IDLE, STST | DIAGF | INVDCMD | DF | CDF);
 
 	/*
 	 * We need to do this too before the 1542 can interact with
 	 * us again.
 	 */
-	setup_mailboxes(SCpnt->device->host->io_port, SCpnt->device->host);
+	setup_mailboxes(shost->io_port, shost);
 
 	/*
 	 * Now try to pick up the pieces.  For all pending commands,
@@ -1416,12 +1416,12 @@ static int aha1542_host_reset(Scsi_Cmnd * SCpnt)
 	 * out.  We do not try and restart any commands or anything - 
 	 * the strategy handler takes care of that crap.
 	 */
-	printk(KERN_WARNING "Sent BUS RESET to scsi host %d\n", SCpnt->device->host->host_no);
+	printk(KERN_WARNING "Sent BUS RESET to scsi host %d\n", shost->host_no);
 
 	for (i = 0; i < AHA1542_MAILBOXES; i++) {
-		if (HOSTDATA(SCpnt->device->host)->SCint[i] != NULL) {
+		if (HOSTDATA(shost)->SCint[i] != NULL) {
 			Scsi_Cmnd *SCtmp;
-			SCtmp = HOSTDATA(SCpnt->device->host)->SCint[i];
+			SCtmp = HOSTDATA(shost)->SCint[i];
 
 			if (SCtmp->device->soft_reset) {
 				/*
@@ -1434,12 +1434,12 @@ static int aha1542_host_reset(Scsi_Cmnd * SCpnt)
 			}
 			kfree(SCtmp->host_scribble);
 			SCtmp->host_scribble = NULL;
-			HOSTDATA(SCpnt->device->host)->SCint[i] = NULL;
-			HOSTDATA(SCpnt->device->host)->mb[i].status = 0;
+			HOSTDATA(shost)->SCint[i] = NULL;
+			HOSTDATA(shost)->mb[i].status = 0;
 		}
 	}
 
-	spin_unlock_irq(SCpnt->device->host->host_lock);
+	spin_unlock_irq(shost->host_lock);
 	return SUCCESS;
 
 fail:
drivers/scsi/arm/fas216.c +4 -4
index b46a6f6..753b2ed 100644
@@ -2653,16 +2653,16 @@ static void fas216_init_chip(FAS216_Info *info)
  * Returns: FAILED if unable to reset.
  * Notes: io_request_lock is taken, and irqs are disabled
  */
-int fas216_eh_host_reset(struct scsi_cmnd *SCpnt)
+int fas216_eh_host_reset(struct Scsi_Host *shost)
 {
-	FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata;
+	FAS216_Info *info = (FAS216_Info *)shost->hostdata;
 
 	spin_lock_irq(info->host->host_lock);
 
 	fas216_checkmagic(info);
 
-	printk("scsi%d.%c: %s: resetting host\n",
-		info->host->host_no, '0' + SCpnt->device->id, __func__);
+	printk("scsi%d: %s: resetting host\n",
+		info->host->host_no, __func__);
 
 	/*
 	 * Reset the SCSI chip.
drivers/scsi/arm/fas216.h +1 -1
index c57c16e..9741c4c 100644
@@ -388,6 +388,6 @@ extern int fas216_eh_bus_reset(struct scsi_cmnd *SCpnt);
  * Params  : SCpnt - command specifing host to reset
  * Returns : FAILED if unable to reset
  */
-extern int fas216_eh_host_reset(struct scsi_cmnd *SCpnt);
+extern int fas216_eh_host_reset(struct Scsi_Host *shost);
 
 #endif /* FAS216_H */
drivers/scsi/dpt_i2o.c +7 -7
index c0ae8fa..b1c22a3 100644
@@ -797,12 +797,12 @@ static int adpt_bus_reset(struct scsi_cmnd* cmd)
 }
 
 // This version of reset is called by the eh_error_handler
-static int __adpt_reset(struct scsi_cmnd* cmd)
+static int __adpt_reset(struct Scsi_Host* shost)
 {
 	adpt_hba* pHba;
 	int rcode;
-	pHba = (adpt_hba*)cmd->device->host->hostdata[0];
-	printk(KERN_WARNING"%s: Hba Reset: scsi id %d: tid: %d\n",pHba->name,cmd->device->channel,pHba->channel[cmd->device->channel].tid );
+	pHba = (adpt_hba*)shost->hostdata[0];
+	printk(KERN_WARNING"%s: Hba Reset\n",pHba->name);
 	rcode =  adpt_hba_reset(pHba);
 	if(rcode == 0){
 		printk(KERN_WARNING"%s: HBA reset complete\n",pHba->name);
@@ -813,13 +813,13 @@ static int __adpt_reset(struct scsi_cmnd* cmd)
 	}
 }
 
-static int adpt_reset(struct scsi_cmnd* cmd)
+static int adpt_reset(struct Scsi_Host* shost)
 {
 	int rc;
 
-	spin_lock_irq(cmd->device->host->host_lock);
-	rc = __adpt_reset(cmd);
-	spin_unlock_irq(cmd->device->host->host_lock);
+	spin_lock_irq(shost->host_lock);
+	rc = __adpt_reset(shost);
+	spin_unlock_irq(shost->host_lock);
 
 	return rc;
 }
drivers/scsi/dpti.h +1 -1
index aeb0461..0d82d77 100644
@@ -31,7 +31,7 @@
 static int adpt_detect(struct scsi_host_template * sht);
 static int adpt_queue(struct Scsi_Host *h, struct scsi_cmnd * cmd);
 static int adpt_abort(struct scsi_cmnd * cmd);
-static int adpt_reset(struct scsi_cmnd* cmd);
+static int adpt_reset(struct Scsi_Host * host);
 static int adpt_release(struct Scsi_Host *host);
 static int adpt_slave_configure(struct scsi_device *);
 
drivers/scsi/eata.c +4 -15
index 03372cf..cd893bf 100644
@@ -507,7 +507,7 @@ static int eata2x_detect(struct scsi_host_template *);
 static int eata2x_release(struct Scsi_Host *);
 static int eata2x_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
 static int eata2x_eh_abort(struct scsi_cmnd *);
-static int eata2x_eh_host_reset(struct scsi_cmnd *);
+static int eata2x_eh_host_reset(struct Scsi_Host *);
 static int eata2x_bios_param(struct scsi_device *, struct block_device *,
 			     sector_t, int *);
 static int eata2x_slave_configure(struct scsi_device *);
@@ -1908,21 +1908,16 @@ static int eata2x_eh_abort(struct scsi_cmnd *SCarg)
 	panic("%s: abort, mbox %d, invalid cp_stat.\n", ha->board_name, i);
 }
 
-static int eata2x_eh_host_reset(struct scsi_cmnd *SCarg)
+static int eata2x_eh_host_reset(struct Scsi_Host *shost)
 {
 	unsigned int i, time, k, c, limit = 0;
-	int arg_done = 0;
 	struct scsi_cmnd *SCpnt;
-	struct Scsi_Host *shost = SCarg->device->host;
 	struct hostdata *ha = (struct hostdata *)shost->hostdata;
 
-	scmd_printk(KERN_INFO, SCarg, "reset, enter.\n");
+	shost_printk(KERN_INFO, shost, "reset, enter.\n");
 
 	spin_lock_irq(shost->host_lock);
 
-	if (SCarg->host_scribble == NULL)
-		printk("%s: reset, inactive.\n", ha->board_name);
-
 	if (ha->in_reset) {
 		printk("%s: reset, exit, already in reset.\n", ha->board_name);
 		spin_unlock_irq(shost->host_lock);
@@ -1979,9 +1974,6 @@ static int eata2x_eh_host_reset(struct scsi_cmnd *SCarg)
 		if (SCpnt->scsi_done == NULL)
 			panic("%s: reset, mbox %d, SCpnt->scsi_done == NULL.\n",
 			      ha->board_name, i);
-
-		if (SCpnt == SCarg)
-			arg_done = 1;
 	}
 
 	if (do_dma(shost->io_port, 0, RESET_PIO)) {
@@ -2049,10 +2041,7 @@ static int eata2x_eh_host_reset(struct scsi_cmnd *SCarg)
 	ha->in_reset = 0;
 	do_trace = 0;
 
-	if (arg_done)
-		printk("%s: reset, exit, done.\n", ha->board_name);
-	else
-		printk("%s: reset, exit.\n", ha->board_name);
+	printk("%s: reset, exit.\n", ha->board_name);
 
 	spin_unlock_irq(shost->host_lock);
 	return SUCCESS;
drivers/scsi/eata_pio.c +14 -15
index 8319d2b..b5470ceb3 100644
@@ -435,19 +435,18 @@ static int eata_pio_abort(struct scsi_cmnd *cmd)
 	panic("eata_pio: abort: invalid slot status\n");
 }
 
-static int eata_pio_host_reset(struct scsi_cmnd *cmd)
+static int eata_pio_host_reset(struct Scsi_Host *host)
 {
 	unsigned int x, limit = 0;
 	unsigned char success = 0;
 	struct scsi_cmnd *sp;
-	struct Scsi_Host *host = cmd->device->host;
 
-	DBG(DBG_ABNORM, scmd_printk(KERN_WARNING, cmd,
+	DBG(DBG_ABNORM, shost_printk(KERN_WARNING, host,
 		"eata_pio_reset called\n"));
 
 	spin_lock_irq(host->host_lock);
 
-	if (HD(cmd)->state == RESET) {
+	if (SD(host)->state == RESET) {
 		printk(KERN_WARNING "eata_pio_reset: exit, already in reset.\n");
 		spin_unlock_irq(host->host_lock);
 		return FAILED;
@@ -455,13 +454,13 @@ static int eata_pio_host_reset(struct scsi_cmnd *cmd)
 
 	/* force all slots to be free */
 
-	for (x = 0; x < cmd->device->host->can_queue; x++) {
+	for (x = 0; x < host->can_queue; x++) {
 
-		if (HD(cmd)->ccb[x].status == FREE)
+		if (SD(host)->ccb[x].status == FREE)
 			continue;
 
-		sp = HD(cmd)->ccb[x].cmd;
-		HD(cmd)->ccb[x].status = RESET;
+		sp = SD(host)->ccb[x].cmd;
+		SD(host)->ccb[x].status = RESET;
 		printk(KERN_WARNING "eata_pio_reset: slot %d in reset.\n", x);
 
 		if (sp == NULL)
@@ -469,10 +468,10 @@ static int eata_pio_host_reset(struct scsi_cmnd *cmd)
 	}
 
 	/* hard reset the HBA  */
-	outb(EATA_CMD_RESET, cmd->device->host->base + HA_WCOMMAND);
+	outb(EATA_CMD_RESET, host->base + HA_WCOMMAND);
 
 	DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: board reset done.\n"));
-	HD(cmd)->state = RESET;
+	SD(host)->state = RESET;
 
 	spin_unlock_irq(host->host_lock);
 	msleep(3000);
@@ -480,23 +479,23 @@ static int eata_pio_host_reset(struct scsi_cmnd *cmd)
 
 	DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: interrupts disabled, " "loops %d.\n", limit));
 
-	for (x = 0; x < cmd->device->host->can_queue; x++) {
+	for (x = 0; x < host->can_queue; x++) {
 
 		/* Skip slots already set free by interrupt */
-		if (HD(cmd)->ccb[x].status != RESET)
+		if (SD(host)->ccb[x].status != RESET)
 			continue;
 
-		sp = HD(cmd)->ccb[x].cmd;
+		sp = SD(host)->ccb[x].cmd;
 		sp->result = DID_RESET << 16;
 
 		/* This mailbox is terminated */
 		printk(KERN_WARNING "eata_pio_reset: reset ccb %d.\n", x);
-		HD(cmd)->ccb[x].status = FREE;
+		SD(host)->ccb[x].status = FREE;
 
 		sp->scsi_done(sp);
 	}
 
-	HD(cmd)->state = 0;
+	SD(host)->state = 0;
 
 	spin_unlock_irq(host->host_lock);
 
drivers/scsi/esas2r/esas2r.h +1 -1
index 3fd305d..9f12a50 100644
@@ -982,7 +982,7 @@ long esas2r_proc_ioctl(struct file *fp, unsigned int cmd, unsigned long arg);
 /* SCSI error handler (eh) functions */
 int esas2r_eh_abort(struct scsi_cmnd *cmd);
 int esas2r_device_reset(struct scsi_cmnd *cmd);
-int esas2r_host_reset(struct scsi_cmnd *cmd);
+int esas2r_host_reset(struct Scsi_Host *shost);
 int esas2r_bus_reset(struct scsi_cmnd *cmd);
 int esas2r_target_reset(struct scsi_cmnd *cmd);
 
drivers/scsi/esas2r/esas2r_main.c +9 -7
index 6504a19..1fa2baa 100644
@@ -1126,10 +1126,10 @@ check_active_queue:
 	return SUCCESS;
 }
 
-static int esas2r_host_bus_reset(struct scsi_cmnd *cmd, bool host_reset)
+static int esas2r_host_bus_reset(struct Scsi_Host *shost, bool host_reset)
 {
 	struct esas2r_adapter *a =
-		(struct esas2r_adapter *)cmd->device->host->hostdata;
+		(struct esas2r_adapter *)shost->hostdata;
 
 	if (test_bit(AF_DEGRADED_MODE, &a->flags))
 		return FAILED;
@@ -1154,18 +1154,20 @@ static int esas2r_host_bus_reset(struct scsi_cmnd *cmd, bool host_reset)
 	return SUCCESS;
 }
 
-int esas2r_host_reset(struct scsi_cmnd *cmd)
+int esas2r_host_reset(struct Scsi_Host *shost)
 {
-	esas2r_log(ESAS2R_LOG_INFO, "host_reset (%p)", cmd);
+	esas2r_log(ESAS2R_LOG_INFO, "host_reset (%p)", shost);
 
-	return esas2r_host_bus_reset(cmd, true);
+	return esas2r_host_bus_reset(shost, true);
 }
 
 int esas2r_bus_reset(struct scsi_cmnd *cmd)
 {
-	esas2r_log(ESAS2R_LOG_INFO, "bus_reset (%p)", cmd);
+	struct Scsi_Host *shost = cmd->device->host;
+
+	esas2r_log(ESAS2R_LOG_INFO, "bus_reset (%p)", shost);
 
-	return esas2r_host_bus_reset(cmd, false);
+	return esas2r_host_bus_reset(shost, false);
 }
 
 static int esas2r_dev_targ_reset(struct scsi_cmnd *cmd, bool target_reset)
drivers/scsi/esp_scsi.c +2 -2
index 55548dc..f0b58b7 100644
@@ -2592,9 +2592,9 @@ static int esp_eh_bus_reset_handler(struct scsi_cmnd *cmd)
 }
 
 /* All bets are off, reset the entire device.  */
-static int esp_eh_host_reset_handler(struct scsi_cmnd *cmd)
+static int esp_eh_host_reset_handler(struct Scsi_Host *shost)
 {
-	struct esp *esp = shost_priv(cmd->device->host);
+	struct esp *esp = shost_priv(shost);
 	unsigned long flags;
 
 	spin_lock_irqsave(esp->host->host_lock, flags);
drivers/scsi/fnic/fnic.h +1 -1
index 1d3521e..0e0a87a 100644
@@ -343,7 +343,7 @@ void fnic_update_mac_locked(struct fnic *, u8 *new);
 int fnic_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
 int fnic_abort_cmd(struct scsi_cmnd *);
 int fnic_device_reset(struct scsi_cmnd *);
-int fnic_host_reset(struct scsi_cmnd *);
+int fnic_host_reset(struct Scsi_Host *);
 int fnic_reset(struct Scsi_Host *);
 void fnic_scsi_cleanup(struct fc_lport *);
 void fnic_scsi_abort_io(struct fc_lport *);
drivers/scsi/fnic/fnic_scsi.c +1 -2
index 1fa1a87..ba90ccb 100644
@@ -2465,11 +2465,10 @@ int fnic_reset(struct Scsi_Host *shost)
  * host is offlined by SCSI.
  *
  */
-int fnic_host_reset(struct scsi_cmnd *sc)
+int fnic_host_reset(struct Scsi_Host *shost)
 {
 	int ret;
 	unsigned long wait_host_tmo;
-	struct Scsi_Host *shost = sc->device->host;
 	struct fc_lport *lp = shost_priv(shost);
 
 	/*
drivers/scsi/ibmvscsi/ibmvfc.c +2 -2
index fee80fa..f2ed70c 100644
@@ -2528,10 +2528,10 @@ static int ibmvfc_eh_target_reset_handler(struct scsi_cmnd *cmd)
  * @cmd:	struct scsi_cmnd having problems
  *
  **/
-static int ibmvfc_eh_host_reset_handler(struct scsi_cmnd *cmd)
+static int ibmvfc_eh_host_reset_handler(struct Scsi_Host *shost)
 {
 	int rc, block_rc;
-	struct ibmvfc_host *vhost = shost_priv(cmd->device->host);
+	struct ibmvfc_host *vhost = shost_priv(shost);
 
 	dev_err(vhost->dev, "Resetting connection due to error recovery\n");
 	rc = ibmvfc_issue_fc_host_lip(vhost->host);
drivers/scsi/ibmvscsi/ibmvscsi.c +2 -2
index 2ebfb2b..3b3de48 100644
@@ -1719,10 +1719,10 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)
  * ibmvscsi_eh_host_reset_handler - Reset the connection to the server
  * @cmd:	struct scsi_cmnd having problems
 */
-static int ibmvscsi_eh_host_reset_handler(struct scsi_cmnd *cmd)
+static int ibmvscsi_eh_host_reset_handler(struct Scsi_Host *shost)
 {
 	unsigned long wait_switch = 0;
-	struct ibmvscsi_host_data *hostdata = shost_priv(cmd->device->host);
+	struct ibmvscsi_host_data *hostdata = shost_priv(shost);
 
 	dev_err(hostdata->dev, "Resetting connection due to error recovery\n");
 
drivers/scsi/imm.c +3 -4
index 89a8266..c5b97d7 100644
@@ -984,11 +984,11 @@ static void imm_reset_pulse(unsigned int base)
 	w_ctr(base, 0x04);
 }
 
-static int imm_reset(struct scsi_cmnd *cmd)
+static int imm_reset(struct Scsi_Host *shost)
 {
-	imm_struct *dev = imm_dev(cmd->device->host);
+	imm_struct *dev = imm_dev(shost);
 
-	if (cmd->SCp.phase)
+	if (dev->cur_cmd->SCp.phase)
 		imm_disconnect(dev);
 	dev->cur_cmd = NULL;	/* Forget the problem */
 
@@ -1104,7 +1104,6 @@ static struct scsi_host_template imm_template = {
 	.name			= "Iomega VPI2 (imm) interface",
 	.queuecommand		= imm_queuecommand,
 	.eh_abort_handler	= imm_abort,
-	.eh_bus_reset_handler	= imm_reset,
 	.eh_host_reset_handler	= imm_reset,
 	.bios_param		= imm_biosparam,
 	.this_id		= 7,
drivers/scsi/ipr.c +2 -2
index 924b0ba..26d3fd02 100644
@@ -4843,14 +4843,14 @@ static int ipr_slave_alloc(struct scsi_device *sdev)
 	return rc;
 }
 
-static int ipr_eh_host_reset(struct scsi_cmnd *cmd)
+static int ipr_eh_host_reset(struct Scsi_Host *shost)
 {
 	struct ipr_ioa_cfg *ioa_cfg;
 	unsigned long lock_flags = 0;
 	int rc = SUCCESS;
 
 	ENTER;
-	ioa_cfg = (struct ipr_ioa_cfg *) cmd->device->host->hostdata;
+	ioa_cfg = (struct ipr_ioa_cfg *) shost->hostdata;
 	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
 
 	if (!ioa_cfg->in_reset_reload && !ioa_cfg->hrrq[IPR_INIT_HRRQ].ioa_is_dead) {
drivers/scsi/ips.c +8 -32
index 52a216f..7615f05 100644
@@ -231,7 +231,7 @@ module_param(ips, charp, 0);
 static int ips_detect(struct scsi_host_template *);
 static int ips_release(struct Scsi_Host *);
 static int ips_eh_abort(struct scsi_cmnd *);
-static int ips_eh_reset(struct scsi_cmnd *);
+static int ips_eh_reset(struct Scsi_Host *);
 static int ips_queue(struct Scsi_Host *, struct scsi_cmnd *);
 static const char *ips_info(struct Scsi_Host *);
 static irqreturn_t do_ipsintr(int, void *);
@@ -838,13 +838,12 @@ int ips_eh_abort(struct scsi_cmnd *SC)
 /* NOTE: this routine is called under the io_request_lock spinlock          */
 /*                                                                          */
 /****************************************************************************/
-static int __ips_eh_reset(struct scsi_cmnd *SC)
+static int __ips_eh_reset(struct Scsi_Host *shost)
 {
 	int ret;
 	int i;
 	ips_ha_t *ha;
 	ips_scb_t *scb;
-	ips_copp_wait_item_t *item;
 
 	METHOD_TRACE("ips_eh_reset", 1);
 
@@ -852,13 +851,7 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)
 	return (FAILED);
 #else
 
-	if (!SC) {
-		DEBUG(1, "Reset called with NULL scsi command");
-
-		return (FAILED);
-	}
-
-	ha = (ips_ha_t *) SC->device->host->hostdata;
+	ha = (ips_ha_t *) shost->hostdata;
 
 	if (!ha) {
 		DEBUG(1, "Reset called with NULL ha struct");
@@ -869,23 +862,6 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)
 	if (!ha->active)
 		return (FAILED);
 
-	/* See if the command is on the copp queue */
-	item = ha->copp_waitlist.head;
-	while ((item) && (item->scsi_cmd != SC))
-		item = item->next;
-
-	if (item) {
-		/* Found it */
-		ips_removeq_copp(&ha->copp_waitlist, item);
-		return (SUCCESS);
-	}
-
-	/* See if the command is on the wait queue */
-	if (ips_removeq_wait(&ha->scb_waitlist, SC)) {
-		/* command not sent yet */
-		return (SUCCESS);
-	}
-
 	/* An explanation for the casual observer:                              */
 	/* Part of the function of a RAID controller is automatic error         */
 	/* detection and recovery.  As such, the only problem that physically   */
@@ -1024,13 +1000,13 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)
 
 }
 
-static int ips_eh_reset(struct scsi_cmnd *SC)
+static int ips_eh_reset(struct Scsi_Host *shost)
 {
 	int rc;
 
-	spin_lock_irq(SC->device->host->host_lock);
-	rc = __ips_eh_reset(SC);
-	spin_unlock_irq(SC->device->host->host_lock);
+	spin_lock_irq(shost->host_lock);
+	rc = __ips_eh_reset(shost);
+	spin_unlock_irq(shost->host_lock);
 
 	return rc;
 }
@@ -1109,7 +1085,7 @@ static int ips_queue_lck(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *)
 				return (0);
 			}
 			ha->ioctl_reset = 1;	/* This reset request is from an IOCTL */
-			__ips_eh_reset(SC);
+			__ips_eh_reset(SC->device->host);
 			SC->result = DID_OK << 16;
 			SC->scsi_done(SC);
 			return (0);
drivers/scsi/libfc/fc_fcp.c +2 -3
index 40f26ea..ab7ec74 100644
@@ -2116,11 +2116,10 @@ EXPORT_SYMBOL(fc_eh_device_reset);
 
 /**
  * fc_eh_host_reset() - Reset a Scsi_Host.
- * @sc_cmd: The SCSI command that identifies the SCSI host to be reset
+ * @shost: The SCSI host to be reset
  */
-int fc_eh_host_reset(struct scsi_cmnd *sc_cmd)
+int fc_eh_host_reset(struct Scsi_Host *shost)
 {
-	struct Scsi_Host *shost = sc_cmd->device->host;
 	struct fc_lport *lport = shost_priv(shost);
 	unsigned long wait_tmo;
 
drivers/scsi/lpfc/lpfc_scsi.c +1 -2
index 832cb9f..df4a43c 100644
@@ -5465,9 +5465,8 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd)
  *  0x2002 - Success
  **/
 static int
-lpfc_host_reset_handler(struct scsi_cmnd *cmnd)
+lpfc_host_reset_handler(struct Scsi_Host *shost)
 {
-	struct Scsi_Host *shost = cmnd->device->host;
 	struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
 	struct lpfc_hba *phba = vport->phba;
 	int rc, ret = SUCCESS;
drivers/scsi/mac53c94.c +4 -4
index e5cd8d8..f664f79 100644
@@ -101,14 +101,14 @@ static int mac53c94_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cm
 
 static DEF_SCSI_QCMD(mac53c94_queue)
 
-static int mac53c94_host_reset(struct scsi_cmnd *cmd)
+static int mac53c94_host_reset(struct Scsi_Host *shost)
 {
-	struct fsc_state *state = (struct fsc_state *) cmd->device->host->hostdata;
+	struct fsc_state *state = (struct fsc_state *) shost->hostdata;
 	struct mac53c94_regs __iomem *regs = state->regs;
 	struct dbdma_regs __iomem *dma = state->dma;
 	unsigned long flags;
 
-	spin_lock_irqsave(cmd->device->host->host_lock, flags);
+	spin_lock_irqsave(shost->host_lock, flags);
 
 	writel((RUN|PAUSE|FLUSH|WAKE) << 16, &dma->control);
 	writeb(CMD_SCSI_RESET, &regs->command);	/* assert RST */
@@ -118,7 +118,7 @@ static int mac53c94_host_reset(struct scsi_cmnd *cmd)
 	mac53c94_init(state);
 	writeb(CMD_NOP, &regs->command);
 
-	spin_unlock_irqrestore(cmd->device->host->host_lock, flags);
+	spin_unlock_irqrestore(shost->host_lock, flags);
 	return SUCCESS;
 }
 
drivers/scsi/megaraid.c +7 -9
index ac5d94c..e8ed321 100644
@@ -1889,13 +1889,13 @@ megaraid_abort(Scsi_Cmnd *cmd)
 
 
 static int
-megaraid_reset(struct scsi_cmnd *cmd)
+megaraid_reset(struct Scsi_Host *shost)
 {
 	adapter_t	*adapter;
 	megacmd_t	mc;
 	int		rval;
 
-	adapter = (adapter_t *)cmd->device->host->hostdata;
+	adapter = (adapter_t *)shost->hostdata;
 
 #if MEGA_HAVE_CLUSTERING
 	mc.cmd = MEGA_CLUSTER_CMD;
@@ -1912,7 +1912,7 @@ megaraid_reset(struct scsi_cmnd *cmd)
 
 	spin_lock_irq(&adapter->lock);
 
-	rval =  megaraid_abort_and_reset(adapter, cmd, SCB_RESET);
+	rval =  megaraid_abort_and_reset(adapter, NULL, SCB_RESET);
 
 	/*
 	 * This is required here to complete any completed requests
@@ -1938,6 +1938,7 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
 {
 	struct list_head	*pos, *next;
 	scb_t			*scb;
+	int failed = 0;
 
 	printk(KERN_WARNING "megaraid: %s cmd=%x <c=%d t=%d l=%d>\n",
 	     (aor == SCB_ABORT)? "ABORTING":"RESET",
@@ -1951,7 +1952,7 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
 
 		scb = list_entry(pos, scb_t, list);
 
-		if (scb->cmd == cmd) { /* Found command */
+		if (!cmd || scb->cmd == cmd) { /* Found command */
 
 			scb->state |= aor;
 
@@ -1968,7 +1969,7 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
 					(aor==SCB_ABORT) ? "ABORTING":"RESET",
 					scb->idx);
 
-				return FALSE;
+				failed++;
 			}
 			else {
 
@@ -1993,12 +1994,11 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
 				list_add_tail(SCSI_LIST(cmd),
 						&adapter->completed_list);
 
-				return TRUE;
 			}
 		}
 	}
 
-	return FALSE;
+	return failed ? FALSE : TRUE;
 }
 
 static inline int
@@ -4183,8 +4183,6 @@ static struct scsi_host_template megaraid_template = {
 	.cmd_per_lun			= DEF_CMD_PER_LUN,
 	.use_clustering			= ENABLE_CLUSTERING,
 	.eh_abort_handler		= megaraid_abort,
-	.eh_device_reset_handler	= megaraid_reset,
-	.eh_bus_reset_handler		= megaraid_reset,
 	.eh_host_reset_handler		= megaraid_reset,
 	.no_write_same			= 1,
 };
drivers/scsi/megaraid.h +1 -1
index 508d65e..6fb6adf 100644
@@ -963,7 +963,7 @@ static irqreturn_t megaraid_isr_iomapped(int, void *);
 static void mega_free_scb(adapter_t *, scb_t *);
 
 static int megaraid_abort(Scsi_Cmnd *);
-static int megaraid_reset(Scsi_Cmnd *);
+static int megaraid_reset(struct Scsi_Host *);
 static int megaraid_abort_and_reset(adapter_t *, Scsi_Cmnd *, int);
 static int megaraid_biosparam(struct scsi_device *, struct block_device *,
 		sector_t, int []);
drivers/scsi/megaraid/megaraid_mbox.c +4 -12
index e2237a9..6321d2a 100644
@@ -97,7 +97,7 @@ static int megaraid_sysfs_alloc_resources(adapter_t *);
 static void megaraid_sysfs_free_resources(adapter_t *);
 
 static int megaraid_abort_handler(struct scsi_cmnd *);
-static int megaraid_reset_handler(struct scsi_cmnd *);
+static int megaraid_reset_handler(struct Scsi_Host *);
 
 static int mbox_post_sync_cmd(adapter_t *, uint8_t []);
 static int mbox_post_sync_cmd_fast(adapter_t *, uint8_t []);
@@ -362,8 +362,6 @@ static struct scsi_host_template megaraid_template_g = {
 	.proc_name			= "megaraid",
 	.queuecommand			= megaraid_queue_command,
 	.eh_abort_handler		= megaraid_abort_handler,
-	.eh_device_reset_handler	= megaraid_reset_handler,
-	.eh_bus_reset_handler		= megaraid_reset_handler,
 	.eh_host_reset_handler		= megaraid_reset_handler,
 	.change_queue_depth		= megaraid_change_queue_depth,
 	.use_clustering			= ENABLE_CLUSTERING,
@@ -2591,7 +2589,7 @@ megaraid_abort_handler(struct scsi_cmnd *scp)
  * host.
  **/
 static int
-megaraid_reset_handler(struct scsi_cmnd *scp)
+megaraid_reset_handler(struct Scsi_Host *shost)
 {
 	adapter_t	*adapter;
 	scb_t		*scb;
@@ -2605,7 +2603,7 @@ megaraid_reset_handler(struct scsi_cmnd *scp)
 	int		i;
 	uioc_t		*kioc;
 
-	adapter		= SCP2ADAPTER(scp);
+	adapter		= (adapter_t *)SCSIHOST2ADAP(shost);
 	raid_dev	= ADAP2RAIDDEV(adapter);
 
 	// return failure if adapter is not responding
@@ -2637,15 +2635,9 @@ megaraid_reset_handler(struct scsi_cmnd *scp)
 
 			megaraid_mbox_mm_done(adapter, scb);
 		} else {
-			if (scb->scp == scp) {	// Found command
-				con_log(CL_ANN, (KERN_WARNING
-					"megaraid: %d[%d:%d], reset from pending list\n",
-					scb->sno, scb->dev_channel, scb->dev_target));
-			} else {
-				con_log(CL_ANN, (KERN_WARNING
+			con_log(CL_ANN, (KERN_WARNING
 				"megaraid: IO packet with %d[%d:%d] being reset\n",
 				scb->sno, scb->dev_channel, scb->dev_target));
-			}
 
 			scb->scp->result = (DID_RESET << 16);
 			scb->scp->scsi_done(scb->scp);
drivers/scsi/megaraid/megaraid_sas_base.c +7 -25
index 112799b..697d7ca 100644
@@ -2291,15 +2291,14 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
  * reset requests. Device, bus and host specific reset handlers can use this
  * function after they do their specific tasks.
  */
-static int megasas_generic_reset(struct scsi_cmnd *scmd)
+static int megasas_generic_reset(struct Scsi_Host *shost)
 {
 	int ret_val;
 	struct megasas_instance *instance;
 
-	instance = (struct megasas_instance *)scmd->device->host->hostdata;
+	instance = (struct megasas_instance *)shost->hostdata;
 
-	scmd_printk(KERN_NOTICE, scmd, "megasas: RESET cmd=%x retries=%x\n",
-		 scmd->cmnd[0], scmd->retries);
+	shost_printk(KERN_NOTICE, shost, "megasas: RESET\n");
 
 	if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR) {
 		printk(KERN_ERR "megasas: cannot recover from previous reset "
@@ -2349,28 +2348,13 @@ blk_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd)
 }
 
 /**
- * megasas_reset_device -	Device reset handler entry point
- */
-static int megasas_reset_device(struct scsi_cmnd *scmd)
-{
-	int ret;
-
-	/*
-	 * First wait for all commands to complete
-	 */
-	ret = megasas_generic_reset(scmd);
-
-	return ret;
-}
-
-/**
  * megasas_reset_bus_host -	Bus & host reset handler entry point
  */
-static int megasas_reset_bus_host(struct scsi_cmnd *scmd)
+static int megasas_reset_bus_host(struct Scsi_Host *shost)
 {
 	int ret;
 	struct megasas_instance *instance;
-	instance = (struct megasas_instance *)scmd->device->host->hostdata;
+	instance = (struct megasas_instance *)shost->hostdata;
 
 	/*
 	 * First wait for all commands to complete
@@ -2379,9 +2363,9 @@ static int megasas_reset_bus_host(struct scsi_cmnd *scmd)
 	    (instance->pdev->device == PCI_DEVICE_ID_LSI_PLASMA) ||
 	    (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) ||
 	    (instance->pdev->device == PCI_DEVICE_ID_LSI_FURY))
-		ret = megasas_reset_fusion(scmd->device->host, 1);
+		ret = megasas_reset_fusion(shost, 1);
 	else
-		ret = megasas_generic_reset(scmd);
+		ret = megasas_generic_reset(shost);
 
 	return ret;
 }
@@ -2504,8 +2488,6 @@ static struct scsi_host_template megasas_template = {
 	.slave_configure = megasas_slave_configure,
 	.slave_alloc = megasas_slave_alloc,
 	.queuecommand = megasas_queue_command,
-	.eh_device_reset_handler = megasas_reset_device,
-	.eh_bus_reset_handler = megasas_reset_bus_host,
 	.eh_host_reset_handler = megasas_reset_bus_host,
 	.eh_timed_out = megasas_reset_timer,
 	.bios_param = megasas_bios_param,
drivers/scsi/mesh.c +5 -5
index e8a04ae..8c2935d 100644
@@ -1700,9 +1700,9 @@ static int mesh_abort(struct scsi_cmnd *cmd)
  * The midlayer will wait for devices to come back, we don't need
  * to do that ourselves
  */
-static int mesh_host_reset(struct scsi_cmnd *cmd)
+static int mesh_host_reset(struct Scsi_Host *shost)
 {
-	struct mesh_state *ms = (struct mesh_state *) cmd->device->host->hostdata;
+	struct mesh_state *ms = (struct mesh_state *) shost->hostdata;
 	volatile struct mesh_regs __iomem *mr = ms->mesh;
 	volatile struct dbdma_regs __iomem *md = ms->dma;
 	unsigned long flags;
@@ -1716,7 +1716,7 @@ static int mesh_host_reset(struct scsi_cmnd *cmd)
 	out_8(&mr->exception, 0xff);	/* clear all exception bits */
 	out_8(&mr->error, 0xff);	/* clear all error bits */
 	out_8(&mr->sequence, SEQ_RESETMESH);
-       	mesh_flush_io(mr);
+	mesh_flush_io(mr);
 	udelay(1);
 	out_8(&mr->intr_mask, INT_ERROR | INT_EXCEPTION | INT_CMDDONE);
 	out_8(&mr->source_id, ms->host->this_id);
@@ -1725,13 +1725,13 @@ static int mesh_host_reset(struct scsi_cmnd *cmd)
 
 	/* Reset the bus */
 	out_8(&mr->bus_status1, BS1_RST);	/* assert RST */
-       	mesh_flush_io(mr);
+	mesh_flush_io(mr);
 	udelay(30);			/* leave it on for >= 25us */
 	out_8(&mr->bus_status1, 0);	/* negate RST */
 
 	/* Complete pending commands */
 	handle_reset(ms);
-	
+
 	spin_unlock_irqrestore(ms->host->host_lock, flags);
 	return SUCCESS;
 }
drivers/scsi/mpt2sas/mpt2sas_scsih.c +6 -7
index 5055f92..ccdbe0c 100644
@@ -2769,20 +2769,19 @@ _scsih_target_reset(struct scsi_cmnd *scmd)
  * Returns SUCCESS if command aborted else FAILED
  */
 static int
-_scsih_host_reset(struct scsi_cmnd *scmd)
+_scsih_host_reset(struct Scsi_Host *shost)
 {
-	struct MPT2SAS_ADAPTER *ioc = shost_priv(scmd->device->host);
+	struct MPT2SAS_ADAPTER *ioc = shost_priv(shost);
 	int r, retval;
 
-	printk(MPT2SAS_INFO_FMT "attempting host reset! scmd(%p)\n",
-	    ioc->name, scmd);
-	scsi_print_command(scmd);
+	printk(MPT2SAS_INFO_FMT "attempting host reset!\n",
+	    ioc->name);
 
 	retval = mpt2sas_base_hard_reset_handler(ioc, CAN_SLEEP,
 	    FORCE_BIG_HAMMER);
 	r = (retval < 0) ? FAILED : SUCCESS;
-	printk(MPT2SAS_INFO_FMT "host reset: %s scmd(%p)\n",
-	    ioc->name, ((r == SUCCESS) ? "SUCCESS" : "FAILED"), scmd);
+	printk(MPT2SAS_INFO_FMT "host reset: %s\n",
+	    ioc->name, ((r == SUCCESS) ? "SUCCESS" : "FAILED"));
 
 	return r;
 }
drivers/scsi/mpt3sas/mpt3sas_scsih.c +6 -7
index 0274ac3..1daae9e 100644
@@ -2427,20 +2427,19 @@ _scsih_target_reset(struct scsi_cmnd *scmd)
  * Returns SUCCESS if command aborted else FAILED
  */
 static int
-_scsih_host_reset(struct scsi_cmnd *scmd)
+_scsih_host_reset(struct Scsi_Host *shost)
 {
-	struct MPT3SAS_ADAPTER *ioc = shost_priv(scmd->device->host);
+	struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
 	int r, retval;
 
-	pr_info(MPT3SAS_FMT "attempting host reset! scmd(%p)\n",
-	    ioc->name, scmd);
-	scsi_print_command(scmd);
+	pr_info(MPT3SAS_FMT "attempting host reset!\n",
+	    ioc->name);
 
 	retval = mpt3sas_base_hard_reset_handler(ioc, CAN_SLEEP,
 	    FORCE_BIG_HAMMER);
 	r = (retval < 0) ? FAILED : SUCCESS;
-	pr_info(MPT3SAS_FMT "host reset: %s scmd(%p)\n",
-	    ioc->name, ((r == SUCCESS) ? "SUCCESS" : "FAILED"), scmd);
+	pr_info(MPT3SAS_FMT "host reset: %s\n",
+	    ioc->name, ((r == SUCCESS) ? "SUCCESS" : "FAILED"));
 
 	return r;
 }
drivers/scsi/mvumi.c +3 -4
index edbee8d..9ee3a3c 100644
@@ -723,14 +723,13 @@ static int mvumi_reset_host_9143(struct mvumi_hba *mhba)
 	return mvumi_wait_for_outstanding(mhba);
 }
 
-static int mvumi_host_reset(struct scsi_cmnd *scmd)
+static int mvumi_host_reset(struct Scsi_Host *shost)
 {
 	struct mvumi_hba *mhba;
 
-	mhba = (struct mvumi_hba *) scmd->device->host->hostdata;
+	mhba = (struct mvumi_hba *) shost->hostdata;
 
-	scmd_printk(KERN_NOTICE, scmd, "RESET -%ld cmd=%x retries=%x\n",
-			scmd->serial_number, scmd->cmnd[0], scmd->retries);
+	shost_printk(KERN_NOTICE, shost, "RESET\n");
 
 	return mhba->instancet->reset_host(mhba);
 }
drivers/scsi/nsp32.c +6 -8
index 0665f9c..953d0bc 100644
@@ -202,7 +202,7 @@ static int         nsp32_release     (struct Scsi_Host *);
 /* SCSI error handler */
 static int         nsp32_eh_abort     (struct scsi_cmnd *);
 static int         nsp32_eh_bus_reset (struct scsi_cmnd *);
-static int         nsp32_eh_host_reset(struct scsi_cmnd *);
+static int         nsp32_eh_host_reset(struct Scsi_Host *);
 
 /* generate SCSI message */
 static void nsp32_build_identify(struct scsi_cmnd *);
@@ -2909,23 +2909,21 @@ static void nsp32_do_bus_reset(nsp32_hw_data *data)
 	data->CurrentSC = NULL;
 }
 
-static int nsp32_eh_host_reset(struct scsi_cmnd *SCpnt)
+static int nsp32_eh_host_reset(struct Scsi_Host *host)
 {
-	struct Scsi_Host *host = SCpnt->device->host;
-	unsigned int      base = SCpnt->device->host->io_port;
+	unsigned int      base = host->io_port;
 	nsp32_hw_data    *data = (nsp32_hw_data *)host->hostdata;
 
-	nsp32_msg(KERN_INFO, "Host Reset");	
-	nsp32_dbg(NSP32_DEBUG_BUSRESET, "SCpnt=0x%x", SCpnt);
+	nsp32_msg(KERN_INFO, "Host Reset");
 
-	spin_lock_irq(SCpnt->device->host->host_lock);
+	spin_lock_irq(host->host_lock);
 
 	nsp32hw_init(data);
 	nsp32_write2(base, IRQ_CONTROL, IRQ_CONTROL_ALL_IRQ_MASK);
 	nsp32_do_bus_reset(data);
 	nsp32_write2(base, IRQ_CONTROL, 0);
 
-	spin_unlock_irq(SCpnt->device->host->host_lock);
+	spin_unlock_irq(host->host_lock);
 	return SUCCESS;	/* Host reset is succeeded at any time. */
 }
 
drivers/scsi/pcmcia/aha152x_stub.c +1 -1
index 7d1609f..f95abd9 100644
@@ -197,7 +197,7 @@ static int aha152x_resume(struct pcmcia_device *link)
 {
 	scsi_info_t *info = link->priv;
 
-	aha152x_host_reset_host(info->host);
+	aha152x_host_reset(info->host);
 
 	return 0;
 }
drivers/scsi/pcmcia/nsp_cs.c +2 -2
index 987fbb1..e8136b1 100644
@@ -1490,9 +1490,9 @@ static int nsp_eh_bus_reset(struct scsi_cmnd *SCpnt)
 	return nsp_bus_reset(data);
 }
 
-static int nsp_eh_host_reset(struct scsi_cmnd *SCpnt)
+static int nsp_eh_host_reset(struct Scsi_Host *host)
 {
-	nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
+	nsp_hw_data *data = (nsp_hw_data *)host->hostdata;
 
 	nsp_dbg(NSP_DEBUG_BUSRESET, "in");
 
drivers/scsi/pcmcia/sym53c500_cs.c +4 -4
index f5b5273..3d174a5 100644
@@ -586,14 +586,14 @@ SYM53C500_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
 static DEF_SCSI_QCMD(SYM53C500_queue)
 
 static int 
-SYM53C500_host_reset(struct scsi_cmnd *SCpnt)
+SYM53C500_host_reset(struct Scsi_Host *shost)
 {
-	int port_base = SCpnt->device->host->io_port;
+	int port_base = shost->io_port;
 
 	DEB(printk("SYM53C500_host_reset called\n"));
-	spin_lock_irq(SCpnt->device->host->host_lock);
+	spin_lock_irq(shost->host_lock);
 	SYM53C500_int_host_reset(port_base);
-	spin_unlock_irq(SCpnt->device->host->host_lock);
+	spin_unlock_irq(shost->host_lock);
 
 	return SUCCESS;
 }
drivers/scsi/pmcraid.c +2 -2
index 017f8b9..4e274f9 100644
@@ -3150,12 +3150,12 @@ static int pmcraid_eh_target_reset_handler(struct scsi_cmnd *scmd)
  * Return value
  *	SUCCESS or FAILED
  */
-static int pmcraid_eh_host_reset_handler(struct scsi_cmnd *scmd)
+static int pmcraid_eh_host_reset_handler(struct Scsi_Host *shost)
 {
 	unsigned long interval = 10000; /* 10 seconds interval */
 	int waits = jiffies_to_msecs(PMCRAID_RESET_HOST_TIMEOUT) / interval;
 	struct pmcraid_instance *pinstance =
-		(struct pmcraid_instance *)(scmd->device->host->hostdata);
+		(struct pmcraid_instance *)(shost->hostdata);
 
 
 	/* wait for an additional 150 seconds just in case firmware could come
drivers/scsi/ppa.c +3 -4
index 1db8b26..b542fe4 100644
@@ -856,11 +856,11 @@ static void ppa_reset_pulse(unsigned int base)
 	w_ctr(base, 0xc);
 }
 
-static int ppa_reset(struct scsi_cmnd *cmd)
+static int ppa_reset(struct Scsi_Host *shost)
 {
-	ppa_struct *dev = ppa_dev(cmd->device->host);
+	ppa_struct *dev = ppa_dev(shost);
 
-	if (cmd->SCp.phase)
+	if (dev->cur_cmd->SCp.phase)
 		ppa_disconnect(dev);
 	dev->cur_cmd = NULL;	/* Forget the problem */
 
@@ -969,7 +969,6 @@ static struct scsi_host_template ppa_template = {
 	.name			= "Iomega VPI0 (ppa) interface",
 	.queuecommand		= ppa_queuecommand,
 	.eh_abort_handler	= ppa_abort,
-	.eh_bus_reset_handler	= ppa_reset,
 	.eh_host_reset_handler	= ppa_reset,
 	.bios_param		= ppa_biosparam,
 	.this_id		= -1,
drivers/scsi/qla1280.c +19 -4
index 1580205..4bea9b9d 100644
@@ -1047,13 +1047,28 @@ qla1280_eh_bus_reset(struct scsi_cmnd *cmd)
  *     Reset the specified adapter (both channels)
  **************************************************************************/
 static int
-qla1280_eh_adapter_reset(struct scsi_cmnd *cmd)
+qla1280_eh_adapter_reset(struct Scsi_Host *shost)
 {
 	int rc;
+	struct scsi_qla_host *ha = (struct scsi_qla_host *)shost->hostdata;
 
-	spin_lock_irq(cmd->device->host->host_lock);
-	rc = qla1280_error_action(cmd, ADAPTER_RESET);
-	spin_unlock_irq(cmd->device->host->host_lock);
+	spin_lock_irq(shost->host_lock);
+	if (qla1280_verbose) {
+		printk(KERN_INFO
+		       "scsi(%ld): Issued ADAPTER RESET\n",
+		       ha->host_no);
+		printk(KERN_INFO "scsi(%ld): I/O processing will "
+		       "continue automatically\n", ha->host_no);
+	}
+	ha->flags.reset_active = 1;
+
+	if (qla1280_abort_isp(ha) != 0) {	/* it's dead */
+		rc = FAILED;
+	}
+
+	ha->flags.reset_active = 0;
+
+	spin_unlock_irq(shost->host_lock);
 
 	return rc;
 }
drivers/scsi/qla2xxx/qla_os.c +6 -11
index cd30445..96ff099 100644
@@ -234,7 +234,7 @@ static int qla2xxx_eh_abort(struct scsi_cmnd *);
 static int qla2xxx_eh_device_reset(struct scsi_cmnd *);
 static int qla2xxx_eh_target_reset(struct scsi_cmnd *);
 static int qla2xxx_eh_bus_reset(struct scsi_cmnd *);
-static int qla2xxx_eh_host_reset(struct scsi_cmnd *);
+static int qla2xxx_eh_host_reset(struct Scsi_Host *);
 
 static int qla2x00_change_queue_depth(struct scsi_device *, int, int);
 static int qla2x00_change_queue_type(struct scsi_device *, int);
@@ -1222,20 +1222,15 @@ eh_bus_reset_done:
 * Note:
 **************************************************************************/
 static int
-qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
+qla2xxx_eh_host_reset(struct Scsi_Host *shost)
 {
-	scsi_qla_host_t *vha = shost_priv(cmd->device->host);
+	scsi_qla_host_t *vha = shost_priv(shost);
 	struct qla_hw_data *ha = vha->hw;
 	int ret = FAILED;
-	unsigned int id;
-	uint64_t lun;
 	scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
 
-	id = cmd->device->id;
-	lun = cmd->device->lun;
-
 	ql_log(ql_log_info, vha, 0x8018,
-	    "ADAPTER RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun);
+	    "ADAPTER RESET ISSUED host=%ld.\n", vha->host_no);
 
 	/*
 	 * No point in issuing another reset if one is active.  Also do not
@@ -1281,8 +1276,8 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
 
 eh_host_reset_lock:
 	ql_log(ql_log_info, vha, 0x8017,
-	    "ADAPTER RESET %s nexus=%ld:%d:%llu.\n",
-	    (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun);
+	    "ADAPTER RESET %s host=%ld.\n",
+	    (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no);
 
 	return ret;
 }
drivers/scsi/qla4xxx/ql4_os.c +7 -9
index c5d9564..62706dd 100644
@@ -160,7 +160,7 @@ static int qla4xxx_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *cmd);
 static int qla4xxx_eh_abort(struct scsi_cmnd *cmd);
 static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd);
 static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd);
-static int qla4xxx_eh_host_reset(struct scsi_cmnd *cmd);
+static int qla4xxx_eh_host_reset(struct Scsi_Host *shost);
 static int qla4xxx_slave_alloc(struct scsi_device *device);
 static int qla4xxx_slave_configure(struct scsi_device *device);
 static void qla4xxx_slave_destroy(struct scsi_device *sdev);
@@ -9412,12 +9412,12 @@ static int qla4xxx_is_eh_active(struct Scsi_Host *shost)
  * This routine is invoked by the Linux kernel to perform fatal error
  * recovery on the specified adapter.
  **/
-static int qla4xxx_eh_host_reset(struct scsi_cmnd *cmd)
+static int qla4xxx_eh_host_reset(struct Scsi_Host *host)
 {
 	int return_status = FAILED;
 	struct scsi_qla_host *ha;
 
-	ha = to_qla_host(cmd->device->host);
+	ha = to_qla_host(host);
 
 	if ((is_qla8032(ha) || is_qla8042(ha)) && ql4xdontresethba)
 		qla4_83xx_set_idc_dontreset(ha);
@@ -9433,20 +9433,18 @@ static int qla4xxx_eh_host_reset(struct scsi_cmnd *cmd)
 		     ha->host_no, __func__));
 
 		/* Clear outstanding srb in queues */
-		if (qla4xxx_is_eh_active(cmd->device->host))
+		if (qla4xxx_is_eh_active(host))
 			qla4xxx_abort_active_cmds(ha, DID_ABORT << 16);
 
 		return FAILED;
 	}
 
 	ql4_printk(KERN_INFO, ha,
-		   "scsi(%ld:%d:%d:%llu): HOST RESET ISSUED.\n", ha->host_no,
-		   cmd->device->channel, cmd->device->id, cmd->device->lun);
+		   "scsi%ld: HOST RESET ISSUED.\n", ha->host_no);
 
 	if (qla4xxx_wait_for_hba_online(ha) != QLA_SUCCESS) {
-		DEBUG2(printk("scsi%ld:%d: %s: Unable to reset host.  Adapter "
-			      "DEAD.\n", ha->host_no, cmd->device->channel,
-			      __func__));
+		DEBUG2(printk("scsi%ld: %s: Unable to reset host.  Adapter "
+			      "DEAD.\n", ha->host_no, __func__));
 
 		return FAILED;
 	}
drivers/scsi/scsi_debug.c +1 -1
index 6ed43fd..ae7e1ae 100644
@@ -2614,7 +2614,7 @@ static int scsi_debug_bus_reset(struct scsi_cmnd * SCpnt)
 	return SUCCESS;
 }
 
-static int scsi_debug_host_reset(struct scsi_cmnd * SCpnt)
+static int scsi_debug_host_reset(struct Scsi_Host * shost)
 {
 	struct sdebug_host_info * sdbg_host;
         struct sdebug_dev_info * dev_info;
drivers/scsi/scsi_error.c +1 -1
index e4a5324..ff069780 100644
@@ -765,7 +765,7 @@ static int scsi_try_host_reset(struct scsi_cmnd *scmd)
 	if (!hostt->eh_host_reset_handler)
 		return FAILED;
 
-	rtn = hostt->eh_host_reset_handler(scmd);
+	rtn = hostt->eh_host_reset_handler(host);
 
 	if (rtn == SUCCESS) {
 		if (!hostt->skip_settle_delay)
drivers/scsi/sgiwd93.c +0 -15
index a464d95..9ceb12c 100644
@@ -192,20 +192,6 @@ static inline void init_hpc_chain(struct ip22_hostdata *hdata)
 	hcp->desc.pnext = hdata->dma;
 }
 
-static int sgiwd93_bus_reset(struct scsi_cmnd *cmd)
-{
-	/* FIXME perform bus-specific reset */
-
-	/* FIXME 2: kill this function, and let midlayer fallback
-	   to the same result, calling wd33c93_host_reset() */
-
-	spin_lock_irq(cmd->device->host->host_lock);
-	wd33c93_host_reset(cmd);
-	spin_unlock_irq(cmd->device->host->host_lock);
-
-	return SUCCESS;
-}
-
 /*
  * Kludge alert - the SCSI code calls the abort and reset method with int
  * arguments not with pointers.  So this is going to blow up beautyfully
@@ -217,7 +203,6 @@ static struct scsi_host_template sgiwd93_template = {
 	.name			= "SGI WD93",
 	.queuecommand		= wd33c93_queuecommand,
 	.eh_abort_handler	= wd33c93_abort,
-	.eh_bus_reset_handler	= sgiwd93_bus_reset,
 	.eh_host_reset_handler	= wd33c93_host_reset,
 	.can_queue		= 16,
 	.this_id		= 7,
drivers/scsi/stex.c +2 -3
index 1aa4bef..2868f80 100644
@@ -1346,15 +1346,14 @@ static int stex_do_reset(struct st_hba *hba)
 	return -1;
 }
 
-static int stex_reset(struct scsi_cmnd *cmd)
+static int stex_reset(struct Scsi_Host *shost)
 {
 	struct st_hba *hba;
 
-	hba = (struct st_hba *) &cmd->device->host->hostdata[0];
+	hba = (struct st_hba *) &shost->hostdata[0];
 
 	printk(KERN_INFO DRV_NAME
 		"(%s): resetting host\n", pci_name(hba->pdev));
-	scsi_print_command(cmd);
 
 	return stex_do_reset(hba) ? FAILED : SUCCESS;
 }
drivers/scsi/storvsc_drv.c +2 -2
index 9969fa1..9b59609 100644
@@ -1467,9 +1467,9 @@ static int storvsc_get_chs(struct scsi_device *sdev, struct block_device * bdev,
 	return 0;
 }
 
-static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
+static int storvsc_host_reset_handler(struct Scsi_Host *shost)
 {
-	struct hv_host_device *host_dev = shost_priv(scmnd->device->host);
+	struct hv_host_device *host_dev = shost_priv(shost);
 	struct hv_device *device = host_dev->dev;
 
 	struct storvsc_device *stor_device;
drivers/scsi/sym53c416.c +3 -3
index 0b7819f..3e8a615 100644
@@ -762,17 +762,17 @@ static int sym53c416_queuecommand_lck(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *
 
 DEF_SCSI_QCMD(sym53c416_queuecommand)
 
-static int sym53c416_host_reset(Scsi_Cmnd *SCpnt)
+static int sym53c416_host_reset(struct Scsi_Host *shost)
 {
 	int base;
-	int scsi_id = -1;	
+	int scsi_id = -1;
 	int i;
 	unsigned long flags;
 
 	spin_lock_irqsave(&sym53c416_lock, flags);
 
 	/* printk("sym53c416_reset\n"); */
-	base = SCpnt->device->host->io_port;
+	base = shost->io_port;
 	/* search scsi_id - fixme, we shouldn't need to iterate for this! */
 	for(i = 0; i < host_index && scsi_id == -1; i++)
 		if(hosts[i].base == base)
drivers/scsi/sym53c8xx_2/sym_glue.c +32 -15

90 lines not on this page · raw message

drivers/scsi/u14-34f.c +5 -12
index 5a03bb3..773b811 100644
@@ -434,7 +434,7 @@ static int u14_34f_detect(struct scsi_host_template *);
 static int u14_34f_release(struct Scsi_Host *);
 static int u14_34f_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
 static int u14_34f_eh_abort(struct scsi_cmnd *);
-static int u14_34f_eh_host_reset(struct scsi_cmnd *);
+static int u14_34f_eh_host_reset(struct Scsi_Host *);
 static int u14_34f_bios_param(struct scsi_device *, struct block_device *,
                               sector_t, int *);
 static int u14_34f_slave_configure(struct scsi_device *);
@@ -1392,20 +1392,15 @@ static int u14_34f_eh_abort(struct scsi_cmnd *SCarg) {
    panic("%s: abort, mbox %d, invalid cp_stat.\n", BN(j), i);
 }
 
-static int u14_34f_eh_host_reset(struct scsi_cmnd *SCarg) {
+static int u14_34f_eh_host_reset(struct Scsi_Host *shost) {
    unsigned int i, j, k, c, limit = 0;
    unsigned long time;
-   int arg_done = FALSE;
-   struct scsi_cmnd *SCpnt;
 
-   j = ((struct hostdata *) SCarg->device->host->hostdata)->board_number;
-   scmd_printk(KERN_INFO, SCarg, "reset, enter.\n");
+   j = ((struct hostdata *) shost->hostdata)->board_number;
+   shost_printk(KERN_INFO, shost, "reset, enter.\n");
 
    spin_lock_irq(sh[j]->host_lock);
 
-   if (SCarg->host_scribble == NULL)
-      printk("%s: reset, inactive.\n", BN(j));
-
    if (HD(j)->in_reset) {
       printk("%s: reset, exit, already in reset.\n", BN(j));
       spin_unlock_irq(sh[j]->host_lock);
@@ -1458,7 +1453,6 @@ static int u14_34f_eh_host_reset(struct scsi_cmnd *SCarg) {
       if (SCpnt->scsi_done == NULL)
          panic("%s: reset, mbox %d, SCpnt->scsi_done == NULL.\n", BN(j), i);
 
-      if (SCpnt == SCarg) arg_done = TRUE;
       }
 
    if (wait_on_busy(sh[j]->io_port, MAXLOOP)) {
@@ -1520,8 +1514,7 @@ static int u14_34f_eh_host_reset(struct scsi_cmnd *SCarg) {
    HD(j)->in_reset = FALSE;
    do_trace = FALSE;
 
-   if (arg_done) printk("%s: reset, exit, done.\n", BN(j));
-   else          printk("%s: reset, exit.\n", BN(j));
+   printk("%s: reset, exit.\n", BN(j));
 
    spin_unlock_irq(sh[j]->host_lock);
    return SUCCESS;
drivers/scsi/ultrastor.c +3 -4
index 14e0c40..406299c 100644
@@ -969,18 +969,17 @@ static int ultrastor_abort(struct scsi_cmnd *SCpnt)
     return SUCCESS;
 }
 
-static int ultrastor_host_reset(struct scsi_cmnd * SCpnt)
+static int ultrastor_host_reset(struct Scsi_Host * host)
 {
     unsigned long flags;
     int i;
-    struct Scsi_Host *host = SCpnt->device->host;
-    
+
 #if (ULTRASTOR_DEBUG & UD_RESET)
     printk("US14F: reset: called\n");
 #endif
 
     if(config.slot)
-    	return FAILED;
+	return FAILED;
 
     spin_lock_irqsave(host->host_lock, flags);
     /* Reset the adapter and SCSI bus.  The SCSI bus reset can be
drivers/scsi/vmw_pvscsi.c +2 -3
index c88e146..a82d3d5 100644
@@ -868,14 +868,13 @@ static void pvscsi_reset_all(struct pvscsi_adapter *adapter)
 	}
 }
 
-static int pvscsi_host_reset(struct scsi_cmnd *cmd)
+static int pvscsi_host_reset(struct Scsi_Host *host)
 {
-	struct Scsi_Host *host = cmd->device->host;
 	struct pvscsi_adapter *adapter = shost_priv(host);
 	unsigned long flags;
 	bool use_msg;
 
-	scmd_printk(KERN_INFO, cmd, "SCSI Host reset\n");
+	shost_printk(KERN_INFO, host, "SCSI Host reset\n");
 
 	spin_lock_irqsave(&adapter->hw_lock, flags);
 
drivers/scsi/wd33c93.c +2 -5
index 41883a8..b9fb855 100644
@@ -1570,16 +1570,14 @@ reset_wd33c93(struct Scsi_Host *instance)
 }
 
 int
-wd33c93_host_reset(struct scsi_cmnd * SCpnt)
+wd33c93_host_reset(struct Scsi_Host * instance)
 {
-	struct Scsi_Host *instance;
 	struct WD33C93_hostdata *hostdata;
 	int i;
 
-	instance = SCpnt->device->host;
 	hostdata = (struct WD33C93_hostdata *) instance->hostdata;
 
-	printk("scsi%d: reset. ", instance->host_no);
+	shost_printk(KERN_INFO, instance, "reset. ");
 	disable_irq(instance->irq);
 
 	hostdata->dma_stop(instance, NULL, 0);
@@ -1600,7 +1598,6 @@ wd33c93_host_reset(struct scsi_cmnd * SCpnt)
 	hostdata->outgoing_len = 0;
 
 	reset_wd33c93(instance);
-	SCpnt->result = DID_RESET << 16;
 	enable_irq(instance->irq);
 	return SUCCESS;
 }
drivers/scsi/wd33c93.h +1 -1
index 08abe50..4d2d3cb 100644
@@ -347,6 +347,6 @@ int wd33c93_queuecommand (struct Scsi_Host *h, struct scsi_cmnd *cmd);
 void wd33c93_intr (struct Scsi_Host *instance);
 int wd33c93_show_info(struct seq_file *, struct Scsi_Host *);
 int wd33c93_write_info(struct Scsi_Host *, char *, int);
-int wd33c93_host_reset (struct scsi_cmnd *);
+int wd33c93_host_reset (struct Scsi_Host *);
 
 #endif /* WD33C93_H */
drivers/scsi/wd7000.c +5 -5
index 3267423..91ad166 100644
@@ -1568,20 +1568,20 @@ static int wd7000_abort(Scsi_Cmnd * SCpnt)
  *  Last resort. Reinitialize the board.
  */
 
-static int wd7000_host_reset(struct scsi_cmnd *SCpnt)
+static int wd7000_host_reset(struct Scsi_Host *shost)
 {
-	Adapter *host = (Adapter *) SCpnt->device->host->hostdata;
+	Adapter *host = (Adapter *) shost->hostdata;
 
-	spin_lock_irq(SCpnt->device->host->host_lock);
+	spin_lock_irq(shost->host_lock);
 
 	if (wd7000_adapter_reset(host) < 0) {
-		spin_unlock_irq(SCpnt->device->host->host_lock);
+		spin_unlock_irq(shost->host_lock);
 		return FAILED;
 	}
 
 	wd7000_enable_intr(host);
 
-	spin_unlock_irq(SCpnt->device->host->host_lock);
+	spin_unlock_irq(shost->host_lock);
 	return SUCCESS;
 }
 
drivers/usb/image/microtek.c +2 -2
index 37b44b0..d8c26fd 100644
@@ -346,9 +346,9 @@ static int mts_scsi_abort(struct scsi_cmnd *srb)
 	return FAILED;
 }
 
-static int mts_scsi_host_reset(struct scsi_cmnd *srb)
+static int mts_scsi_host_reset(struct Scsi_Host *shost)
 {
-	struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]);
+	struct mts_desc* desc = (struct mts_desc*)(shost->hostdata[0]);
 	int result;
 
 	MTS_DEBUG_GOT_HERE();
include/scsi/libfc.h +1 -1
index 52beadf..e5d348f 100644
@@ -1103,7 +1103,7 @@ void fc_fcp_destroy(struct fc_lport *);
 int fc_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
 int fc_eh_abort(struct scsi_cmnd *);
 int fc_eh_device_reset(struct scsi_cmnd *);
-int fc_eh_host_reset(struct scsi_cmnd *);
+int fc_eh_host_reset(struct Scsi_Host *);
 int fc_slave_alloc(struct scsi_device *);
 int fc_change_queue_depth(struct scsi_device *, int qdepth, int reason);
 int fc_change_queue_type(struct scsi_device *, int tag_type);
include/scsi/scsi_host.h +1 -1
index abb6958..95a8cbd 100644
@@ -174,7 +174,7 @@ struct scsi_host_template {
 	int (* eh_device_reset_handler)(struct scsi_cmnd *);
 	int (* eh_target_reset_handler)(struct scsi_cmnd *);
 	int (* eh_bus_reset_handler)(struct scsi_cmnd *);
-	int (* eh_host_reset_handler)(struct scsi_cmnd *);
+	int (* eh_host_reset_handler)(struct Scsi_Host *);
 
 	/*
 	 * Before the mid layer attempts to scan for a new device where none
Signature · 1 line
1.7.12.4
#8 lore raw

Re: [PATCH 6/7] scsi: Use Scsi_Host as argument for eh_host_reset_handler

Quoted 15 lines · Hannes Reinecke

Issuing a host reset should not rely on any commands. So use Scsi_Host as argument for eh_host_reset_handler.

---

  drivers/s390/scsi/zfcp_scsi.c             |  3 +-
  69 files changed, 289 insertions(+), 379 deletions(-)
drivers/s390/scsi/zfcp_scsi.c +0 -0
index dc42c93..fe50f69 100644

drivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt) · line 286

Quoted 7 lines
drivers/s390/scsi/zfcp_scsi.c +1 -1
@@ -281,13 +281,14 @@ static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt)
  	return zfcp_task_mgmt_function(scpnt, FCP_TMF_TGT_RESET);
  }
 
-static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
+static int zfcp_scsi_eh_host_reset_handler(struct Scsi_Host *host)
  {
  	struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);

Scpnt argument no longer exists, so this line must likely go away to compile.

drivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt) · line 287

Quoted 1 line
drivers/s390/scsi/zfcp_scsi.c +0 -0
  	struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;

This needs the assignment from the added line below since zfcp_sdev no longer exists.
Alternatively, drop the assignment here, only have the auto variable definition, and do the assignment below with the added line.

drivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt) · line 294

Quoted 7 lines
drivers/s390/scsi/zfcp_scsi.c +1 -0
  	struct fc_rport *rport = zfcp_sdev->port->rport;
  	int ret;
 
+	adapter = (struct zfcp_adapter *)host->hostdata[0];
  	zfcp_erp_adapter_reopen(adapter, 0, "schrh_1");
  	zfcp_erp_wait(adapter);
  	ret = fc_block_scsi_eh(rport);

A question just for my understanding: Calling fc_block_scsi_eh at the end *after* our adapter recovery is OK to wait for rports to become unblocked (or fast_io_failed)? I would guess so.

Signature · 15 lines
Mit freundlichen Grüßen / Kind regards
Steffen Maier

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#9 lore raw

Re: [PATCH 6/7] scsi: Use Scsi_Host as argument for eh_host_reset_handler

Quoted 44 lines · Steffen Maier
Quoted 16 lines · Hannes Reinecke

Issuing a host reset should not rely on any commands. So use Scsi_Host as argument for eh_host_reset_handler.

---

  drivers/s390/scsi/zfcp_scsi.c             |  3 +-
  69 files changed, 289 insertions(+), 379 deletions(-)
drivers/s390/scsi/zfcp_scsi.c +0 -0
index dc42c93..fe50f69 100644

drivers/s390/scsi/zfcp_scsi.c static int · line 287

Quoted 8 lines
drivers/s390/scsi/zfcp_scsi.c +1 -1
@@ -281,13 +281,14 @@ static int
 zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt)
      return zfcp_task_mgmt_function(scpnt, FCP_TMF_TGT_RESET);
  }
 
-static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
+static int zfcp_scsi_eh_host_reset_handler(struct Scsi_Host *host)
  {
      struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);

Scpnt argument no longer exists, so this line must likely go away to compile.

drivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt) · line 287

Quoted 1 line
drivers/s390/scsi/zfcp_scsi.c +0 -0
      struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;

This needs the assignment from the added line below since zfcp_sdev no longer exists.
Alternatively, drop the assignment here, only have the auto variable definition, and do the assignment below with the added line.

Quoted 7 lines
drivers/s390/scsi/zfcp_scsi.c +1 -0
      struct fc_rport *rport = zfcp_sdev->port->rport;
      int ret;
 
+    adapter = (struct zfcp_adapter *)host->hostdata[0];
      zfcp_erp_adapter_reopen(adapter, 0, "schrh_1");
      zfcp_erp_wait(adapter);
      ret = fc_block_scsi_eh(rport);
Quoted 5 lines

A question just for my understanding: Calling fc_block_scsi_eh at the end *after* our adapter recovery is OK to wait for rports to become unblocked (or fast_io_failed)?
I would guess so.

Hehe. That's actually a question for _you_ :-)

Thing is, 'fc_block_scsi-eh' only waits for the rport to become unblocked; the unblocking itself would need to be done from the LLDD. So I would like to ask the maintainer of the LLDD why this code is there; normally I would have expected the 'zfcp_erp_wait' to only return after the HBA is fully online again.

And in general waiting for an rport during host reset is _really_ a bad idea. The rport might not be present after host reset at all, making the check pretty much pointless.

Can't you check whether the HBA is in a working state after zfcp_erp_wait() and return a status based on that?

Cheers,

Hannes

Signature · 8 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#10 lore raw

Re: [PATCH 6/7] scsi: Use Scsi_Host as argument for eh_host_reset_handler

Quoted 45 lines · Hannes Reinecke
Quoted 44 lines · Steffen Maier
Quoted 16 lines · Hannes Reinecke

Issuing a host reset should not rely on any commands. So use Scsi_Host as argument for eh_host_reset_handler.

---

  drivers/s390/scsi/zfcp_scsi.c             |  3 +-
  69 files changed, 289 insertions(+), 379 deletions(-)
drivers/s390/scsi/zfcp_scsi.c +0 -0
index dc42c93..fe50f69 100644

drivers/s390/scsi/zfcp_scsi.c static int · line 287

Quoted 8 lines
drivers/s390/scsi/zfcp_scsi.c +1 -1
@@ -281,13 +281,14 @@ static int
 zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt)
      return zfcp_task_mgmt_function(scpnt, FCP_TMF_TGT_RESET);
  }
 
-static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
+static int zfcp_scsi_eh_host_reset_handler(struct Scsi_Host *host)
  {
      struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);

Scpnt argument no longer exists, so this line must likely go away to compile.

drivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt) · line 287

Quoted 1 line
drivers/s390/scsi/zfcp_scsi.c +0 -0
      struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;

This needs the assignment from the added line below since zfcp_sdev no longer exists.
Alternatively, drop the assignment here, only have the auto variable definition, and do the assignment below with the added line.

Quoted 7 lines
drivers/s390/scsi/zfcp_scsi.c +1 -0
      struct fc_rport *rport = zfcp_sdev->port->rport;
      int ret;
 
+    adapter = (struct zfcp_adapter *)host->hostdata[0];
      zfcp_erp_adapter_reopen(adapter, 0, "schrh_1");
      zfcp_erp_wait(adapter);
      ret = fc_block_scsi_eh(rport);
Quoted 6 lines
Quoted 5 lines

A question just for my understanding: Calling fc_block_scsi_eh at the end *after* our adapter recovery is OK to wait for rports to become unblocked (or fast_io_failed)?
I would guess so.

Hehe. That's actually a question for _you_ :-)

git says:

commit af4de36d911ab907b92c5f3f81ceff8474ed7485

Author: Christof Schmitt <[email protected]>
Date:   Tue Nov 24 16:54:16 2009 +0100

[SCSI] zfcp: Block scsi_eh thread for rport state BLOCKED

In case the SCSI error recovery starts because of a SCSI command timeout, but then something else triggers the rport to be deleted, the SCSI error recovery will run to the end and set the SCSI device offline. To prevent this, call the FC transport function fc_block_scsi_eh which waits until the rport leaves the BLOCKED state. This guarantees that communication is possible if the rport is ONLINE, or the SCSI devices will be removed if the rport state switches to NOT_PRESENT.

Not sure if this reasoning is (still) valid.

Isn't command timeouts the only reason for scsi eh to kick in?

Martin

Signature · 12 lines
Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#11 lore raw

Re: [PATCH 6/7] scsi: Use Scsi_Host as argument for eh_host_reset_handler

Quoted 71 lines · Martin Peschke
Quoted 45 lines · Hannes Reinecke
Quoted 44 lines · Steffen Maier
Quoted 16 lines · Hannes Reinecke

Issuing a host reset should not rely on any commands. So use Scsi_Host as argument for eh_host_reset_handler.

---

   drivers/s390/scsi/zfcp_scsi.c             |  3 +-
   69 files changed, 289 insertions(+), 379 deletions(-)
drivers/s390/scsi/zfcp_scsi.c +0 -0
index dc42c93..fe50f69 100644

drivers/s390/scsi/zfcp_scsi.c static int · line 287

Quoted 8 lines
drivers/s390/scsi/zfcp_scsi.c +1 -1
@@ -281,13 +281,14 @@ static int
 zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt)
       return zfcp_task_mgmt_function(scpnt, FCP_TMF_TGT_RESET);
   }
 
-static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
+static int zfcp_scsi_eh_host_reset_handler(struct Scsi_Host *host)
   {
       struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);

Scpnt argument no longer exists, so this line must likely go away to compile.

drivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt) · line 287

Quoted 1 line
drivers/s390/scsi/zfcp_scsi.c +0 -0
       struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;

This needs the assignment from the added line below since zfcp_sdev no longer exists.
Alternatively, drop the assignment here, only have the auto variable definition, and do the assignment below with the added line.

Quoted 7 lines
drivers/s390/scsi/zfcp_scsi.c +1 -0
       struct fc_rport *rport = zfcp_sdev->port->rport;
       int ret;
 
+    adapter = (struct zfcp_adapter *)host->hostdata[0];
       zfcp_erp_adapter_reopen(adapter, 0, "schrh_1");
       zfcp_erp_wait(adapter);
       ret = fc_block_scsi_eh(rport);
Quoted 6 lines
Quoted 5 lines

A question just for my understanding: Calling fc_block_scsi_eh at the end *after* our adapter recovery is OK to wait for rports to become unblocked (or fast_io_failed)?
I would guess so.

Hehe. That's actually a question for _you_ :-)

git says:

commit af4de36d911ab907b92c5f3f81ceff8474ed7485

Author: Christof Schmitt <[email protected]>
Date:   Tue Nov 24 16:54:16 2009 +0100

[SCSI] zfcp: Block scsi_eh thread for rport state BLOCKED

In case the SCSI error recovery starts because of a SCSI command timeout, but then something else triggers the rport to be deleted, the SCSI error recovery will run to the end and set the SCSI device offline. To prevent this, call the FC transport function fc_block_scsi_eh which waits until the rport leaves the BLOCKED state. This guarantees that communication is possible if the rport is ONLINE, or the SCSI devices will be removed if the rport state switches to NOT_PRESENT.

Quoted 4 lines

Not sure if this reasoning is (still) valid.

Isn't command timeouts the only reason for scsi eh to kick in?

In principle, no (there are some corner cases when evaluating the SCSI command result which will trigger scsi_eh). But in practice timeout is the most common reason here.

Also we've done tons of improvements and fixes in this area since 2009, so I'm all for removing this.

But without it host_reset can never _ever_ fail with zfcp. Is that correct?

Cheers,

Hannes

Signature · 8 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#12 lore raw

Re: [PATCH 6/7] scsi: Use Scsi_Host as argument for eh_host_reset_handler

In reply to Steffen Maier

What base does this patch set apply to?
I failed with scsi:misc / scsi:fixes / vanilla.

Quoted 29 lines · Steffen Maier
Quoted 16 lines · Hannes Reinecke

Issuing a host reset should not rely on any commands. So use Scsi_Host as argument for eh_host_reset_handler.

---

  drivers/s390/scsi/zfcp_scsi.c             |  3 +-
  69 files changed, 289 insertions(+), 379 deletions(-)
drivers/s390/scsi/zfcp_scsi.c +0 -0
index dc42c93..fe50f69 100644

drivers/s390/scsi/zfcp_scsi.c static int · line 287

Quoted 8 lines
drivers/s390/scsi/zfcp_scsi.c +1 -1
@@ -281,13 +281,14 @@ static int
 zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt)
      return zfcp_task_mgmt_function(scpnt, FCP_TMF_TGT_RESET);
  }
 
-static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
+static int zfcp_scsi_eh_host_reset_handler(struct Scsi_Host *host)
  {
      struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);

Scpnt argument no longer exists, so this line must likely go away to compile.

Quoted 8 lines

drivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt) · line 287

Quoted 1 line
drivers/s390/scsi/zfcp_scsi.c +0 -0
      struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;

This needs the assignment from the added line below since zfcp_sdev no longer exists.
Alternatively, drop the assignment here, only have the auto variable definition, and do the assignment below with the added line.

Quoted 1 line
drivers/s390/scsi/zfcp_scsi.c +0 -0
      struct fc_rport *rport = zfcp_sdev->port->rport;

Oh crap, this also no longer works now. And as a consequence we cannot get a reasonable rport any more now to call fc_block_scsi_eh().

I think it's us as LLDD calling fc_remote_port_add() anyway as part of adapter/port recovery, so we trigger the change to an unblocked rport. So, now we "only" need to make sure to block long enough for all fc_remote_port_add's to have happened? zfcp_erp_wait() might not be sufficient which is probably why Christof introduced fc_block_scsi_eh() in that commit Martin referred to.

Where's a design document which explains how to correctly use scsi_transport_fc?

Quoted 1 line

drivers/s390/scsi/zfcp_scsi.c static int · line 290

Quoted 1 line
drivers/s390/scsi/zfcp_scsi.c +0 -0
      int ret;

If adapter recovery fails, e.g. because there is no local light on the fibre, I would suppose that our recovery ended with a blocked Scsi_Host (at the latest after zfcp_erp_wait()). Is that sufficient or do we need to actually return the success of the host reset from this handler function?
If not, we drop the "ret" variable as well.
If yes, how is host reset success defined?
Is it success, e.g. if adapter recovery succeeded but there is no light on the fibre?

Quoted 10 lines

drivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt) · line 294

Quoted 5 lines
drivers/s390/scsi/zfcp_scsi.c +1 -0
+    adapter = (struct zfcp_adapter *)host->hostdata[0];
      zfcp_erp_adapter_reopen(adapter, 0, "schrh_1");
      zfcp_erp_wait(adapter);
      ret = fc_block_scsi_eh(rport);

A question just for my understanding: Calling fc_block_scsi_eh at the end *after* our adapter recovery is OK to wait for rports to become unblocked (or fast_io_failed)?
I would guess so.

Maybe we could replace the call to fc_block_scsi_eh() with something like the following which would wait until zfcp called fc_remote_port_add() [synchronously via work item in zfcp_scsi_schedule_rport_register() during port recovery or if link test with ADISC succeeded] for all ports of the adapter as part of the adapter recovery:

flush_workqueue(adapter->work_queue);

That's as coarse granular as the zfcp_erp_wait() just waiting for the queue to run empty, no matter which items were queued.
Strictly speaking we would only wait for all rport work items of this adapter, but that's more complicated to code. It would be safer to actually return in time, and not prolong arbitrarily if new work items were queued meanwhile and the work queue does not become empty, but then again flush_workqueue might already be safe compared to drain_workqueue.

Can I assume, that fc_remote_port_add() is synchronous and does the rport state change to unblocked before returning? If so, I would think this would semantically replace our previous call to fc_block_scsi_eh().

Does any of this make sense?

To make a long story short: I'm still kinda clueless how to get this right.

Signature · 15 lines
Mit freundlichen Grüßen / Kind regards
Steffen Maier

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#13 lore raw

Re: [PATCH 6/7] scsi: Use Scsi_Host as argument for eh_host_reset_handler

Quoted 42 lines · Steffen Maier

What base does this patch set apply to?
I failed with scsi:misc / scsi:fixes / vanilla.

Quoted 29 lines · Steffen Maier
Quoted 16 lines · Hannes Reinecke

Issuing a host reset should not rely on any commands. So use Scsi_Host as argument for eh_host_reset_handler.

---

  drivers/s390/scsi/zfcp_scsi.c             |  3 +-
  69 files changed, 289 insertions(+), 379 deletions(-)
drivers/s390/scsi/zfcp_scsi.c +0 -0
index dc42c93..fe50f69 100644

drivers/s390/scsi/zfcp_scsi.c static int · line 287

Quoted 8 lines
drivers/s390/scsi/zfcp_scsi.c +1 -1
@@ -281,13 +281,14 @@ static int
 zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt)
      return zfcp_task_mgmt_function(scpnt, FCP_TMF_TGT_RESET);
  }
 
-static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
+static int zfcp_scsi_eh_host_reset_handler(struct Scsi_Host *host)
  {
      struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);

Scpnt argument no longer exists, so this line must likely go away to compile.

Quoted 8 lines

drivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt) · line 287

Quoted 1 line
drivers/s390/scsi/zfcp_scsi.c +0 -0
      struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;

This needs the assignment from the added line below since zfcp_sdev no longer exists.
Alternatively, drop the assignment here, only have the auto variable definition, and do the assignment below with the added line.

Quoted 1 line
drivers/s390/scsi/zfcp_scsi.c +0 -0
      struct fc_rport *rport = zfcp_sdev->port->rport;
Quoted 7 lines

Oh crap, this also no longer works now. And as a consequence we cannot get a reasonable rport any more now to call fc_block_scsi_eh().

I think it's us as LLDD calling fc_remote_port_add() anyway as part of adapter/port recovery, so we trigger the change to an unblocked rport. So, now we "only" need to make sure to block long enough for all fc_remote_port_add's to have happened?

Either that, or have some hook in queuecommand which will return any command with BUSY until the HBA reset is finished.

Quoted 6 lines

zfcp_erp_wait() might not be sufficient which is probably why Christof introduced fc_block_scsi_eh() in that commit Martin referred to.

Where's a design document which explains how to correctly use scsi_transport_fc?

Typically the LLDD sets all ports to 'BLOCKED' if it's still doing discovery (ie during LIP for FC-AL) and then updates the port states accordingly once discovery is finished via fc_remote_port_add()/fc_remote_port_delete().

Quoted 5 lines
Quoted 1 line

drivers/s390/scsi/zfcp_scsi.c static int · line 290

Quoted 1 line
drivers/s390/scsi/zfcp_scsi.c +0 -0
      int ret;

If adapter recovery fails, e.g. because there is no local light on the fibre, I would suppose that our recovery ended with a blocked Scsi_Host (at the latest after zfcp_erp_wait()).

No. It's perfectly okay for host_reset to end up with no local light on the fibre; that is not a failure. (Of course, the driver would have to call fc_remote_port_delete() here first).
Adapter recovery should only be considered 'failed' if for some reason the HBA itself doesn't react to the host reset procedure.

Quoted 2 lines

Is that sufficient or do we need to actually return the success of the host reset from this handler function?

Not necessarily. If the communication with the HBA is always assumed to be working (and, judging from DASD details, this is a safe assumption) host reset cannot really fail for zfcp.

Quoted 5 lines

If not, we drop the "ret" variable as well.
If yes, how is host reset success defined?
Is it success, e.g. if adapter recovery succeeded but there is no light on the fibre?

As mentioned above: Yes, that's perfectly okay.
It still means that you can communicate with the HBA, otherwise you wouldn't even know the current light status :-)

Quoted 20 lines
Quoted 10 lines

drivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt) · line 294

Quoted 5 lines
drivers/s390/scsi/zfcp_scsi.c +1 -0
+    adapter = (struct zfcp_adapter *)host->hostdata[0];
      zfcp_erp_adapter_reopen(adapter, 0, "schrh_1");
      zfcp_erp_wait(adapter);
      ret = fc_block_scsi_eh(rport);

A question just for my understanding: Calling fc_block_scsi_eh at the end *after* our adapter recovery is OK to wait for rports to become unblocked (or fast_io_failed)?
I would guess so.

Maybe we could replace the call to fc_block_scsi_eh() with something like the following which would wait until zfcp called fc_remote_port_add() [synchronously via work item in zfcp_scsi_schedule_rport_register() during port recovery or if link test with ADISC succeeded] for all ports of the adapter as part of the adapter recovery:

flush_workqueue(adapter->work_queue);

Quoted 8 lines

That's as coarse granular as the zfcp_erp_wait() just waiting for the queue to run empty, no matter which items were queued. Strictly speaking we would only wait for all rport work items of this adapter, but that's more complicated to code. It would be safer to actually return in time, and not prolong arbitrarily if new work items were queued meanwhile and the work queue does not become empty, but then again flush_workqueue might already be safe compared to drain_workqueue.

Actually, it would be safe to call 'fc_remote_port_delete()' for all remote ports as the first part of the host_reset() function. (Always assuming you're not doing that already; I haven't checked here).
The you could call zfcp_erp_adapter_reopen() and zfcp_erp_wait() as you do nowadays.
But now it wouldn't matter if there are any work items queued or not;
the ports will be reset if and when the workqueue items are called.
And the SCSI midlayer wouldn't be sending any commands as the ports are still in BLOCKED during that time.

Of course, it might be that the ports does in fact vanish during host reset (dev_loss_tmo might trigger before host reset finished), but the SCSI layer is well equipped to handle that.

Quoted 2 lines

Can I assume, that fc_remote_port_add() is synchronous and does the rport state change to unblocked before returning?

Yes.

Quoted 3 lines

If so, I would think this would semantically replace our previous call to fc_block_scsi_eh().

No. You cannot assume that the rport is still present after host_reset. So I would really not try to call anything rport related in host_reset ...

Quoted 2 lines

Does any of this make sense?

Sorta. Hope the same holds for my answers :-)

Cheers,

Hannes

Signature · 8 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#14 lore raw

PATCH 7/7 scsi_error: do not use command list for host reset

In reply to Hannes Reinecke

When host reset is called the host should be reset, and not depend on any commands on the queue.

---
 drivers/scsi/scsi_error.c | 40 ++++++++++++++--------------------------
 1 file changed, 14 insertions(+), 26 deletions(-)
drivers/scsi/scsi_error.c +14 -26
index ff069780..a32c46f 100644
@@ -752,11 +752,10 @@ static void scsi_eh_done(struct scsi_cmnd *scmd)
  * scsi_try_host_reset - ask host adapter to reset itself
  * @scmd:	SCSI cmd to send host reset.
  */
-static int scsi_try_host_reset(struct scsi_cmnd *scmd)
+static int scsi_try_host_reset(struct Scsi_Host *host)
 {
 	unsigned long flags;
 	int rtn;
-	struct Scsi_Host *host = scmd->device->host;
 	struct scsi_host_template *hostt = host->hostt;
 
 	SCSI_LOG_ERROR_RECOVERY(3,
@@ -771,7 +770,7 @@ static int scsi_try_host_reset(struct scsi_cmnd *scmd)
 		if (!hostt->skip_settle_delay)
 			ssleep(HOST_RESET_SETTLE_TIME);
 		spin_lock_irqsave(host->host_lock, flags);
-		scsi_report_bus_reset(host, scmd_channel(scmd));
+		scsi_report_bus_reset(host, -1);
 		spin_unlock_irqrestore(host->host_lock, flags);
 	}
 
@@ -883,7 +882,7 @@ static void scsi_abort_eh_cmnd(struct scsi_cmnd *scmd)
 		if (scsi_try_bus_device_reset(scmd) != SUCCESS)
 			if (scsi_try_target_reset(scmd) != SUCCESS)
 				if (scsi_try_bus_reset(scmd) != SUCCESS)
-					scsi_try_host_reset(scmd);
+					scsi_try_host_reset(scmd->device->host);
 }
 
 /**
@@ -1638,6 +1637,7 @@ static int scsi_eh_bus_reset(struct Scsi_Host *shost,
 
 /**
  * scsi_eh_host_reset - send a host reset
+ * @shost:	&scsi host being recovered.
  * @work_q:	list_head for processed commands.
  * @done_q:	list_head for processed commands.
  */
@@ -1649,28 +1649,16 @@ static int scsi_eh_host_reset(struct Scsi_Host *shost,
 	LIST_HEAD(check_list);
 	int rtn;
 
-	if (!list_empty(work_q)) {
-		scmd = list_entry(work_q->next,
-				  struct scsi_cmnd, eh_entry);
-
+	rtn = scsi_try_host_reset(shost);
+	if (rtn == SUCCESS) {
+		list_splice_init(work_q, &check_list);
+	} else if (rtn == FAST_IO_FAIL) {
+		list_for_each_entry_safe(scmd, next, work_q, eh_entry)
+			scsi_eh_finish_cmd(scmd, done_q);
+	} else {
 		SCSI_LOG_ERROR_RECOVERY(3,
-			shost_printk(KERN_INFO, shost,
-				     "%s: Sending HRST\n",
+			shost_printk("%s: HRST failed\n",
 				     current->comm));
-
-		rtn = scsi_try_host_reset(scmd);
-		if (rtn == SUCCESS) {
-			list_splice_init(work_q, &check_list);
-		} else if (rtn == FAST_IO_FAIL) {
-			list_for_each_entry_safe(scmd, next, work_q, eh_entry) {
-					scsi_eh_finish_cmd(scmd, done_q);
-			}
-		} else {
-			SCSI_LOG_ERROR_RECOVERY(3,
-				shost_printk(KERN_INFO, shost,
-					     "%s: HRST failed\n",
-					     current->comm));
-		}
 	}
 	return scsi_eh_test_devices(&check_list, work_q, done_q, 1);
 }
@@ -2245,7 +2233,7 @@ void scsi_report_bus_reset(struct Scsi_Host *shost, int channel)
 	struct scsi_device *sdev;
 
 	__shost_for_each_device(sdev, shost) {
-		if (channel == sdev_channel(sdev))
+		if (channel == -1 || channel == sdev_channel(sdev))
 			__scsi_report_device_reset(sdev, NULL);
 	}
 }
@@ -2360,7 +2348,7 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
 			break;
 		/* FALLTHROUGH */
 	case SCSI_TRY_RESET_HOST:
-		rtn = scsi_try_host_reset(scmd);
+		rtn = scsi_try_host_reset(shost);
 		break;
 	default:
 		rtn = FAILED;
Signature · 1 line
1.7.12.4
maintainer
#15 lore raw

Re: [PATCH 7/7] scsi_error: do not use command list for host reset

Quoted 2 lines · Hannes Reinecke

* scsi_eh_host_reset - send a host reset
+ * @shost: &scsi host being recovered.

In "Documentation/kernel-doc-nano-HOWTO.txt" I found "'&struct_name' - name of a structure (up to two words including 'struct')". This made me wonder whether the ampersand was added on purpose in the scsi_eh_host_reset() kernel-doc header ?

Bart.

#16 lore raw

Re: [PATCH 7/7] scsi_error: do not use command list for host reset

In reply to Hannes Reinecke

drivers/scsi/scsi_error.c static int scsi_try_host_reset(struct scsi_cmnd *scmd) · line 773

Quoted 6 lines
drivers/scsi/scsi_error.c +1 -1
@@ -771,7 +770,7 @@ static int scsi_try_host_reset(struct scsi_cmnd *scmd)
 		if (!hostt->skip_settle_delay)
 			ssleep(HOST_RESET_SETTLE_TIME);
 		spin_lock_irqsave(host->host_lock, flags);
-		scsi_report_bus_reset(host, scmd_channel(scmd));
+		scsi_report_bus_reset(host, -1);

The old code report a bus reset for every device on the channel this command was on, and the new one will not report anything because scsi_report_bus_reset doesn't treat -1 as a wild card. To keep the old behaviour you'll have to pass a channel argument here. It's not quite clear to me if ->eh_host_reset_handler is only supposed to reset a "channel" or the whole HBA, but if we want to change behavior here it should be a separate well documented patch.

#17 lore raw

Re: [PATCH 7/7] scsi_error: do not use command list for host reset

Quoted 7 lines · Christoph Hellwig

drivers/scsi/scsi_error.c static int scsi_try_host_reset(struct scsi_cmnd *scmd) · line 773

Quoted 6 lines
drivers/scsi/scsi_error.c +1 -1
@@ -771,7 +770,7 @@ static int scsi_try_host_reset(struct scsi_cmnd *scmd)
  		if (!hostt->skip_settle_delay)
  			ssleep(HOST_RESET_SETTLE_TIME);
  		spin_lock_irqsave(host->host_lock, flags);
-		scsi_report_bus_reset(host, scmd_channel(scmd));
+		scsi_report_bus_reset(host, -1);
Quoted 7 lines

The old code report a bus reset for every device on the channel this command was on, and the new one will not report anything because scsi_report_bus_reset doesn't treat -1 as a wild card. To keep the old behaviour you'll have to pass a channel argument here. It's not quite clear to me if ->eh_host_reset_handler is only supposed to reset a "channel" or the whole HBA, but if we want to change behavior here it should be a separate well documented patch.

I think Hannes' change down below in his same patch introduces a channel of -1 as wild card for the host reset which affects all rports of the host, so I assume this would work as before?:

Quoted 9 lines
drivers/scsi/scsi_error.c +1 -1
@@ -2245,7 +2233,7 @@ void scsi_report_bus_reset(struct Scsi_Host *shost, int channel)
 	struct scsi_device *sdev;
 
 	__shost_for_each_device(sdev, shost) {
-		if (channel == sdev_channel(sdev))
+		if (channel == -1 || channel == sdev_channel(sdev))
 			__scsi_report_device_reset(sdev, NULL);
 	}
 }
Signature · 15 lines
Mit freundlichen Grüßen / Kind regards
Steffen Maier

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#18 lore raw
In reply to Hannes Reinecke
Quoted 3 lines · Hannes Reinecke

eh_host_reset_handler can only depend on the Scsi_Host, so we should make that explicit by using 'struct Scsi_Host' as argument for it.

I like where this is going. Are you going to do a similar conversion away from scsi_cmnd for the other reset methods as well? It would be good to get them into a single kernel release so that we don't have a churn of lots of small driver API changes.

author maintainer
#19 lore raw
Quoted 10 lines · Christoph Hellwig
Quoted 3 lines · Hannes Reinecke

eh_host_reset_handler can only depend on the Scsi_Host, so we should make that explicit by using 'struct Scsi_Host' as argument for it.

I like where this is going. Are you going to do a similar conversion away from scsi_cmnd for the other reset methods as well? It would be good to get them into a single kernel release so that we don't have a churn of lots of small driver API changes.

Yes, that was the plan.

I just wanted to push this out to get some feedback. Especially the driver changes do warrant some maintainer approval.

And I didn't want this to linger in my tree, as sending out the entire conversion will result in a massive patchset.

But if you're fine with it ...

Cheers,

Hannes

Signature · 8 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#20 lore raw
Quoted 4 lines · Hannes Reinecke

And I didn't want this to linger in my tree, as sending out the entire conversion will result in a massive patchset.

But if you're fine with it ...

I've not done a formal review yet, but as I said I really like the idea behind it.

author maintainer
#22 lore raw
Quoted 3 lines · Christoph Hellwig

Did you plan to get back to this series and revisit it per the comments? I'd love to at least get the first preparatory patches in ASAP.

Up to now I've been focussed on the printk series, and I've shelved this one as the initial feedback was to have a full series converting all _eh function.

But sure, I definitely want to see this in. Unfortunately I'll be on vacation this week, so won't have time to do anything here.

Cheers,

Hannes

Signature · 8 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html