scsi: EH rework, main part
Subsystems (61)
Hannes Reinecke
maintainerv8 cover scsi: EH rework, main part
Hi all,
(taking up an old thread:)
here's now the main part of my EH rework.
It modifies the reset callbacks for SCSI EH such that each callback (eh_host_reset_handler, eh_bus_reset_handler, eh_target_reset_handler, eh_device_reset_handler) only references the actual entity it needs to work on
(ie 'Scsi_Host', (scsi bus), 'scsi_target', 'scsi_device'), and the 'struct scsi_cmnd' is dropped from the argument list. This simplifies the handler themselves as they don't need to exclude some 'magic' command, and we don't need to allocate a mock 'struct scsi_cmnd' when issuing a reset via SCSI ioctl.
The entire patchset can be found at:
https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
branch eh-rework.v8
As usual, comments and reviews are welcome.
Changes to v6:
- Include reviews from Bart
- Add patch to return -EAGAIN from scsi_ioctl_reset()
Changes to v5:
- Improve description for patch to modify scsi_eh_bus_device_reset()
- Add patch to modify the iteratrion in scsi_eh_bus_reset()
Hannes Reinecke (10):
scsi: Use Scsi_Host as argument for eh_host_reset_handler
scsi: Use Scsi_Host and channel number as argument for
eh_bus_reset_handler()
scsi: Use scsi_target as argument for eh_target_reset_handler()
scsi: Use scsi_device as argument to eh_device_reset_handler()
scsi: set host byte after EH completed
scsi_error: iterate over list of failed commands in
scsi_eh_bus_reset()
scsi: Do not allocate scsi command in scsi_ioctl_reset()
scsi_error: iterate over list of failed commands in
scsi_eh_bus_device_reset()
scsi_error: map FAST_IO_FAIL to -EAGAIN in SCSI EH
scsi: remove SUBMITTED_BY_SCSI_RESET_IOCTL
Documentation/scsi/scsi_eh.rst | 15 +- Documentation/scsi/scsi_mid_low_api.rst | 35 ++- drivers/infiniband/ulp/srp/ib_srp.c | 12 +- drivers/message/fusion/mptfc.c | 25 +- drivers/message/fusion/mptsas.c | 10 +- drivers/message/fusion/mptscsih.c | 114 +++------ drivers/message/fusion/mptscsih.h | 8 +- drivers/message/fusion/mptspi.c | 8 +- drivers/s390/scsi/zfcp_scsi.c | 16 +- drivers/scsi/3w-9xxx.c | 11 +- drivers/scsi/3w-sas.c | 11 +- drivers/scsi/3w-xxxx.c | 13 +- drivers/scsi/53c700.c | 39 +-- drivers/scsi/BusLogic.c | 24 +- drivers/scsi/NCR5380.c | 5 +- drivers/scsi/a100u2w.c | 14 +- drivers/scsi/aacraid/linit.c | 41 ++- drivers/scsi/advansys.c | 28 ++- drivers/scsi/aha152x.c | 10 +- drivers/scsi/aha1542.c | 28 +-- drivers/scsi/aic7xxx/aic79xx_osm.c | 37 ++- drivers/scsi/aic7xxx/aic7xxx_osm.c | 10 +- drivers/scsi/arcmsr/arcmsr_hba.c | 8 +- drivers/scsi/arm/acornscsi.c | 8 +- drivers/scsi/arm/fas216.c | 24 +- drivers/scsi/arm/fas216.h | 17 +- drivers/scsi/atari_scsi.c | 4 +- drivers/scsi/be2iscsi/be_main.c | 12 +- drivers/scsi/bfa/bfad_im.c | 8 +- drivers/scsi/bnx2fc/bnx2fc.h | 4 +- drivers/scsi/bnx2fc/bnx2fc_io.c | 14 +- drivers/scsi/csiostor/csio_scsi.c | 5 +- drivers/scsi/cxlflash/main.c | 10 +- drivers/scsi/dc395x.c | 24 +- drivers/scsi/esas2r/esas2r.h | 8 +- drivers/scsi/esas2r/esas2r_main.c | 57 +++-- drivers/scsi/esp_scsi.c | 9 +- drivers/scsi/fdomain.c | 3 +- drivers/scsi/fnic/fnic.h | 4 +- drivers/scsi/fnic/fnic_scsi.c | 12 +- drivers/scsi/hpsa.c | 14 +- drivers/scsi/hptiop.c | 6 +- drivers/scsi/ibmvscsi/ibmvfc.c | 19 +- drivers/scsi/ibmvscsi/ibmvscsi.c | 25 +- drivers/scsi/imm.c | 6 +- drivers/scsi/initio.c | 14 +- drivers/scsi/ipr.c | 29 ++- drivers/scsi/ips.c | 30 +-- drivers/scsi/libfc/fc_fcp.c | 18 +- drivers/scsi/libiscsi.c | 21 +- drivers/scsi/libsas/sas_scsi_host.c | 21 +- drivers/scsi/lpfc/lpfc_scsi.c | 29 ++- drivers/scsi/mac53c94.c | 8 +- drivers/scsi/megaraid.c | 6 +- drivers/scsi/megaraid.h | 2 +- drivers/scsi/megaraid/megaraid_mbox.c | 18 +- drivers/scsi/megaraid/megaraid_sas.h | 3 +- drivers/scsi/megaraid/megaraid_sas_base.c | 60 ++--- drivers/scsi/megaraid/megaraid_sas_fusion.c | 55 +++-- drivers/scsi/mesh.c | 12 +- drivers/scsi/mpi3mr/mpi3mr_os.c | 134 +++++----- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 82 +++--- drivers/scsi/mvumi.c | 9 +- drivers/scsi/myrb.c | 3 +- drivers/scsi/myrs.c | 3 +- drivers/scsi/ncr53c8xx.c | 4 +- drivers/scsi/nsp32.c | 14 +- drivers/scsi/pcmcia/nsp_cs.c | 10 +- drivers/scsi/pcmcia/nsp_cs.h | 6 +- drivers/scsi/pcmcia/qlogic_stub.c | 4 +- drivers/scsi/pcmcia/sym53c500_cs.c | 8 +- drivers/scsi/pmcraid.c | 36 ++- drivers/scsi/ppa.c | 6 +- drivers/scsi/qedf/qedf_main.c | 13 +- drivers/scsi/qedi/qedi_iscsi.c | 3 +- drivers/scsi/qla1280.c | 74 +++--- drivers/scsi/qla2xxx/qla_os.c | 85 +++---- drivers/scsi/qla4xxx/ql4_os.c | 58 ++--- drivers/scsi/qlogicfas408.c | 10 +- drivers/scsi/qlogicfas408.h | 2 +- drivers/scsi/qlogicpti.c | 3 +- drivers/scsi/scsi_debug.c | 54 ++-- drivers/scsi/scsi_error.c | 260 ++++++++++---------- drivers/scsi/scsi_lib.c | 2 - drivers/scsi/smartpqi/smartpqi.h | 1 - drivers/scsi/smartpqi/smartpqi_init.c | 19 +- drivers/scsi/snic/snic.h | 5 +- drivers/scsi/snic/snic_scsi.c | 41 +-- drivers/scsi/stex.c | 9 +- drivers/scsi/storvsc_drv.c | 4 +- drivers/scsi/sym53c8xx_2/sym_glue.c | 14 +- drivers/scsi/virtio_scsi.c | 12 +- drivers/scsi/vmw_pvscsi.c | 20 +- drivers/scsi/wd33c93.c | 8 +- drivers/scsi/wd33c93.h | 2 +- drivers/scsi/wd719x.c | 17 +- drivers/scsi/xen-scsifront.c | 6 +- drivers/staging/rts5208/rtsx.c | 6 +- drivers/target/loopback/tcm_loop.c | 17 +- drivers/ufs/core/ufshcd.c | 18 +- drivers/usb/image/microtek.c | 4 +- drivers/usb/storage/scsiglue.c | 8 +- drivers/usb/storage/uas.c | 3 +- include/scsi/libfc.h | 4 +- include/scsi/libiscsi.h | 4 +- include/scsi/libsas.h | 4 +- include/scsi/scsi_cmnd.h | 1 - include/scsi/scsi_eh.h | 2 +- include/scsi/scsi_host.h | 8 +- 109 files changed, 1038 insertions(+), 1223 deletions(-)
Signature · 1 line
2.35.3
Hannes Reinecke
maintainerPATCH v8 1/10 scsi: Use Scsi_Host as argument for eh_host_reset_handler
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.rst | 2 +- Documentation/scsi/scsi_mid_low_api.rst | 6 +-- drivers/infiniband/ulp/srp/ib_srp.c | 6 +-- drivers/message/fusion/mptscsih.c | 23 ++++-------- drivers/message/fusion/mptscsih.h | 2 +- drivers/s390/scsi/zfcp_scsi.c | 5 +-- drivers/scsi/3w-9xxx.c | 11 ++---- drivers/scsi/3w-sas.c | 11 ++---- drivers/scsi/3w-xxxx.c | 13 +++---- drivers/scsi/53c700.c | 39 +++++++++---------- drivers/scsi/BusLogic.c | 24 ++++++------ drivers/scsi/NCR5380.c | 5 +-- drivers/scsi/aacraid/linit.c | 8 ++-- drivers/scsi/advansys.c | 28 +++++++------- drivers/scsi/aha1542.c | 18 ++++----- drivers/scsi/arm/acornscsi.c | 8 ++-- drivers/scsi/arm/fas216.c | 10 ++--- drivers/scsi/arm/fas216.h | 6 +-- drivers/scsi/atari_scsi.c | 4 +- drivers/scsi/cxlflash/main.c | 5 +-- drivers/scsi/esas2r/esas2r.h | 2 +- drivers/scsi/esas2r/esas2r_main.c | 17 +++++---- drivers/scsi/esp_scsi.c | 4 +- drivers/scsi/fdomain.c | 3 +- drivers/scsi/fnic/fnic.h | 2 +- drivers/scsi/fnic/fnic_scsi.c | 3 +- drivers/scsi/hptiop.c | 6 +-- drivers/scsi/ibmvscsi/ibmvfc.c | 6 +-- drivers/scsi/ibmvscsi/ibmvscsi.c | 6 +-- drivers/scsi/imm.c | 6 +-- drivers/scsi/ipr.c | 5 +-- drivers/scsi/ips.c | 30 ++++----------- drivers/scsi/libfc/fc_fcp.c | 5 +-- drivers/scsi/lpfc/lpfc_scsi.c | 5 +-- drivers/scsi/mac53c94.c | 8 ++-- drivers/scsi/megaraid.c | 6 +-- drivers/scsi/megaraid.h | 2 +- drivers/scsi/megaraid/megaraid_mbox.c | 18 +++------ drivers/scsi/megaraid/megaraid_sas_base.c | 46 ++++++++++------------- drivers/scsi/mesh.c | 12 +++--- drivers/scsi/mpi3mr/mpi3mr_os.c | 12 +++--- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 15 ++++---- drivers/scsi/mvumi.c | 9 ++--- drivers/scsi/myrb.c | 3 +- drivers/scsi/myrs.c | 3 +- drivers/scsi/nsp32.c | 14 +++---- drivers/scsi/pcmcia/nsp_cs.c | 4 +- drivers/scsi/pcmcia/nsp_cs.h | 2 +- drivers/scsi/pcmcia/qlogic_stub.c | 4 +- drivers/scsi/pcmcia/sym53c500_cs.c | 8 ++-- drivers/scsi/pmcraid.c | 7 ++-- drivers/scsi/ppa.c | 6 +-- drivers/scsi/qedf/qedf_main.c | 4 +- drivers/scsi/qedi/qedi_iscsi.c | 3 +- drivers/scsi/qla1280.c | 5 +-- drivers/scsi/qla2xxx/qla_os.c | 18 +++------ drivers/scsi/qla4xxx/ql4_os.c | 18 ++++----- drivers/scsi/qlogicfas408.c | 10 ++--- drivers/scsi/qlogicfas408.h | 2 +- drivers/scsi/qlogicpti.c | 3 +- drivers/scsi/scsi_debug.c | 6 +-- drivers/scsi/scsi_error.c | 2 +- drivers/scsi/snic/snic.h | 3 +- drivers/scsi/snic/snic_scsi.c | 37 ++++-------------- drivers/scsi/stex.c | 9 ++--- drivers/scsi/storvsc_drv.c | 4 +- drivers/scsi/sym53c8xx_2/sym_glue.c | 3 +- drivers/scsi/vmw_pvscsi.c | 5 +-- drivers/scsi/wd33c93.c | 8 +--- drivers/scsi/wd33c93.h | 2 +- drivers/scsi/wd719x.c | 4 +- drivers/ufs/core/ufshcd.c | 10 ++--- drivers/usb/image/microtek.c | 4 +- include/scsi/libfc.h | 2 +- include/scsi/scsi_host.h | 2 +- 75 files changed, 286 insertions(+), 391 deletions(-)
Documentation/scsi/scsi_eh.rst +1 -1
@@ -217,7 +217,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.rst +3 -3
@@ -777,9 +777,9 @@ Details:: /** * eh_host_reset_handler - reset host (host bus adapter) - * @scp: SCSI host that contains this device should be reset + * @shp: SCSI host that should be reset * - * Returns SUCCESS if command aborted else FAILED + * Returns SUCCESS if host has been reset else FAILED * * Locks: None held *
@@ -794,7 +794,7 @@ Details:: * * Optionally defined in: LLD **/ - int eh_host_reset_handler(struct scsi_cmnd * scp) + int eh_host_reset_handler(struct Scsi_Host * shp) /**
drivers/infiniband/ulp/srp/ib_srp.c +3 -3
@@ -2831,11 +2831,11 @@ 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" ); +shost_printk (KERN_ERR , shost,PFX "SRP reset_host called\n" );return srp_reconnect_rport (target->rport) ==0 ?SUCCESS :FAILED ; }
drivers/message/fusion/mptscsih.c +8 -15
@@ -1955,34 +1955,27 @@ 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 +* mptscsih_host_reset - Perform a SCSI host adapter RESET +* @sh: Pointer to Scsi_Host structure, which is reset due to * * (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 *sh) { -MPT_SCSI_HOST * hd; +MPT_SCSI_HOST * hd =shost_priv (sh);int status =SUCCESS ;MPT_ADAPTER *ioc;int retval; -/* If we can't locate the host to reset, then we failed. */ -if ((hd =shost_priv (SCpnt->device->host)) ==NULL ){ - printk(KERN_ERR MYNAM ": host reset: " - "Can't locate host! (sc=%p)\n", SCpnt); -return FAILED ; - } -/* make sure we have no outstanding commands at this stage */ 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.
@@ -1993,8 +1986,8 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt)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
@@ -122,7 +122,7 @@ extern int mptscsih_abort(struct scsi_cmnd * SCpnt);extern int mptscsih_dev_reset (struct scsi_cmnd * SCpnt);extern int mptscsih_target_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 *sh);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 -3
@@ -371,10 +371,9 @@ static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt)return ret; } -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 zfcp_adapter *adapter = (struct zfcp_adapter *)host->hostdata[0 ];int ret =FAST_IO_FAIL ;if (!(adapter->connection_features &FSF_FEATURE_NPIV_MODE )) {
drivers/scsi/3w-9xxx.c +4 -7
@@ -1717,18 +1717,15 @@ 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 ; +TW_Device_Extension *tw_dev =shost_priv (shost);int retval =FAILED ; - tw_dev = (TW_Device_Extension *)SCpnt->device->host->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: Command timed out, resetting card." );/* Make sure we are not issuing an ioctl or resetting from ioctl */ mutex_lock (&tw_dev->ioctl_lock);
drivers/scsi/3w-sas.c +4 -7
@@ -1423,18 +1423,15 @@ 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 ; +TW_Device_Extension *tw_dev =shost_priv (shost);int retval =FAILED ; - tw_dev = (TW_Device_Extension *)SCpnt->device->host->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: Command timed out, resetting card." );/* Make sure we are not issuing an ioctl or resetting from ioctl */ mutex_lock (&tw_dev->ioctl_lock);
drivers/scsi/3w-xxxx.c +5 -8
@@ -1366,25 +1366,22 @@ 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 ; +TW_Device_Extension *tw_dev =shost_priv (shost);int retval =FAILED ; - tw_dev = (TW_Device_Extension *)SCpnt->device->host->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." );/* 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 +20 -19
@@ -155,7 +155,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_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);
@@ -1934,40 +1934,41 @@ NCR_700_abort(struct scsi_cmnd * SCp) } STATIC int -NCR_700_host_reset (struct scsi_cmnd * SCp) +NCR_700_host_reset (struct Scsi_Host * host) {DECLARE_COMPLETION_ONSTACK (complete); -struct NCR_700_Host_Parameters *hostdata = - (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0 ]; +struct NCR_700_Host_Parameters *hostdata = + (struct NCR_700_Host_Parameters *)host->hostdata[0 ]; -scmd_printk (KERN_INFO , SCp, -"New error handler wants HOST reset, cmd %p\n\t" , SCp); -scsi_print_command (SCp); +shost_printk (KERN_INFO , host, +"New error handler wants HOST reset\n" );/* In theory, eh_complete should always be null because the * eh is single threaded, but just in case we're handling a * reset via sg or something */ -spin_lock_irq (SCp->device->host->host_lock); +spin_lock_irq (host->host_lock);while (hostdata->eh_complete !=NULL ) { -spin_unlock_irq (SCp->device->host->host_lock); +spin_unlock_irq (host->host_lock);msleep_interruptible (100 ); -spin_lock_irq (SCp->device->host->host_lock); +spin_lock_irq (host->host_lock); } hostdata->eh_complete = &complete; -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);wait_for_completion (&complete); -spin_lock_irq (SCp->device->host->host_lock); +spin_lock_irq (host->host_lock); hostdata->eh_complete =NULL ; -/* Revalidate the transport parameters of the failing device */ -if (hostdata->fast) -spi_schedule_dv_device (SCp->device); - -spin_unlock_irq (SCp->device->host->host_lock); +/* Revalidate the transport parameters for attached devices */ +if (hostdata->fast) { +struct scsi_device *sdev; +__shost_for_each_device (sdev, host) +spi_schedule_dv_device (sdev); + } +spin_unlock_irq (host->host_lock);return SUCCESS ; }
drivers/scsi/BusLogic.c +12 -12
@@ -2852,21 +2852,21 @@ 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]; -int rc; - -spin_lock_irq (SCpnt->device->host->host_lock); - -blogic_inc_count (&stats->adapter_reset_req); +struct blogic_adapter *adapter =shost_priv (shost); +int tgt, rc; +spin_lock_irq (shost->host_lock); +for (tgt =0 ; tgt < adapter->maxdev; tgt++) { +struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt]; +struct blogic_tgt_stats *tgt_stats = &adapter->tgt_stats[tgt]; +if (!tgt_flags->tgt_exists) +continue ; +blogic_inc_count (&tgt_stats->adapter_reset_req); + } rc =blogic_resetadapter (adapter, false); -spin_unlock_irq (SCpnt->device->host->host_lock); +spin_unlock_irq (shost->host_lock);return rc; }
drivers/scsi/NCR5380.c +2 -3
@@ -2374,14 +2374,13 @@ static void bus_reset_cleanup(struct Scsi_Host *instance)/** * NCR5380_host_reset - reset the SCSI host -* @cmd: SCSI command undergoing EH +* @instance: SCSI host undergoing EH * * Returns SUCCESS */ -static int NCR5380_host_reset (struct scsi_cmnd *cmd) +static int NCR5380_host_reset (struct Scsi_Host *instance) { -struct Scsi_Host *instance = cmd->device->host;struct NCR5380_hostdata *hostdata =shost_priv (instance);unsigned long flags;struct NCR5380_cmd *ncmd;
drivers/scsi/aacraid/linit.c +3 -5
@@ -1087,14 +1087,12 @@ static int aac_eh_bus_reset(struct scsi_cmnd* cmd)/* * aac_eh_host_reset - Host reset command handling -* @scsi_cmd: SCSI command block causing the reset +* @host: SCSI host to be reset * */ -static int aac_eh_host_reset (struct scsi_cmnd *cmd) +static int aac_eh_host_reset (struct Scsi_Host *host) { -struct scsi_device * dev = cmd->device; -struct Scsi_Host * host = dev->host; -struct aac_dev * aac = (struct aac_dev *)host->hostdata; +struct aac_dev * aac =shost_priv (host);int ret =FAILED ;__le32 supported_options2 =0 ;bool is_mu_reset;
drivers/scsi/advansys.c +15 -13
@@ -7010,15 +7010,14 @@ static int AscISR(ASC_DVC_VAR *asc_dvc)/* * advansys_reset() * -* Reset the host associated with the command 'scp'. +* Reset the host. * * This function runs its own thread. Interrupts must be blocked but * sleeping is allowed and no locking other than for host structures is * required. Returns SUCCESS or FAILED. */ -static int advansys_reset (struct scsi_cmnd *scp) +static int advansys_reset (struct Scsi_Host *shost) { -struct Scsi_Host *shost = scp->device->host;struct asc_board *boardp =shost_priv (shost);unsigned long flags;int status;
@@ -7028,7 +7027,7 @@ static int advansys_reset(struct scsi_cmnd *scp)ASC_STATS (shost, reset); -scmd_printk (KERN_INFO , scp,"SCSI host reset started...\n" ); +shost_printk (KERN_INFO , shost,"SCSI host reset started...\n" );if (ASC_NARROW_BOARD (boardp)) {ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var;
@@ -7039,16 +7038,18 @@ static int advansys_reset(struct scsi_cmnd *scp)/* Refer to ASC_IERR_* definitions for meaning of 'err_code'. */ if (asc_dvc->err_code || !asc_dvc->overrun_dma) { -scmd_printk (KERN_INFO , scp,"SCSI host reset error: " -"0x%x, status: 0x%x\n" , asc_dvc->err_code, +shost_printk (KERN_INFO , shost, +"SCSI host reset error: 0x%x, status: 0x%x\n" , + asc_dvc->err_code, status); ret =FAILED ; }else if (status) { -scmd_printk (KERN_INFO , scp,"SCSI host reset warning: " -"0x%x\n" , status); +shost_printk (KERN_INFO , shost, +"SCSI host reset warning: 0x%x\n" , + status); }else { -scmd_printk (KERN_INFO , scp,"SCSI host reset " -"successful\n" ); +shost_printk (KERN_INFO , shost, +"SCSI host reset successful\n" ); }ASC_DBG (1 ,"after AscInitAsc1000Driver()\n" );
@@ -7065,12 +7066,13 @@ static int advansys_reset(struct scsi_cmnd *scp)ASC_DBG (1 ,"before AdvResetChipAndSB()\n" );switch (AdvResetChipAndSB (adv_dvc)) {case ASC_TRUE : -scmd_printk (KERN_INFO , scp,"SCSI host reset " -"successful\n" ); +shost_printk (KERN_INFO , shost, +"SCSI host reset successful\n" );break ;case ASC_FALSE :default : -scmd_printk (KERN_INFO , scp,"SCSI host reset error\n" ); +shost_printk (KERN_INFO , shost, +"SCSI host reset error\n" ); ret =FAILED ;break ; }
drivers/scsi/aha1542.c +9 -9
@@ -920,9 +920,8 @@ static int aha1542_dev_reset(struct scsi_cmnd *cmd)return SUCCESS ; } -static int aha1542_reset (struct scsi_cmnd *cmd,u8 reset_cmd) +static int aha1542_reset (struct Scsi_Host *sh,u8 reset_cmd) { -struct Scsi_Host *sh = cmd->device->host;struct aha1542_hostdata *aha1542 =shost_priv (sh);unsigned long flags;int i;
@@ -934,9 +933,9 @@ static int aha1542_reset(struct scsi_cmnd *cmd, u8 reset_cmd)* we do this? Try this first, and we can add that later * if it turns out to be useful. */ -outb (reset_cmd,CONTROL (cmd->device->host->io_port)); +outb (reset_cmd,CONTROL (sh->io_port)); -if (!wait_mask (STATUS (cmd->device->host->io_port), +if (!wait_mask (STATUS (sh->io_port),STATMASK ,IDLE ,STST |DIAGF |INVDCMD |DF |CDF ,0 )) {spin_unlock_irqrestore (sh->host_lock, flags);return FAILED ;
@@ -947,7 +946,7 @@ static int aha1542_reset(struct scsi_cmnd *cmd, u8 reset_cmd)* us again after host reset. */ if (reset_cmd &HRST ) -setup_mailboxes (cmd->device->host); +setup_mailboxes (sh);/* * Now try to pick up the pieces. For all pending commands,
@@ -955,7 +954,8 @@ static int aha1542_reset(struct scsi_cmnd *cmd, u8 reset_cmd)* out. We do not try and restart any commands or anything - * the strategy handler takes care of that crap. */ -shost_printk (KERN_WARNING , cmd->device->host,"Sent BUS RESET to scsi host %d\n" , cmd->device->host->host_no); +shost_printk (KERN_WARNING , sh,"Sent BUS RESET to scsi host %d\n" , + sh->host_no);for (i =0 ; i <AHA1542_MAILBOXES ; i++) {if (aha1542->int_cmds[i] !=NULL ) {
@@ -983,12 +983,12 @@ static int aha1542_reset(struct scsi_cmnd *cmd, u8 reset_cmd)static int aha1542_bus_reset (struct scsi_cmnd *cmd) { -return aha1542_reset (cmd,SCRST ); +return aha1542_reset (cmd->device->host,SCRST ); } -static int aha1542_host_reset (struct scsi_cmnd *cmd) +static int aha1542_host_reset (struct Scsi_Host *sh) { -return aha1542_reset (cmd,HRST |SCRST ); +return aha1542_reset (sh,HRST |SCRST ); } static int aha1542_biosparam(struct scsi_device *sdev,
drivers/scsi/arm/acornscsi.c +4 -4
@@ -2631,15 +2631,15 @@ int acornscsi_abort(struct scsi_cmnd *SCpnt)/* * Prototype: int acornscsi_reset(struct scsi_cmnd *SCpnt) * Purpose : reset a command on this host/reset this host -* Params : SCpnt - command causing reset +* Params : shost - host to be reset * Returns : one of SCSI_RESET_ macros */ -int acornscsi_host_reset (struct scsi_cmnd *SCpnt) +int acornscsi_host_reset (struct Scsi_Host *shost) { -AS_Host *host = (AS_Host *)SCpnt->device->host->hostdata; +AS_Host *host =shost_priv (shost);struct scsi_cmnd *SCptr; - host->stats.resets +=1 ; + host->stats.resets +=1 ;#if (DEBUG &DEBUG_RESET ) {
drivers/scsi/arm/fas216.c +5 -5
@@ -2649,16 +2649,16 @@ static void fas216_init_chip(FAS216_Info *info) }/** -* fas216_eh_host_reset - Reset the host associated with this command -* @SCpnt: command specifing host to reset +* fas216_eh_host_reset - Reset the host +* @shost: host to reset * -* Reset the host associated with this command. +* Reset the specified host. * 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 =shost_priv (shost);spin_lock_irq (info->host->host_lock);
drivers/scsi/arm/fas216.h +3 -3
@@ -394,11 +394,11 @@ extern int fas216_eh_device_reset(struct scsi_cmnd *SCpnt);*/ extern int fas216_eh_bus_reset (struct scsi_cmnd *SCpnt); -/* Function: int fas216_eh_host_reset(struct scsi_cmnd *SCpnt) +/* Function: int fas216_eh_host_reset(struct Scsi_Host *shost) * Purpose : Reset the host associated with this command -* Params : SCpnt - command specifing host to reset +* Params : shost - 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/atari_scsi.c +2 -2
@@ -667,7 +667,7 @@ static void atari_scsi_falcon_reg_write(unsigned int reg, u8 value)#include "NCR5380.c" -static int atari_scsi_host_reset (struct scsi_cmnd *cmd) +static int atari_scsi_host_reset (struct Scsi_Host *shost) {int rv;unsigned long flags;
@@ -684,7 +684,7 @@ static int atari_scsi_host_reset(struct scsi_cmnd *cmd) atari_dma_orig_addr =NULL ; } - rv =NCR5380_host_reset (cmd); + rv =NCR5380_host_reset (shost);/* The 5380 raises its IRQ line while _RST is active but the ST DMA * "lock" has been released so this interrupt may end up handled by
drivers/scsi/cxlflash/main.c +2 -3
@@ -2476,7 +2476,7 @@ static int cxlflash_eh_device_reset_handler(struct scsi_cmnd *scp)/** * cxlflash_eh_host_reset_handler() - reset the host adapter -* @scp: SCSI command from stack identifying host. +* @host: SCSI host adapter. * * Following a reset, the state is evaluated again in case an EEH occurred * during the reset. In such a scenario, the host reset will either yield
@@ -2487,11 +2487,10 @@ static int cxlflash_eh_device_reset_handler(struct scsi_cmnd *scp)* SUCCESS as defined in scsi/scsi.h * FAILED as defined in scsi/scsi.h */ -static int cxlflash_eh_host_reset_handler (struct scsi_cmnd *scp) +static int cxlflash_eh_host_reset_handler (struct Scsi_Host *host) {int rc =SUCCESS ;int rcr =0 ; -struct Scsi_Host *host = scp->device->host;struct cxlflash_cfg *cfg =shost_priv (host);struct device *dev = &cfg->dev->dev;
drivers/scsi/esas2r/esas2r.h +1 -1
@@ -976,7 +976,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 -8
@@ -1062,10 +1062,9 @@ int esas2r_eh_abort(struct scsi_cmnd *cmd)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 *a =shost_priv (shost);if (test_bit (AF_DEGRADED_MODE , &a->flags))return FAILED ;
@@ -1090,18 +1089,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
@@ -2640,9 +2640,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/fdomain.c +1 -2
@@ -456,9 +456,8 @@ static int fdomain_abort(struct scsi_cmnd *cmd)return SUCCESS ; } -static int fdomain_host_reset (struct scsi_cmnd *cmd) +static int fdomain_host_reset (struct Scsi_Host *sh) { -struct Scsi_Host *sh = cmd->device->host;struct fdomain *fd =shost_priv (sh);unsigned long flags;
drivers/scsi/fnic/fnic.h +1 -1
@@ -347,7 +347,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
@@ -2457,11 +2457,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);struct fnic *fnic =lport_priv (lp);unsigned long flags;
drivers/scsi/hptiop.c +3 -3
@@ -1088,12 +1088,12 @@ static int hptiop_reset_hba(struct hptiop_hba *hba)return 0 ; } -static int hptiop_reset (struct scsi_cmnd *scp) +static int hptiop_reset (struct Scsi_Host *host) { -struct hptiop_hba * hba = (struct hptiop_hba *)scp->device->host->hostdata; +struct hptiop_hba * hba =shost_priv (host);printk (KERN_WARNING "hptiop_reset(%d/%d/%d)\n" , - scp->device->host->host_no,-1 ,-1 ); + host->host_no,-1 ,-1 );return hptiop_reset_hba (hba)?FAILED :SUCCESS ; }
drivers/scsi/ibmvscsi/ibmvfc.c +3 -3
@@ -3049,13 +3049,13 @@ static int ibmvfc_eh_target_reset_handler(struct scsi_cmnd *cmd)/** * ibmvfc_eh_host_reset_handler - Reset the connection to the server -* @cmd: struct scsi_cmnd having problems +* @shost: struct Scsi_Host 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; -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 +3 -3
@@ -1733,12 +1733,12 @@ 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 +* @shost: struct Scsi_Host 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 -3
@@ -998,11 +998,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 *host) { -imm_struct *dev =imm_dev (cmd->device->host); +imm_struct *dev =imm_dev (host); -if (imm_scsi_pointer (cmd)->phase) +if (dev->cur_cmd &&imm_scsi_pointer (dev->cur_cmd)->phase)imm_disconnect (dev); dev->cur_cmd =NULL ;/* Forget the problem */
drivers/scsi/ipr.c +2 -3
@@ -4959,14 +4959,13 @@ static int ipr_wait_for_ops(struct ipr_ioa_cfg *ioa_cfg, void *device,return SUCCESS ; } -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; +struct ipr_ioa_cfg *ioa_cfg =shost_priv (shost);unsigned long lock_flags =0 ;int rc =SUCCESS ;ENTER ; - ioa_cfg = (struct ipr_ioa_cfg *) cmd->device->host->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 -22
@@ -229,7 +229,7 @@ module_param(ips, charp, 0);* Function prototypes */ 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 *);
@@ -829,11 +829,11 @@ 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_ha_t *ha =shost_priv (shost);ips_scb_t *scb;METHOD_TRACE ("ips_eh_reset" ,1 );
@@ -842,20 +842,6 @@ 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; - -if (!ha) { -DEBUG (1 ,"Reset called with NULL ha struct" ); - -return (FAILED ); - } -if (!ha->active)return (FAILED );
@@ -994,13 +980,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; }
@@ -1078,7 +1064,7 @@ static int ips_queue_lck(struct scsi_cmnd *SC)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 ;scsi_done (SC );return (0 );
drivers/scsi/libfc/fc_fcp.c +2 -3
@@ -2186,11 +2186,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 +2 -3
@@ -6160,7 +6160,7 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd)/** * lpfc_host_reset_handler - scsi_host_template eh_host_reset_handler entry pt -* @cmnd: Pointer to scsi_cmnd data structure. +* @shost: Pointer to Scsi_Host data structure. * * This routine does host reset to the adaptor port. It brings the HBA * offline, performs a board restart, and then brings the board back online.
@@ -6175,9 +6175,8 @@ lpfc_target_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
@@ -100,14 +100,14 @@ static int mac53c94_queue_lck(struct scsi_cmnd *cmd)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 =shost_priv (shost);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 , ®s->command);/* assert RST */
@@ -117,7 +117,7 @@ static int mac53c94_host_reset(struct scsi_cmnd *cmd)mac53c94_init (state);writeb (CMD_NOP , ®s->command); -spin_unlock_irqrestore (cmd->device->host->host_lock, flags); +spin_unlock_irqrestore (shost->host_lock, flags);return SUCCESS ; }
drivers/scsi/megaraid.c +2 -4
@@ -1876,14 +1876,12 @@ megaraid_abort(struct scsi_cmnd *cmd)static int -megaraid_reset (struct scsi_cmnd *cmd) +megaraid_reset (struct Scsi_Host *shost) { -adapter_t *adapter; +adapter_t *adapter =shost_priv (shost);megacmd_t mc;int rval; - adapter = (adapter_t *)cmd->device->host->hostdata; -#if MEGA_HAVE_CLUSTERING mc.cmd =MEGA_CLUSTER_CMD ; mc.opcode =MEGA_RESET_RESERVATIONS ;
drivers/scsi/megaraid.h +1 -1
@@ -973,7 +973,7 @@ static irqreturn_t megaraid_isr_iomapped(int, void *);static void mega_free_scb (adapter_t *,scb_t *);static int megaraid_abort (struct scsi_cmnd *); -static int megaraid_reset (struct scsi_cmnd *); +static int megaraid_reset (struct Scsi_Host *);static int megaraid_abort_and_reset (adapter_t *,struct scsi_cmnd *,int );static int megaraid_biosparam (struct scsi_device *,struct block_device *,sector_t ,int []);
drivers/scsi/megaraid/megaraid_mbox.c +6 -12
@@ -92,7 +92,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 []);
@@ -2502,8 +2502,8 @@ megaraid_abort_handler(struct scsi_cmnd *scp) }/** -* megaraid_reset_handler - device reset handler for mailbox based driver -* @scp : reference command +* megaraid_reset_handler - host reset handler for mailbox based driver +* @shost : host to reset * * Reset handler for the mailbox based controller. First try to find out if * the FW is still live, in which case the outstanding commands counter mut go
@@ -2512,7 +2512,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;
@@ -2525,7 +2525,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
@@ -2556,15 +2556,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 );scsi_done (scb->scp);
drivers/scsi/megaraid/megaraid_sas_base.c +20 -26
74 lines not on this page · raw message
drivers/scsi/mesh.c +6 -6
@@ -1695,13 +1695,13 @@ static int mesh_abort(struct scsi_cmnd *cmd)/* * Called by the midlayer with the lock held to reset the -* SCSI host and bus. +* SCSI host. * 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 =shost_priv (shost);volatile struct mesh_regs __iomem *mr = ms->mesh;volatile struct dbdma_regs __iomem *md = ms->dma;unsigned long flags;
@@ -1718,7 +1718,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);
@@ -1727,13 +1727,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/mpi3mr/mpi3mr_os.c +6 -6
@@ -4010,15 +4010,15 @@ static inline void mpi3mr_setup_divert_ws(struct mpi3mr_ioc *mrioc,/** * mpi3mr_eh_host_reset - Host reset error handling callback -* @scmd: SCSI command reference +* @shost: SCSI host reference * * Issue controller reset * * Return: SUCCESS of successful reset else FAILED */ -static int mpi3mr_eh_host_reset (struct scsi_cmnd *scmd) +static int mpi3mr_eh_host_reset (struct Scsi_Host *shost) { -struct mpi3mr_ioc *mrioc =shost_priv (scmd->device->host); +struct mpi3mr_ioc *mrioc =shost_priv (shost);int retval =FAILED , ret; ret = mpi3mr_soft_reset_handler(mrioc,
@@ -4028,9 +4028,9 @@ static int mpi3mr_eh_host_reset(struct scsi_cmnd *scmd) retval =SUCCESS ; out: -sdev_printk (KERN_INFO , scmd->device, -"Host reset is %s for scmd(%p)\n" , - ((retval ==SUCCESS ) ?"SUCCESS" :"FAILED" ), scmd); +shost_printk (KERN_INFO , shost, +"Host reset is %s\n" , + ((retval ==SUCCESS ) ?"SUCCESS" :"FAILED" ));return retval; }
drivers/scsi/mpt3sas/mpt3sas_scsih.c +7 -8
@@ -3520,18 +3520,17 @@ scsih_target_reset(struct scsi_cmnd *scmd)/** * scsih_host_reset - eh threads main host reset routine -* @scmd: pointer to scsi command object +* @shost: pointer to scsi host object * -* Return: SUCCESS if command aborted else FAILED +* Return: SUCCESS if host reset succeeded 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; -ioc_info (ioc,"attempting host reset! scmd(0x%p)\n" , scmd); -scsi_print_command (scmd); +ioc_info (ioc,"attempting host reset\n" );if (ioc->is_driver_loading || ioc->remove_host) {ioc_info (ioc,"Blocking the host reset\n" );
@@ -3542,8 +3541,8 @@ scsih_host_reset(struct scsi_cmnd *scmd) retval =mpt3sas_base_hard_reset_handler (ioc,FORCE_BIG_HAMMER ); r = (retval <0 ) ?FAILED :SUCCESS ; out: -ioc_info (ioc,"host reset: %s scmd(0x%p)\n" , - r ==SUCCESS ?"SUCCESS" :"FAILED" , scmd); +ioc_info (ioc,"host reset: %s\n" , + r ==SUCCESS ?"SUCCESS" :"FAILED" );return r; }
drivers/scsi/mvumi.c +3 -6
@@ -695,14 +695,11 @@ 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; +struct mvumi_hba *mhba =shost_priv (shost); -scmd_printk (KERN_NOTICE , scmd,"RESET -%u cmd=%x retries=%x\n" , -scsi_cmd_to_rq (scmd)->tag, scmd->cmnd[0 ], scmd->retries); +shost_printk (KERN_NOTICE , shost,"RESET\n" );return mhba->instancet->reset_host (mhba); }
drivers/scsi/myrb.c +1 -2
@@ -1252,9 +1252,8 @@ static void myrb_cleanup(struct myrb_hba *cb)scsi_host_put (cb->host); } -static int myrb_host_reset (struct scsi_cmnd *scmd) +static int myrb_host_reset (struct Scsi_Host *shost) { -struct Scsi_Host *shost = scmd->device->host;struct myrb_hba *cb =shost_priv (shost); cb->reset (cb->io_base);
drivers/scsi/myrs.c +1 -2
@@ -1529,9 +1529,8 @@ ATTRIBUTE_GROUPS(myrs_shost);/* * SCSI midlayer interface */ -static int myrs_host_reset (struct scsi_cmnd *scmd) +static int myrs_host_reset (struct Scsi_Host *shost) { -struct Scsi_Host *shost = scmd->device->host;struct myrs_hba *cs =shost_priv (shost); cs->reset (cs->io_base);
drivers/scsi/nsp32.c +6 -8
@@ -191,7 +191,7 @@ static int nsp32_release (struct Scsi_Host *);/* SCSI error handler */ static int nsp32_eh_abort (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 *);
@@ -2876,23 +2876,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; -nsp32_hw_data *data = (nsp32_hw_data *)host->hostdata; +unsigned int base = host->io_port; +nsp32_hw_data *data =shost_priv (host);nsp32_msg (KERN_INFO ,"Host Reset" ); -nsp32_dbg (NSP32_DEBUG_BUSRESET ,"SCpnt=0x%x" , SCpnt); -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/nsp_cs.c +2 -2
@@ -1495,9 +1495,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 =shost_priv (host);nsp_dbg (NSP_DEBUG_BUSRESET ,"in" );
drivers/scsi/pcmcia/nsp_cs.h +1 -1
@@ -300,7 +300,7 @@ static int nsp_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *SCpnt);/*static int nsp_eh_abort (struct scsi_cmnd *SCpnt);*/ /*static int nsp_eh_device_reset(struct scsi_cmnd *SCpnt);*/ static int nsp_eh_bus_reset (struct scsi_cmnd *SCpnt); -static int nsp_eh_host_reset (struct scsi_cmnd *SCpnt); +static int nsp_eh_host_reset (struct Scsi_Host *host);static int nsp_bus_reset (nsp_hw_data *data);/* */
drivers/scsi/pcmcia/qlogic_stub.c +2 -2
@@ -270,8 +270,8 @@ static int qlogic_resume(struct pcmcia_device *link)outb (0x24 , link->resource[0 ]->start +0x9 );outb (0x04 , link->resource[0 ]->start +0xd ); } -/* Ugggglllyyyy!!! */ -qlogicfas408_host_reset (NULL ); + +qlogicfas408_host_reset (info->host);return 0 ; }
drivers/scsi/pcmcia/sym53c500_cs.c +4 -4
@@ -583,14 +583,14 @@ static int SYM53C500_queue_lck(struct scsi_cmnd *SCpnt)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 +3 -4
@@ -3089,19 +3089,18 @@ static int pmcraid_eh_target_reset_handler(struct scsi_cmnd *scmd)/** * pmcraid_eh_host_reset_handler - adapter reset handler callback * -* @scmd: pointer to scsi_cmd that was sent to a resource of adapter +* @shost: pointer to scsi_host * * Initiates adapter reset to bring it up to operational state * * 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 *pinstance =shost_priv (shost);/* wait for an additional 150 seconds just in case firmware could come
drivers/scsi/ppa.c +3 -3
@@ -887,11 +887,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 *host) { -ppa_struct *dev =ppa_dev (cmd->device->host); +ppa_struct *dev =ppa_dev (host); -if (ppa_scsi_pointer (cmd)->phase) +if (dev->cur_cmd &&ppa_scsi_pointer (dev->cur_cmd)->phase)ppa_disconnect (dev); dev->cur_cmd =NULL ;/* Forget the problem */
drivers/scsi/qedf/qedf_main.c +2 -2
@@ -953,12 +953,12 @@ void qedf_ctx_soft_reset(struct fc_lport *lport) }/* Reset the host by gracefully logging out and then logging back in */ -static int qedf_eh_host_reset (struct scsi_cmnd *sc_cmd) +static int qedf_eh_host_reset (struct Scsi_Host *shost) {struct fc_lport *lport;struct qedf_ctx *qedf; - lport =shost_priv (sc_cmd->device->host); + lport =shost_priv (shost); qedf =lport_priv (lport); if (atomic_read(&qedf->link_state) == QEDF_LINK_DOWN ||
drivers/scsi/qedi/qedi_iscsi.c +1 -2
@@ -30,9 +30,8 @@ int qedi_recover_all_conns(struct qedi_ctx *qedi)return SUCCESS ; } -static int qedi_eh_host_reset (struct scsi_cmnd *cmd) +static int qedi_eh_host_reset (struct Scsi_Host *shost) { -struct Scsi_Host *shost = cmd->device->host;struct qedi_ctx *qedi; qedi =iscsi_host_priv (shost);
drivers/scsi/qla1280.c +2 -3
@@ -995,11 +995,10 @@ 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 =SUCCESS ; -struct Scsi_Host *shost = cmd->device->host; -struct scsi_qla_host *ha = (struct scsi_qla_host *)shost->hostdata; +struct scsi_qla_host *ha =shost_priv (shost);spin_lock_irq (shost->host_lock);if (qla1280_verbose) {
drivers/scsi/qla2xxx/qla_os.c +6 -12
@@ -1656,8 +1656,7 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)* The reset function will reset the Adapter. * * Input: -* cmd = Linux SCSI command packet of the command that cause the -* adapter reset. +* shost = Linux SCSI host to be reset * * Returns: * Either SUCCESS or FAILED.
@@ -1665,13 +1664,11 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)* 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);if (qla2x00_isp_reg_stat (ha)) {
@@ -1681,11 +1678,8 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)return SUCCESS ; } - 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
@@ -1731,8 +1725,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 +8 -10
@@ -159,7 +159,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 umode_t qla4_attr_is_visible (int param_type,int param);static int qla4xxx_host_reset (struct Scsi_Host *shost,int reset_type);
@@ -9421,18 +9421,18 @@ static int qla4xxx_is_eh_active(struct Scsi_Host *shost)/** * qla4xxx_eh_host_reset - kernel callback -* @cmd: Pointer to Linux's SCSI command structure +* @host: Pointer to Linux's SCSI host structure * * 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;int rval; - ha =to_qla_host (cmd->device->host); + ha =to_qla_host (host); rval =qla4xxx_isp_check_reg (ha);if (rval !=QLA_SUCCESS ) {
@@ -9454,20 +9454,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/qlogicfas408.c +4 -6
@@ -525,20 +525,18 @@ int qlogicfas408_abort(struct scsi_cmnd *cmd)/* * Reset SCSI bus -* FIXME: This function is invoked with cmd = NULL directly by -* the PCMCIA qlogic_stub code. This wants fixing */ -int qlogicfas408_host_reset (struct scsi_cmnd *cmd) +int qlogicfas408_host_reset (struct Scsi_Host *host) { -struct qlogicfas408_priv *priv =get_priv_by_cmd (cmd); +struct qlogicfas408_priv *priv =get_priv_by_host (host);unsigned long flags; priv->qabort =2 ; -spin_lock_irqsave (cmd->device->host->host_lock, flags); +spin_lock_irqsave (host->host_lock, flags);ql_zap (priv); -spin_unlock_irqrestore (cmd->device->host->host_lock, flags); +spin_unlock_irqrestore (host->host_lock, flags);return SUCCESS ; }
drivers/scsi/qlogicfas408.h +1 -1
@@ -109,7 +109,7 @@ int qlogicfas408_biosparam(struct scsi_device * disk,struct block_device *dev, sector_t capacity, int ip[]);int qlogicfas408_abort (struct scsi_cmnd * cmd); -extern int qlogicfas408_host_reset (struct scsi_cmnd *cmd); +extern int qlogicfas408_host_reset (struct Scsi_Host *host);const char *qlogicfas408_info (struct Scsi_Host *host);int qlogicfas408_get_chip_type (int qbase,int int_type);void qlogicfas408_setup (int qbase,int id,int int_type);
drivers/scsi/qlogicpti.c +1 -2
@@ -1261,10 +1261,9 @@ static int qlogicpti_abort(struct scsi_cmnd *Cmnd)return return_status; } -static int qlogicpti_reset (struct scsi_cmnd *Cmnd) +static int qlogicpti_reset (struct Scsi_Host *host) {u_short param[6 ]; -struct Scsi_Host *host = Cmnd->device->host;struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata;int return_status =SUCCESS ;
drivers/scsi/scsi_debug.c +3 -3
@@ -5805,7 +5805,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 *devip;
@@ -5813,7 +5813,7 @@ static int scsi_debug_host_reset(struct scsi_cmnd *SCpnt) ++num_host_resets;if (SDEBUG_OPT_ALL_NOISE & sdebug_opts) -sdev_printk (KERN_INFO , SCpnt->device,"%s\n" , __func__); +shost_printk (KERN_INFO , shost,"%s\n" , __func__);mutex_lock (&sdebug_host_list_mutex);list_for_each_entry (sdbg_host, &sdebug_host_list, host_list) { list_for_each_entry(devip, &sdbg_host->dev_info_list,
@@ -5825,7 +5825,7 @@ static int scsi_debug_host_reset(struct scsi_cmnd *SCpnt)mutex_unlock (&sdebug_host_list_mutex);stop_all_queued ();if (SDEBUG_OPT_RESET_NOISE & sdebug_opts) -sdev_printk (KERN_INFO , SCpnt->device, +shost_printk (KERN_INFO , shost,"%s: %d device(s) found\n" , __func__, k);return SUCCESS ; }
drivers/scsi/scsi_error.c +1 -1
@@ -881,7 +881,7 @@ static enum scsi_disposition 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/snic/snic.h +1 -2
@@ -365,8 +365,7 @@ extern const struct attribute_group *snic_host_groups[];int snic_queuecommand (struct Scsi_Host *,struct scsi_cmnd *);int snic_abort_cmd (struct scsi_cmnd *);int snic_device_reset (struct scsi_cmnd *); -int snic_host_reset (struct scsi_cmnd *); -int snic_reset (struct Scsi_Host *); +int snic_host_reset (struct Scsi_Host *);void snic_shutdown_scsi_cleanup (struct snic *);
drivers/scsi/snic/snic_scsi.c +8 -29
@@ -2259,8 +2259,15 @@ snic_issue_hba_reset(struct snic *snic)return ret; }/* end of snic_issue_hba_reset */ +/* +* SCSI Error handling calls driver's eh_host_reset if all prior +* error handling levels return FAILED. +* +* Host Reset is the highest level of error recovery. If this fails, then +* host is offlined by SCSI. +*/ int -snic_reset (struct Scsi_Host *shost) +snic_host_reset (struct Scsi_Host *shost) {struct snic *snic =shost_priv (shost);enum snic_state sv_state;
@@ -2306,34 +2313,6 @@ snic_reset(struct Scsi_Host *shost) ret =SUCCESS ; reset_end: -return ret; -}/* end of snic_reset */ - -/* -* SCSI Error handling calls driver's eh_host_reset if all prior -* error handling levels return FAILED. -* -* Host Reset is the highest level of error recovery. If this fails, then -* host is offlined by SCSI. -*/ -int -snic_host_reset (struct scsi_cmnd *sc) -{ -struct Scsi_Host *shost = sc->device->host; -u32 start_time = jiffies; -int ret; - -SNIC_SCSI_DBG (shost, -"host reset:sc %p sc_cmd 0x%x req %p tag %d flags 0x%llx\n" , - sc, sc->cmnd[0 ],scsi_cmd_to_rq (sc), -snic_cmd_tag (sc),CMD_FLAGS (sc)); - - ret =snic_reset (shost); - -SNIC_TRC (shost->host_no,snic_cmd_tag (sc), (ulong ) sc, -jiffies_to_msecs (jiffies - start_time), -0 ,SNIC_TRC_CMD (sc),SNIC_TRC_CMD_STATE_FLAGS (sc)); -return ret; }/* end of snic_host_reset */
drivers/scsi/stex.c +3 -6
@@ -1438,14 +1438,11 @@ 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 ]; +struct st_hba *hba =shost_priv (shost); -shost_printk (KERN_INFO , cmd->device->host, -"resetting host\n" ); +shost_printk (KERN_INFO , shost,"resetting host\n" );return stex_do_reset (hba) ?FAILED :SUCCESS ; }
drivers/scsi/storvsc_drv.c +2 -2
@@ -1624,9 +1624,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/sym53c8xx_2/sym_glue.c +1 -2
@@ -693,9 +693,8 @@ static int sym53c8xx_eh_bus_reset_handler(struct scsi_cmnd *cmd)return SCSI_SUCCESS ; } -static int sym53c8xx_eh_host_reset_handler (struct scsi_cmnd *cmd) +static int sym53c8xx_eh_host_reset_handler (struct Scsi_Host *shost) { -struct Scsi_Host *shost = cmd->device->host;struct sym_data *sym_data =shost_priv (shost);struct pci_dev *pdev = sym_data->pdev;struct sym_hcb *np = sym_data->ncb;
drivers/scsi/vmw_pvscsi.c +2 -3
@@ -894,14 +894,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 -6
@@ -1508,15 +1508,12 @@ 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; +struct WD33C93_hostdata *hostdata =shost_priv (instance);int i; - instance = SCpnt->device->host;spin_lock_irq (instance->host_lock); - hostdata = (struct WD33C93_hostdata *) instance->hostdata;printk ("scsi%d: reset. " , instance->host_no);disable_irq (instance->irq);
@@ -1539,7 +1536,6 @@ wd33c93_host_reset(struct scsi_cmnd * SCpnt) hostdata->outgoing_len =0 ;reset_wd33c93 (instance); - SCpnt->result =DID_RESET <<16 ;enable_irq (instance->irq);spin_unlock_irq (instance->host_lock);return SUCCESS ;
drivers/scsi/wd33c93.h +1 -1
@@ -336,6 +336,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/wd719x.c +2 -2
@@ -520,9 +520,9 @@ static int wd719x_bus_reset(struct scsi_cmnd *cmd)return wd719x_reset (cmd,WD719X_CMD_BUSRESET ,0 ); } -static int wd719x_host_reset (struct scsi_cmnd *cmd) +static int wd719x_host_reset (struct Scsi_Host *host) { -struct wd719x *wd =shost_priv (cmd->device->host); +struct wd719x *wd =shost_priv (host);struct wd719x_scb *scb, *tmp;unsigned long flags;
drivers/ufs/core/ufshcd.c +4 -6
@@ -266,7 +266,7 @@ static const struct ufs_dev_quirk ufs_fixups[] = {static irqreturn_t ufshcd_tmc_handler (struct ufs_hba *hba);static void ufshcd_async_scan (void *data,async_cookie_t cookie);static int ufshcd_reset_and_restore (struct ufs_hba *hba); -static int ufshcd_eh_host_reset_handler (struct scsi_cmnd *cmd); +static int ufshcd_eh_host_reset_handler (struct Scsi_Host *shost);static int ufshcd_clear_tm_cmd (struct ufs_hba *hba,int tag);static void ufshcd_hba_exit (struct ufs_hba *hba);static int ufshcd_probe_hba (struct ufs_hba *hba,bool init_dev_params);
@@ -7797,17 +7797,15 @@ static int ufshcd_reset_and_restore(struct ufs_hba *hba)/** * ufshcd_eh_host_reset_handler - host reset handler registered to scsi layer -* @cmd: SCSI command pointer +* @shost: SCSI Host * * Return: SUCCESS or FAILED. */ -static int ufshcd_eh_host_reset_handler (struct scsi_cmnd *cmd) +static int ufshcd_eh_host_reset_handler (struct Scsi_Host *shost) {int err =SUCCESS ;unsigned long flags; -struct ufs_hba *hba; - - hba =shost_priv (cmd->device->host); +struct ufs_hba *hba =shost_priv (shost);/* * If runtime PM sent SSU and got a timeout, scsi_error_handler is
drivers/usb/image/microtek.c +2 -2
@@ -345,9 +345,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 =shost_priv (shost);int result;MTS_DEBUG_GOT_HERE ();
include/scsi/libfc.h +1 -1
@@ -950,7 +950,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 *);/*
include/scsi/scsi_host.h +1 -1
@@ -153,7 +153,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
2.35.3
Re: [PATCH 01/10] scsi: Use Scsi_Host as argument for eh_host_reset_handler
Hello Hannes,
Documentation/scsi/scsi_mid_low_api.rst Details:: · line 782
Quoted 13 lines · Hannes Reinecke
Documentation/scsi/scsi_mid_low_api.rst +2
-2@@ -777,9 +777,9 @@ Details:: /** * eh_host_reset_handler - reset host (host bus adapter) - * @scp: SCSI host that contains this device should be reset + * @shp: SCSI host that should be reset * - * Returns SUCCESS if command aborted else FAILED + * Returns SUCCESS if host has been reset else FAILED
This should also mention FAST_IO_FAIL now that we touch this documentation anyway. Same for the other callbacks that you change later in the patchset.
Quoted 35 lines
Documentation/scsi/scsi_mid_low_api.rst +0
-0* * Locks: None held *drivers/message/fusion/mptscsih.c +4
-9@@ -1955,34 +1955,27 @@ 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 +* mptscsih_host_reset - Perform a SCSI host adapter RESET +* @sh: Pointer to Scsi_Host structure, which is reset due to * * (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 *sh) { -MPT_SCSI_HOST * hd; +MPT_SCSI_HOST * hd =shost_priv (sh);int status =SUCCESS ;MPT_ADAPTER *ioc;int retval; -/* If we can't locate the host to reset, then we failed. */ -if ((hd =shost_priv (SCpnt->device->host)) ==NULL ){ - printk(KERN_ERR MYNAM ": host reset: " - "Can't locate host! (sc=%p)\n", SCpnt); -return FAILED ;
drivers/message/fusion/mptscsih.c mptscsih_bus_reset(struct scsi_cmnd * SCpnt) · line 1978
Quoted 10 lines
drivers/message/fusion/mptscsih.c +2
-4- } -/* make sure we have no outstanding commands at this stage */ 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);
Nitpick: you could remove the line-break here now.
drivers/message/fusion/mptscsih.c mptscsih_host_reset(struct scsi_cmnd *SCpnt) · line 1990
Quoted 11 lines
drivers/message/fusion/mptscsih.c +2
-2/* 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. @@ -1993,8 +1986,8 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt)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" ));
^
Nitpick: IFF you remove the line-break above, maybe also remove the Plenk
here.
Quoted 17 lines
drivers/message/fusion/mptscsih.c +0
-0return status; }drivers/scsi/3w-9xxx.c +2
-2@@ -1717,18 +1717,15 @@ 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 ; +TW_Device_Extension *tw_dev =shost_priv (shost);int retval =FAILED ;
drivers/scsi/3w-9xxx.c static int twa_scsi_biosparam(struct scsi_device *sdev, struct block_device *bde · line 1728
Quoted 10 lines
drivers/scsi/3w-9xxx.c +2
-5- tw_dev = (TW_Device_Extension *)SCpnt->device->host->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: Command timed out, resetting card." );
Why remove the end-of-line \n? IIRC printk() generally doesn't append one automatically.
Quoted 27 lines
drivers/scsi/3w-9xxx.c +0
-0/* Make sure we are not issuing an ioctl or resetting from ioctl */ mutex_lock (&tw_dev->ioctl_lock);drivers/scsi/3w-sas.c +4
-7@@ -1423,18 +1423,15 @@ 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 ; +TW_Device_Extension *tw_dev =shost_priv (shost);int retval =FAILED ; - tw_dev = (TW_Device_Extension *)SCpnt->device->host->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: Command timed out, resetting card." );
...
Quoted 27 lines
drivers/scsi/3w-sas.c +0
-0/* Make sure we are not issuing an ioctl or resetting from ioctl */ mutex_lock (&tw_dev->ioctl_lock);drivers/scsi/3w-xxxx.c +4
-7@@ -1366,25 +1366,22 @@ 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 ; +TW_Device_Extension *tw_dev =shost_priv (shost);int retval =FAILED ; - tw_dev = (TW_Device_Extension *)SCpnt->device->host->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." );
...
Quoted 16 lines
drivers/scsi/3w-xxxx.c +1
-1/* 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/arm/fas216.c +0
-0
drivers/scsi/arm/fas216.c static void fas216_init_chip(FAS216_Info *info) · line 2652
Quoted 6 lines
drivers/scsi/arm/fas216.c +1
-2@@ -2649,16 +2649,16 @@ static void fas216_init_chip(FAS216_Info *info) }/** -* fas216_eh_host_reset - Reset the host associated with this command -* @SCpnt: command specifing host to reset +* fas216_eh_host_reset - Reset the host
Nitpick:
I think kdoc style wants the function to have () appended (now that you change that line anyway).
* fas216_eh_host_reset() - Reset the host.
Quoted 36 lines
drivers/scsi/arm/fas216.c +4
-3+* @shost: host to reset * -* Reset the host associated with this command. +* Reset the specified host. * 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 =shost_priv (shost);spin_lock_irq (info->host->host_lock);drivers/scsi/ips.c +2
-2@@ -829,11 +829,11 @@ 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_ha_t *ha =shost_priv (shost);ips_scb_t *scb;METHOD_TRACE ("ips_eh_reset" ,1 );@@ -842,20 +842,6 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)return (FAILED );#else
drivers/scsi/ips.c static int __ips_eh_reset(struct scsi_cmnd *SC) · line 853
Quoted 10 lines
drivers/scsi/ips.c +0
-9-if (!SC ) { -DEBUG (1 ,"Reset called with NULL scsi command" ); - -return (FAILED ); - } - - ha = (ips_ha_t *)SC ->device->host->hostdata; - -if (!ha) {
I wonder whether we really know ha is always set here? At least from the changeset it doesn't appear obvious to me. We get ha via the provided shost and shost_priv(), but that doesn't necessarily mean the pointer is not NULL.
Quoted 17 lines
drivers/scsi/ips.c +0
-5-DEBUG (1 ,"Reset called with NULL ha struct" ); - -return (FAILED ); - } -if (!ha->active)return (FAILED );drivers/scsi/megaraid.h +0
-1@@ -2502,8 +2502,8 @@ megaraid_abort_handler(struct scsi_cmnd *scp) }/** -* megaraid_reset_handler - device reset handler for mailbox based driver
...
Quoted 12 lines
- * @scp : reference command
+ *megaraid_reset_handler- host reset handler for mailbox based driver
+ * @shost : host to reset
*
* Reset handler for the mailbox based controller. First try to find out if
* the FW is still live, in which case the outstanding commands counter mut godrivers/scsi/megaraid/megaraid_sas_base.c +0
-0@@ -2890,21 +2890,18 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
drivers/scsi/megaraid/megaraid_sas_base.c static int megasas_wait_for_outstanding(struct megasas_instance *instance) · line 2897
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_base.c +3
-3/** * megasas_generic_reset - Generic reset routine -* @scmd: Mid-layer SCSI command +* @shost: Mid-layer SCSI host * -* This routine implements a generic reset handler for device, bus and host -* reset requests. Device, bus and host specific reset handlers can use this +* This routine implements a generic reset handler for host +* reset requests. Host specific reset handlers can use this * function after they do their specific tasks.
Nitpick: this comment really does sound sorta strange now, especially since
this function is only called from one place.
Quoted 21 lines
drivers/scsi/megaraid/megaraid_sas_base.c +3
-6*/ -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; +struct megasas_instance *instance =shost_priv (shost); -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 (atomic_read (&instance->adprecovery) ==MEGASAS_HW_CRITICAL_ERROR ) {dev_err (&instance->pdev->dev,"cannot recover from previous reset failures\n" );drivers/scsi/mpi3mr/mpi3mr_os.c +0
-0
drivers/scsi/mpi3mr/mpi3mr_os.c static int mpi3mr_eh_host_reset(struct scsi_cmnd *scmd) · line 4033
Quoted 9 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +3
-3@@ -4028,9 +4028,9 @@ static int mpi3mr_eh_host_reset(struct scsi_cmnd *scmd) retval =SUCCESS ; out: -sdev_printk (KERN_INFO , scmd->device, -"Host reset is %s for scmd(%p)\n" , - ((retval ==SUCCESS ) ?"SUCCESS" :"FAILED" ), scmd); +shost_printk (KERN_INFO , shost, +"Host reset is %s\n" , + ((retval ==SUCCESS ) ?"SUCCESS" :"FAILED" ));
Nitpick: superfluous parentheses.
Quoted 15 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +0
-0return retval; }drivers/scsi/qla2xxx/qla_os.c +2
-2@@ -1731,8 +1725,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);
...
Quoted 28 lines
drivers/scsi/qla2xxx/qla_os.c +0
-0return ret; }drivers/scsi/snic/snic_scsi.c +0
-17@@ -2306,34 +2313,6 @@ snic_reset(struct Scsi_Host *shost) ret =SUCCESS ; reset_end: -return ret; -}/* end of snic_reset */ - -/* -* SCSI Error handling calls driver's eh_host_reset if all prior -* error handling levels return FAILED. -* -* Host Reset is the highest level of error recovery. If this fails, then -* host is offlined by SCSI. -*/ -int -snic_host_reset (struct scsi_cmnd *sc) -{ -struct Scsi_Host *shost = sc->device->host; -u32 start_time = jiffies; -int ret; -
drivers/scsi/snic/snic_scsi.c snic_reset(struct Scsi_Host *shost) · line 2335
Quoted 10 lines
drivers/scsi/snic/snic_scsi.c +0
-10-SNIC_SCSI_DBG (shost, -"host reset:sc %p sc_cmd 0x%x req %p tag %d flags 0x%llx\n" , - sc, sc->cmnd[0 ],scsi_cmd_to_rq (sc), -snic_cmd_tag (sc),CMD_FLAGS (sc)); - - ret =snic_reset (shost); - -SNIC_TRC (shost->host_no,snic_cmd_tag (sc), (ulong ) sc, -jiffies_to_msecs (jiffies - start_time), -0 ,SNIC_TRC_CMD (sc),SNIC_TRC_CMD_STATE_FLAGS (sc));
Is it ok to loose those twp debug/logging statements? They seem to have some information about timing.
Quoted 4 lines
drivers/scsi/snic/snic_scsi.c +0
-1-return ret; }/* end of snic_host_reset */
Signature · 4 lines
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy Vors. Aufs.-R.: Gregor Pillen / Geschäftsführung: David Faller Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Hannes Reinecke
maintainerPATCH v8 2/10 scsi: Use Scsi_Host and channel number as argument for eh_bus_reset_handler()
In reply to Hannes ReineckeThe bus reset should not depend on any command, but rather only use the SCSI Host and the channel/bus number as argument.
--- Documentation/scsi/scsi_eh.rst | 2 +- Documentation/scsi/scsi_mid_low_api.rst | 7 +++-- drivers/message/fusion/mptfc.c | 13 ++++----- drivers/message/fusion/mptscsih.c | 26 +++++++---------- drivers/message/fusion/mptscsih.h | 2 +- drivers/scsi/a100u2w.c | 5 ++-- drivers/scsi/aacraid/linit.c | 13 ++++----- drivers/scsi/aha152x.c | 4 +-- drivers/scsi/aha1542.c | 4 +-- drivers/scsi/aic7xxx/aic79xx_osm.c | 10 +++---- drivers/scsi/aic7xxx/aic7xxx_osm.c | 6 ++-- drivers/scsi/arcmsr/arcmsr_hba.c | 8 +++--- drivers/scsi/arm/fas216.c | 9 +++--- drivers/scsi/arm/fas216.h | 5 ++-- drivers/scsi/dc395x.c | 24 ++++++++-------- drivers/scsi/esas2r/esas2r.h | 2 +- drivers/scsi/esas2r/esas2r_main.c | 4 +-- drivers/scsi/esp_scsi.c | 5 ++-- drivers/scsi/initio.c | 14 +++++----- drivers/scsi/mpi3mr/mpi3mr_os.c | 37 +++++++++++++++---------- drivers/scsi/ncr53c8xx.c | 4 +-- drivers/scsi/pcmcia/nsp_cs.c | 6 ++-- drivers/scsi/pcmcia/nsp_cs.h | 2 +- drivers/scsi/pmcraid.c | 11 ++++---- drivers/scsi/qla1280.c | 16 ++++++----- drivers/scsi/qla2xxx/qla_os.c | 19 +++++-------- drivers/scsi/scsi_debug.c | 9 +++--- drivers/scsi/scsi_error.c | 4 +-- drivers/scsi/sym53c8xx_2/sym_glue.c | 8 +++--- drivers/scsi/vmw_pvscsi.c | 5 ++-- drivers/scsi/wd719x.c | 11 ++++---- drivers/usb/storage/scsiglue.c | 4 +-- include/scsi/scsi_eh.h | 2 +- include/scsi/scsi_host.h | 2 +- 34 files changed, 149 insertions(+), 154 deletions(-)
Documentation/scsi/scsi_eh.rst +1 -1
@@ -216,7 +216,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_bus_reset_handler)(struct Scsi_Host *, unsigned int); int (* eh_host_reset_handler)(struct Scsi_Host *); Higher-severity actions are taken only when lower-severity actions
Documentation/scsi/scsi_mid_low_api.rst +4 -3
@@ -548,7 +548,7 @@ Details:: * * Defined in: drivers/scsi/scsi_error.c . **/ - void scsi_report_bus_reset(struct Scsi_Host * shost, int channel) + void scsi_report_bus_reset(struct Scsi_Host * shost, unsigned int channel) /**
@@ -741,7 +741,8 @@ Details:: /** * eh_bus_reset_handler - issue SCSI bus reset - * @scp: SCSI bus that contains this device should be reset + * @host: SCSI Host that contains the channel which should be reset + * @channel: channel to be reset * * Returns SUCCESS if command aborted else FAILED *
@@ -754,7 +755,7 @@ Details:: * * Optionally defined in: LLD **/ - int eh_bus_reset_handler(struct scsi_cmnd * scp) + int eh_bus_reset_handler(struct Scsi_Host * host, unsigned int channel) /**
drivers/message/fusion/mptfc.c +5 -8
@@ -103,7 +103,7 @@ static void mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout);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_bus_reset (struct Scsi_Host *shost,unsigned int channel);static const struct scsi_host_template mptfc_driver_template = { .module =THIS_MODULE ,
@@ -259,11 +259,9 @@ mptfc_dev_reset(struct scsi_cmnd *SCpnt) }static int -mptfc_bus_reset (struct scsi_cmnd *SCpnt) +mptfc_bus_reset (struct Scsi_Host *shost,unsigned int channel) { -struct Scsi_Host *shost = SCpnt->device->host;MPT_SCSI_HOST __maybe_unused *hd =shost_priv (shost); -int channel = SCpnt->device->channel;struct mptfc_rport_info *ri;int rtn =FAILED ;
@@ -280,10 +278,9 @@ mptfc_bus_reset(struct scsi_cmnd *SCpnt) }if (rtn ==0 ) {dfcprintk (hd->ioc,printk (MYIOC_s_DEBUG_FMT -"%s.%d: %d:%llu, executing recovery.\n" , __func__, - hd->ioc->name, shost->host_no, - SCpnt->device->id, SCpnt->device->lun)); - rtn =mptscsih_bus_reset (SCpnt); +"%s.%d: 0:0, executing recovery.\n" , __func__, + hd->ioc->name, shost->host_no)); + rtn =mptscsih_bus_reset (shost, channel); }return rtn; }
drivers/message/fusion/mptscsih.c +10 -16
@@ -1906,46 +1906,40 @@ mptscsih_target_reset(struct scsi_cmnd * SCpnt)/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /** * mptscsih_bus_reset - Perform a SCSI BUS_RESET! new_eh variant -* @SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to -* -* (linux scsi_host_template.eh_bus_reset_handler routine) +* @shost: Pointer to scsi_host structure which is to be reset +* @channel: bus number to be reset * * Returns SUCCESS or FAILED. **/ int -mptscsih_bus_reset (struct scsi_cmnd * SCpnt) +mptscsih_bus_reset (struct Scsi_Host * shost,unsigned int channel) {MPT_SCSI_HOST *hd;int retval; -VirtDevice *vdevice;MPT_ADAPTER *ioc;/* If we can't locate our host adapter structure, return FAILED status. */ -if ((hd =shost_priv (SCpnt->device->host)) ==NULL ){ +if ((hd =shost_priv (shost)) ==NULL ){ printk(KERN_ERR MYNAM ": bus reset: " - "Can't locate host! (sc=%p)\n", SCpnt); + "Can't locate host!\n");return FAILED ; } ioc = hd->ioc; -printk (MYIOC_s_INFO_FMT"attempting bus reset! (sc=%p)\n" , - ioc->name, SCpnt); -scsi_print_command (SCpnt); +printk (MYIOC_s_INFO_FMT"attempting bus reset!\n" , + ioc->name);if (ioc->timeouts <-1 ) ioc->timeouts++; - vdevice = SCpnt->device->hostdata; -if (!vdevice || !vdevice->vtarget) -return SUCCESS ; retval =mptscsih_IssueTaskMgmt (hd,MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS , - vdevice->vtarget->channel,0 ,0 ,0 , + channel,0 ,0 ,0 ,mptscsih_get_tm_timeout (ioc)); -printk (MYIOC_s_INFO_FMT"bus reset: %s (sc=%p)\n" , - ioc->name, ((retval ==0 ) ?"SUCCESS" :"FAILED" ), SCpnt); +printk (MYIOC_s_INFO_FMT"bus reset: %s\n" , + ioc->name, (retval ==0 ) ?"SUCCESS" :"FAILED" );if (retval ==0 )return SUCCESS ;
drivers/message/fusion/mptscsih.h +1 -1
@@ -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_target_reset (struct scsi_cmnd * SCpnt); -extern int mptscsih_bus_reset (struct scsi_cmnd * SCpnt); +extern int mptscsih_bus_reset (struct Scsi_Host *,unsigned int );extern int mptscsih_host_reset (struct Scsi_Host *sh);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);
drivers/scsi/a100u2w.c +3 -2
@@ -930,13 +930,14 @@ static int inia100_abort(struct scsi_cmnd * cmd)Description : Reset registers, reset a hanging bus and kill active and disconnected commands for target w/o soft reset Input : host - Pointer to host adapter structure +channel - Bus number (unused) Output : None. Return : pSRB - Pointer to SCSI request block. *****************************************************************************/ -static int inia100_bus_reset (struct scsi_cmnd * cmd) +static int inia100_bus_reset (struct Scsi_Host * shost,unsigned int channel) {/* I need Host Control Block Information */ struct orc_host *host; - host = (struct orc_host *) cmd->device->host->hostdata; + host =shost_priv (shost);return orc_reset_scsi_bus (host); }
drivers/scsi/aacraid/linit.c +6 -7
@@ -1034,20 +1034,18 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd)/* * aac_eh_bus_reset - Bus reset command handling -* @scsi_cmd: SCSI command block causing the reset +* @host: SCSI host causing the reset +* @channel: Number of the bus to be reset * */ -static int aac_eh_bus_reset (struct scsi_cmnd * cmd) +static int aac_eh_bus_reset (struct Scsi_Host *host,unsigned int channel) { -struct scsi_device * dev = cmd->device; -struct Scsi_Host * host = dev->host; -struct aac_dev * aac = (struct aac_dev *)host->hostdata; +struct aac_dev * aac =shost_priv (host);int count;u32 cmd_bus;int status =0 ; - - cmd_bus =aac_logical_to_phys (scmd_channel (cmd)); + cmd_bus =aac_logical_to_phys (channel);/* Mark the assoc. FIB to not complete, eh handler does this */ for (count =0 ; count < (host->can_queue +AAC_NUM_MGT_FIB ); ++count) {struct fib *fib = &aac->fibs[count];
@@ -1055,6 +1053,7 @@ static int aac_eh_bus_reset(struct scsi_cmnd* cmd)if (fib->hw_fib_va->header.XferState && (fib->flags &FIB_CONTEXT_FLAG ) && (fib->flags &FIB_CONTEXT_FLAG_SCSI_CMD )) { +struct scsi_cmnd *cmd;struct aac_hba_map_info *info;u32 bus, cid;
drivers/scsi/aha152x.c +2 -2
@@ -1192,9 +1192,9 @@ static int aha152x_bus_reset_host(struct Scsi_Host *shpnt)* Reset the bus * */ -static int aha152x_bus_reset (struct scsi_cmnd *SCpnt) +static int aha152x_bus_reset (struct Scsi_Host *shpnt,unsigned int channel) { -return aha152x_bus_reset_host (SCpnt->device->host); +return aha152x_bus_reset_host (shpnt); }/*
drivers/scsi/aha1542.c +2 -2
@@ -981,9 +981,9 @@ static int aha1542_reset(struct Scsi_Host *sh, u8 reset_cmd)return SUCCESS ; } -static int aha1542_bus_reset (struct scsi_cmnd *cmd) +static int aha1542_bus_reset (struct Scsi_Host *sh,unsigned int channel) { -return aha1542_reset (cmd->device->host,SCRST ); +return aha1542_reset (sh,SCRST ); }static int aha1542_host_reset (struct Scsi_Host *sh)
drivers/scsi/aic7xxx/aic79xx_osm.c +5 -5
@@ -863,21 +863,21 @@ ahd_linux_dev_reset(struct scsi_cmnd *cmd)* Reset the SCSI bus. */ static int -ahd_linux_bus_reset (struct scsi_cmnd *cmd) +ahd_linux_bus_reset (struct Scsi_Host *shost,unsigned int channel) {struct ahd_softc *ahd;int found;unsigned long flags; - ahd = *(struct ahd_softc **)cmd->device->host->hostdata; + ahd = *(struct ahd_softc **)shost->hostdata;#ifdef AHD_DEBUG if ((ahd_debug &AHD_SHOW_RECOVERY ) !=0 ) -printk ("%s: Bus reset called for cmd %p\n" , -ahd_name (ahd), cmd); +printk ("%s: Bus reset called for channel %c\n" , +ahd_name (ahd), channel +'A' );#endif ahd_lock (ahd, &flags); - found =ahd_reset_channel (ahd,scmd_channel (cmd) +'A' , + found =ahd_reset_channel (ahd, channel +'A' ,/*initiate reset*/ TRUE);ahd_unlock (ahd, &flags);
drivers/scsi/aic7xxx/aic7xxx_osm.c +3 -3
@@ -753,16 +753,16 @@ ahc_linux_dev_reset(struct scsi_cmnd *cmd)* Reset the SCSI bus. */ static int -ahc_linux_bus_reset (struct scsi_cmnd *cmd) +ahc_linux_bus_reset (struct Scsi_Host *shost,unsigned int channel) {struct ahc_softc *ahc;int found;unsigned long flags; - ahc = *(struct ahc_softc **)cmd->device->host->hostdata; + ahc = *(struct ahc_softc **)shost->hostdata;ahc_lock (ahc, &flags); - found =ahc_reset_channel (ahc,scmd_channel (cmd) +'A' , + found =ahc_reset_channel (ahc, channel +'A' ,/*initiate reset*/ TRUE);ahc_unlock (ahc, &flags);
drivers/scsi/arcmsr/arcmsr_hba.c +4 -4
@@ -110,7 +110,7 @@ static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, struct scsi_cmnd *cmd);static int arcmsr_iop_confirm (struct AdapterControlBlock *acb);static int arcmsr_abort (struct scsi_cmnd *); -static int arcmsr_bus_reset (struct scsi_cmnd *); +static int arcmsr_bus_reset (struct Scsi_Host *,unsigned int );static int arcmsr_bios_param (struct scsi_device *sdev,struct block_device *bdev,sector_t capacity,int *info);static int arcmsr_queue_command (struct Scsi_Host *h,struct scsi_cmnd *cmd);
@@ -4571,12 +4571,12 @@ static uint8_t arcmsr_iop_reset(struct AdapterControlBlock *acb)return rtnval; } -static int arcmsr_bus_reset (struct scsi_cmnd *cmd) +static int arcmsr_bus_reset (struct Scsi_Host *shost,unsigned int channel) { -struct AdapterControlBlock *acb; +struct AdapterControlBlock *acb =shost_priv (shost);int retry_count =0 ;int rtn =FAILED ; - acb = (struct AdapterControlBlock *) cmd->device->host->hostdata; +if (acb->acb_flags &ACB_F_ADAPTER_REMOVED )return SUCCESS ; pr_notice("arcmsr: executing bus reset eh.....num_resets = %d,"
drivers/scsi/arm/fas216.c +5 -4
@@ -2550,15 +2550,16 @@ int fas216_eh_device_reset(struct scsi_cmnd *SCpnt)/** * fas216_eh_bus_reset - Reset the bus associated with the command -* @SCpnt: command specifing bus to reset +* @shost: host to be reset +* @channel: bus number to reset * -* Reset the bus associated with the command. +* Reset the bus. * Returns: FAILED if unable to reset. * Notes: Further commands are blocked. */ -int fas216_eh_bus_reset (struct scsi_cmnd *SCpnt) +int fas216_eh_bus_reset (struct Scsi_Host *shost,unsigned int channel) { -FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; +FAS216_Info *info =shost_priv (shost);unsigned long flags;struct scsi_device *SDpnt;
drivers/scsi/arm/fas216.h +3 -2
@@ -389,10 +389,11 @@ extern int fas216_eh_device_reset(struct scsi_cmnd *SCpnt);/* Function: int fas216_eh_bus_reset(struct scsi_cmnd *SCpnt) * Purpose : Reset the complete bus associated with this command -* Params : SCpnt - command specifing bus to reset +* Params : shost - host to be reset +* channel - bus to be reset * Returns : FAILED if unable to reset */ -extern int fas216_eh_bus_reset (struct scsi_cmnd *SCpnt); +extern int fas216_eh_bus_reset (struct Scsi_Host *shost,unsigned int channel);/* Function: int fas216_eh_host_reset(struct Scsi_Host *shost) * Purpose : Reset the host associated with this command
drivers/scsi/dc395x.c +12 -12
@@ -1140,22 +1140,22 @@ static void reset_dev_param(struct AdapterCtlBlk *acb)/* * perform a hard reset on the SCSI bus -* @cmd - some command for this host (for fetching hooks) +* @shost - SCSI Host to be reset +* @channel - bus number * Returns: SUCCESS (0x2002) on success, else FAILED (0x2003). */ -static int __dc395x_eh_bus_reset (struct scsi_cmnd *cmd) +static int __dc395x_eh_bus_reset (struct Scsi_Host *shost,unsigned int channel) { -struct AdapterCtlBlk *acb = - (struct AdapterCtlBlk *)cmd->device->host->hostdata; +struct AdapterCtlBlk *acb =shost_priv (shost); +dprintkl (KERN_INFO , -"eh_bus_reset: (0%p) target=<%02i-%i> cmd=%p\n" , - cmd, cmd->device->id, (u8 )cmd->device->lun, cmd); +"eh_bus_reset: bus=<%02i>\n" , channel);if (timer_pending (&acb->waiting_timer))del_timer (&acb->waiting_timer);/* -* disable interrupt +* disable interrupt */ DC395x_write8 (acb,TRM_S1040_DMA_INTEN ,0x00 );DC395x_write8 (acb,TRM_S1040_SCSI_INTEN ,0x00 );
@@ -1171,7 +1171,7 @@ static int __dc395x_eh_bus_reset(struct scsi_cmnd *cmd)HZ * acb->eeprom.delay_time;/* -* re-enable interrupt +* re-enable interrupt */ /* Clear SCSI FIFO */ DC395x_write8 (acb,TRM_S1040_DMA_CONTROL ,CLRXFIFO );
@@ -1189,13 +1189,13 @@ static int __dc395x_eh_bus_reset(struct scsi_cmnd *cmd)return SUCCESS ; } -static int dc395x_eh_bus_reset (struct scsi_cmnd *cmd) +static int dc395x_eh_bus_reset (struct Scsi_Host *shost,unsigned int channel) {int rc; -spin_lock_irq (cmd->device->host->host_lock); - rc =__dc395x_eh_bus_reset (cmd); -spin_unlock_irq (cmd->device->host->host_lock); +spin_lock_irq (shost->host_lock); + rc =__dc395x_eh_bus_reset (shost, channel); +spin_unlock_irq (shost->host_lock);return rc; }
drivers/scsi/esas2r/esas2r.h +1 -1
@@ -977,7 +977,7 @@ long esas2r_proc_ioctl(struct file *fp, unsigned int cmd, unsigned long arg);int esas2r_eh_abort (struct scsi_cmnd *cmd);int esas2r_device_reset (struct scsi_cmnd *cmd);int esas2r_host_reset (struct Scsi_Host *shost); -int esas2r_bus_reset (struct scsi_cmnd *cmd); +int esas2r_bus_reset (struct Scsi_Host *shost,unsigned int channel);int esas2r_target_reset (struct scsi_cmnd *cmd);/* Internal functions */
drivers/scsi/esas2r/esas2r_main.c +1 -3
@@ -1096,10 +1096,8 @@ int esas2r_host_reset(struct Scsi_Host *shost)return esas2r_host_bus_reset (shost, true); } -int esas2r_bus_reset (struct scsi_cmnd *cmd) +int esas2r_bus_reset (struct Scsi_Host *shost,unsigned int channel) { -struct Scsi_Host *shost = cmd->device->host; -esas2r_log (ESAS2R_LOG_INFO ,"bus_reset (%p)" , shost);return esas2r_host_bus_reset (shost, false);
drivers/scsi/esp_scsi.c +3 -2
@@ -2604,9 +2604,10 @@ static int esp_eh_abort_handler(struct scsi_cmnd *cmd)return FAILED ; } -static int esp_eh_bus_reset_handler (struct scsi_cmnd *cmd) +static int esp_eh_bus_reset_handler (struct Scsi_Host *shost, +unsigned int channel) { -struct esp *esp =shost_priv (cmd->device->host); +struct esp *esp =shost_priv (shost);struct completion eh_reset;unsigned long flags;
drivers/scsi/initio.c +7 -7
@@ -2625,20 +2625,20 @@ static DEF_SCSI_QCMD(i91u_queuecommand)/** * i91u_bus_reset - reset the SCSI bus -* @cmnd: Command block we want to trigger the reset for +* @shost: SCSI host to be reset +* @channel: Bus number to be reset * * Initiate a SCSI bus reset sequence */ -static int i91u_bus_reset (struct scsi_cmnd * cmnd) +static int i91u_bus_reset (struct Scsi_Host * shost, +unsigned int channel) { -struct initio_host *host; - - host = (struct initio_host *) cmnd->device->host->hostdata; +struct initio_host *host =shost_priv (shost); -spin_lock_irq (cmnd->device->host->host_lock); +spin_lock_irq (shost->host_lock);initio_reset_scsi (host,0 ); -spin_unlock_irq (cmnd->device->host->host_lock); +spin_unlock_irq (shost->host_lock);return SUCCESS ; }
drivers/scsi/mpi3mr/mpi3mr_os.c +22 -15
@@ -4037,39 +4037,46 @@ static int mpi3mr_eh_host_reset(struct Scsi_Host *shost)/** * mpi3mr_eh_bus_reset - Bus reset error handling callback -* @scmd: SCSI command reference +* @shost: SCSI host reference +* @channel: bus number * * Checks whether pending I/Os are present for the RAID volume; * if not there's no need to reset the adapter. * * Return: SUCCESS of successful reset else FAILED */ -static int mpi3mr_eh_bus_reset (struct scsi_cmnd *scmd) +static int mpi3mr_eh_bus_reset (struct Scsi_Host *shost,unsigned int channel) { -struct mpi3mr_ioc *mrioc =shost_priv (scmd->device->host); +struct mpi3mr_ioc *mrioc =shost_priv (shost); +struct mpi3mr_tgt_dev *tgtdev;struct mpi3mr_stgt_priv_data *stgt_priv_data; -struct mpi3mr_sdev_priv_data *sdev_priv_data; -u8 dev_type =MPI3_DEVICE_DEVFORM_VD ;int retval =FAILED ; - sdev_priv_data = scmd->device->hostdata; -if (sdev_priv_data && sdev_priv_data->tgt_priv_data) { - stgt_priv_data = sdev_priv_data->tgt_priv_data; - dev_type = stgt_priv_data->dev_type; +spin_lock (&mrioc->tgtdev_lock); +list_for_each_entry (tgtdev, &mrioc->tgtdev_list, list) { +if (!tgtdev->starget || !tgtdev->starget->hostdata) +continue ; + stgt_priv_data = (struct mpi3mr_stgt_priv_data *) + tgtdev->starget->hostdata; +if (stgt_priv_data->dev_type ==MPI3_DEVICE_DEVFORM_VD ) { + retval =SUCCESS ; +break ; + } } +spin_unlock (&mrioc->tgtdev_lock); -if (dev_type ==MPI3_DEVICE_DEVFORM_VD ) { +if (retval ==SUCCESS ) {mpi3mr_wait_for_host_io (mrioc,MPI3MR_RAID_ERRREC_RESET_TIMEOUT ); -if (!mpi3mr_get_fw_pending_ios (mrioc)) - retval =SUCCESS ; +if (mpi3mr_get_fw_pending_ios (mrioc)) + retval =FAILED ; }if (retval ==FAILED )mpi3mr_print_pending_host_io (mrioc); -sdev_printk (KERN_INFO , scmd->device, -"Bus reset is %s for scmd(%p)\n" , - ((retval ==SUCCESS ) ?"SUCCESS" :"FAILED" ), scmd); +shost_printk (KERN_INFO , shost, +"Bus reset is %s\n" , + ((retval ==SUCCESS ) ?"SUCCESS" :"FAILED" ));return retval; }
drivers/scsi/ncr53c8xx.c +2 -2
@@ -7936,9 +7936,9 @@ static void ncr53c8xx_timeout(struct timer_list *t)ncr_flush_done_cmds (done_list); } -static int ncr53c8xx_bus_reset (struct scsi_cmnd *cmd) +static int ncr53c8xx_bus_reset (struct Scsi_Host *host,unsigned int channel) { -struct ncb *np = ((struct host_data *) cmd->device->host->hostdata)->ncb; +struct ncb *np = ((struct host_data *)shost_priv (host))->ncb;int sts;unsigned long flags;struct scsi_cmnd *done_list;
drivers/scsi/pcmcia/nsp_cs.c +3 -3
@@ -1486,11 +1486,11 @@ static int nsp_bus_reset(nsp_hw_data *data)return SUCCESS ; } -static int nsp_eh_bus_reset (struct scsi_cmnd *SCpnt) +static int nsp_eh_bus_reset (struct Scsi_Host *host,unsigned int channel) { -nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; +nsp_hw_data *data =shost_priv (host); -nsp_dbg (NSP_DEBUG_BUSRESET ,"SCpnt=0x%p" , SCpnt); +nsp_dbg (NSP_DEBUG_BUSRESET ,"channel=%u" , channel);return nsp_bus_reset (data); }
drivers/scsi/pcmcia/nsp_cs.h +1 -1
@@ -299,7 +299,7 @@ static int nsp_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *SCpnt);/* Error handler */ /*static int nsp_eh_abort (struct scsi_cmnd *SCpnt);*/ /*static int nsp_eh_device_reset(struct scsi_cmnd *SCpnt);*/ -static int nsp_eh_bus_reset (struct scsi_cmnd *SCpnt); +static int nsp_eh_bus_reset (struct Scsi_Host *host,unsigned int channel);static int nsp_eh_host_reset (struct Scsi_Host *host);static int nsp_bus_reset (nsp_hw_data *data);
drivers/scsi/pmcraid.c +5 -6
@@ -3023,11 +3023,10 @@ static int pmcraid_eh_device_reset_handler(struct scsi_cmnd *scmd) RESET_DEVICE_LUN); } -static int pmcraid_eh_bus_reset_handler (struct scsi_cmnd *scmd) +static int pmcraid_eh_bus_reset_handler (struct Scsi_Host *host, +unsigned int channel) { -struct Scsi_Host *host = scmd->device->host; -struct pmcraid_instance *pinstance = - (struct pmcraid_instance *)host->hostdata; +struct pmcraid_instance *pinstance =shost_priv (host);struct pmcraid_resource_entry *res =NULL ;struct pmcraid_resource_entry *temp;struct scsi_device *sdev =NULL ;
@@ -3039,11 +3038,11 @@ static int pmcraid_eh_bus_reset_handler(struct scsi_cmnd *scmd)*/ spin_lock_irqsave (&pinstance->resource_lock, lock_flags);list_for_each_entry (temp, &pinstance->used_res_q, queue) { -if (scmd->device->channel ==PMCRAID_VSET_BUS_ID && +if (channel ==PMCRAID_VSET_BUS_ID &&RES_IS_VSET (temp->cfg_entry)) { res = temp;break ; - }else if (scmd->device->channel ==PMCRAID_PHYS_BUS_ID && + }else if (channel ==PMCRAID_PHYS_BUS_ID &&RES_IS_GSCSI (temp->cfg_entry)) { res = temp;break ;
drivers/scsi/qla1280.c +9 -7
@@ -401,7 +401,7 @@ static int qla1280_init_rings(struct scsi_qla_host *);static int qla1280_nvram_config (struct scsi_qla_host *);static int qla1280_mailbox_command (struct scsi_qla_host *,uint8_t ,uint16_t *); -static int qla1280_bus_reset (struct scsi_qla_host *,int ); +static int qla1280_bus_reset (struct scsi_qla_host *,unsigned int );static int qla1280_device_reset (struct scsi_qla_host *,int ,int );static int qla1280_abort_command (struct scsi_qla_host *,struct srb *,int );static int qla1280_abort_isp (struct scsi_qla_host *);
@@ -979,13 +979,15 @@ qla1280_eh_device_reset(struct scsi_cmnd *cmd)* Reset the specified bus. **************************************************************************/ static int -qla1280_eh_bus_reset (struct scsi_cmnd *cmd) +qla1280_eh_bus_reset (struct Scsi_Host *shost,unsigned int bus) { -int rc; +int rc =FAILED ; +struct scsi_qla_host *ha =shost_priv (shost); -spin_lock_irq (cmd->device->host->host_lock); - rc =qla1280_error_action (cmd,BUS_RESET ); -spin_unlock_irq (cmd->device->host->host_lock); +spin_lock_irq (shost->host_lock); +if (qla1280_bus_reset (ha, bus) ==0 ) + rc =qla1280_wait_for_pending_commands (ha,1 ,0 ); +spin_unlock_irq (shost->host_lock);return rc; }
@@ -2535,7 +2537,7 @@ qla1280_poll(struct scsi_qla_host *ha)* 0 = success */ static int -qla1280_bus_reset (struct scsi_qla_host *ha,int bus) +qla1280_bus_reset (struct scsi_qla_host *ha,unsigned int bus) {uint16_t mb[MAILBOX_REGISTER_COUNT ];uint16_t reset_delay;
drivers/scsi/qla2xxx/qla_os.c +7 -12
@@ -1589,20 +1589,18 @@ qla2xxx_eh_target_reset(struct scsi_cmnd *cmd)* commands. * * Input: -* cmd = Linux SCSI command packet of the command that cause the -* bus reset. +* host = Linux SCSI host to be reset +* channel = bus nummber * * Returns: * SUCCESS/FAILURE (defined as macro in scsi.h). * **************************************************************************/ static int -qla2xxx_eh_bus_reset (struct scsi_cmnd *cmd) +qla2xxx_eh_bus_reset (struct Scsi_Host *shost,unsigned int channel) { -scsi_qla_host_t *vha =shost_priv (cmd->device->host); +scsi_qla_host_t *vha =shost_priv (shost);int ret =FAILED ; -unsigned int id; -uint64_t lun;struct qla_hw_data *ha = vha->hw;if (qla2x00_isp_reg_stat (ha)) {
@@ -1612,14 +1610,11 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)return FAILED ; } - id = cmd->device->id; - lun = cmd->device->lun; -if (qla2x00_chip_is_down (vha))return ret;ql_log (ql_log_info, vha,0x8012 , -"BUS RESET ISSUED nexus=%ld:%d:%llu.\n" , vha->host_no, id, lun); +"BUS RESET ISSUED nexus=%ld:%u.\n" , vha->host_no, channel);if (qla2x00_wait_for_hba_online (vha) !=QLA_SUCCESS ) { ql_log(ql_log_fatal, vha, 0x8013,
@@ -1643,8 +1638,8 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) eh_bus_reset_done:ql_log (ql_log_warn, vha,0x802b , -"BUS RESET %s nexus=%ld:%d:%llu.\n" , - (ret ==FAILED ) ?"FAILED" :"SUCCEEDED" , vha->host_no, id, lun); +"BUS RESET %s nexus=%ld:%u.\n" , + (ret ==FAILED ) ?"FAILED" :"SUCCEEDED" , vha->host_no, channel);return ret; }
drivers/scsi/scsi_debug.c +4 -5
@@ -5782,17 +5782,16 @@ static int scsi_debug_target_reset(struct scsi_cmnd *SCpnt)return SUCCESS ; } -static int scsi_debug_bus_reset (struct scsi_cmnd *SCpnt) +static int scsi_debug_bus_reset (struct Scsi_Host * hp,unsigned int channel) { -struct scsi_device *sdp = SCpnt->device; -struct sdebug_host_info *sdbg_host =shost_to_sdebug_host (sdp->host); +struct sdebug_host_info *sdbg_host =shost_to_sdebug_host (hp);struct sdebug_dev_info *devip;int k =0 ; ++num_bus_resets;if (SDEBUG_OPT_ALL_NOISE & sdebug_opts) -sdev_printk (KERN_INFO , sdp,"%s\n" , __func__); +shost_printk (KERN_INFO , hp,"%s\n" , __func__);list_for_each_entry (devip, &sdbg_host->dev_info_list, dev_list) {set_bit (SDEBUG_UA_BUS_RESET , devip->uas_bm);
@@ -5800,7 +5799,7 @@ static int scsi_debug_bus_reset(struct scsi_cmnd *SCpnt) }if (SDEBUG_OPT_RESET_NOISE & sdebug_opts) -sdev_printk (KERN_INFO , sdp, +shost_printk (KERN_INFO , hp,"%s: %d device(s) found in host\n" , __func__, k);return SUCCESS ; }
drivers/scsi/scsi_error.c +2 -2
@@ -911,7 +911,7 @@ static enum scsi_disposition scsi_try_bus_reset(struct scsi_cmnd *scmd)if (!hostt->eh_bus_reset_handler)return FAILED ; - rtn = hostt->eh_bus_reset_handler (scmd); + rtn = hostt->eh_bus_reset_handler (host,scmd_channel (scmd));if (rtn ==SUCCESS ) {if (!hostt->skip_settle_delay)
@@ -2378,7 +2378,7 @@ int scsi_error_handler(void *data)* The main purpose of this is to make sure that a CHECK_CONDITION * is properly treated. */ -void scsi_report_bus_reset (struct Scsi_Host *shost,int channel) +void scsi_report_bus_reset (struct Scsi_Host *shost,unsigned int channel) {struct scsi_device *sdev;
drivers/scsi/sym53c8xx_2/sym_glue.c +4 -4
@@ -670,14 +670,14 @@ static int sym53c8xx_eh_target_reset_handler(struct scsi_cmnd *cmd)return SCSI_SUCCESS ; } -static int sym53c8xx_eh_bus_reset_handler (struct scsi_cmnd *cmd) +static int sym53c8xx_eh_bus_reset_handler (struct Scsi_Host *shost, +unsigned int channel) { -struct Scsi_Host *shost = cmd->device->host;struct sym_data *sym_data =shost_priv (shost);struct pci_dev *pdev = sym_data->pdev;struct sym_hcb *np = sym_data->ncb; -scmd_printk (KERN_WARNING , cmd,"BUS RESET operation started\n" ); +shost_printk (KERN_WARNING , shost,"BUS RESET operation started\n" );/* * Escalate to host reset if the PCI bus went down
@@ -689,7 +689,7 @@ static int sym53c8xx_eh_bus_reset_handler(struct scsi_cmnd *cmd)sym_reset_scsi_bus (np,1 );spin_unlock_irq (shost->host_lock); -dev_warn (&cmd->device->sdev_gendev,"BUS RESET operation complete.\n" ); +shost_printk (KERN_WARNING , shost,"BUS RESET operation complete.\n" );return SCSI_SUCCESS ; }
drivers/scsi/vmw_pvscsi.c +2 -3
@@ -947,13 +947,12 @@ static int pvscsi_host_reset(struct Scsi_Host *host)return SUCCESS ; } -static int pvscsi_bus_reset (struct scsi_cmnd *cmd) +static int pvscsi_bus_reset (struct Scsi_Host *host,unsigned int channel) { -struct Scsi_Host *host = cmd->device->host;struct pvscsi_adapter *adapter =shost_priv (host);unsigned long flags; -scmd_printk (KERN_INFO , cmd,"SCSI Bus reset\n" ); +shost_printk (KERN_INFO , host,"SCSI Bus reset\n" );/* * We don't want to queue new requests for this bus after
drivers/scsi/wd719x.c +6 -5
@@ -484,11 +484,11 @@ static int wd719x_abort(struct scsi_cmnd *cmd)return SUCCESS ; } -static int wd719x_reset (struct scsi_cmnd *cmd,u8 opcode,u8 device) +static int wd719x_reset (struct Scsi_Host *shost,u8 opcode,u8 device) {int result;unsigned long flags; -struct wd719x *wd =shost_priv (cmd->device->host); +struct wd719x *wd =shost_priv (shost);struct wd719x_scb *scb, *tmp; dev_info(&wd->pdev->dev, "%s reset requested\n",
@@ -512,12 +512,13 @@ static int wd719x_reset(struct scsi_cmnd *cmd, u8 opcode, u8 device)static int wd719x_dev_reset (struct scsi_cmnd *cmd) { -return wd719x_reset (cmd,WD719X_CMD_RESET , cmd->device->id); +return wd719x_reset (cmd->device->host,WD719X_CMD_RESET , + cmd->device->id); } -static int wd719x_bus_reset (struct scsi_cmnd *cmd) +static int wd719x_bus_reset (struct Scsi_Host *host,unsigned int channel) { -return wd719x_reset (cmd,WD719X_CMD_BUSRESET ,0 ); +return wd719x_reset (host,WD719X_CMD_BUSRESET ,0 ); }static int wd719x_host_reset (struct Scsi_Host *host)
drivers/usb/storage/scsiglue.c +2 -2
@@ -478,9 +478,9 @@ static int device_reset(struct scsi_cmnd *srb) }/* Simulate a SCSI bus reset by resetting the device's USB port. */ -static int bus_reset (struct scsi_cmnd *srb) +static int bus_reset (struct Scsi_Host *shost,unsigned int channel) { -struct us_data *us =host_to_us (srb->device->host); +struct us_data *us =host_to_us (shost);int result;usb_stor_dbg (us,"%s called\n" , __func__);
include/scsi/scsi_eh.h +1 -1
@@ -12,7 +12,7 @@ struct Scsi_Host;extern void scsi_eh_finish_cmd (struct scsi_cmnd *scmd,struct list_head *done_q);extern void scsi_eh_flush_done_q (struct list_head *done_q); -extern void scsi_report_bus_reset (struct Scsi_Host *,int ); +extern void scsi_report_bus_reset (struct Scsi_Host *,unsigned int );extern void scsi_report_device_reset (struct Scsi_Host *,int ,int );extern int scsi_block_when_processing_errors (struct scsi_device *); extern bool scsi_command_normalize_sense(const struct scsi_cmnd *cmd,
include/scsi/scsi_host.h +1 -1
@@ -152,7 +152,7 @@ struct scsi_host_template {int (* eh_abort_handler)(struct scsi_cmnd *);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_bus_reset_handler)(struct Scsi_Host *,unsigned int );int (* eh_host_reset_handler)(struct Scsi_Host *);/*
Signature · 1 line
2.35.3
Re: [PATCH 02/10] scsi: Use Scsi_Host and channel number as argument for eh_bus_reset_handler()
Documentation/scsi/scsi_mid_low_api.rst Details:: · line 747
Quoted 13 lines · Hannes Reinecke
Documentation/scsi/scsi_mid_low_api.rst +2
-1@@ -741,7 +741,8 @@ Details:: /** * eh_bus_reset_handler - issue SCSI bus reset - * @scp: SCSI bus that contains this device should be reset + * @host: SCSI Host that contains the channel which should be reset + * @channel: channel to be reset * * Returns SUCCESS if command aborted else FAILED
Same as in Patch 1. Although I don't know how relevant FAST_IO_FAIL is for bus reset, we don't implement that for zFCP.
Quoted 8 lines
Documentation/scsi/scsi_mid_low_api.rst +0
-0*drivers/scsi/aic7xxx/aic79xx_osm.c +0
-0@@ -863,21 +863,21 @@ ahd_linux_dev_reset(struct scsi_cmnd *cmd)* Reset the SCSI bus. */
drivers/scsi/aic7xxx/aic79xx_osm.c ahd_linux_dev_reset(struct scsi_cmnd *cmd) · line 872
Quoted 10 lines
drivers/scsi/aic7xxx/aic79xx_osm.c +2
-2static int -ahd_linux_bus_reset (struct scsi_cmnd *cmd) +ahd_linux_bus_reset (struct Scsi_Host *shost,unsigned int channel) {struct ahd_softc *ahd;int found;unsigned long flags; - ahd = *(struct ahd_softc **)cmd->device->host->hostdata; + ahd = *(struct ahd_softc **)shost->hostdata;
Not shost_priv(shost)? The pointer casts end up at struct ahd_softc *, so void * as return type should be fine.
Quoted 31 lines
drivers/scsi/aic7xxx/aic79xx_osm.c +3
-3#ifdef AHD_DEBUG if ((ahd_debug &AHD_SHOW_RECOVERY ) !=0 ) -printk ("%s: Bus reset called for cmd %p\n" , -ahd_name (ahd), cmd); +printk ("%s: Bus reset called for channel %c\n" , +ahd_name (ahd), channel +'A' );#endif ahd_lock (ahd, &flags); - found =ahd_reset_channel (ahd,scmd_channel (cmd) +'A' , + found =ahd_reset_channel (ahd, channel +'A' ,/*initiate reset*/ TRUE);ahd_unlock (ahd, &flags);drivers/scsi/aic7xxx/aic7xxx_osm.c +2
-2@@ -753,16 +753,16 @@ ahc_linux_dev_reset(struct scsi_cmnd *cmd)* Reset the SCSI bus. */ static int -ahc_linux_bus_reset (struct scsi_cmnd *cmd) +ahc_linux_bus_reset (struct Scsi_Host *shost,unsigned int channel) {struct ahc_softc *ahc;int found;unsigned long flags; - ahc = *(struct ahc_softc **)cmd->device->host->hostdata; + ahc = *(struct ahc_softc **)shost->hostdata;
...
Quoted 7 lines
drivers/scsi/aic7xxx/aic7xxx_osm.c +1
-1ahc_lock (ahc, &flags); - found =ahc_reset_channel (ahc,scmd_channel (cmd) +'A' , + found =ahc_reset_channel (ahc, channel +'A' ,/*initiate reset*/ TRUE);ahc_unlock (ahc, &flags);
Signature · 4 lines
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy Vors. Aufs.-R.: Gregor Pillen / Geschäftsführung: David Faller Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Hannes Reinecke
maintainerRe: [PATCH 02/10] scsi: Use Scsi_Host and channel number as argument for eh_bus_reset_handler()
Quoted 7 lines · Benjamin Block
Quoted 6 lines · Hannes Reinecke
Documentation/scsi/scsi_mid_low_api.rst +0
-0@@ -741,7 +741,8 @@ Details::
Quoted 11 lines
Documentation/scsi/scsi_mid_low_api.rst Details:: · line 747
Quoted 7 lines
Documentation/scsi/scsi_mid_low_api.rst +2
-1/** * eh_bus_reset_handler - issue SCSI bus reset - * @scp: SCSI bus that contains this device should be reset + * @host: SCSI Host that contains the channel which should be reset + * @channel: channel to be reset * * Returns SUCCESS if command aborted else FAILEDSame as in Patch 1. Although I don't know how relevant
FAST_IO_FAILis for bus reset, we don't implement that for zFCP.
I'd rather delegate that to the later patch where I update scsi_error to factor in FAST_IO_FAIL for ioctl reset.
Quoted 16 lines
Quoted 16 lines
Documentation/scsi/scsi_mid_low_api.rst +0
-0*drivers/scsi/aic7xxx/aic79xx_osm.c +1
-1@@ -863,21 +863,21 @@ ahd_linux_dev_reset(struct scsi_cmnd *cmd)* Reset the SCSI bus. */ static int -ahd_linux_bus_reset (struct scsi_cmnd *cmd) +ahd_linux_bus_reset (struct Scsi_Host *shost,unsigned int channel) {struct ahd_softc *ahd;int found;unsigned long flags;
Quoted 6 lines
drivers/scsi/aic7xxx/aic79xx_osm.c ahd_linux_dev_reset(struct scsi_cmnd *cmd) · line 872
Quoted 2 lines
drivers/scsi/aic7xxx/aic79xx_osm.c +1
-1- ahd = *(struct ahd_softc **)cmd->device->host->hostdata; + ahd = *(struct ahd_softc **)shost->hostdata;Not
shost_priv(shost)? The pointer casts end up atstruct ahd_softc *, sovoid *as return type should be fine.
Ah, no. The adaptec driver is storing the _pointer_ to 'ahd_softc' in hostdata[0]. So shost_priv() won't work here. Or, rather, not without an additional cast, but then we might as well keep it for now.
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew Myers, Andrew McDonald, Martje Boudien Moerman
Benjamin Block
Reviewed-byRe: [PATCH 02/10] scsi: Use Scsi_Host and channel number as argument for eh_bus_reset_handler()
Quoted 19 lines · Hannes Reinecke
Quoted 7 lines · Benjamin Block
Quoted 6 lines · Hannes Reinecke
Documentation/scsi/scsi_mid_low_api.rst +0
-0@@ -741,7 +741,8 @@ Details::Quoted 10 lines
Documentation/scsi/scsi_mid_low_api.rst Details:: · line 747
Quoted 7 lines
Documentation/scsi/scsi_mid_low_api.rst +2
-1/** * eh_bus_reset_handler - issue SCSI bus reset - * @scp: SCSI bus that contains this device should be reset + * @host: SCSI Host that contains the channel which should be reset + * @channel: channel to be reset * * Returns SUCCESS if command aborted else FAILEDSame as in Patch 1. Although I don't know how relevant
FAST_IO_FAILis for bus reset, we don't implement that for zFCP.
Quoted 2 lines
I'd rather delegate that to the later patch where I update
scsi_errorto factor inFAST_IO_FAILfor ioctl reset.
Ok, that works as well.
Quoted 22 lines
Quoted 16 lines
Quoted 16 lines
Documentation/scsi/scsi_mid_low_api.rst +0
-0*drivers/scsi/aic7xxx/aic79xx_osm.c +1
-1@@ -863,21 +863,21 @@ ahd_linux_dev_reset(struct scsi_cmnd *cmd)* Reset the SCSI bus. */ static int -ahd_linux_bus_reset (struct scsi_cmnd *cmd) +ahd_linux_bus_reset (struct Scsi_Host *shost,unsigned int channel) {struct ahd_softc *ahd;int found;unsigned long flags;Quoted 6 lines
drivers/scsi/aic7xxx/aic79xx_osm.c ahd_linux_dev_reset(struct scsi_cmnd *cmd) · line 872
Quoted 2 lines
drivers/scsi/aic7xxx/aic79xx_osm.c +1
-1- ahd = *(struct ahd_softc **)cmd->device->host->hostdata; + ahd = *(struct ahd_softc **)shost->hostdata;Not
shost_priv(shost)? The pointer casts end up atstruct ahd_softc *, sovoid *as return type should be fine.
Quoted 5 lines
Ah, no. The adaptec driver is storing the _pointer_ to '
ahd_softc' in hostdata[0]. Soshost_priv()won't work here.
Or, rather, not without an additional cast, but then we might as well keep it for now.
Ah yeah, ofc, we need the extra de-reference. I was confused. Never mind. I Don't see anything else then.
Signature · 4 lines
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy Vors. Aufs.-R.: Gregor Pillen / Geschäftsführung: David Faller Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Hannes Reinecke
maintainerPATCH v8 3/10 scsi: Use scsi_target as argument for eh_target_reset_handler()
In reply to Hannes ReineckeThe target reset function should only depend on the scsi target, not the scsi command.
--- Documentation/scsi/scsi_eh.rst | 9 ++++ Documentation/scsi/scsi_mid_low_api.rst | 18 +++++++ drivers/message/fusion/mptsas.c | 10 +++- drivers/message/fusion/mptscsih.c | 38 +++++--------- drivers/message/fusion/mptscsih.h | 2 +- drivers/message/fusion/mptspi.c | 8 ++- drivers/s390/scsi/zfcp_scsi.c | 7 ++- drivers/scsi/aacraid/linit.c | 11 ++--- drivers/scsi/be2iscsi/be_main.c | 4 +- drivers/scsi/bfa/bfad_im.c | 5 +- drivers/scsi/bnx2fc/bnx2fc.h | 2 +- drivers/scsi/bnx2fc/bnx2fc_io.c | 6 +-- drivers/scsi/esas2r/esas2r.h | 2 +- drivers/scsi/esas2r/esas2r_main.c | 39 ++++++++------- drivers/scsi/ibmvscsi/ibmvfc.c | 5 +- drivers/scsi/libiscsi.c | 6 +-- drivers/scsi/libsas/sas_scsi_host.c | 9 ++-- drivers/scsi/lpfc/lpfc_scsi.c | 12 ++--- drivers/scsi/megaraid/megaraid_sas.h | 3 +- drivers/scsi/megaraid/megaraid_sas_base.c | 14 +++--- drivers/scsi/megaraid/megaraid_sas_fusion.c | 55 +++++++++++++-------- drivers/scsi/mpi3mr/mpi3mr_os.c | 45 ++++++----------- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 35 ++++++------- drivers/scsi/pmcraid.c | 8 +-- drivers/scsi/qedf/qedf_main.c | 3 +- drivers/scsi/qla2xxx/qla_os.c | 24 +++++---- drivers/scsi/qla4xxx/ql4_os.c | 15 +++--- drivers/scsi/scsi_debug.c | 23 ++++----- drivers/scsi/scsi_error.c | 11 +++-- drivers/scsi/sym53c8xx_2/sym_glue.c | 3 +- drivers/target/loopback/tcm_loop.c | 9 ++-- include/scsi/libiscsi.h | 2 +- include/scsi/libsas.h | 2 +- include/scsi/scsi_host.h | 2 +- 34 files changed, 232 insertions(+), 215 deletions(-)
Documentation/scsi/scsi_eh.rst +9 -0
@@ -216,6 +216,7 @@ considered to fail always. int (* eh_abort_handler)(struct scsi_cmnd *); int (* eh_device_reset_handler)(struct scsi_cmnd *); + int (* eh_target_reset_handler)(struct scsi_target *); int (* eh_bus_reset_handler)(struct Scsi_Host *, unsigned int); int (* eh_host_reset_handler)(struct Scsi_Host *);
@@ -411,6 +412,14 @@ scmd->allowed. resetting clears all scmds on the sdev, there is no need to choose error-completed scmds. + 2. If !list_empty(&eh_work_q), invoke scsi_eh_target_reset(). + + ``scsi_eh_target_reset`` + + hostt->eh_target_reset_handler() is invoked for each target. + If target reset succeeds, all failed scmds on all ready or + offline sdevs on the target are EH-finished. + 3. If !list_empty(&eh_work_q), invoke scsi_eh_bus_reset() ``scsi_eh_bus_reset``
Documentation/scsi/scsi_mid_low_api.rst +18 -0
@@ -758,6 +758,24 @@ Details:: int eh_bus_reset_handler(struct Scsi_Host * host, unsigned int channel) + /** + * eh_target_reset_handler - issue SCSI target reset + * @starget: identifies SCSI target to be reset + * + * Returns SUCCESS if command aborted else FAILED + * + * Locks: None held + * + * Calling context: kernel thread + * + * Notes: Invoked from scsi_eh thread. No other commands will be + * queued on current host during eh. + * + * Optionally defined in: LLD + **/ + int eh_target_reset_handler(struct scsi_target * starget) + + /** * eh_device_reset_handler - issue SCSI device reset * @scp: identifies SCSI device to be reset
drivers/message/fusion/mptsas.c +9 -1
@@ -1997,6 +1997,14 @@ static enum scsi_timeout_action mptsas_eh_timed_out(struct scsi_cmnd *sc) } +static int mptsas_eh_target_reset (struct scsi_target *starget) +{ +struct sas_rphy *rphy =dev_to_rphy (starget->dev.parent); +MPT_ADAPTER *ioc =rphy_to_ioc (rphy); + +return mptscsih_target_reset (ioc->sh, starget); +} +static const struct scsi_host_template mptsas_driver_template = { .module =THIS_MODULE , .proc_name ="mptsas" ,
@@ -2012,7 +2020,7 @@ static const struct scsi_host_template mptsas_driver_template = { .change_queue_depth = mptscsih_change_queue_depth, .eh_timed_out = mptsas_eh_timed_out, .eh_abort_handler = mptscsih_abort, - .eh_device_reset_handler = mptscsih_dev_reset, + .eh_target_reset_handler = mptsas_eh_target_reset, .eh_host_reset_handler = mptscsih_host_reset, .bios_param = mptscsih_bios_param, .can_queue = MPT_SAS_CAN_QUEUE,
drivers/message/fusion/mptscsih.c +13 -25
@@ -1846,55 +1846,43 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt)/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /** * mptscsih_target_reset - Perform a SCSI TARGET_RESET! -* @SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to +* @shost: Pointer to scsi_host structure +* @starget: Pointer to scsi_target structure which reset is due to * * (linux scsi_host_template.eh_target_reset_handler routine) * * Returns SUCCESS or FAILED. **/ int -mptscsih_target_reset (struct scsi_cmnd * SCpnt) +mptscsih_target_reset (struct Scsi_Host *shost,struct scsi_target * starget) { -MPT_SCSI_HOST *hd; +MPT_SCSI_HOST *hd =shost_priv (shost);int retval; -VirtDevice *vdevice; -MPT_ADAPTER *ioc; - -/* If we can't locate our host adapter structure, return FAILED status. -*/ -if ((hd =shost_priv (SCpnt->device->host)) ==NULL ){ - printk(KERN_ERR MYNAM ": target reset: " - "Can't locate host! (sc=%p)\n", SCpnt); -return FAILED ; - } - - ioc = hd->ioc; -printk (MYIOC_s_INFO_FMT"attempting target reset! (sc=%p)\n" , - ioc->name, SCpnt); -scsi_print_command (SCpnt); +VirtTarget *vtarget; +MPT_ADAPTER *ioc = hd->ioc; - vdevice = SCpnt->device->hostdata; -if (!vdevice || !vdevice->vtarget) { +printk (MYIOC_s_INFO_FMT"attempting target reset!\n" , ioc->name); + vtarget = starget->hostdata; +if (!vtarget) { retval =0 ; goto out; }/* Target reset to hidden raid component is not supported */ -if (vdevice->vtarget->tflags &MPT_TARGET_FLAGS_RAID_COMPONENT ) { +if (vtarget->tflags &MPT_TARGET_FLAGS_RAID_COMPONENT ) { retval =FAILED ; goto out; } retval =mptscsih_IssueTaskMgmt (hd,MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET , - vdevice->vtarget->channel, - vdevice->vtarget->id,0 ,0 , + vtarget->channel, vtarget->id,0 ,0 ,mptscsih_get_tm_timeout (ioc)); out: -printk (MYIOC_s_INFO_FMT"target reset: %s (sc=%p)\n" , - ioc->name, ((retval ==0 ) ?"SUCCESS" :"FAILED" ), SCpnt); +printk (MYIOC_s_INFO_FMT"target reset: %s\n" , + ioc->name, ((retval ==0 ) ?"SUCCESS" :"FAILED" ));if (retval ==0 )return SUCCESS ;
drivers/message/fusion/mptscsih.h +1 -1
@@ -120,7 +120,7 @@ extern void mptscsih_slave_destroy(struct scsi_device *device);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_target_reset (struct scsi_cmnd * SCpnt); +extern int mptscsih_target_reset (struct Scsi_Host *,struct scsi_target *);extern int mptscsih_bus_reset (struct Scsi_Host *,unsigned int );extern int mptscsih_host_reset (struct Scsi_Host *sh);extern int mptscsih_bios_param (struct scsi_device * sdev,struct block_device *bdev,sector_t capacity,int geom[]);
drivers/message/fusion/mptspi.c +7 -1
@@ -820,6 +820,12 @@ static void mptspi_slave_destroy(struct scsi_device *sdev)mptscsih_slave_destroy (sdev); } +static int mptspi_eh_target_reset (struct scsi_target *starget) +{ +struct Scsi_Host *shost =dev_to_shost (&starget->dev); +return mptscsih_target_reset (shost, starget); +} +static const struct scsi_host_template mptspi_driver_template = { .module =THIS_MODULE , .proc_name ="mptspi" ,
@@ -834,7 +840,7 @@ static const struct scsi_host_template mptspi_driver_template = { .slave_destroy = mptspi_slave_destroy, .change_queue_depth = mptscsih_change_queue_depth, .eh_abort_handler = mptscsih_abort, - .eh_device_reset_handler = mptscsih_dev_reset, + .eh_target_reset_handler = mptspi_eh_target_reset, .eh_bus_reset_handler = mptscsih_bus_reset, .eh_host_reset_handler = mptscsih_host_reset, .bios_param = mptscsih_bios_param,
drivers/s390/scsi/zfcp_scsi.c +5 -2
@@ -340,9 +340,12 @@ static int zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt)return zfcp_scsi_task_mgmt_function (sdev,FCP_TMF_LUN_RESET ); } -static int zfcp_scsi_eh_target_reset_handler (struct scsi_cmnd *scpnt) +/* +* Note: We need to select a LUN as the storage array doesn't +* necessarily supports LUN 0 and might refuse the target reset. +*/ +static int zfcp_scsi_eh_target_reset_handler (struct scsi_target *starget) { -struct scsi_target *starget =scsi_target (scpnt->device);struct fc_rport *rport =starget_to_rport (starget);struct Scsi_Host *shost =rport_to_shost (rport);struct scsi_device *sdev =NULL , *tmp_sdev;
drivers/scsi/aacraid/linit.c +5 -6
@@ -968,13 +968,12 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd)/* * aac_eh_target_reset - Target reset command handling -* @scsi_cmd: SCSI command block causing the reset +* @starget: SCSI target to be reset * */ -static int aac_eh_target_reset (struct scsi_cmnd *cmd) +static int aac_eh_target_reset (struct scsi_target *starget) { -struct scsi_device * dev = cmd->device; -struct Scsi_Host * host = dev->host; +struct Scsi_Host * host =dev_to_shost (&starget->dev);struct aac_dev * aac = (struct aac_dev *)host->hostdata;struct aac_hba_map_info *info;int count;
@@ -984,8 +983,8 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd)int status;u8 command; - bus =aac_logical_to_phys (scmd_channel (cmd)); - cid =scmd_id (cmd); + bus =aac_logical_to_phys (starget->channel); + cid = starget->id;if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS )return FAILED ;
drivers/scsi/be2iscsi/be_main.c +2 -2
@@ -385,11 +385,11 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc)return rc; } -static int beiscsi_eh_session_reset (struct scsi_cmnd *sc) +static int beiscsi_eh_session_reset (struct scsi_target *starget) {struct iscsi_cls_session *cls_session; - cls_session =starget_to_session (scsi_target (sc->device)); + cls_session =starget_to_session (starget);return iscsi_eh_session_reset (cls_session); }
drivers/scsi/bfa/bfad_im.c +2 -3
@@ -362,11 +362,10 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd)* Scsi_Host template entry, resets the target and abort all commands. */ static int -bfad_im_reset_target_handler (struct scsi_cmnd *cmnd) +bfad_im_reset_target_handler (struct scsi_target *starget) { -struct Scsi_Host *shost = cmnd->device->host; -struct scsi_target *starget =scsi_target (cmnd->device);struct fc_rport *rport =starget_to_rport (starget); +struct Scsi_Host *shost =rport_to_shost (rport);struct bfad_im_port_s *im_port = (struct bfad_im_port_s *) shost->hostdata[0 ];struct bfad_s *bfad = im_port->bfad;
drivers/scsi/bnx2fc/bnx2fc.h +1 -1
@@ -551,7 +551,7 @@ void bnx2fc_init_task(struct bnx2fc_cmd *io_req,void bnx2fc_add_2_sq (struct bnx2fc_rport *tgt,u16 xid);void bnx2fc_ring_doorbell (struct bnx2fc_rport *tgt);int bnx2fc_eh_abort (struct scsi_cmnd *sc_cmd); -int bnx2fc_eh_target_reset (struct scsi_cmnd *sc_cmd); +int bnx2fc_eh_target_reset (struct scsi_target *sc_tgt);int bnx2fc_eh_device_reset (struct scsi_cmnd *sc_cmd); void bnx2fc_rport_event_handler(struct fc_lport *lport, struct fc_rport_priv *rport,
drivers/scsi/bnx2fc/bnx2fc_io.c +3 -3
@@ -1051,14 +1051,14 @@ int bnx2fc_initiate_cleanup(struct bnx2fc_cmd *io_req)/** * bnx2fc_eh_target_reset: Reset a target * -* @sc_cmd: SCSI command +* @sc_tgt: SCSI target * * Set from SCSI host template to send task mgmt command to the target * and wait for the response */ -int bnx2fc_eh_target_reset (struct scsi_cmnd *sc_cmd) +int bnx2fc_eh_target_reset (struct scsi_target *sc_tgt) { -struct fc_rport *rport =starget_to_rport (scsi_target (sc_cmd->device)); +struct fc_rport *rport =starget_to_rport (sc_tgt);struct fc_lport *lport =shost_priv (rport_to_shost (rport));return bnx2fc_initiate_tmf (lport, rport,0 ,FCP_TMF_TGT_RESET );
drivers/scsi/esas2r/esas2r.h +1 -1
@@ -978,7 +978,7 @@ int esas2r_eh_abort(struct scsi_cmnd *cmd);int esas2r_device_reset (struct scsi_cmnd *cmd);int esas2r_host_reset (struct Scsi_Host *shost);int esas2r_bus_reset (struct Scsi_Host *shost,unsigned int channel); -int esas2r_target_reset (struct scsi_cmnd *cmd); +int esas2r_target_reset (struct scsi_target *starget);/* Internal functions */ int esas2r_init_adapter(struct Scsi_Host *host, struct pci_dev *pcid,
drivers/scsi/esas2r/esas2r_main.c +20 -19
@@ -1103,10 +1103,10 @@ int esas2r_bus_reset(struct Scsi_Host *shost, unsigned int channel)return esas2r_host_bus_reset (shost, false); } -static int esas2r_dev_targ_reset (struct scsi_cmnd *cmd,bool target_reset) +static int esas2r_dev_targ_reset (struct Scsi_Host *shost,int id,u64 lun, +bool target_reset) { -struct esas2r_adapter *a = - (struct esas2r_adapter *)cmd->device->host->hostdata; +struct esas2r_adapter *a =shost_priv (shost);struct esas2r_request *rq;u8 task_management_status =RS_PENDING ;bool completed;
@@ -1120,34 +1120,30 @@ static int esas2r_dev_targ_reset(struct scsi_cmnd *cmd, bool target_reset)if (target_reset) {esas2r_log (ESAS2R_LOG_CRIT ,"unable to allocate a request for a " -"target reset (%d)!" , - cmd->device->id); +"target reset (%d)!" , id); }else {esas2r_log (ESAS2R_LOG_CRIT ,"unable to allocate a request for a " -"device reset (%d:%llu)!" , - cmd->device->id, - cmd->device->lun); +"device reset (%d:%llu)!" , id, lun); }return FAILED ; } - rq->target_id = cmd->device->id; - rq->vrq->scsi.flags |=cpu_to_le32 (cmd->device->lun); + rq->target_id = id; + rq->vrq->scsi.flags |=cpu_to_le32 (lun); rq->req_stat =RS_PENDING ; rq->comp_cb = complete_task_management_request; rq->task_management_status_ptr = &task_management_status;if (target_reset) { -esas2r_debug ("issuing target reset (%p) to id %d" , rq, - cmd->device->id); +esas2r_debug ("issuing target reset (%p) to id %d" , rq, id); completed =esas2r_send_task_mgmt (a, rq,0x20 ); }else { -esas2r_debug ("issuing device reset (%p) to id %d lun %d" , rq, - cmd->device->id, cmd->device->lun); +esas2r_debug ("issuing device reset (%p) to id %d lun %llu" , rq, + id, lun); completed =esas2r_send_task_mgmt (a, rq,0x10 ); }
@@ -1181,17 +1177,22 @@ static int esas2r_dev_targ_reset(struct scsi_cmnd *cmd, bool target_reset)int esas2r_device_reset (struct scsi_cmnd *cmd) { -esas2r_log (ESAS2R_LOG_INFO ,"device_reset (%p)" , cmd); +struct scsi_device *sdev = cmd->device; +struct Scsi_Host *shost = sdev->host; + +esas2r_log (ESAS2R_LOG_INFO ,"device_reset" ); -return esas2r_dev_targ_reset (cmd, false); +return esas2r_dev_targ_reset (shost, sdev->id, sdev->lun, false); } -int esas2r_target_reset (struct scsi_cmnd *cmd) +int esas2r_target_reset (struct scsi_target *starget) { -esas2r_log (ESAS2R_LOG_INFO ,"target_reset (%p)" , cmd); +struct Scsi_Host *shost =dev_to_shost (&starget->dev); + +esas2r_log (ESAS2R_LOG_INFO ,"target_reset" ); -return esas2r_dev_targ_reset (cmd, true); +return esas2r_dev_targ_reset (shost, starget->id,0 , true); } void esas2r_log_request_failure(struct esas2r_adapter *a,
drivers/scsi/ibmvscsi/ibmvfc.c +2 -3
@@ -2997,14 +2997,13 @@ static void ibmvfc_dev_cancel_all_noreset(struct scsi_device *sdev, void *data)/** * ibmvfc_eh_target_reset_handler - Reset the target -* @cmd: scsi command struct +* @starget: scsi target struct * * Returns: * SUCCESS / FAST_IO_FAIL / FAILED **/ -static int ibmvfc_eh_target_reset_handler (struct scsi_cmnd *cmd) +static int ibmvfc_eh_target_reset_handler (struct scsi_target *starget) { -struct scsi_target *starget =scsi_target (cmd->device);struct fc_rport *rport =starget_to_rport (starget);struct Scsi_Host *shost =rport_to_shost (rport);struct ibmvfc_host *vhost =shost_priv (shost);
drivers/scsi/libiscsi.c +3 -3
@@ -2738,17 +2738,17 @@ static int iscsi_eh_target_reset(struct iscsi_cls_session *cls_session)/** * iscsi_eh_recover_target - reset target and possibly the session -* @sc: scsi command +* @starget: scsi target * * This will attempt to send a warm target reset. If that fails, * we will escalate to ERL0 session recovery. */ -int iscsi_eh_recover_target (struct scsi_cmnd *sc) +int iscsi_eh_recover_target (struct scsi_target *starget) {struct iscsi_cls_session *cls_session;int rc; - cls_session =starget_to_session (scsi_target (sc->device)); + cls_session =starget_to_session (starget); rc =iscsi_eh_target_reset (cls_session);if (rc ==FAILED ) rc =iscsi_eh_session_reset (cls_session);
drivers/scsi/libsas/sas_scsi_host.c +5 -4
@@ -478,11 +478,12 @@ int sas_eh_device_reset_handler(struct scsi_cmnd *cmd) }EXPORT_SYMBOL_GPL (sas_eh_device_reset_handler); -int sas_eh_target_reset_handler (struct scsi_cmnd *cmd) +int sas_eh_target_reset_handler (struct scsi_target *starget) {int res; -struct Scsi_Host *host = cmd->device->host; -struct domain_device *dev =cmd_to_domain_dev (cmd); +struct domain_device *dev =starget_to_domain_dev (starget); +struct sas_rphy *rphy = dev->rphy; +struct Scsi_Host *host =dev_to_shost (rphy->dev.parent);struct sas_internal *i =to_sas_internal (host->transportt);if (current != host->ehandler)
@@ -515,7 +516,7 @@ static int try_to_reset_cmd_device(struct scsi_cmnd *cmd) try_target_reset:if (shost->hostt->eh_target_reset_handler) -return shost->hostt->eh_target_reset_handler (cmd); +return shost->hostt->eh_target_reset_handler (scsi_target (cmd->device));return FAILED ; }
drivers/scsi/lpfc/lpfc_scsi.c +6 -6
@@ -6035,7 +6035,7 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd)/** * lpfc_target_reset_handler - scsi_host_template eh_target_reset entry point -* @cmnd: Pointer to scsi_cmnd data structure. +* @starget: Pointer to scsi_target data structure. * * This routine does a target reset by sending a TARGET_RESET task management * command.
@@ -6045,15 +6045,15 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd)* 0x2002 - Success **/ static int -lpfc_target_reset_handler (struct scsi_cmnd *cmnd) +lpfc_target_reset_handler (struct scsi_target *starget) { -struct Scsi_Host *shost = cmnd->device->host; -struct fc_rport *rport =starget_to_rport (scsi_target (cmnd->device)); +struct fc_rport *rport =starget_to_rport (starget); +struct Scsi_Host *shost =rport_to_shost (rport);struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;struct lpfc_rport_data *rdata;struct lpfc_nodelist *pnode; -unsigned tgt_id = cmnd->device->id; -uint64_t lun_id = cmnd->device->lun; +unsigned tgt_id = starget->id; +uint64_t lun_id =0 ;struct lpfc_scsi_event_header scsi_event;int status;u32 logit =LOG_FCP ;
drivers/scsi/megaraid/megaraid_sas.h +2 -1
@@ -2725,7 +2725,8 @@ void megasas_setup_jbod_map(struct megasas_instance *instance);void megasas_update_sdev_properties (struct scsi_device *sdev);int megasas_reset_fusion (struct Scsi_Host *shost,int reason);int megasas_task_abort_fusion (struct scsi_cmnd *scmd); -int megasas_reset_target_fusion (struct scsi_cmnd *scmd); +int megasas_reset_target_fusion (struct Scsi_Host *shost, +struct scsi_target *starget);u32 mega_mod64 (u64 dividend,u32 divisor);int megasas_alloc_fusion_context (struct megasas_instance *instance);void megasas_free_fusion_context (struct megasas_instance *instance);
drivers/scsi/megaraid/megaraid_sas_base.c +7 -7
@@ -3104,19 +3104,19 @@ static int megasas_task_abort(struct scsi_cmnd *scmd)/** * megasas_reset_target: Issues target reset request to firmware * (supported only for fusion adapters) -* @scmd: SCSI command pointer +* @starget: SCSI target */ -static int megasas_reset_target (struct scsi_cmnd *scmd) +static int megasas_reset_target (struct scsi_target *starget) { +struct Scsi_Host *shost =dev_to_shost (&starget->dev);int ret; -struct megasas_instance *instance; - - instance = (struct megasas_instance *)scmd->device->host->hostdata; +struct megasas_instance *instance =shost_priv (shost);if (instance->adapter_type !=MFI_SERIES ) - ret =megasas_reset_target_fusion (scmd); + ret =megasas_reset_target_fusion (shost, starget);else { -sdev_printk (KERN_NOTICE , scmd->device,"TARGET RESET not supported\n" ); +starget_printk (KERN_NOTICE , starget, +"TARGET RESET not supported\n" ); ret =FAILED ; }
drivers/scsi/megaraid/megaraid_sas_fusion.c +34 -21
95 lines not on this page · raw message
drivers/scsi/mpi3mr/mpi3mr_os.c +16 -29
86 lines not on this page · raw message
drivers/scsi/mpt3sas/mpt3sas_scsih.c +14 -21
@@ -3441,52 +3441,45 @@ scsih_dev_reset(struct scsi_cmnd *scmd)/** * scsih_target_reset - eh threads main target reset routine -* @scmd: pointer to scsi command object +* @starget: pointer to scsi target object * -* Return: SUCCESS if command aborted else FAILED +* Return: SUCCESS if target reset suceeded else FAILED */ static int -scsih_target_reset (struct scsi_cmnd *scmd) +scsih_target_reset (struct scsi_target *starget) { -struct MPT3SAS_ADAPTER *ioc =shost_priv (scmd->device->host); -struct MPT3SAS_DEVICE *sas_device_priv_data; +struct Scsi_Host *shost =dev_to_shost (&starget->dev); +struct MPT3SAS_ADAPTER *ioc =shost_priv (shost);struct _sas_device *sas_device =NULL ;struct _pcie_device *pcie_device =NULL ;u16 handle;u8 tr_method =0 ;u8 tr_timeout =30 ;int r; -struct scsi_target *starget = scmd->device->sdev_target;struct MPT3SAS_TARGET *target_priv_data = starget->hostdata;starget_printk (KERN_INFO , starget, -"attempting target reset! scmd(0x%p)\n" , scmd); -_scsih_tm_display_info (ioc, scmd); +"attempting target reset!\n" ); - sas_device_priv_data = scmd->device->hostdata; -if (!sas_device_priv_data || !sas_device_priv_data->sas_target || - ioc->remove_host) { +if (!target_priv_data || ioc->remove_host) {starget_printk (KERN_INFO , starget, -"target been deleted! scmd(0x%p)\n" , scmd); - scmd->result =DID_NO_CONNECT <<16 ; -scsi_done (scmd); +"target been deleted!\n" ); r =SUCCESS ; goto out; }/* for hidden raid components obtain the volume_handle */ handle =0 ; -if (sas_device_priv_data->sas_target->flags & +if (target_priv_data->flags &MPT_TARGET_FLAGS_RAID_COMPONENT ) { sas_device =mpt3sas_get_sdev_from_target (ioc, target_priv_data);if (sas_device) handle = sas_device->volume_handle; }else - handle = sas_device_priv_data->sas_target->handle; + handle = target_priv_data->handle;if (!handle) { - scmd->result =DID_RESET <<16 ; r =FAILED ; goto out; }
@@ -3499,16 +3492,16 @@ scsih_target_reset(struct scsi_cmnd *scmd) tr_method =MPI26_SCSITASKMGMT_MSGFLAGS_PROTOCOL_LVL_RST_PCIE ; }else tr_method =MPI2_SCSITASKMGMT_MSGFLAGS_LINK_RESET ; - r =mpt3sas_scsih_issue_locked_tm (ioc, handle, scmd->device->channel, - scmd->device->id,0 , + r =mpt3sas_scsih_issue_locked_tm (ioc, handle, starget->channel, + starget->id,0 ,MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET ,0 ,0 , tr_timeout, tr_method);/* Check for busy commands after reset */ if (r ==SUCCESS &&atomic_read (&starget->target_busy)) r =FAILED ; out: -starget_printk (KERN_INFO , starget,"target reset: %s scmd(0x%p)\n" , - ((r ==SUCCESS ) ?"SUCCESS" :"FAILED" ), scmd); +starget_printk (KERN_INFO , starget,"target reset: %s\n" , + ((r ==SUCCESS ) ?"SUCCESS" :"FAILED" ));if (sas_device)sas_device_put (sas_device);
drivers/scsi/pmcraid.c +4 -4
@@ -3061,15 +3061,15 @@ static int pmcraid_eh_bus_reset_handler(struct Scsi_Host *host, RESET_DEVICE_BUS); } -static int pmcraid_eh_target_reset_handler (struct scsi_cmnd *scmd) +static int pmcraid_eh_target_reset_handler (struct scsi_target *starget) { -struct Scsi_Host *shost = scmd->device->host; +struct Scsi_Host *shost =dev_to_shost (&starget->dev);struct scsi_device *scsi_dev =NULL , *tmp;int ret;shost_for_each_device (tmp, shost) { -if ((tmp->channel == scmd->device->channel) && - (tmp->id == scmd->device->id)) { +if ((tmp->channel == starget->channel) && + (tmp->id == starget->id)) { scsi_dev = tmp;break ; }
drivers/scsi/qedf/qedf_main.c +1 -2
@@ -856,9 +856,8 @@ static int qedf_eh_abort(struct scsi_cmnd *sc_cmd)return rc; } -static int qedf_eh_target_reset (struct scsi_cmnd *sc_cmd) +static int qedf_eh_target_reset (struct scsi_target *starget) { -struct scsi_target *starget =scsi_target (sc_cmd->device);struct fc_rport *rport =starget_to_rport (starget);QEDF_ERR (NULL ,"TARGET RESET Issued..." );
drivers/scsi/qla2xxx/qla_os.c +11 -13
@@ -1515,10 +1515,9 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd) }static int -qla2xxx_eh_target_reset (struct scsi_cmnd *cmd) +qla2xxx_eh_target_reset (struct scsi_target *starget) { -struct scsi_device *sdev = cmd->device; -struct fc_rport *rport =starget_to_rport (scsi_target (sdev)); +struct fc_rport *rport =starget_to_rport (starget);scsi_qla_host_t *vha =shost_priv (rport_to_shost (rport));struct qla_hw_data *ha = vha->hw;fc_port_t *fcport = *(fc_port_t **)rport->dd_data;
@@ -1543,40 +1542,39 @@ qla2xxx_eh_target_reset(struct scsi_cmnd *cmd)return FAILED ;ql_log (ql_log_info, vha,0x8009 , -"TARGET RESET ISSUED nexus=%ld:%d cmd=%p.\n" , vha->host_no, - sdev->id, cmd); +"TARGET RESET ISSUED nexus=%ld:%d.\n" , vha->host_no, + starget->id); err =0 ;if (qla2x00_wait_for_hba_online (vha) !=QLA_SUCCESS ) {ql_log (ql_log_warn, vha,0x800a , -"Wait for hba online failed for cmd=%p.\n" , cmd); +"Wait for hba online failed.\n" ); goto eh_reset_failed; } err =2 ;if (ha->isp_ops->target_reset (fcport,0 ,0 ) !=QLA_SUCCESS ) {ql_log (ql_log_warn, vha,0x800c , -"target_reset failed for cmd=%p.\n" , cmd); +"target_reset failed.\n" ); goto eh_reset_failed; } err =3 ;if (qla2x00_eh_wait_for_pending_commands (vha, fcport->d_id.b24,0 ,WAIT_TARGET ) !=QLA_SUCCESS ) {ql_log (ql_log_warn, vha,0x800d , -"wait for pending cmds failed for cmd=%p.\n" , cmd); +"wait for pending cmds failed.\n" ); goto eh_reset_failed; }ql_log (ql_log_info, vha,0x800e , -"TARGET RESET SUCCEEDED nexus:%ld:%d cmd=%p.\n" , - vha->host_no, sdev->id, cmd); +"TARGET RESET SUCCEEDED nexus:%ld:%d.\n" , + vha->host_no, starget->id);return SUCCESS ; eh_reset_failed:ql_log (ql_log_info, vha,0x800f , -"TARGET RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n" , - reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun, - cmd); +"TARGET RESET FAILED: %s nexus=%ld:%d.\n" , + reset_errors[err], vha->host_no, starget->id); vha->reset_cmd_err_cnt++;return FAILED ; }
drivers/scsi/qla4xxx/ql4_os.c +6 -9
@@ -158,7 +158,7 @@ static int qla4xxx_get_host_stats(struct Scsi_Host *shost, char *buf, int len);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_target_reset (struct scsi_target *starget);static int qla4xxx_eh_host_reset (struct Scsi_Host *shost);static int qla4xxx_slave_alloc (struct scsi_device *device);static umode_t qla4_attr_is_visible (int param_type,int param);
@@ -9338,13 +9338,12 @@ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd)/** * qla4xxx_eh_target_reset - callback for target reset. -* @cmd: Pointer to Linux's SCSI command structure +* @starget: Pointer to Linux's SCSI target structure * * This routine is called by the Linux OS to reset the target. **/ -static int qla4xxx_eh_target_reset (struct scsi_cmnd *cmd) +static int qla4xxx_eh_target_reset (struct scsi_target *starget) { -struct scsi_target *starget =scsi_target (cmd->device);struct iscsi_cls_session *cls_session =starget_to_session (starget);struct iscsi_session *sess;struct scsi_qla_host *ha;
@@ -9366,10 +9365,8 @@ static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd) "WARM TARGET RESET ISSUED.\n");DEBUG2 (printk (KERN_INFO -"scsi%ld: TARGET_DEVICE_RESET cmd=%p jiffies = 0x%lx, " -"to=%x,dpc_flags=%lx, status=%x allowed=%d\n" , - ha->host_no, cmd, jiffies,scsi_cmd_to_rq (cmd)->timeout /HZ , - ha->dpc_flags, cmd->result, cmd->allowed)); +"scsi%ld: TARGET_DEVICE_RESET dpc_flags=%lx\n" , + ha->host_no, ha->dpc_flags)); rval =qla4xxx_isp_check_reg (ha);if (rval !=QLA_SUCCESS ) {
@@ -9392,7 +9389,7 @@ static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd) }/* Send marker. */ -if (qla4xxx_send_marker_iocb (ha, ddb_entry, cmd->device->lun, +if (qla4xxx_send_marker_iocb (ha, ddb_entry,0 ,MM_TGT_WARM_RESET ) !=QLA_SUCCESS ) {starget_printk (KERN_INFO , starget, "WARM TARGET DEVICE RESET FAILED - "
drivers/scsi/scsi_debug.c +9 -14
@@ -5737,9 +5737,8 @@ static int scsi_debug_device_reset(struct scsi_cmnd *SCpnt)return SUCCESS ; } -static int sdebug_fail_target_reset (struct scsi_cmnd *cmnd) +static int sdebug_fail_target_reset (struct scsi_target *starget) { -struct scsi_target *starget =scsi_target (cmnd->device);struct sdebug_target_info *targetip = (struct sdebug_target_info *)starget->hostdata;
@@ -5749,33 +5748,29 @@ static int sdebug_fail_target_reset(struct scsi_cmnd *cmnd)return 0 ; } -static int scsi_debug_target_reset (struct scsi_cmnd *SCpnt) +static int scsi_debug_target_reset (struct scsi_target *starget) { -struct scsi_device *sdp = SCpnt->device; -struct sdebug_host_info *sdbg_host =shost_to_sdebug_host (sdp->host); +struct Scsi_Host *hp =dev_to_shost (&starget->dev); +struct sdebug_host_info *sdbg_host =shost_to_sdebug_host (hp);struct sdebug_dev_info *devip; -u8 *cmd = SCpnt->cmnd; -u8 opcode = cmd[0 ];int k =0 ; ++num_target_resets;if (SDEBUG_OPT_ALL_NOISE & sdebug_opts) -sdev_printk (KERN_INFO , sdp,"%s\n" , __func__); - +starget_printk (KERN_INFO , starget,"%s\n" , __func__);list_for_each_entry (devip, &sdbg_host->dev_info_list, dev_list) { -if (devip->target == sdp->id) { +if (devip->target == starget->id) {set_bit (SDEBUG_UA_BUS_RESET , devip->uas_bm); ++k; } }if (SDEBUG_OPT_RESET_NOISE & sdebug_opts) -sdev_printk (KERN_INFO , sdp, +starget_printk (KERN_INFO , starget,"%s: %d device(s) found in target\n" , __func__, k); -if (sdebug_fail_target_reset (SCpnt)) { -scmd_printk (KERN_INFO , SCpnt,"fail target reset 0x%x\n" , - opcode); +if (sdebug_fail_target_reset (starget)) { +starget_printk (KERN_INFO , starget,"fail target reset\n" );return FAILED ; }
drivers/scsi/scsi_error.c +7 -4
@@ -946,14 +946,15 @@ static enum scsi_disposition scsi_try_target_reset(struct scsi_cmnd *scmd)enum scsi_disposition rtn;struct Scsi_Host *host = scmd->device->host;const struct scsi_host_template *hostt = host->hostt; +struct scsi_target *starget =scsi_target (scmd->device);if (!hostt->eh_target_reset_handler)return FAILED ; - rtn = hostt->eh_target_reset_handler (scmd); + rtn = hostt->eh_target_reset_handler (starget);if (rtn ==SUCCESS ) {spin_lock_irqsave (host->host_lock, flags); -__starget_for_each_device (scsi_target (scmd->device),NULL , +__starget_for_each_device (starget,NULL , __scsi_report_device_reset);spin_unlock_irqrestore (host->host_lock, flags); }
@@ -1634,7 +1635,7 @@ static int scsi_eh_target_reset(struct Scsi_Host *shost,while (!list_empty (&tmp_list)) {struct scsi_cmnd *next, *scmd;enum scsi_disposition rtn; -unsigned int id; +unsigned int channel, id;if (scsi_host_eh_past_deadline (shost)) {/* push back on work queue for further processing */
@@ -1648,6 +1649,7 @@ static int scsi_eh_target_reset(struct Scsi_Host *shost, } scmd = list_entry(tmp_list.next, struct scsi_cmnd, eh_entry); + channel =scmd_channel (scmd); id =scmd_id (scmd); SCSI_LOG_ERROR_RECOVERY(3,
@@ -1662,7 +1664,8 @@ static int scsi_eh_target_reset(struct Scsi_Host *shost," target: %d\n" , current->comm, id));list_for_each_entry_safe (scmd, next, &tmp_list, eh_entry) { -if (scmd_id (scmd) != id) +if (scmd_channel (scmd) != channel || +scmd_id (scmd) != id)continue ;if (rtn ==SUCCESS )
drivers/scsi/sym53c8xx_2/sym_glue.c +1 -2
@@ -619,9 +619,8 @@ static int sym53c8xx_eh_abort_handler(struct scsi_cmnd *cmd)return sts ?SCSI_FAILED :SCSI_SUCCESS ; } -static int sym53c8xx_eh_target_reset_handler (struct scsi_cmnd *cmd) +static int sym53c8xx_eh_target_reset_handler (struct scsi_target *starget) { -struct scsi_target *starget =scsi_target (cmd->device);struct Scsi_Host *shost =dev_to_shost (starget->dev.parent);struct sym_data *sym_data =shost_priv (shost);struct pci_dev *pdev = sym_data->pdev;
drivers/target/loopback/tcm_loop.c +5 -4
@@ -267,23 +267,24 @@ static int tcm_loop_device_reset(struct scsi_cmnd *sc)return (ret ==TMR_FUNCTION_COMPLETE ) ?SUCCESS :FAILED ; } -static int tcm_loop_target_reset (struct scsi_cmnd *sc) +static int tcm_loop_target_reset (struct scsi_target *starget) {struct tcm_loop_hba *tl_hba;struct tcm_loop_tpg *tl_tpg; +struct Scsi_Host *shost =dev_to_shost (&starget->dev);/* * Locate the tcm_loop_hba_t pointer */ - tl_hba = *(struct tcm_loop_hba **)shost_priv (sc->device->host); + tl_hba = *(struct tcm_loop_hba **)shost_priv (shost);if (!tl_hba) {pr_err ("Unable to perform device reset without active I_T Nexus\n" );return FAILED ; }/* -* Locate the tl_tpg pointer from TargetID in sc->device->id +* Locate the tl_tpg pointer from TargetID in starget->id */ - tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id]; + tl_tpg = &tl_hba->tl_hba_tpgs[starget->id];if (tl_tpg) { tl_tpg->tl_transport_status =TCM_TRANSPORT_ONLINE ;return SUCCESS ;
include/scsi/libiscsi.h +1 -1
@@ -389,7 +389,7 @@ struct iscsi_host {* scsi host template */ extern int iscsi_eh_abort (struct scsi_cmnd *sc); -extern int iscsi_eh_recover_target (struct scsi_cmnd *sc); +extern int iscsi_eh_recover_target (struct scsi_target *starget);extern int iscsi_eh_session_reset (struct iscsi_cls_session *cls_session);extern int iscsi_eh_device_reset (struct scsi_cmnd *sc);extern int iscsi_queuecommand (struct Scsi_Host *host,struct scsi_cmnd *sc);
include/scsi/libsas.h +1 -1
@@ -699,7 +699,7 @@ extern struct device_attribute dev_attr_phy_event_threshold;void sas_task_abort (struct sas_task *);int sas_eh_abort_handler (struct scsi_cmnd *cmd);int sas_eh_device_reset_handler (struct scsi_cmnd *cmd); -int sas_eh_target_reset_handler (struct scsi_cmnd *cmd); +int sas_eh_target_reset_handler (struct scsi_target *starget);extern void sas_target_destroy (struct scsi_target *);extern int sas_slave_alloc (struct scsi_device *);
include/scsi/scsi_host.h +1 -1
@@ -151,7 +151,7 @@ struct scsi_host_template {*/ int (* eh_abort_handler)(struct scsi_cmnd *);int (* eh_device_reset_handler)(struct scsi_cmnd *); -int (* eh_target_reset_handler)(struct scsi_cmnd *); +int (* eh_target_reset_handler)(struct scsi_target *);int (* eh_bus_reset_handler)(struct Scsi_Host *,unsigned int );int (* eh_host_reset_handler)(struct Scsi_Host *);
Signature · 1 line
2.35.3
Re: [PATCH 03/10] scsi: Use scsi_target as argument for eh_target_reset_handler()
Documentation/scsi/scsi_eh.rst scmd->allowed. · line 419
Quoted 13 lines · Hannes Reinecke
Documentation/scsi/scsi_eh.rst +5
-0@@ -411,6 +412,14 @@ scmd->allowed. resetting clears all scmds on the sdev, there is no need to choose error-completed scmds. + 2. If !list_empty(&eh_work_q), invoke scsi_eh_target_reset(). + + ``scsi_eh_target_reset`` + + hostt->eh_target_reset_handler() is invoked for each target.
It's only invoked for targets that have commands on the work-q, not each. We could have 16 rports open, but only one of them has a command that timed out, and is in EH.
At least that is what I thought it does.
Quoted 11 lines
Documentation/scsi/scsi_eh.rst +3
-0+ If target reset succeeds, all failed scmds on all ready or + offline sdevs on the target are EH-finished. + 3. If !list_empty(&eh_work_q), invoke scsi_eh_bus_reset() ``scsi_eh_bus_reset``Documentation/scsi/scsi_mid_low_api.rst +0
-0
Documentation/scsi/scsi_mid_low_api.rst Details:: · line 765
Quoted 8 lines
Documentation/scsi/scsi_mid_low_api.rst +5
-0@@ -758,6 +758,24 @@ Details:: int eh_bus_reset_handler(struct Scsi_Host * host, unsigned int channel) + /** + * eh_target_reset_handler - issue SCSI target reset + * @starget: identifies SCSI target to be reset + * + * Returns SUCCESS if command aborted else FAILED
Same as in Patch 1. Or in a later patch, if you prefer.
Quoted 21 lines
Documentation/scsi/scsi_mid_low_api.rst +13
-0+ * + * Locks: None held + * + * Calling context: kernel thread + * + * Notes: Invoked from scsi_eh thread. No other commands will be + * queued on current host during eh. + * + * Optionally defined in: LLD + **/ + int eh_target_reset_handler(struct scsi_target * starget) + + /** * eh_device_reset_handler - issue SCSI device reset * @scp: identifies SCSI device to be resetdrivers/message/fusion/mptsas.c +0
-0
drivers/message/fusion/mptsas.c static const struct scsi_host_template mptsas_driver_template = { · line 2023
Quoted 5 lines
drivers/message/fusion/mptsas.c +1
-1@@ -2012,7 +2020,7 @@ static const struct scsi_host_template mptsas_driver_template = { .change_queue_depth = mptscsih_change_queue_depth, .eh_timed_out = mptsas_eh_timed_out, .eh_abort_handler = mptscsih_abort, - .eh_device_reset_handler = mptscsih_dev_reset, + .eh_target_reset_handler = mptsas_eh_target_reset,
Huh, it that correct? Replace the device reset handler with the target handler? That seems odd.
Quoted 13 lines
drivers/message/fusion/mptsas.c +0
-0.eh_host_reset_handler = mptscsih_host_reset, .bios_param = mptscsih_bios_param, .can_queue = MPT_SAS_CAN_QUEUE,drivers/message/fusion/mptspi.c +1
-1@@ -834,7 +840,7 @@ static const struct scsi_host_template mptspi_driver_template = { .slave_destroy = mptspi_slave_destroy, .change_queue_depth = mptscsih_change_queue_depth, .eh_abort_handler = mptscsih_abort, - .eh_device_reset_handler = mptscsih_dev_reset, + .eh_target_reset_handler = mptspi_eh_target_reset,
...
Quoted 8 lines
drivers/message/fusion/mptspi.c +0
-0.eh_bus_reset_handler = mptscsih_bus_reset, .eh_host_reset_handler = mptscsih_host_reset, .bios_param = mptscsih_bios_param,drivers/s390/scsi/zfcp_scsi.c +0
-0
drivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt) · line 345
Quoted 7 lines
drivers/s390/scsi/zfcp_scsi.c +3
-1@@ -340,9 +340,12 @@ static int zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt)return zfcp_scsi_task_mgmt_function (sdev,FCP_TMF_LUN_RESET ); } -static int zfcp_scsi_eh_target_reset_handler (struct scsi_cmnd *scpnt) +/* +* Note: We need to select a LUN as the storage array doesn't +* necessarily supports LUN 0 and might refuse the target reset.
That might be true, I don't really know, but it's not the reason why we added this "search a sdev" logic to the function. The firmware for FCP channels needs a valid "LUN handle" for each FCP request we send, otherwise it's rejected. So we have to find a valid handle. This is an artifact from HBA virtualisation before NPIV on Z.
There is more details in674595d8519f ("scsi: zfcp: decouple our scsi_eh callbacks from scsi_cmnd")
From my perspective you can just remove the comment, or change it to match the part about zfcp_scsi_eh_target_reset_handler() in what Steffen wrote in the commit.
Quoted 19 lines
drivers/s390/scsi/zfcp_scsi.c +2
-1+*/ +static int zfcp_scsi_eh_target_reset_handler (struct scsi_target *starget) { -struct scsi_target *starget =scsi_target (scpnt->device);struct fc_rport *rport =starget_to_rport (starget);struct Scsi_Host *shost =rport_to_shost (rport);struct scsi_device *sdev =NULL , *tmp_sdev;drivers/scsi/lpfc/lpfc_scsi.c +1
-2@@ -6045,15 +6045,15 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd)* 0x2002 - Success **/ static int -lpfc_target_reset_handler (struct scsi_cmnd *cmnd) +lpfc_target_reset_handler (struct scsi_target *starget) { -struct Scsi_Host *shost = cmnd->device->host;
drivers/scsi/lpfc/lpfc_scsi.c lpfc_device_reset_handler(struct scsi_cmnd *cmnd) · line 6056
Quoted 10 lines
drivers/scsi/lpfc/lpfc_scsi.c +4
-3-struct fc_rport *rport =starget_to_rport (scsi_target (cmnd->device)); +struct fc_rport *rport =starget_to_rport (starget); +struct Scsi_Host *shost =rport_to_shost (rport);struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;struct lpfc_rport_data *rdata;struct lpfc_nodelist *pnode; -unsigned tgt_id = cmnd->device->id; -uint64_t lun_id = cmnd->device->lun; +unsigned tgt_id = starget->id; +uint64_t lun_id =0 ;
Well, hopefully storage targets for LPFC can deal with LUN 0 :)
Quoted 24 lines
drivers/scsi/lpfc/lpfc_scsi.c +0
-0struct lpfc_scsi_event_header scsi_event;int status;u32 logit =LOG_FCP ;drivers/scsi/megaraid/megaraid_sas_fusion.c +4
-2@@ -4804,21 +4804,25 @@ int megasas_task_abort_fusion(struct scsi_cmnd *scmd)/* * megasas_reset_target_fusion : target reset function for fusion adapters -* scmd: SCSI command pointer +* @shost: SCSI host pointer +* @starget: SCSI target pointer * * Returns SUCCESS if all commands associated with target aborted else FAILED */ -int megasas_reset_target_fusion (struct scsi_cmnd *scmd) +int megasas_reset_target_fusion (struct Scsi_Host *shost, +struct scsi_target *starget) {struct megasas_instance *instance;
drivers/scsi/megaraid/megaraid_sas_fusion.c int megasas_task_abort_fusion(struct scsi_cmnd *scmd) · line 4823
Quoted 10 lines
drivers/scsi/megaraid/megaraid_sas_fusion.c +4
-4+struct scsi_device *sdev;int ret =FAILED ; -u16 devhandle; -struct MR_PRIV_DEVICE *mr_device_priv_data; - mr_device_priv_data = scmd->device->hostdata; +u16 devhandle =USHRT_MAX ; +struct MR_PRIV_DEVICE *mr_device_priv_data =NULL ; - instance = (struct megasas_instance *)scmd->device->host->hostdata; + instance = (struct megasas_instance *)shost->hostdata;
shost_priv()? And you can move that to the top as well I think.
Quoted 28 lines
drivers/scsi/megaraid/megaraid_sas_fusion.c +2
-0+starget_printk (KERN_INFO , starget, +"target reset called\n" );if (atomic_read (&instance->adprecovery) !=MEGASAS_HBA_OPERATIONAL ) { dev_err(&instance->pdev->dev, "Controller is not OPERATIONAL,"drivers/scsi/mpi3mr/mpi3mr_os.c +3
-6@@ -4090,54 +4090,41 @@ static int mpi3mr_eh_bus_reset(struct Scsi_Host *shost, unsigned int channel)* Return: SUCCESS of successful termination of the scmd else * FAILED */ -static int mpi3mr_eh_target_reset (struct scsi_cmnd *scmd) +static int mpi3mr_eh_target_reset (struct scsi_target *starget) { -struct mpi3mr_ioc *mrioc =shost_priv (scmd->device->host); +struct Scsi_Host *shost =dev_to_shost (&starget->dev); +struct mpi3mr_ioc *mrioc =shost_priv (shost);struct mpi3mr_stgt_priv_data *stgt_priv_data; -struct mpi3mr_sdev_priv_data *sdev_priv_data;u16 dev_handle;u8 resp_code =0 ;int retval =FAILED , ret =0 ; -sdev_printk (KERN_INFO , scmd->device, -"Attempting Target Reset! scmd(%p)\n" , scmd); -scsi_print_command (scmd);
drivers/scsi/mpi3mr/mpi3mr_os.c static int mpi3mr_eh_bus_reset(struct Scsi_Host *shost, unsigned int channel) · line 4103
Quoted 10 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +2
-8- - sdev_priv_data = scmd->device->hostdata; -if (!sdev_priv_data || !sdev_priv_data->tgt_priv_data) { -sdev_printk (KERN_INFO , scmd->device, -"SCSI device is not available\n" ); - retval =SUCCESS ; - goto out; - } +starget_printk (KERN_INFO , starget, +"Attempting Target Reset!\n" );
Nitpick: you can remove the line-break.
Quoted 10 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +1
-1- stgt_priv_data = sdev_priv_data->tgt_priv_data; + stgt_priv_data = starget->hostdata; dev_handle = stgt_priv_data->dev_handle;if (stgt_priv_data->dev_removed) {drivers/scsi/scsi_error.c +0
-0
drivers/scsi/scsi_error.c static int scsi_eh_target_reset(struct Scsi_Host *shost, · line 1668
Quoted 6 lines
drivers/scsi/scsi_error.c +2
-1@@ -1662,7 +1664,8 @@ static int scsi_eh_target_reset(struct Scsi_Host *shost," target: %d\n" , current->comm, id));list_for_each_entry_safe (scmd, next, &tmp_list, eh_entry) { -if (scmd_id (scmd) != id) +if (scmd_channel (scmd) != channel || +scmd_id (scmd) != id)
Hmm, interesting. So this was broken before as well?
Tbh., this seems like a fix that could go to stable? Should we have a separate patch for it?
Quoted 3 lines
drivers/scsi/scsi_error.c +0
-0continue ;if (rtn ==SUCCESS )
Signature · 4 lines
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy Vors. Aufs.-R.: Gregor Pillen / Geschäftsführung: David Faller Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Hannes Reinecke
maintainerRe: [PATCH 03/10] scsi: Use scsi_target as argument for eh_target_reset_handler()
Quoted 19 lines · Benjamin Block
Documentation/scsi/scsi_eh.rst scmd->allowed. · line 419
Quoted 13 lines · Hannes Reinecke
Documentation/scsi/scsi_eh.rst +5
-0@@ -411,6 +412,14 @@ scmd->allowed. resetting clears all scmds on the sdev, there is no need to choose error-completed scmds. + 2. If !list_empty(&eh_work_q), invoke scsi_eh_target_reset(). + + ``scsi_eh_target_reset`` + + hostt->eh_target_reset_handler() is invoked for each target.It's only invoked for targets that have commands on the work-q, not each. We could have 16 rports open, but only one of them has a command that timed out, and is in EH.
Quoted 2 lines
At least that is what I thought it does.
Oh, yes. It is invoked for every target for which a scmd is on the work_q. Will be updating the patch.
Quoted 14 lines
Quoted 14 lines
Documentation/scsi/scsi_eh.rst +3
-0+ If target reset succeeds, all failed scmds on all ready or + offline sdevs on the target are EH-finished. + 3. If !list_empty(&eh_work_q), invoke scsi_eh_bus_reset() ``scsi_eh_bus_reset``Documentation/scsi/scsi_mid_low_api.rst +0
-0@@ -758,6 +758,24 @@ Details:: int eh_bus_reset_handler(struct Scsi_Host * host, unsigned int channel)
Quoted 8 lines
Documentation/scsi/scsi_mid_low_api.rst Details:: · line 765
Quoted 5 lines
Documentation/scsi/scsi_mid_low_api.rst +5
-0+ /** + * eh_target_reset_handler - issue SCSI target reset + * @starget: identifies SCSI target to be reset + * + * Returns SUCCESS if command aborted else FAILEDSame as in Patch 1. Or in a later patch, if you prefer.
Yes, I do :-)
Quoted 21 lines
Quoted 21 lines
Documentation/scsi/scsi_mid_low_api.rst +13
-0+ * + * Locks: None held + * + * Calling context: kernel thread + * + * Notes: Invoked from scsi_eh thread. No other commands will be + * queued on current host during eh. + * + * Optionally defined in: LLD + **/ + int eh_target_reset_handler(struct scsi_target * starget) + + /** * eh_device_reset_handler - issue SCSI device reset * @scp: identifies SCSI device to be resetdrivers/message/fusion/mptsas.c +0
-0@@ -2012,7 +2020,7 @@ static const struct scsi_host_template mptsas_driver_template = {
Quoted 9 lines
drivers/message/fusion/mptsas.c static const struct scsi_host_template mptsas_driver_template = { · line 2023
Quoted 5 lines
drivers/message/fusion/mptsas.c +1
-1.change_queue_depth = mptscsih_change_queue_depth, .eh_timed_out = mptsas_eh_timed_out, .eh_abort_handler = mptscsih_abort, - .eh_device_reset_handler = mptscsih_dev_reset, + .eh_target_reset_handler = mptsas_eh_target_reset,Huh, it that correct? Replace the device reset handler with the target handler? That seems odd.
Please check drivers/message/fusion/mptscsih.c
mptscsih_dev_reset _is_ a target reset.
Quoted 38 lines
Quoted 13 lines
drivers/message/fusion/mptsas.c +0
-0.eh_host_reset_handler = mptscsih_host_reset, .bios_param = mptscsih_bios_param, .can_queue = MPT_SAS_CAN_QUEUE,drivers/message/fusion/mptspi.c +1
-1@@ -834,7 +840,7 @@ static const struct scsi_host_template mptspi_driver_template = { .slave_destroy = mptspi_slave_destroy, .change_queue_depth = mptscsih_change_queue_depth, .eh_abort_handler = mptscsih_abort, - .eh_device_reset_handler = mptscsih_dev_reset, + .eh_target_reset_handler = mptspi_eh_target_reset,...
Quoted 8 lines
.eh_bus_reset_handler =
mptscsih_bus_reset,
.eh_host_reset_handler =mptscsih_host_reset,
.bios_param =mptscsih_bios_param,drivers/s390/scsi/zfcp_scsi.c +0
-0drivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt) · line 345
Quoted 7 lines
drivers/s390/scsi/zfcp_scsi.c +3
-1@@ -340,9 +340,12 @@ static int zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt)return zfcp_scsi_task_mgmt_function (sdev,FCP_TMF_LUN_RESET ); } -static int zfcp_scsi_eh_target_reset_handler (struct scsi_cmnd *scpnt) +/* +* Note: We need to select a LUN as the storage array doesn't +* necessarily supports LUN 0 and might refuse the target reset. That might be true, I don't really know, but it's not the reason why we added this "search a sdev" logic to the function. The firmware for FCP channels needs a valid "LUN handle" for each FCP request we send, otherwise it's rejected. So we have to find a valid handle. This is an artifact from HBA virtualisation before NPIV on Z.
Quoted 7 lines
There is more details in
674595d8519f("scsi: zfcp: decouple ourscsi_ehcallbacks fromscsi_cmnd")From my perspective you can just remove the comment, or change it to match
the part aboutzfcp_scsi_eh_target_reset_handler()in what Steffen wrote in the commit.
Okay, will be doing so.
Quoted 23 lines
Quoted 23 lines
drivers/s390/scsi/zfcp_scsi.c +2
-1+*/ +static int zfcp_scsi_eh_target_reset_handler (struct scsi_target *starget) { -struct scsi_target *starget =scsi_target (scpnt->device);struct fc_rport *rport =starget_to_rport (starget);struct Scsi_Host *shost =rport_to_shost (rport);struct scsi_device *sdev =NULL , *tmp_sdev;drivers/scsi/lpfc/lpfc_scsi.c +3
-3@@ -6045,15 +6045,15 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd)* 0x2002 - Success **/ static int -lpfc_target_reset_handler (struct scsi_cmnd *cmnd) +lpfc_target_reset_handler (struct scsi_target *starget) { -struct Scsi_Host *shost = cmnd->device->host; -struct fc_rport *rport =starget_to_rport (scsi_target (cmnd->device)); +struct fc_rport *rport =starget_to_rport (starget); +struct Scsi_Host *shost =rport_to_shost (rport);struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
Quoted 9 lines
drivers/scsi/lpfc/lpfc_scsi.c lpfc_device_reset_handler(struct scsi_cmnd *cmnd) · line 6056
Quoted 6 lines
drivers/scsi/lpfc/lpfc_scsi.c +2
-2struct lpfc_rport_data *rdata;struct lpfc_nodelist *pnode; -unsigned tgt_id = cmnd->device->id; -uint64_t lun_id = cmnd->device->lun; +unsigned tgt_id = starget->id; +uint64_t lun_id =0 ;Well, hopefully storage targets for LPFC can deal with LUN 0 :)
Sad to say, but it's only with zfcp where I've seen the 'WLUN' thingie being deployed. But alright, I'll check if I can grab a valid LUN ID.
Quoted 32 lines
Quoted 32 lines
drivers/scsi/lpfc/lpfc_scsi.c +0
-0struct lpfc_scsi_event_header scsi_event;int status;u32 logit =LOG_FCP ;drivers/scsi/megaraid/megaraid_sas_fusion.c +7
-5@@ -4804,21 +4804,25 @@ int megasas_task_abort_fusion(struct scsi_cmnd *scmd)/* * megasas_reset_target_fusion : target reset function for fusion adapters -* scmd: SCSI command pointer +* @shost: SCSI host pointer +* @starget: SCSI target pointer * * Returns SUCCESS if all commands associated with target aborted else FAILED */ -int megasas_reset_target_fusion (struct scsi_cmnd *scmd) +int megasas_reset_target_fusion (struct Scsi_Host *shost, +struct scsi_target *starget) {struct megasas_instance *instance; +struct scsi_device *sdev;int ret =FAILED ; -u16 devhandle; -struct MR_PRIV_DEVICE *mr_device_priv_data; - mr_device_priv_data = scmd->device->hostdata; +u16 devhandle =USHRT_MAX ; +struct MR_PRIV_DEVICE *mr_device_priv_data =NULL ;
Quoted 5 lines
drivers/scsi/megaraid/megaraid_sas_fusion.c int megasas_task_abort_fusion(struct scsi_cmnd *scmd) · line 4823
Quoted 2 lines
drivers/scsi/megaraid/megaraid_sas_fusion.c +1
-1- instance = (struct megasas_instance *)scmd->device->host->hostdata; + instance = (struct megasas_instance *)shost->hostdata;
shost_priv()? And you can move that to the top as well I think.
Ok, will be doing that.
Quoted 25 lines
Quoted 25 lines
drivers/scsi/megaraid/megaraid_sas_fusion.c +2
-0+starget_printk (KERN_INFO , starget, +"target reset called\n" );if (atomic_read (&instance->adprecovery) !=MEGASAS_HBA_OPERATIONAL ) { dev_err(&instance->pdev->dev, "Controller is not OPERATIONAL,"drivers/scsi/mpi3mr/mpi3mr_os.c +3
-3@@ -4090,54 +4090,41 @@ static int mpi3mr_eh_bus_reset(struct Scsi_Host *shost, unsigned int channel)* Return: SUCCESS of successful termination of the scmd else * FAILED */ -static int mpi3mr_eh_target_reset (struct scsi_cmnd *scmd) +static int mpi3mr_eh_target_reset (struct scsi_target *starget) { -struct mpi3mr_ioc *mrioc =shost_priv (scmd->device->host); +struct Scsi_Host *shost =dev_to_shost (&starget->dev); +struct mpi3mr_ioc *mrioc =shost_priv (shost);struct mpi3mr_stgt_priv_data *stgt_priv_data; -struct mpi3mr_sdev_priv_data *sdev_priv_data;u16 dev_handle;u8 resp_code =0 ;int retval =FAILED , ret =0 ;
Quoted 16 lines
drivers/scsi/mpi3mr/mpi3mr_os.c static int mpi3mr_eh_bus_reset(struct Scsi_Host *shost, unsigned int channel) · line 4103
Quoted 13 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +2
-11-sdev_printk (KERN_INFO , scmd->device, -"Attempting Target Reset! scmd(%p)\n" , scmd); -scsi_print_command (scmd); - - sdev_priv_data = scmd->device->hostdata; -if (!sdev_priv_data || !sdev_priv_data->tgt_priv_data) { -sdev_printk (KERN_INFO , scmd->device, -"SCSI device is not available\n" ); - retval =SUCCESS ; - goto out; - } +starget_printk (KERN_INFO , starget, +"Attempting Target Reset!\n" );Nitpick: you can remove the line-break.
Yes, and no. I had been debating with me whether I really wanted to do that. Linebreaks are in nearly all of the debugging messages in this driver, so once I start removing them here questions will be asked why I removed it _just_ here, or, why I removed it at all.
I'd prefer doing that in a separate patch.
Quoted 19 lines
Quoted 10 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +1
-1- stgt_priv_data = sdev_priv_data->tgt_priv_data; + stgt_priv_data = starget->hostdata; dev_handle = stgt_priv_data->dev_handle;if (stgt_priv_data->dev_removed) {drivers/scsi/scsi_error.c +0
-0drivers/scsi/scsi_error.c static int scsi_eh_target_reset(struct Scsi_Host *shost, · line 1668
Quoted 6 lines
drivers/scsi/scsi_error.c +2
-1@@ -1662,7 +1664,8 @@ static int scsi_eh_target_reset(struct Scsi_Host *shost," target: %d\n" , current->comm, id));list_for_each_entry_safe (scmd, next, &tmp_list, eh_entry) { -if (scmd_id (scmd) != id) +if (scmd_channel (scmd) != channel || +scmd_id (scmd) != id)Hmm, interesting. So this was broken before as well?
Quoted 3 lines
Tbh., this seems like a fix that could go to stable? Should we have a separate patch for it?
Technically, yes. In practise it'll be hard to trigger, so no-one has seen this issue so far.
But good point, I'll be splitting it out into a separate patch.
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew Myers, Andrew McDonald, Martje Boudien Moerman
Re: [PATCH 03/10] scsi: Use scsi_target as argument for eh_target_reset_handler()
Quoted 11 lines · Hannes Reinecke
Quoted 7 lines · Benjamin Block
drivers/scsi/lpfc/lpfc_scsi.c lpfc_device_reset_handler(struct scsi_cmnd *cmnd) · line 6056
Quoted 4 lines · Hannes Reinecke
drivers/scsi/lpfc/lpfc_scsi.c +2
-2-unsigned tgt_id = cmnd->device->id; -uint64_t lun_id = cmnd->device->lun; +unsigned tgt_id = starget->id; +uint64_t lun_id =0 ;Well, hopefully storage targets for LPFC can deal with LUN 0 :)
Sad to say, but it's only with zfcp where I've seen the 'WLUN' thingie being deployed. But alright, I'll check if I can grab a valid LUN ID.
I mean, I don't actually know whether this is a problem in practice; sending a TMF to LUN 0. If this works for the LPFC folks, I don't mind.
Quoted 10 lines
Quoted 8 lines
drivers/scsi/mpi3mr/mpi3mr_os.c static int mpi3mr_eh_bus_reset(struct Scsi_Host *shost, unsigned int channel) · line 4103
Quoted 5 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +2
-3- retval =SUCCESS ; - goto out; - } +starget_printk (KERN_INFO , starget, +"Attempting Target Reset!\n" );Nitpick: you can remove the line-break.
Yes, and no. I had been debating with me whether I really wanted to do that. Linebreaks are in nearly all of the debugging messages
I meant the line-break in the source-code, not message :)
starget_printk(KERN_INFO, starget, "Attempting Target Reset!\n");
Quoted 5 lines
in this driver, so once I start removing them here questions will be asked why I removed it _just_ here, or, why I removed it at all.
I'd prefer doing that in a separate patch.
Signature · 4 lines
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy Vors. Aufs.-R.: Gregor Pillen / Geschäftsführung: David Faller Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Hannes Reinecke
maintainerPATCH v8 4/10 scsi: Use scsi_device as argument to eh_device_reset_handler()
In reply to Hannes ReineckeThe device reset function should only depend on the scsi device, not the scsi command.
--- Documentation/scsi/scsi_eh.rst | 2 +- Documentation/scsi/scsi_mid_low_api.rst | 4 +- drivers/infiniband/ulp/srp/ib_srp.c | 6 +-- drivers/message/fusion/mptfc.c | 12 +++--- drivers/message/fusion/mptscsih.c | 27 ++++--------- drivers/message/fusion/mptscsih.h | 2 +- drivers/s390/scsi/zfcp_scsi.c | 4 +- drivers/scsi/a100u2w.c | 9 ++--- drivers/scsi/aacraid/linit.c | 9 ++--- drivers/scsi/aha152x.c | 6 +-- drivers/scsi/aha1542.c | 8 ++-- drivers/scsi/aic7xxx/aic79xx_osm.c | 27 +++++-------- drivers/scsi/aic7xxx/aic7xxx_osm.c | 4 +- drivers/scsi/arm/fas216.c | 5 +-- drivers/scsi/arm/fas216.h | 6 +-- drivers/scsi/be2iscsi/be_main.c | 8 ++-- drivers/scsi/bfa/bfad_im.c | 3 +- drivers/scsi/bnx2fc/bnx2fc.h | 2 +- drivers/scsi/bnx2fc/bnx2fc_io.c | 8 ++-- drivers/scsi/csiostor/csio_scsi.c | 5 +-- drivers/scsi/cxlflash/main.c | 5 +-- drivers/scsi/esas2r/esas2r.h | 2 +- drivers/scsi/esas2r/esas2r_main.c | 3 +- drivers/scsi/fnic/fnic.h | 2 +- drivers/scsi/fnic/fnic_scsi.c | 9 ++--- drivers/scsi/hpsa.c | 14 +++---- drivers/scsi/ibmvscsi/ibmvfc.c | 8 ++-- drivers/scsi/ibmvscsi/ibmvscsi.c | 19 ++++----- drivers/scsi/ipr.c | 24 +++++------ drivers/scsi/libfc/fc_fcp.c | 13 +++--- drivers/scsi/libiscsi.c | 15 ++++--- drivers/scsi/libsas/sas_scsi_host.c | 12 +++--- drivers/scsi/lpfc/lpfc_scsi.c | 12 +++--- drivers/scsi/mpi3mr/mpi3mr_os.c | 40 ++++++++----------- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 32 +++++++-------- drivers/scsi/pcmcia/nsp_cs.h | 2 - drivers/scsi/pmcraid.c | 10 ++--- drivers/scsi/qedf/qedf_main.c | 6 +-- drivers/scsi/qla1280.c | 53 ++++++++----------------- drivers/scsi/qla2xxx/qla_os.c | 24 +++++------ drivers/scsi/qla4xxx/ql4_os.c | 25 +++++------- drivers/scsi/scsi_debug.c | 16 +++----- drivers/scsi/scsi_error.c | 2 +- drivers/scsi/smartpqi/smartpqi.h | 1 - drivers/scsi/smartpqi/smartpqi_init.c | 19 ++++----- drivers/scsi/snic/snic.h | 2 +- drivers/scsi/snic/snic_scsi.c | 4 +- drivers/scsi/virtio_scsi.c | 12 +++--- drivers/scsi/vmw_pvscsi.c | 10 ++--- drivers/scsi/wd719x.c | 6 +-- drivers/scsi/xen-scsifront.c | 6 +-- drivers/staging/rts5208/rtsx.c | 6 ++- drivers/target/loopback/tcm_loop.c | 8 ++-- drivers/ufs/core/ufshcd.c | 8 ++-- drivers/usb/storage/scsiglue.c | 4 +- drivers/usb/storage/uas.c | 3 +- include/scsi/libfc.h | 2 +- include/scsi/libiscsi.h | 2 +- include/scsi/libsas.h | 2 +- include/scsi/scsi_host.h | 2 +- 60 files changed, 264 insertions(+), 338 deletions(-)
Documentation/scsi/scsi_eh.rst +1 -1
@@ -215,7 +215,7 @@ considered to fail always. :: int (* eh_abort_handler)(struct scsi_cmnd *); - int (* eh_device_reset_handler)(struct scsi_cmnd *); + int (* eh_device_reset_handler)(struct scsi_device *); int (* eh_target_reset_handler)(struct scsi_target *); int (* eh_bus_reset_handler)(struct Scsi_Host *, unsigned int); int (* eh_host_reset_handler)(struct Scsi_Host *);
Documentation/scsi/scsi_mid_low_api.rst +2 -2
@@ -778,7 +778,7 @@ Details:: /** * eh_device_reset_handler - issue SCSI device reset - * @scp: identifies SCSI device to be reset + * @sdev: identifies SCSI device to be reset * * Returns SUCCESS if command aborted else FAILED *
@@ -791,7 +791,7 @@ Details:: * * Optionally defined in: LLD **/ - int eh_device_reset_handler(struct scsi_cmnd * scp) + int eh_device_reset_handler(struct scsi_device * sdev) /**
drivers/infiniband/ulp/srp/ib_srp.c +3 -3
@@ -2813,16 +2813,16 @@ static int srp_abort(struct scsi_cmnd *scmnd)return ret; } -static int srp_reset_device (struct scsi_cmnd *scmnd) +static int srp_reset_device (struct scsi_device *sdev) { -struct srp_target_port *target =host_to_target (scmnd->device->host); +struct srp_target_port *target =host_to_target (sdev->host);struct srp_rdma_ch *ch;u8 status;shost_printk (KERN_ERR , target->scsi_host,"SRP reset_device called\n" ); ch = &target->ch[0 ]; -if (srp_send_tsk_mgmt (ch,SRP_TAG_NO_REQ , scmnd->device->lun, +if (srp_send_tsk_mgmt (ch,SRP_TAG_NO_REQ , sdev->lun,SRP_TSK_LUN_RESET , &status))return FAILED ;if (status)
drivers/message/fusion/mptfc.c +6 -6
@@ -102,7 +102,7 @@ static void mptfc_target_destroy(struct scsi_target *starget);static void mptfc_set_rport_loss_tmo (struct fc_rport *rport,uint32_t timeout);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_dev_reset (struct scsi_device *sdev);static int mptfc_bus_reset (struct Scsi_Host *shost,unsigned int channel);static const struct scsi_host_template mptfc_driver_template = {
@@ -240,10 +240,10 @@ mptfc_abort(struct scsi_cmnd *SCpnt) }static int -mptfc_dev_reset (struct scsi_cmnd *SCpnt) +mptfc_dev_reset (struct scsi_device *sdev) { -struct Scsi_Host *shost = SCpnt->device->host; -struct fc_rport *rport =starget_to_rport (scsi_target (SCpnt->device)); +struct Scsi_Host *shost = sdev->host; +struct fc_rport *rport =starget_to_rport (scsi_target (sdev));MPT_SCSI_HOST __maybe_unused *hd =shost_priv (shost);int rtn;
@@ -252,8 +252,8 @@ mptfc_dev_reset(struct scsi_cmnd *SCpnt)dfcprintk (hd->ioc,printk (MYIOC_s_DEBUG_FMT"%s.%d: %d:%llu, executing recovery.\n" , __func__, hd->ioc->name, shost->host_no, - SCpnt->device->id, SCpnt->device->lun)); - rtn =mptscsih_dev_reset (SCpnt); + sdev->id, sdev->lun)); + rtn =mptscsih_dev_reset (sdev); }return rtn; }
drivers/message/fusion/mptscsih.c +8 -19
@@ -1794,34 +1794,23 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /** * mptscsih_dev_reset - Perform a SCSI LOGICAL_UNIT_RESET! -* @SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to +* @device: Pointer to scsi_device structure, which reset is due to * * (linux scsi_host_template.eh_dev_reset_handler routine) * * Returns SUCCESS or FAILED. **/ int -mptscsih_dev_reset (struct scsi_cmnd * SCpnt) +mptscsih_dev_reset (struct scsi_device * device) { -MPT_SCSI_HOST *hd; +MPT_SCSI_HOST *hd =shost_priv (device->host);int retval;VirtDevice *vdevice; -MPT_ADAPTER *ioc; - -/* If we can't locate our host adapter structure, return FAILED status. -*/ -if ((hd =shost_priv (SCpnt->device->host)) ==NULL ){ - printk(KERN_ERR MYNAM ": lun reset: " - "Can't locate host! (sc=%p)\n", SCpnt); -return FAILED ; - } +MPT_ADAPTER *ioc = hd->ioc; - ioc = hd->ioc; -printk (MYIOC_s_INFO_FMT"attempting lun reset! (sc=%p)\n" , - ioc->name, SCpnt); -scsi_print_command (SCpnt); +printk (MYIOC_s_INFO_FMT"attempting lun reset!\n" , ioc->name); - vdevice = SCpnt->device->hostdata; + vdevice = device->hostdata;if (!vdevice || !vdevice->vtarget) { retval =0 ; goto out;
@@ -1834,8 +1823,8 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt) mptscsih_get_tm_timeout(ioc)); out: -printk (MYIOC_s_INFO_FMT"lun reset: %s (sc=%p)\n" , - ioc->name, ((retval ==0 ) ?"SUCCESS" :"FAILED" ), SCpnt); +printk (MYIOC_s_INFO_FMT"lun reset: %s\n" , + ioc->name, ((retval ==0 ) ?"SUCCESS" :"FAILED" ));if (retval ==0 )return SUCCESS ;
drivers/message/fusion/mptscsih.h +1 -1
@@ -119,7 +119,7 @@ extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel,extern void mptscsih_slave_destroy (struct scsi_device *device);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_dev_reset (struct scsi_device *);extern int mptscsih_target_reset (struct Scsi_Host *,struct scsi_target *);extern int mptscsih_bus_reset (struct Scsi_Host *,unsigned int );extern int mptscsih_host_reset (struct Scsi_Host *sh);
drivers/s390/scsi/zfcp_scsi.c +1 -3
@@ -333,10 +333,8 @@ static int zfcp_scsi_task_mgmt_function(struct scsi_device *sdev, u8 tm_flags)return retval; } -static int zfcp_scsi_eh_device_reset_handler (struct scsi_cmnd *scpnt) +static int zfcp_scsi_eh_device_reset_handler (struct scsi_device *sdev) { -struct scsi_device *sdev = scpnt->device; -return zfcp_scsi_task_mgmt_function (sdev,FCP_TMF_LUN_RESET ); }
drivers/scsi/a100u2w.c +4 -5
@@ -944,16 +944,15 @@ static int inia100_bus_reset(struct Scsi_Host * shost, unsigned int channel)/***************************************************************************** Function name : inia100_device_reset Description : Reset the device -Input : host - Pointer to host adapter structure +Input : dev - Pointer to scsi device structure Output : None. Return : pSRB - Pointer to SCSI request block. *****************************************************************************/ -static int inia100_device_reset (struct scsi_cmnd * cmd) +static int inia100_device_reset (struct scsi_device * dev) {/* I need Host Control Block Information */ struct orc_host *host; - host = (struct orc_host *) cmd->device->host->hostdata; -return orc_device_reset (host, cmd->device); - + host = (struct orc_host *) dev->host->hostdata; +return orc_device_reset (host, dev); }/**
drivers/scsi/aacraid/linit.c +4 -5
@@ -905,12 +905,11 @@ static void aac_tmf_callback(void *context, struct fib *fibptr)/* * aac_eh_dev_reset - Device reset command handling -* @scsi_cmd: SCSI command block causing the reset +* @dev: SCSI device to be reset * */ -static int aac_eh_dev_reset (struct scsi_cmnd *cmd) +static int aac_eh_dev_reset (struct scsi_device *dev) { -struct scsi_device * dev = cmd->device;struct Scsi_Host * host = dev->host;struct aac_dev * aac = (struct aac_dev *)host->hostdata;struct aac_hba_map_info *info;
@@ -921,8 +920,8 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd)int status;u8 command; - bus =aac_logical_to_phys (scmd_channel (cmd)); - cid =scmd_id (cmd); + bus =aac_logical_to_phys (sdev_channel (dev)); + cid =sdev_id (dev);if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS )return FAILED ;
drivers/scsi/aha152x.c +3 -3
@@ -1068,12 +1068,12 @@ static int aha152x_abort(struct scsi_cmnd *SCpnt)* Reset a device * */ -static int aha152x_device_reset (struct scsi_cmnd * SCpnt) +static int aha152x_device_reset (struct scsi_device * sdev) { -struct scsi_device *sdev = SCpnt->device;struct Scsi_Host *shpnt = sdev->host; +struct scsi_cmnd *SCpnt;DECLARE_COMPLETION (done); -int ret, issued, disconnected; +int ret, issued, disconnected =0 ;unsigned char old_cmd_len;unsigned long flags;unsigned long timeleft;
drivers/scsi/aha1542.c +4 -4
@@ -861,14 +861,14 @@ static int aha1542_release(struct Scsi_Host *sh)* This is a device reset. This is handled by sending a special command * to the device. */ -static int aha1542_dev_reset (struct scsi_cmnd *cmd) +static int aha1542_dev_reset (struct scsi_device *sdev) { -struct Scsi_Host *sh = cmd->device->host; +struct Scsi_Host *sh = sdev->host;struct aha1542_hostdata *aha1542 =shost_priv (sh);unsigned long flags;struct mailbox *mb = aha1542->mb; -u8 target = cmd->device->id; -u8 lun = cmd->device->lun; +u8 target = sdev->id; +u8 lun = sdev->lun;int mbo;struct ccb *ccb = aha1542->ccb;
drivers/scsi/aic7xxx/aic79xx_osm.c +11 -16
@@ -767,12 +767,11 @@ ahd_linux_abort(struct scsi_cmnd *cmd)* Attempt to send a target reset message to the device that timed out. */ static int -ahd_linux_dev_reset (struct scsi_cmnd *cmd) +ahd_linux_dev_reset (struct scsi_device *sdev) {struct ahd_softc *ahd;struct ahd_linux_device *dev;struct scb *reset_scb; -u_int cdb_byte;int retval =SUCCESS ;struct ahd_initiator_tinfo *tinfo;struct ahd_tmode_tstate *tstate;
@@ -781,27 +780,22 @@ ahd_linux_dev_reset(struct scsi_cmnd *cmd) reset_scb =NULL ; - ahd = *(struct ahd_softc **)cmd->device->host->hostdata; + ahd = *(struct ahd_softc **)sdev->host->hostdata; -scmd_printk (KERN_INFO , cmd, +sdev_printk (KERN_INFO , sdev,"Attempting to queue a TARGET RESET message:" ); -printk ("CDB:" ); -for (cdb_byte =0 ; cdb_byte < cmd->cmd_len; cdb_byte++) -printk (" 0x%x" , cmd->cmnd[cdb_byte]); -printk ("\n" ); -/* * Determine if we currently own this command. */ - dev =scsi_transport_device_data (cmd->device); + dev =scsi_transport_device_data (sdev);if (dev ==NULL ) {/* * No target device for this command exists, * so we must not still own the command. */ -scmd_printk (KERN_INFO , cmd,"Is not an active device\n" ); +sdev_printk (KERN_INFO , sdev,"Is not an active device\n" );return SUCCESS ; }
@@ -810,12 +804,12 @@ ahd_linux_dev_reset(struct scsi_cmnd *cmd)*/ reset_scb =ahd_get_scb (ahd,AHD_NEVER_COL_IDX );if (!reset_scb) { -scmd_printk (KERN_INFO , cmd,"No SCB available\n" ); +sdev_printk (KERN_INFO , sdev,"No SCB available\n" );return FAILED ; } tinfo =ahd_fetch_transinfo (ahd,'A' , ahd->our_id, - cmd->device->id, &tstate); + sdev->id, &tstate); reset_scb->io_ctx =NULL ; reset_scb->platform_data->dev = dev; reset_scb->sg_count =0 ;
@@ -823,8 +817,8 @@ ahd_linux_dev_reset(struct scsi_cmnd *cmd)ahd_set_sense_residual (reset_scb,0 ); reset_scb->platform_data->xfer_len =0 ; reset_scb->hscb->control =0 ; - reset_scb->hscb->scsiid =ahd_build_scsiid (ahd, cmd->device); - reset_scb->hscb->lun = cmd->device->lun; + reset_scb->hscb->scsiid =ahd_build_scsiid (ahd, sdev); + reset_scb->hscb->lun = sdev->lun; reset_scb->hscb->cdb_len =0 ; reset_scb->hscb->task_management =SIU_TASKMGMT_LUN_RESET ; reset_scb->flags |=SCB_DEVICE_RESET |SCB_RECOVERY_SCB |SCB_ACTIVE ;
@@ -1790,7 +1784,8 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb)* was retrieved anytime the first byte of * the sense buffer looks "sane". */ - cmd->sense_buffer[0 ] =0 ; +if (cmd) + cmd->sense_buffer[0 ] =0 ;if (ahd_get_transaction_status (scb) ==CAM_REQ_INPROG ) {#ifdef AHD_REPORT_UNDERFLOWS uint32_t amount_xferred;
drivers/scsi/aic7xxx/aic7xxx_osm.c +2 -2
@@ -739,11 +739,11 @@ ahc_linux_abort(struct scsi_cmnd *cmd)* Attempt to send a target reset message to the device that timed out. */ static int -ahc_linux_dev_reset (struct scsi_cmnd *cmd) +ahc_linux_dev_reset (struct scsi_device *sdev) {int error; - error =ahc_linux_queue_recovery_cmd (cmd->device,NULL ); + error =ahc_linux_queue_recovery_cmd (sdev,NULL );if (error !=SUCCESS )printk ("aic7xxx_dev_reset returns 0x%x\n" , error);return (error);
drivers/scsi/arm/fas216.c +2 -3
@@ -2474,16 +2474,15 @@ int fas216_eh_abort(struct scsi_cmnd *SCpnt)/** * fas216_eh_device_reset - Reset the device associated with this command -* @SCpnt: command specifing device to reset +* @sdev: device to reset * * Reset the device associated with this command. * Returns: FAILED if unable to reset. * Notes: We won't be re-entered, so we'll only have one device * reset on the go at one time. */ -int fas216_eh_device_reset (struct scsi_cmnd *SCpnt) +int fas216_eh_device_reset (struct scsi_device *sdev) { -struct scsi_device *sdev = SCpnt->device;FAS216_Info *info = (FAS216_Info *)sdev->host->hostdata;unsigned long flags;int i, res =FAILED , target = sdev->id;
drivers/scsi/arm/fas216.h +3 -3
@@ -380,12 +380,12 @@ extern void fas216_print_devices(FAS216_Info *info, struct seq_file *m);*/ extern int fas216_eh_abort (struct scsi_cmnd *SCpnt); -/* Function: int fas216_eh_device_reset(struct scsi_cmnd *SCpnt) +/* Function: int fas216_eh_device_reset(struct scsi_device *sdev) * Purpose : Reset the device associated with this command -* Params : SCpnt - command specifing device to reset +* Params : sdev - device to be reset * Returns : FAILED if unable to reset */ -extern int fas216_eh_device_reset (struct scsi_cmnd *SCpnt); +extern int fas216_eh_device_reset (struct scsi_device *sdev);/* Function: int fas216_eh_bus_reset(struct scsi_cmnd *SCpnt) * Purpose : Reset the complete bus associated with this command
drivers/scsi/be2iscsi/be_main.c +4 -4
@@ -274,7 +274,7 @@ static int beiscsi_eh_abort(struct scsi_cmnd *sc)return iscsi_eh_abort (sc); } -static int beiscsi_eh_device_reset (struct scsi_cmnd *sc) +static int beiscsi_eh_device_reset (struct scsi_device *sdev) {struct beiscsi_invldt_cmd_tbl {struct invldt_cmd_tbl tbl[BE_INVLDT_CMD_TBL_SZ ];
@@ -290,7 +290,7 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc)unsigned int i, nents;int rc, more =0 ; - cls_session =starget_to_session (scsi_target (sc->device)); + cls_session =starget_to_session (scsi_target (sdev)); session = cls_session->dd_data;spin_lock_bh (&session->frwd_lock);
@@ -318,7 +318,7 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc)if (!task->sc)continue ; -if (sc->device->lun != task->sc->device->lun) +if (sdev->lun != task->sc->device->lun)continue ;/** * Can't fit in more cmds? Normally this won't happen b'coz
@@ -381,7 +381,7 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc)kfree (inv_tbl);if (rc ==SUCCESS ) - rc =iscsi_eh_device_reset (sc); + rc =iscsi_eh_device_reset (sdev);return rc; }
drivers/scsi/bfa/bfad_im.c +1 -2
@@ -283,9 +283,8 @@ bfad_im_target_reset_send(struct bfad_s *bfad,* */ static int -bfad_im_reset_lun_handler (struct scsi_cmnd *cmnd) +bfad_im_reset_lun_handler (struct scsi_device *sdev) { -struct scsi_device *sdev = cmnd->device;struct Scsi_Host *shost = sdev->host;struct bfad_im_port_s *im_port = (struct bfad_im_port_s *) shost->hostdata[0 ];
drivers/scsi/bnx2fc/bnx2fc.h +1 -1
@@ -552,7 +552,7 @@ void bnx2fc_add_2_sq(struct bnx2fc_rport *tgt, u16 xid);void bnx2fc_ring_doorbell (struct bnx2fc_rport *tgt);int bnx2fc_eh_abort (struct scsi_cmnd *sc_cmd);int bnx2fc_eh_target_reset (struct scsi_target *sc_tgt); -int bnx2fc_eh_device_reset (struct scsi_cmnd *sc_cmd); +int bnx2fc_eh_device_reset (struct scsi_device *sdev);void bnx2fc_rport_event_handler (struct fc_lport *lport,struct fc_rport_priv *rport,enum fc_rport_event event);
drivers/scsi/bnx2fc/bnx2fc_io.c +4 -4
@@ -1067,17 +1067,17 @@ int bnx2fc_eh_target_reset(struct scsi_target *sc_tgt)/** * bnx2fc_eh_device_reset - Reset a single LUN * -* @sc_cmd: SCSI command +* @sdev: SCSI device * * Set from SCSI host template to send task mgmt command to the target * and wait for the response */ -int bnx2fc_eh_device_reset (struct scsi_cmnd *sc_cmd) +int bnx2fc_eh_device_reset (struct scsi_device *sdev) { -struct fc_rport *rport =starget_to_rport (scsi_target (sc_cmd->device)); +struct fc_rport *rport =starget_to_rport (scsi_target (sdev));struct fc_lport *lport =shost_priv (rport_to_shost (rport)); -return bnx2fc_initiate_tmf (lport, rport, sc_cmd->device->lun, +return bnx2fc_initiate_tmf (lport, rport, sdev->lun,FCP_TMF_LUN_RESET ); }
drivers/scsi/csiostor/csio_scsi.c +2 -3
@@ -2066,9 +2066,8 @@ csio_tm_cbfn(struct csio_hw *hw, struct csio_ioreq *req) }static int -csio_eh_lun_reset_handler (struct scsi_cmnd *cmnd) +csio_eh_lun_reset_handler (struct scsi_device *sdev) { -struct scsi_device *sdev = cmnd->device;struct csio_lnode *ln =shost_priv (sdev->host);struct csio_hw *hw =csio_lnode_to_hw (ln);struct csio_scsim *scsim =csio_hw_to_scsim (hw);
@@ -2098,7 +2097,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_rport (rn->rport);if (ret)return ret;
drivers/scsi/cxlflash/main.c +2 -3
@@ -2438,16 +2438,15 @@ static int cxlflash_eh_abort_handler(struct scsi_cmnd *scp)/** * cxlflash_eh_device_reset_handler() - reset a single LUN -* @scp: SCSI command to send. +* @sdev: SCSI device to be reset. * * Return: * SUCCESS as defined in scsi/scsi.h * FAILED as defined in scsi/scsi.h */ -static int cxlflash_eh_device_reset_handler (struct scsi_cmnd *scp) +static int cxlflash_eh_device_reset_handler (struct scsi_device *sdev) {int rc =SUCCESS ; -struct scsi_device *sdev = scp->device;struct Scsi_Host *host = sdev->host;struct cxlflash_cfg *cfg =shost_priv (host);struct device *dev = &cfg->dev->dev;
drivers/scsi/esas2r/esas2r.h +1 -1
@@ -975,7 +975,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_device_reset (struct scsi_device *sdev);int esas2r_host_reset (struct Scsi_Host *shost);int esas2r_bus_reset (struct Scsi_Host *shost,unsigned int channel);int esas2r_target_reset (struct scsi_target *starget);
drivers/scsi/esas2r/esas2r_main.c +1 -2
@@ -1175,9 +1175,8 @@ static int esas2r_dev_targ_reset(struct Scsi_Host *shost, int id, u64 lun,return SUCCESS ; } -int esas2r_device_reset (struct scsi_cmnd *cmd) +int esas2r_device_reset (struct scsi_device *sdev) { -struct scsi_device *sdev = cmd->device;struct Scsi_Host *shost = sdev->host;esas2r_log (ESAS2R_LOG_INFO ,"device_reset" );
drivers/scsi/fnic/fnic.h +1 -1
@@ -346,7 +346,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_device_reset (struct scsi_device *);int fnic_host_reset (struct Scsi_Host *);int fnic_reset (struct Scsi_Host *);void fnic_scsi_cleanup (struct fc_lport *);
drivers/scsi/fnic/fnic_scsi.c +4 -5
@@ -2159,13 +2159,13 @@ static int fnic_clean_pending_aborts(struct fnic *fnic,/* * SCSI Eh thread issues a Lun Reset when one or more commands on a LUN -* fail to get aborted. It calls driver's eh_device_reset with a SCSI command -* on the LUN. +* fail to get aborted. It calls driver's eh_device_reset with the LUN +* to be reset. */ -int fnic_device_reset (struct scsi_cmnd *sc) +int fnic_device_reset (struct scsi_device *sdev) { -struct scsi_device *sdev = sc->device;struct request *req; +struct scsi_cmnd *sc;struct fc_lport *lp;struct fnic *fnic;struct fnic_io_req *io_req =NULL ;
@@ -2193,7 +2193,6 @@ int fnic_device_reset(struct scsi_cmnd *sc) fnic =lport_priv (lp); fnic_stats = &fnic->fnic_stats; reset_stats = &fnic->fnic_stats.reset_stats; -atomic64_inc (&reset_stats->device_resets); FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
drivers/scsi/hpsa.c +6 -8
@@ -282,7 +282,7 @@ static int hpsa_scan_finished(struct Scsi_Host *sh, unsigned long elapsed_time);static int hpsa_change_queue_depth (struct scsi_device *sdev,int qdepth); -static int hpsa_eh_device_reset_handler (struct scsi_cmnd *scsicmd); +static int hpsa_eh_device_reset_handler (struct scsi_device *sdev);static int hpsa_slave_alloc (struct scsi_device *sdev);static int hpsa_slave_configure (struct scsi_device *sdev);static void hpsa_slave_destroy (struct scsi_device *sdev);
@@ -6021,7 +6021,7 @@ static int wait_for_device_to_become_ready(struct ctlr_info *h,/* Need at least one of these error handlers to keep ../scsi/hosts.c from * complaining. Doing a host- or bus-reset can't do anything good here. */ -static int hpsa_eh_device_reset_handler (struct scsi_cmnd *scsicmd) +static int hpsa_eh_device_reset_handler (struct scsi_device *sdev) {int rc =SUCCESS ;int i;
@@ -6032,7 +6032,7 @@ static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd)unsigned long flags;/* find the controller to which the command to be aborted was sent */ - h =sdev_to_hba (scsicmd->device); + h =sdev_to_hba (sdev);if (h ==NULL )/* paranoia */ return FAILED ;
@@ -6045,7 +6045,7 @@ static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd) goto return_reset_status; } - dev = scsicmd->device->hostdata; + dev = sdev->hostdata;if (!dev) {dev_err (&h->pdev->dev,"%s: device lookup failed\n" , __func__); rc =FAILED ;
@@ -6060,8 +6060,7 @@ static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd)/* if controller locked up, we can guarantee command won't complete */ if (lockup_detected (h)) {snprintf (msg,sizeof (msg), -"cmd %d RESET FAILED, lockup detected" , -hpsa_get_cmd_index (scsicmd)); +"RESET FAILED, lockup detected" );hpsa_show_dev_msg (KERN_WARNING , h, dev, msg); rc =FAILED ; goto return_reset_status;
@@ -6070,8 +6069,7 @@ static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd)/* this reset request might be the result of a lockup; check */ if (detect_controller_lockup (h)) {snprintf (msg,sizeof (msg), -"cmd %d RESET FAILED, new lockup detected" , -hpsa_get_cmd_index (scsicmd)); +"RESET FAILED, new lockup detected" );hpsa_show_dev_msg (KERN_WARNING , h, dev, msg); rc =FAILED ; goto return_reset_status;
drivers/scsi/ibmvscsi/ibmvfc.c +4 -4
@@ -2952,20 +2952,20 @@ static int ibmvfc_eh_abort_handler(struct scsi_cmnd *cmd)/** * ibmvfc_eh_device_reset_handler - Reset a single LUN -* @cmd: scsi command struct +* @sdev: scsi device struct * * Returns: * SUCCESS / FAST_IO_FAIL / FAILED **/ -static int ibmvfc_eh_device_reset_handler (struct scsi_cmnd *cmd) +static int ibmvfc_eh_device_reset_handler (struct scsi_device *sdev) { -struct scsi_device *sdev = cmd->device; +struct fc_rport *rport =starget_to_rport (scsi_target (sdev));struct ibmvfc_host *vhost =shost_priv (sdev->host);int cancel_rc, block_rc, reset_rc =0 ;int rc =FAILED ;ENTER ; - block_rc =fc_block_scsi_eh (cmd); + block_rc =fc_block_rport (rport);ibmvfc_wait_while_resetting (vhost);if (block_rc !=FAST_IO_FAIL ) { cancel_rc =ibmvfc_cancel_all (sdev,IBMVFC_TMF_LUN_RESET );
drivers/scsi/ibmvscsi/ibmvscsi.c +10 -9
@@ -1624,16 +1624,16 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd)* template send this over to the server and wait synchronously for the * response */ -static int ibmvscsi_eh_device_reset_handler (struct scsi_cmnd *cmd) +static int ibmvscsi_eh_device_reset_handler (struct scsi_device *sdev) { -struct ibmvscsi_host_data *hostdata =shost_priv (cmd->device->host); +struct ibmvscsi_host_data *hostdata =shost_priv (sdev->host);struct srp_tsk_mgmt *tsk_mgmt;struct srp_event_struct *evt;struct srp_event_struct *tmp_evt, *pos;union viosrp_iu srp_rsp;int rsp_rc;unsigned long flags; -u16 lun =lun_from_dev (cmd->device); +u16 lun =lun_from_dev (sdev);unsigned long wait_switch =0 ;spin_lock_irqsave (hostdata->host->host_lock, flags);
@@ -1642,7 +1642,7 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd) evt =get_event_struct (&hostdata->pool);if (evt ==NULL ) {spin_unlock_irqrestore (hostdata->host->host_lock, flags); -sdev_printk (KERN_ERR , cmd->device, +sdev_printk (KERN_ERR , sdev,"failed to allocate reset event\n" );return FAILED ; }
@@ -1676,12 +1676,12 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)spin_unlock_irqrestore (hostdata->host->host_lock, flags);if (rsp_rc !=0 ) { -sdev_printk (KERN_ERR , cmd->device, +sdev_printk (KERN_ERR , sdev,"failed to send reset event. rc=%d\n" , rsp_rc);return FAILED ; } -sdev_printk (KERN_INFO , cmd->device,"resetting device. lun 0x%llx\n" , +sdev_printk (KERN_INFO , sdev,"resetting device. lun 0x%llx\n" , (((u64 ) lun) <<48 ));wait_for_completion (&evt->comp);
@@ -1689,7 +1689,8 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)/* make sure we got a good response */ if (unlikely (srp_rsp.srp.rsp.opcode !=SRP_RSP )) {if (printk_ratelimit ()) -sdev_printk (KERN_WARNING , cmd->device,"reset bad SRP RSP type %d\n" , +sdev_printk (KERN_WARNING , sdev, +"reset bad SRP RSP type %d\n" , srp_rsp.srp.rsp.opcode);return FAILED ; }
@@ -1701,7 +1702,7 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)if (rsp_rc) {if (printk_ratelimit ()) -sdev_printk (KERN_WARNING , cmd->device, +sdev_printk (KERN_WARNING , sdev,"reset code %d for task tag 0x%llx\n" , rsp_rc, tsk_mgmt->task_tag);return FAILED ;
@@ -1712,7 +1713,7 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)*/ spin_lock_irqsave (hostdata->host->host_lock, flags);list_for_each_entry_safe (tmp_evt, pos, &hostdata->sent, list) { -if ((tmp_evt->cmnd) && (tmp_evt->cmnd->device == cmd->device)) { +if ((tmp_evt->cmnd) && (tmp_evt->cmnd->device == sdev)) {if (tmp_evt->cmnd) tmp_evt->cmnd->result = (DID_RESET <<16 );list_del (&tmp_evt->list);
drivers/scsi/ipr.c +12 -12
@@ -5036,7 +5036,7 @@ static int ipr_device_reset(struct ipr_ioa_cfg *ioa_cfg,/** * __ipr_eh_dev_reset - Reset the device -* @scsi_cmd: scsi command struct +* @scsi_dev: scsi device struct * * This function issues a device reset to the affected device. * A LUN reset will be sent to the device first. If that does
@@ -5045,15 +5045,15 @@ static int ipr_device_reset(struct ipr_ioa_cfg *ioa_cfg,* Return value: * SUCCESS / FAILED **/ -static int __ipr_eh_dev_reset (struct scsi_cmnd *scsi_cmd) +static int __ipr_eh_dev_reset (struct scsi_device *scsi_dev) {struct ipr_ioa_cfg *ioa_cfg;struct ipr_resource_entry *res;int rc =0 ;ENTER ; - ioa_cfg = (struct ipr_ioa_cfg *) scsi_cmd->device->host->hostdata; - res = scsi_cmd->device->hostdata; + ioa_cfg = (struct ipr_ioa_cfg *) scsi_dev->host->hostdata; + res = scsi_dev->hostdata;/* * If we are currently going through reset/reload, return failed. This will force the
@@ -5066,7 +5066,7 @@ static int __ipr_eh_dev_reset(struct scsi_cmnd *scsi_cmd)return FAILED ; res->resetting_device =1 ; -scmd_printk (KERN_ERR , scsi_cmd,"Resetting device\n" ); +sdev_printk (KERN_ERR , scsi_dev,"Resetting device\n" ); rc =ipr_device_reset (ioa_cfg, res); res->resetting_device =0 ;
@@ -5076,24 +5076,24 @@ static int __ipr_eh_dev_reset(struct scsi_cmnd *scsi_cmd)return rc ?FAILED :SUCCESS ; } -static int ipr_eh_dev_reset (struct scsi_cmnd *cmd) +static int ipr_eh_dev_reset (struct scsi_device *sdev) {int rc;struct ipr_ioa_cfg *ioa_cfg;struct ipr_resource_entry *res; - ioa_cfg = (struct ipr_ioa_cfg *) cmd->device->host->hostdata; - res = cmd->device->hostdata; + ioa_cfg = (struct ipr_ioa_cfg *) sdev->host->hostdata; + res = sdev->hostdata;if (!res)return FAILED ; -spin_lock_irq (cmd->device->host->host_lock); - rc =__ipr_eh_dev_reset (cmd); -spin_unlock_irq (cmd->device->host->host_lock); +spin_lock_irq (sdev->host->host_lock); + rc =__ipr_eh_dev_reset (sdev); +spin_unlock_irq (sdev->host->host_lock);if (rc ==SUCCESS ) - rc =ipr_wait_for_ops (ioa_cfg, cmd->device, ipr_match_lun); + rc =ipr_wait_for_ops (ioa_cfg, sdev, ipr_match_lun);return rc; }
drivers/scsi/libfc/fc_fcp.c +6 -7
@@ -2135,24 +2135,23 @@ EXPORT_SYMBOL(fc_eh_abort);/** * fc_eh_device_reset() - Reset a single LUN -* @sc_cmd: The SCSI command which identifies the device whose -* LUN is to be reset +* @sdev: The SCSI device whose LUN is to be reset * * Set from SCSI host template. */ -int fc_eh_device_reset (struct scsi_cmnd *sc_cmd) +int fc_eh_device_reset (struct scsi_device *sdev) {struct fc_lport *lport;struct fc_fcp_pkt *fsp; -struct fc_rport *rport =starget_to_rport (scsi_target (sc_cmd->device)); +struct fc_rport *rport =starget_to_rport (scsi_target (sdev));int rc =FAILED ;int rval; - rval =fc_block_scsi_eh (sc_cmd); + rval =fc_block_rport (rport);if (rval)return rval; - lport =shost_priv (sc_cmd->device->host); + lport =shost_priv (sdev->host);if (lport->state !=LPORT_ST_READY )return rc;
@@ -2175,7 +2174,7 @@ int fc_eh_device_reset(struct scsi_cmnd *sc_cmd)/* * flush outstanding commands */ - rc =fc_lun_reset (lport, fsp,scmd_id (sc_cmd), sc_cmd->device->lun); + rc =fc_lun_reset (lport, fsp, sdev->id, sdev->lun); fsp->state =FC_SRB_FREE ;fc_fcp_pkt_release (fsp);
drivers/scsi/libiscsi.c +7 -8
@@ -2496,17 +2496,17 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) }EXPORT_SYMBOL_GPL (iscsi_eh_abort); -static void iscsi_prep_lun_reset_pdu (struct scsi_cmnd *sc,struct iscsi_tm *hdr) +static void iscsi_prep_lun_reset_pdu (struct scsi_device *sdev,struct iscsi_tm *hdr) {memset (hdr,0 ,sizeof (*hdr)); hdr->opcode =ISCSI_OP_SCSI_TMFUNC |ISCSI_OP_IMMEDIATE ; hdr->flags =ISCSI_TM_FUNC_LOGICAL_UNIT_RESET &ISCSI_FLAG_TM_FUNC_MASK ; hdr->flags |=ISCSI_FLAG_CMD_FINAL ; -int_to_scsilun (sc->device->lun, &hdr->lun); +int_to_scsilun (sdev->lun, &hdr->lun); hdr->rtt =RESERVED_ITT ; } -int iscsi_eh_device_reset (struct scsi_cmnd *sc) +int iscsi_eh_device_reset (struct scsi_device *sdev) {struct iscsi_cls_session *cls_session;struct iscsi_session *session;
@@ -2514,11 +2514,10 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc)struct iscsi_tm *hdr;int rc =FAILED ; - cls_session =starget_to_session (scsi_target (sc->device)); + cls_session =starget_to_session (scsi_target (sdev)); session = cls_session->dd_data; -ISCSI_DBG_EH (session,"LU Reset [sc %p lun %llu]\n" , sc, - sc->device->lun); +ISCSI_DBG_EH (session,"LU Reset [lun %llu]\n" , sdev->lun);mutex_lock (&session->eh_mutex);spin_lock_bh (&session->frwd_lock);
@@ -2536,7 +2535,7 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc) session->tmf_state =TMF_QUEUED ; hdr = &session->tmhdr; -iscsi_prep_lun_reset_pdu (sc, hdr); +iscsi_prep_lun_reset_pdu (sdev, hdr);if (iscsi_exec_task_mgmt_fn (conn, hdr, session->age, session->lu_reset_timeout)) {
@@ -2563,7 +2562,7 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc)spin_lock_bh (&session->frwd_lock);memset (hdr,0 ,sizeof (*hdr)); -fail_scsi_tasks (conn, sc->device->lun,DID_ERROR ); +fail_scsi_tasks (conn, sdev->lun,DID_ERROR ); session->tmf_state =TMF_INITIAL ;spin_unlock_bh (&session->frwd_lock);
drivers/scsi/libsas/sas_scsi_host.c +6 -6
@@ -454,18 +454,18 @@ int sas_eh_abort_handler(struct scsi_cmnd *cmd)EXPORT_SYMBOL_GPL (sas_eh_abort_handler);/* Attempt to send a LUN reset message to a device */ -int sas_eh_device_reset_handler (struct scsi_cmnd *cmd) +int sas_eh_device_reset_handler (struct scsi_device *sdev) {int res;struct scsi_lun lun; -struct Scsi_Host *host = cmd->device->host; -struct domain_device *dev =cmd_to_domain_dev (cmd); +struct Scsi_Host *host = sdev->host; +struct domain_device *dev =sdev_to_domain_dev (sdev);struct sas_internal *i =to_sas_internal (host->transportt);if (current != host->ehandler) -return sas_queue_reset (dev,SAS_DEV_LU_RESET , cmd->device->lun); +return sas_queue_reset (dev,SAS_DEV_LU_RESET , sdev->lun); -int_to_scsilun (cmd->device->lun, &lun); +int_to_scsilun (sdev->lun, &lun);if (!i->dft->lldd_lu_reset)return FAILED ;
@@ -510,7 +510,7 @@ static int try_to_reset_cmd_device(struct scsi_cmnd *cmd)if (!shost->hostt->eh_device_reset_handler) goto try_target_reset; - res = shost->hostt->eh_device_reset_handler (cmd); + res = shost->hostt->eh_device_reset_handler (cmd->device);if (res ==SUCCESS )return res;
drivers/scsi/lpfc/lpfc_scsi.c +6 -6
@@ -5957,7 +5957,7 @@ lpfc_reset_flush_io_context(struct lpfc_vport *vport, uint16_t tgt_id,/** * lpfc_device_reset_handler - scsi_host_template eh_device_reset entry point -* @cmnd: Pointer to scsi_cmnd data structure. +* @sdev: Pointer to scsi_device data structure. * * This routine does a device reset by sending a LUN_RESET task management * command.
@@ -5967,15 +5967,15 @@ lpfc_reset_flush_io_context(struct lpfc_vport *vport, uint16_t tgt_id,* 0x2002 - Success **/ static int -lpfc_device_reset_handler (struct scsi_cmnd *cmnd) +lpfc_device_reset_handler (struct scsi_device *sdev) { -struct Scsi_Host *shost = cmnd->device->host; -struct fc_rport *rport =starget_to_rport (scsi_target (cmnd->device)); +struct Scsi_Host *shost = sdev->host; +struct fc_rport *rport =starget_to_rport (scsi_target (sdev));struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;struct lpfc_rport_data *rdata;struct lpfc_nodelist *pnode; -unsigned tgt_id = cmnd->device->id; -uint64_t lun_id = cmnd->device->lun; +unsigned tgt_id = sdev->id; +uint64_t lun_id = sdev->lun;struct lpfc_scsi_event_header scsi_event;int status;u32 logit =LOG_FCP ;
drivers/scsi/mpi3mr/mpi3mr_os.c +17 -23
@@ -4141,30 +4141,28 @@ static int mpi3mr_eh_target_reset(struct scsi_target *starget)/** * mpi3mr_eh_dev_reset- Device reset error handling callback -* @scmd: SCSI command reference +* @sdev: SCSI device reference * -* Issue lun reset Task Management and verify the scmd is -* terminated successfully and return status accordingly. +* Issue lun reset Task Management and return status accordingly. * -* Return: SUCCESS of successful termination of the scmd else +* Return: SUCCESS of successful lun reset else * FAILED */ -static int mpi3mr_eh_dev_reset (struct scsi_cmnd *scmd) +static int mpi3mr_eh_dev_reset (struct scsi_device *sdev) { -struct mpi3mr_ioc *mrioc =shost_priv (scmd->device->host); +struct mpi3mr_ioc *mrioc =shost_priv (sdev->host);struct mpi3mr_stgt_priv_data *stgt_priv_data;struct mpi3mr_sdev_priv_data *sdev_priv_data;u16 dev_handle;u8 resp_code =0 ;int retval =FAILED , ret =0 ; -sdev_printk (KERN_INFO , scmd->device, -"Attempting Device(lun) Reset! scmd(%p)\n" , scmd); -scsi_print_command (scmd); +sdev_printk (KERN_INFO , sdev, +"Attempting Device(lun) Reset!\n" ); - sdev_priv_data = scmd->device->hostdata; + sdev_priv_data = sdev->hostdata;if (!sdev_priv_data || !sdev_priv_data->tgt_priv_data) { -sdev_printk (KERN_INFO , scmd->device, +sdev_printk (KERN_INFO , sdev,"SCSI device is not available\n" ); retval =SUCCESS ; goto out;
@@ -4173,38 +4171,34 @@ static int mpi3mr_eh_dev_reset(struct scsi_cmnd *scmd) stgt_priv_data = sdev_priv_data->tgt_priv_data; dev_handle = stgt_priv_data->dev_handle;if (stgt_priv_data->dev_removed) { -struct scmd_priv *cmd_priv =scsi_cmd_priv (scmd); -sdev_printk (KERN_INFO , scmd->device, +sdev_printk (KERN_INFO , sdev,"%s: device(handle = 0x%04x) is removed, device(LUN) reset is not issued\n" , mrioc->name, dev_handle); -if (!cmd_priv->in_lld_scope || cmd_priv->host_tag ==MPI3MR_HOSTTAG_INVALID ) - retval =SUCCESS ; -else - retval =FAILED ; + retval =FAILED ; goto out; } -sdev_printk (KERN_INFO , scmd->device, +sdev_printk (KERN_INFO , sdev,"Device(lun) Reset is issued to handle(0x%04x)\n" , dev_handle); ret =mpi3mr_issue_tm (mrioc,MPI3_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET , dev_handle, sdev_priv_data->lun_id,MPI3MR_HOSTTAG_BLK_TMS , -MPI3MR_RESETTM_TIMEOUT , &mrioc->host_tm_cmds, &resp_code, scmd); +MPI3MR_RESETTM_TIMEOUT , &mrioc->host_tm_cmds, &resp_code,NULL );if (ret) goto out;if (sdev_priv_data->pend_count) { -sdev_printk (KERN_INFO , scmd->device, +sdev_printk (KERN_INFO , sdev,"%s: device has %d pending commands, device(LUN) reset is failed\n" , mrioc->name, sdev_priv_data->pend_count); goto out; } retval =SUCCESS ; out: -sdev_printk (KERN_INFO , scmd->device, -"%s: device(LUN) reset is %s for scmd(%p)\n" , mrioc->name, - ((retval ==SUCCESS ) ?"SUCCESS" :"FAILED" ), scmd); +sdev_printk (KERN_INFO , sdev, +"%s: device(LUN) reset is %s\n" , mrioc->name, + ((retval ==SUCCESS ) ?"SUCCESS" :"FAILED" ));return retval; }
drivers/scsi/mpt3sas/mpt3sas_scsih.c +14 -18
@@ -3360,14 +3360,14 @@ scsih_abort(struct scsi_cmnd *scmd)/** * scsih_dev_reset - eh threads main device reset routine -* @scmd: pointer to scsi command object +* @sdev: pointer to scsi device object * * Return: SUCCESS if command aborted else FAILED */ static int -scsih_dev_reset (struct scsi_cmnd *scmd) +scsih_dev_reset (struct scsi_device *sdev) { -struct MPT3SAS_ADAPTER *ioc =shost_priv (scmd->device->host); +struct MPT3SAS_ADAPTER *ioc =shost_priv (sdev->host);struct MPT3SAS_DEVICE *sas_device_priv_data;struct _sas_device *sas_device =NULL ;struct _pcie_device *pcie_device =NULL ;
@@ -3376,20 +3376,17 @@ scsih_dev_reset(struct scsi_cmnd *scmd)u8 tr_timeout =30 ;int r; -struct scsi_target *starget = scmd->device->sdev_target; +struct scsi_target *starget = sdev->sdev_target;struct MPT3SAS_TARGET *target_priv_data = starget->hostdata; -sdev_printk (KERN_INFO , scmd->device, -"attempting device reset! scmd(0x%p)\n" , scmd); -_scsih_tm_display_info (ioc, scmd); +sdev_printk (KERN_INFO , sdev, +"attempting device reset!\n" ); - sas_device_priv_data = scmd->device->hostdata; + sas_device_priv_data = sdev->hostdata;if (!sas_device_priv_data || !sas_device_priv_data->sas_target || ioc->remove_host) { -sdev_printk (KERN_INFO , scmd->device, -"device been deleted! scmd(0x%p)\n" , scmd); - scmd->result =DID_NO_CONNECT <<16 ; -scsi_done (scmd); +sdev_printk (KERN_INFO , sdev, +"device been deleted!\n" ); r =SUCCESS ; goto out; }
@@ -3406,7 +3403,6 @@ scsih_dev_reset(struct scsi_cmnd *scmd) handle = sas_device_priv_data->sas_target->handle;if (!handle) { - scmd->result =DID_RESET <<16 ; r =FAILED ; goto out; }
@@ -3420,16 +3416,16 @@ scsih_dev_reset(struct scsi_cmnd *scmd) }else tr_method =MPI2_SCSITASKMGMT_MSGFLAGS_LINK_RESET ; - r =mpt3sas_scsih_issue_locked_tm (ioc, handle, scmd->device->channel, - scmd->device->id, scmd->device->lun, + r =mpt3sas_scsih_issue_locked_tm (ioc, handle, sdev->channel, + sdev->id, sdev->lun,MPI2_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET ,0 ,0 , tr_timeout, tr_method);/* Check for busy commands after reset */ -if (r ==SUCCESS &&scsi_device_busy (scmd->device)) +if (r ==SUCCESS &&scsi_device_busy (sdev)) r =FAILED ; out: -sdev_printk (KERN_INFO , scmd->device,"device reset: %s scmd(0x%p)\n" , - ((r ==SUCCESS ) ?"SUCCESS" :"FAILED" ), scmd); +sdev_printk (KERN_INFO , sdev,"device reset: %s\n" , + ((r ==SUCCESS ) ?"SUCCESS" :"FAILED" ));if (sas_device)sas_device_put (sas_device);
drivers/scsi/pcmcia/nsp_cs.h +0 -2
@@ -297,8 +297,6 @@ static int nsp_show_info (struct seq_file *m,static int nsp_queuecommand (struct Scsi_Host *h,struct scsi_cmnd *SCpnt);/* Error handler */ -/*static int nsp_eh_abort (struct scsi_cmnd *SCpnt);*/ -/*static int nsp_eh_device_reset(struct scsi_cmnd *SCpnt);*/ static int nsp_eh_bus_reset (struct Scsi_Host *host,unsigned int channel);static int nsp_eh_host_reset (struct Scsi_Host *host);static int nsp_bus_reset (nsp_hw_data *data);
drivers/scsi/pmcraid.c +5 -5
@@ -2679,7 +2679,7 @@ static int pmcraid_error_handler(struct pmcraid_cmd *cmd)/** * pmcraid_reset_device - device reset handler functions * -* @scsi_cmd: scsi command struct +* @scsi_dev: scsi device struct * @timeout: command timeout * @modifier: reset modifier indicating the reset sequence to be performed *
@@ -3003,7 +3003,7 @@ static int pmcraid_eh_abort_handler(struct scsi_cmnd *scsi_cmd)/** * pmcraid_eh_device_reset_handler - bus/target/device reset handler callbacks * -* @scmd: pointer to scsi_cmd that was sent to the resource to be reset. +* @sdev: pointer to the resource to be reset. * * All these routines invokve pmcraid_reset_device with appropriate parameters. * Since these are called from mid-layer EH thread, no other IO will be queued
@@ -3014,11 +3014,11 @@ static int pmcraid_eh_abort_handler(struct scsi_cmnd *scsi_cmd)* Return value * SUCCESS or FAILED */ -static int pmcraid_eh_device_reset_handler (struct scsi_cmnd *scmd) +static int pmcraid_eh_device_reset_handler (struct scsi_device *sdev) { -scmd_printk (KERN_INFO , scmd, +sdev_printk (KERN_INFO , sdev,"resetting device due to an I/O command timeout.\n" ); -return pmcraid_reset_device (scmd->device, +return pmcraid_reset_device (sdev,PMCRAID_INTERNAL_TIMEOUT ,RESET_DEVICE_LUN ); }
drivers/scsi/qedf/qedf_main.c +3 -3
@@ -864,12 +864,12 @@ static int qedf_eh_target_reset(struct scsi_target *starget)return qedf_initiate_tmf (rport,0 ,FCP_TMF_TGT_RESET ); } -static int qedf_eh_device_reset (struct scsi_cmnd *sc_cmd) +static int qedf_eh_device_reset (struct scsi_device *sdev) { -struct fc_rport *rport =starget_to_rport (scsi_target (sc_cmd->device)); +struct fc_rport *rport =starget_to_rport (scsi_target (sdev));QEDF_ERR (NULL ,"LUN RESET Issued...\n" ); -return qedf_initiate_tmf (rport, sc_cmd->device->lun,FCP_TMF_LUN_RESET ); +return qedf_initiate_tmf (rport, sdev->lun,FCP_TMF_LUN_RESET ); }bool qedf_wait_for_upload (struct qedf_ctx *qedf)
drivers/scsi/qla1280.c +17 -36
129 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_os.c +11 -13
@@ -1446,9 +1446,8 @@ static char *reset_errors[] = { };static int -qla2xxx_eh_device_reset (struct scsi_cmnd *cmd) +qla2xxx_eh_device_reset (struct scsi_device *sdev) { -struct scsi_device *sdev = cmd->device;scsi_qla_host_t *vha =shost_priv (sdev->host);struct fc_rport *rport =starget_to_rport (scsi_target (sdev));fc_port_t *fcport = (struct fc_port *) sdev->hostdata;
@@ -1474,42 +1473,41 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)return FAILED ;ql_log (ql_log_info, vha,0x8009 , -"DEVICE RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n" , vha->host_no, - sdev->id, sdev->lun, cmd); +"DEVICE RESET ISSUED nexus=%ld:%d:%llu.\n" , vha->host_no, + sdev->id, sdev->lun); err =0 ;if (qla2x00_wait_for_hba_online (vha) !=QLA_SUCCESS ) {ql_log (ql_log_warn, vha,0x800a , -"Wait for hba online failed for cmd=%p.\n" , cmd); +"Wait for hba online failed.\n" ); goto eh_reset_failed; } err =2 ;if (ha->isp_ops->lun_reset (fcport, sdev->lun,1 ) !=QLA_SUCCESS ) {ql_log (ql_log_warn, vha,0x800c , -"do_reset failed for cmd=%p.\n" , cmd); +"do_reset failed.\n" ); goto eh_reset_failed; } err =3 ;if (qla2x00_eh_wait_for_pending_commands (vha, fcport->d_id.b24, - cmd->device->lun, + sdev->lun,WAIT_LUN ) !=QLA_SUCCESS ) {ql_log (ql_log_warn, vha,0x800d , -"wait for pending cmds failed for cmd=%p.\n" , cmd); +"wait for pending cmds failed.\n" ); goto eh_reset_failed; }ql_log (ql_log_info, vha,0x800e , -"DEVICE RESET SUCCEEDED nexus:%ld:%d:%llu cmd=%p.\n" , - vha->host_no, sdev->id, sdev->lun, cmd); +"DEVICE RESET SUCCEEDED nexus:%ld:%d:%llu.\n" , + vha->host_no, sdev->id, sdev->lun);return SUCCESS ; eh_reset_failed:ql_log (ql_log_info, vha,0x800f , -"DEVICE RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n" , - reset_errors[err], vha->host_no, sdev->id, sdev->lun, - cmd); +"DEVICE RESET FAILED: %s nexus=%ld:%d:%llu.\n" , + reset_errors[err], vha->host_no, sdev->id, sdev->lun); vha->reset_cmd_err_cnt++;return FAILED ; }
drivers/scsi/qla4xxx/ql4_os.c +10 -15
@@ -157,7 +157,7 @@ static int qla4xxx_get_host_stats(struct Scsi_Host *shost, char *buf, int len);*/ 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_device_reset (struct scsi_device *sdev);static int qla4xxx_eh_target_reset (struct scsi_target *starget);static int qla4xxx_eh_host_reset (struct Scsi_Host *shost);static int qla4xxx_slave_alloc (struct scsi_device *device);
@@ -9265,14 +9265,13 @@ static int qla4xxx_eh_abort(struct scsi_cmnd *cmd)/** * qla4xxx_eh_device_reset - callback for target reset. -* @cmd: Pointer to Linux's SCSI command structure +* @sdev: Pointer to Linux's SCSI device structure * * This routine is called by the Linux OS to reset all luns on the * specified target. **/ -static int qla4xxx_eh_device_reset (struct scsi_cmnd *cmd) +static int qla4xxx_eh_device_reset (struct scsi_device *sdev) { -struct scsi_device *sdev = cmd->device;struct scsi_qla_host *ha =to_qla_host (sdev->host);struct iscsi_cls_session *session;struct ddb_entry *ddb_entry = sdev->hostdata;
@@ -9290,13 +9289,11 @@ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd)ql4_printk (KERN_INFO , ha,"scsi%ld:%d:%d:%llu: DEVICE RESET ISSUED.\n" , ha->host_no, - cmd->device->channel, cmd->device->id, cmd->device->lun); + sdev->channel, sdev->id, sdev->lun);DEBUG2 (printk (KERN_INFO -"scsi%ld: DEVICE_RESET cmd=%p jiffies = 0x%lx, to=%x," -"dpc_flags=%lx, status=%x allowed=%d\n" , ha->host_no, - cmd, jiffies,scsi_cmd_to_rq (cmd)->timeout /HZ , - ha->dpc_flags, cmd->result, cmd->allowed)); +"scsi%ld: DEVICE_RESET dpc_flags=%lx\n" , + ha->host_no, ha->dpc_flags)); rval =qla4xxx_isp_check_reg (ha);if (rval !=QLA_SUCCESS ) {
@@ -9305,14 +9302,13 @@ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd) }/* FIXME: wait for hba to go online */ - stat =qla4xxx_reset_lun (ha, ddb_entry, cmd->device->lun); + stat =qla4xxx_reset_lun (ha, ddb_entry, sdev->lun);if (stat !=QLA_SUCCESS ) {ql4_printk (KERN_INFO , ha,"DEVICE RESET FAILED. %d\n" , stat); goto eh_dev_reset_done; } -if (qla4xxx_eh_wait_for_commands (ha,scsi_target (cmd->device), - cmd->device)) { +if (qla4xxx_eh_wait_for_commands (ha,scsi_target (sdev), sdev)) {ql4_printk (KERN_INFO , ha,"DEVICE RESET FAILED - waiting for " "commands.\n" );
@@ -9320,14 +9316,13 @@ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd) }/* Send marker. */ -if (qla4xxx_send_marker_iocb (ha, ddb_entry, cmd->device->lun, +if (qla4xxx_send_marker_iocb (ha, ddb_entry, sdev->lun,MM_LUN_RESET ) !=QLA_SUCCESS ) goto eh_dev_reset_done;ql4_printk (KERN_INFO , ha,"scsi(%ld:%d:%d:%llu): DEVICE RESET SUCCEEDED.\n" , - ha->host_no, cmd->device->channel, cmd->device->id, - cmd->device->lun); + ha->host_no, sdev->channel, sdev->id, sdev->lun); ret =SUCCESS ;
drivers/scsi/scsi_debug.c +5 -11
@@ -5685,12 +5685,10 @@ static void scsi_debug_stop_all_queued(struct scsi_device *sdp) scsi_debug_stop_all_queued_iter, sdp); } -static int sdebug_fail_lun_reset (struct scsi_cmnd *cmnd) +static int sdebug_fail_lun_reset (struct scsi_device *sdp) { -struct scsi_device *sdp = cmnd->device;struct sdebug_dev_info *devip = (struct sdebug_dev_info *)sdp->hostdata;struct sdebug_err_inject *err; -unsigned char *cmd = cmnd->cmnd;int ret =0 ;if (devip ==NULL )
@@ -5698,8 +5696,7 @@ static int sdebug_fail_lun_reset(struct scsi_cmnd *cmnd)rcu_read_lock ();list_for_each_entry_rcu (err, &devip->inject_err_list, list) { -if (err->type ==ERR_LUN_RESET_FAILED && - (err->cmd == cmd[0 ] || err->cmd ==0xff )) { +if (err->type ==ERR_LUN_RESET_FAILED ) { ret = !!err->cnt;if (err->cnt <0 ) err->cnt++;
@@ -5713,12 +5710,9 @@ static int sdebug_fail_lun_reset(struct scsi_cmnd *cmnd)return 0 ; } -static int scsi_debug_device_reset (struct scsi_cmnd *SCpnt) +static int scsi_debug_device_reset (struct scsi_device *sdp) { -struct scsi_device *sdp = SCpnt->device;struct sdebug_dev_info *devip = sdp->hostdata; -u8 *cmd = SCpnt->cmnd; -u8 opcode = cmd[0 ]; ++num_dev_resets;
@@ -5729,8 +5723,8 @@ static int scsi_debug_device_reset(struct scsi_cmnd *SCpnt)if (devip)set_bit (SDEBUG_UA_POR , devip->uas_bm); -if (sdebug_fail_lun_reset (SCpnt)) { -scmd_printk (KERN_INFO , SCpnt,"fail lun reset 0x%x\n" , opcode); +if (sdebug_fail_lun_reset (sdp)) { +sdev_printk (KERN_INFO , sdp,"fail lun reset\n" );return FAILED ; }
drivers/scsi/scsi_error.c +1 -1
@@ -980,7 +980,7 @@ static enum scsi_disposition scsi_try_bus_device_reset(struct scsi_cmnd *scmd)if (!hostt->eh_device_reset_handler)return FAILED ; - rtn = hostt->eh_device_reset_handler (scmd); + rtn = hostt->eh_device_reset_handler (scmd->device);if (rtn ==SUCCESS )__scsi_report_device_reset (scmd->device,NULL );return rtn;
drivers/scsi/smartpqi/smartpqi.h +0 -1
@@ -1093,7 +1093,6 @@ struct pqi_tmf_work {struct pqi_ctrl_info *ctrl_info;struct pqi_scsi_dev *device;u8 lun; -u8 scsi_opcode; };struct pqi_scsi_dev {
drivers/scsi/smartpqi/smartpqi_init.c +8 -11
@@ -6351,15 +6351,15 @@ static int pqi_device_reset(struct pqi_ctrl_info *ctrl_info, struct pqi_scsi_devreturn rc; } -static int pqi_device_reset_handler (struct pqi_ctrl_info *ctrl_info,struct pqi_scsi_dev *device,u8 lun,struct scsi_cmnd *scmd,u8 scsi_opcode) +static int pqi_device_reset_handler (struct pqi_ctrl_info *ctrl_info,struct pqi_scsi_dev *device,u8 lun) {int rc;mutex_lock (&ctrl_info->lun_reset_mutex);dev_err (&ctrl_info->pci_dev->dev, -"resetting scsi %d:%d:%d:%u SCSI cmd at %p due to cmd opcode 0x%02x\n" , - ctrl_info->scsi_host->host_no, device->bus, device->target, lun, scmd, scsi_opcode); +"resetting scsi %d:%d:%d:%u\n" , + ctrl_info->scsi_host->host_no, device->bus, device->target, lun);pqi_check_ctrl_health (ctrl_info);if (pqi_ctrl_offline (ctrl_info))
@@ -6377,19 +6377,17 @@ static int pqi_device_reset_handler(struct pqi_ctrl_info *ctrl_info, struct pqi_return rc; } -static int pqi_eh_device_reset_handler (struct scsi_cmnd *scmd) +static int pqi_eh_device_reset_handler (struct scsi_device *sdev) {struct Scsi_Host *shost;struct pqi_ctrl_info *ctrl_info;struct pqi_scsi_dev *device; -u8 scsi_opcode; - shost = scmd->device->host; + shost = sdev->host; ctrl_info =shost_to_hba (shost); - device = scmd->device->hostdata; - scsi_opcode = scmd->cmd_len >0 ? scmd->cmnd[0 ] :0xff ; + device = sdev->hostdata; -return pqi_device_reset_handler (ctrl_info, device, (u8 )scmd->device->lun, scmd, scsi_opcode); +return pqi_device_reset_handler (ctrl_info, device, (u8 )sdev->lun); }static void pqi_tmf_worker (struct work_struct *work)
@@ -6400,7 +6398,7 @@ static void pqi_tmf_worker(struct work_struct *work) tmf_work = container_of(work, struct pqi_tmf_work, work_struct); scmd = (struct scsi_cmnd *)xchg (&tmf_work->scmd,NULL ); -pqi_device_reset_handler (tmf_work->ctrl_info, tmf_work->device, tmf_work->lun, scmd, tmf_work->scsi_opcode); +pqi_device_reset_handler (tmf_work->ctrl_info, tmf_work->device, tmf_work->lun); }static int pqi_eh_abort_handler (struct scsi_cmnd *scmd)
@@ -6433,7 +6431,6 @@ static int pqi_eh_abort_handler(struct scsi_cmnd *scmd) tmf_work->ctrl_info = ctrl_info; tmf_work->device = device; tmf_work->lun = (u8 )scmd->device->lun; - tmf_work->scsi_opcode = scmd->cmd_len >0 ? scmd->cmnd[0 ] :0xff ;schedule_work (&tmf_work->work_struct); }
drivers/scsi/snic/snic.h +1 -1
@@ -364,7 +364,7 @@ extern const struct attribute_group *snic_host_groups[];int snic_queuecommand (struct Scsi_Host *,struct scsi_cmnd *);int snic_abort_cmd (struct scsi_cmnd *); -int snic_device_reset (struct scsi_cmnd *); +int snic_device_reset (struct scsi_device *);int snic_host_reset (struct Scsi_Host *);void snic_shutdown_scsi_cleanup (struct snic *);
drivers/scsi/snic/snic_scsi.c +2 -2
@@ -2089,9 +2089,8 @@ snic_unlink_and_release_req(struct snic *snic, struct scsi_cmnd *sc, int flag)* command on the LUN. */ int -snic_device_reset (struct scsi_cmnd *sc) +snic_device_reset (struct scsi_device *sdev) { -struct scsi_device *sdev = sc->device;struct Scsi_Host *shost = sdev->host;struct snic *snic =shost_priv (shost);struct request *req;
@@ -2099,6 +2098,7 @@ snic_device_reset(struct scsi_cmnd *sc)int start_time = jiffies;int ret =FAILED ;int dr_supp =0 ; +struct scsi_cmnd tmf_sc, *sc = &tmf_sc;SNIC_SCSI_DBG (shost,"dev_reset\n" ); dr_supp =snic_dev_reset_supported (sdev);
drivers/scsi/virtio_scsi.c +6 -6
@@ -638,12 +638,12 @@ static int virtscsi_tmf(struct virtio_scsi *vscsi, struct virtio_scsi_cmd *cmd)return ret; } -static int virtscsi_device_reset (struct scsi_cmnd *sc) +static int virtscsi_device_reset (struct scsi_device *sdev) { -struct virtio_scsi *vscsi =shost_priv (sc->device->host); +struct virtio_scsi *vscsi =shost_priv (sdev->host);struct virtio_scsi_cmd *cmd; -sdev_printk (KERN_INFO , sc->device,"device reset\n" ); +sdev_printk (KERN_INFO , sdev,"device reset\n" ); cmd =mempool_alloc (virtscsi_cmd_pool,GFP_NOIO );if (!cmd)return FAILED ;
@@ -654,9 +654,9 @@ static int virtscsi_device_reset(struct scsi_cmnd *sc) .subtype = cpu_to_virtio32(vscsi->vdev, VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET), .lun[0] = 1, - .lun[1] = sc->device->id, - .lun[2] = (sc->device->lun >> 8) | 0x40, - .lun[3] = sc->device->lun & 0xff, + .lun[1] = sdev->id, + .lun[2] = (sdev->lun >> 8) | 0x40, + .lun[3] = sdev->lun & 0xff, };return virtscsi_tmf (vscsi, cmd); }
drivers/scsi/vmw_pvscsi.c +5 -5
@@ -971,14 +971,14 @@ static int pvscsi_bus_reset(struct Scsi_Host *host, unsigned int channel)return SUCCESS ; } -static int pvscsi_device_reset (struct scsi_cmnd *cmd) +static int pvscsi_device_reset (struct scsi_device *sdev) { -struct Scsi_Host *host = cmd->device->host; +struct Scsi_Host *host = sdev->host;struct pvscsi_adapter *adapter =shost_priv (host);unsigned long flags; -scmd_printk (KERN_INFO , cmd,"SCSI device reset on scsi%u:%u\n" , - host->host_no, cmd->device->id); +sdev_printk (KERN_INFO , sdev,"SCSI device reset on scsi%u:%u\n" , + host->host_no, sdev->id);/* * We don't want to queue new requests for this device after flushing
@@ -988,7 +988,7 @@ static int pvscsi_device_reset(struct scsi_cmnd *cmd)spin_lock_irqsave (&adapter->hw_lock, flags);pvscsi_process_request_ring (adapter); -ll_device_reset (adapter, cmd->device->id); +ll_device_reset (adapter, sdev->id);pvscsi_process_completion_ring (adapter);spin_unlock_irqrestore (&adapter->hw_lock, flags);
drivers/scsi/wd719x.c +3 -3
@@ -510,10 +510,10 @@ static int wd719x_reset(struct Scsi_Host *shost, u8 opcode, u8 device)return SUCCESS ; } -static int wd719x_dev_reset (struct scsi_cmnd *cmd) +static int wd719x_dev_reset (struct scsi_device *sdev) { -return wd719x_reset (cmd->device->host,WD719X_CMD_RESET , - cmd->device->id); +return wd719x_reset (sdev->host,WD719X_CMD_RESET , + sdev->id); }static int wd719x_bus_reset (struct Scsi_Host *host,unsigned int channel)
drivers/scsi/xen-scsifront.c +3 -3
@@ -699,7 +699,7 @@ static int scsifront_action_handler(struct scsi_device *sdev,if (scsifront_enter (info)) goto fail; -if (!scsifront_do_request (sc->device, info, shadow)) +if (!scsifront_do_request (sdev, info, shadow))break ;scsifront_return (info);
@@ -743,10 +743,10 @@ static int scsifront_eh_abort_handler(struct scsi_cmnd *sc)return scsifront_action_handler (sc->device, sc); } -static int scsifront_dev_reset_handler (struct scsi_cmnd *sc) +static int scsifront_dev_reset_handler (struct scsi_device *sdev) {pr_debug ("%s\n" , __func__); -return scsifront_action_handler (sc->device,NULL ); +return scsifront_action_handler (sdev,NULL ); }static int scsifront_sdev_configure (struct scsi_device *sdev)
drivers/staging/rts5208/rtsx.c +5 -1
@@ -182,8 +182,12 @@ static int command_abort(struct scsi_cmnd *srb)* This invokes the transport reset mechanism to reset the state of the * device */ -static int device_reset (struct scsi_cmnd *srb) +static int device_reset (struct scsi_device *sdev) { +struct rtsx_dev *dev =host_to_rtsx (sdev->host); + +dev_info (&dev->pci->dev,"%s called\n" , __func__); +return SUCCESS ; }
drivers/target/loopback/tcm_loop.c +4 -4
@@ -250,7 +250,7 @@ static int tcm_loop_abort_task(struct scsi_cmnd *sc)* Called from SCSI EH process context to issue a LUN_RESET TMR * to struct scsi_device */ -static int tcm_loop_device_reset (struct scsi_cmnd *sc) +static int tcm_loop_device_reset (struct scsi_device *sdev) {struct tcm_loop_hba *tl_hba;struct tcm_loop_tpg *tl_tpg;
@@ -259,10 +259,10 @@ static int tcm_loop_device_reset(struct scsi_cmnd *sc)/* * Locate the tcm_loop_hba_t pointer */ - tl_hba = *(struct tcm_loop_hba **)shost_priv (sc->device->host); - tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id]; + tl_hba = *(struct tcm_loop_hba **)shost_priv (sdev->host); + tl_tpg = &tl_hba->tl_hba_tpgs[sdev->id]; - ret =tcm_loop_issue_tmr (tl_tpg, sc->device->lun, + ret =tcm_loop_issue_tmr (tl_tpg, sdev->lun,0 ,TMR_LUN_RESET );return (ret ==TMR_FUNCTION_COMPLETE ) ?SUCCESS :FAILED ; }
drivers/ufs/core/ufshcd.c +4 -4
@@ -7396,11 +7396,11 @@ int ufshcd_advanced_rpmb_req_handler(struct ufs_hba *hba, struct utp_upiu_req *r/** * ufshcd_eh_device_reset_handler() - Reset a single logical unit. -* @cmd: SCSI command pointer +* @sdev: SCSI device pointer * * Return: SUCCESS or FAILED. */ -static int ufshcd_eh_device_reset_handler (struct scsi_cmnd *cmd) +static int ufshcd_eh_device_reset_handler (struct scsi_device *sdev) {unsigned long flags, pending_reqs =0 , not_cleared =0 ;struct Scsi_Host *host;
@@ -7411,10 +7411,10 @@ static int ufshcd_eh_device_reset_handler(struct scsi_cmnd *cmd)int err;u8 resp =0xF , lun; - host = cmd->device->host; + host = sdev->host; hba =shost_priv (host); - lun =ufshcd_scsi_to_upiu_lun (cmd->device->lun); + lun =ufshcd_scsi_to_upiu_lun (sdev->lun); err =ufshcd_issue_tm_cmd (hba, lun,0 ,UFS_LOGICAL_RESET , &resp);if (err || resp !=UPIU_TASK_MANAGEMENT_FUNC_COMPL ) {if (!err)
drivers/usb/storage/scsiglue.c +2 -2
@@ -459,9 +459,9 @@ static int command_abort(struct scsi_cmnd *srb)* This invokes the transport reset mechanism to reset the state of the * device */ -static int device_reset (struct scsi_cmnd *srb) +static int device_reset (struct scsi_device *sdev) { -struct us_data *us =host_to_us (srb->device->host); +struct us_data *us =host_to_us (sdev->host);int result;usb_stor_dbg (us,"%s called\n" , __func__);
drivers/usb/storage/uas.c +1 -2
@@ -762,9 +762,8 @@ static int uas_eh_abort_handler(struct scsi_cmnd *cmnd)return FAILED ; } -static int uas_eh_device_reset_handler (struct scsi_cmnd *cmnd) +static int uas_eh_device_reset_handler (struct scsi_device *sdev) { -struct scsi_device *sdev = cmnd->device;struct uas_dev_info *devinfo = sdev->hostdata;struct usb_device *udev = devinfo->udev;unsigned long flags;
include/scsi/libfc.h +1 -1
@@ -949,7 +949,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_device_reset (struct scsi_device *);int fc_eh_host_reset (struct Scsi_Host *);int fc_slave_alloc (struct scsi_device *);
include/scsi/libiscsi.h +1 -1
@@ -391,7 +391,7 @@ struct iscsi_host {extern int iscsi_eh_abort (struct scsi_cmnd *sc);extern int iscsi_eh_recover_target (struct scsi_target *starget);extern int iscsi_eh_session_reset (struct iscsi_cls_session *cls_session); -extern int iscsi_eh_device_reset (struct scsi_cmnd *sc); +extern int iscsi_eh_device_reset (struct scsi_device *sdev);extern int iscsi_queuecommand (struct Scsi_Host *host,struct scsi_cmnd *sc);extern enum scsi_timeout_action iscsi_eh_cmd_timed_out (struct scsi_cmnd *sc);
include/scsi/libsas.h +1 -1
@@ -698,7 +698,7 @@ extern struct device_attribute dev_attr_phy_event_threshold;void sas_task_abort (struct sas_task *);int sas_eh_abort_handler (struct scsi_cmnd *cmd); -int sas_eh_device_reset_handler (struct scsi_cmnd *cmd); +int sas_eh_device_reset_handler (struct scsi_device *sdev);int sas_eh_target_reset_handler (struct scsi_target *starget);extern void sas_target_destroy (struct scsi_target *);
include/scsi/scsi_host.h +1 -1
@@ -150,7 +150,7 @@ struct scsi_host_template {* Status: REQUIRED (at least one of them) */ int (* eh_abort_handler)(struct scsi_cmnd *); -int (* eh_device_reset_handler)(struct scsi_cmnd *); +int (* eh_device_reset_handler)(struct scsi_device *);int (* eh_target_reset_handler)(struct scsi_target *);int (* eh_bus_reset_handler)(struct Scsi_Host *,unsigned int );int (* eh_host_reset_handler)(struct Scsi_Host *);
Signature · 1 line
2.35.3
Re: [PATCH 04/10] scsi: Use scsi_device as argument to eh_device_reset_handler()
Quoted 11 lines · Hannes Reinecke
drivers/scsi/a100u2w.c +1
-1@@ -944,16 +944,15 @@ static int inia100_bus_reset(struct Scsi_Host * shost, unsigned int channel)/***************************************************************************** Function name : inia100_device_reset Description : Reset the device -Input : host - Pointer to host adapter structure +Input : dev - Pointer to scsi device structure Output : None.
drivers/scsi/a100u2w.c static int inia100_bus_reset(struct Scsi_Host * shost, unsigned int channel) · line 954
Quoted 10 lines
drivers/scsi/a100u2w.c +2
-4Return : pSRB - Pointer to SCSI request block. *****************************************************************************/ -static int inia100_device_reset (struct scsi_cmnd * cmd) +static int inia100_device_reset (struct scsi_device * dev) {/* I need Host Control Block Information */ struct orc_host *host; - host = (struct orc_host *) cmd->device->host->hostdata; -return orc_device_reset (host, cmd->device); - + host = (struct orc_host *) dev->host->hostdata;
Nitpick: you could use shost_priv() here.
Quoted 10 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +2
-2@@ -4141,30 +4141,28 @@ static int mpi3mr_eh_target_reset(struct scsi_target *starget) -static int mpi3mr_eh_dev_reset (struct scsi_cmnd *scmd) +static int mpi3mr_eh_dev_reset (struct scsi_device *sdev) { -struct mpi3mr_ioc *mrioc =shost_priv (scmd->device->host); +struct mpi3mr_ioc *mrioc =shost_priv (sdev->host);
drivers/scsi/mpi3mr/mpi3mr_os.c static int mpi3mr_eh_target_reset(struct scsi_target *starget) · line 4150
Quoted 10 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +1
-3struct mpi3mr_stgt_priv_data *stgt_priv_data;struct mpi3mr_sdev_priv_data *sdev_priv_data;u16 dev_handle;u8 resp_code =0 ;int retval =FAILED , ret =0 ; -sdev_printk (KERN_INFO , scmd->device, -"Attempting Device(lun) Reset! scmd(%p)\n" , scmd); -scsi_print_command (scmd); + sdev_printk(KERN_INFO, sdev,
Nitpick: you can remove the line-break after sdev,
Quoted 26 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +3
-2+ "Attempting Device(lun) Reset!\n"); - sdev_priv_data = scmd->device->hostdata; + sdev_priv_data = sdev->hostdata;if (!sdev_priv_data || !sdev_priv_data->tgt_priv_data) { -sdev_printk (KERN_INFO , scmd->device, +sdev_printk (KERN_INFO , sdev,"SCSI device is not available\n" ); retval =SUCCESS ; goto out;drivers/scsi/mpt3sas/mpt3sas_scsih.c +2
-4@@ -3376,20 +3376,17 @@ scsih_dev_reset(struct scsi_cmnd *scmd)u8 tr_timeout =30 ;int r; -struct scsi_target *starget = scmd->device->sdev_target; +struct scsi_target *starget = sdev->sdev_target;struct MPT3SAS_TARGET *target_priv_data = starget->hostdata; -sdev_printk (KERN_INFO , scmd->device, -"attempting device reset! scmd(0x%p)\n" , scmd); -_scsih_tm_display_info (ioc, scmd); + sdev_printk(KERN_INFO, sdev,
...
Quoted 9 lines
drivers/scsi/mpt3sas/mpt3sas_scsih.c +2
-1+ "attempting device reset!\n"); - sas_device_priv_data = scmd->device->hostdata; + sas_device_priv_data = sdev->hostdata;drivers/scsi/pcmcia/nsp_cs.h +0
-0
drivers/scsi/pcmcia/nsp_cs.h static int nsp_show_info (struct seq_file *m, · line 301
Quoted 5 lines
drivers/scsi/pcmcia/nsp_cs.h +0
-2@@ -297,8 +297,6 @@ static int nsp_show_info (struct seq_file *m,static int nsp_queuecommand (struct Scsi_Host *h,struct scsi_cmnd *SCpnt);/* Error handler */ -/*static int nsp_eh_abort (struct scsi_cmnd *SCpnt);*/ -/*static int nsp_eh_device_reset(struct scsi_cmnd *SCpnt);*/
Hmm, this is a bit off-topic; is it? You don't change anything else in this header. Hmm, maybe because it's the old device-reset handler that still has scsi_cmnd as arg.
Quoted 30 lines
drivers/scsi/pcmcia/nsp_cs.h +0
-0static int nsp_eh_bus_reset (struct Scsi_Host *host,unsigned int channel);static int nsp_eh_host_reset (struct Scsi_Host *host);static int nsp_bus_reset (nsp_hw_data *data);drivers/scsi/qla1280.c +3
-3@@ -797,18 +797,18 @@ qla1280_wait_for_pending_commands(struct scsi_qla_host *ha, int bus, int target)* wait for the results (or time out). * * Input: +* sdev = Linux SCSI device * cmd = Linux SCSI command packet of the command that cause the * bus reset. -* action = error action to take (see action_t) * * Returns: * SUCCESS or FAILED * **************************************************************************/ static int -qla1280_error_action (struct scsi_cmnd *cmd,enum action action) +qla1280_error_action (struct scsi_device *sdev,struct scsi_cmnd *cmd) { -struct scsi_qla_host *ha; +struct scsi_qla_host *ha =shost_priv (sdev->host);int bus, target, lun;struct srb *sp;int i, found;
drivers/scsi/qla1280.c qla1280_error_action(struct scsi_cmnd *cmd, enum action action) · line 823
Quoted 9 lines
drivers/scsi/qla1280.c +1
-1@@ -816,14 +816,14 @@ qla1280_error_action(struct scsi_cmnd *cmd, enum action action)int wait_for_bus=-1 ;int wait_for_target =-1 ;DECLARE_COMPLETION_ONSTACK (wait); +enum action action = cmd ?ABORT_COMMAND :DEVICE_RESET ;ENTER ("qla1280_error_action" ); - ha = (struct scsi_qla_host *)(CMD_HOST (cmd)->hostdata); sp =scsi_cmd_priv (cmd);
That is wrong now that cmd can be NULL. In that case this will return something near address 0 and the rest of the function will fall apart.
static inline void *scsi_cmd_priv(struct scsi_cmnd *cmd)
{
return cmd + 1;
}Quoted 14 lines
drivers/scsi/qla1280.c +3
-3- bus =SCSI_BUS_32 (cmd); - target =SCSI_TCN_32 (cmd); - lun =SCSI_LUN_32 (cmd); + bus = sdev->channel; + target = sdev->id; + lun = sdev->lun;dprintk (4 ,"error_action %i, istatus 0x%04x\n" , action,RD_REG_WORD (&ha->iobase->istatus));drivers/scsi/snic/snic_scsi.c +0
-0
drivers/scsi/snic/snic_scsi.c snic_device_reset(struct scsi_cmnd *sc) · line 2101
Quoted 4 lines
drivers/scsi/snic/snic_scsi.c +1
-0@@ -2099,6 +2098,7 @@ snic_device_reset(struct scsi_cmnd *sc)int start_time = jiffies;int ret =FAILED ;int dr_supp =0 ; +struct scsi_cmnd tmf_sc, *sc = &tmf_sc;
No quite sure why you need that tmf_sc and it's address in sc? sc is first used here:
sc = blk_mq_rq_to_pdu(req);
which overwrites the value, and tmf_sc is not used at all. Or am I missing something?
Quoted 3 lines
drivers/scsi/snic/snic_scsi.c +0
-0SNIC_SCSI_DBG (shost,"dev_reset\n" ); dr_supp =snic_dev_reset_supported (sdev);
Signature · 4 lines
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy Vors. Aufs.-R.: Gregor Pillen / Geschäftsführung: David Faller Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Hannes Reinecke
maintainerRe: [PATCH 04/10] scsi: Use scsi_device as argument to eh_device_reset_handler()
Quoted 16 lines · Benjamin Block
Quoted 15 lines · Hannes Reinecke
drivers/scsi/a100u2w.c +2
-2@@ -944,16 +944,15 @@ static int inia100_bus_reset(struct Scsi_Host * shost, unsigned int channel)/***************************************************************************** Function name : inia100_device_reset Description : Reset the device -Input : host - Pointer to host adapter structure +Input : dev - Pointer to scsi device structure Output : None. Return : pSRB - Pointer to SCSI request block. *****************************************************************************/ -static int inia100_device_reset (struct scsi_cmnd * cmd) +static int inia100_device_reset (struct scsi_device * dev)
Quoted 9 lines
drivers/scsi/a100u2w.c static int inia100_bus_reset(struct Scsi_Host * shost, unsigned int channel) · line 954
Quoted 6 lines
drivers/scsi/a100u2w.c +1
-3{/* I need Host Control Block Information */ struct orc_host *host; - host = (struct orc_host *) cmd->device->host->hostdata; -return orc_device_reset (host, cmd->device); - + host = (struct orc_host *) dev->host->hostdata;Nitpick: you could use
shost_priv()here.
Yes, can do.
Quoted 16 lines
Quoted 16 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +2
-2@@ -4141,30 +4141,28 @@ static int mpi3mr_eh_target_reset(struct scsi_target *starget) -static int mpi3mr_eh_dev_reset (struct scsi_cmnd *scmd) +static int mpi3mr_eh_dev_reset (struct scsi_device *sdev) { -struct mpi3mr_ioc *mrioc =shost_priv (scmd->device->host); +struct mpi3mr_ioc *mrioc =shost_priv (sdev->host);struct mpi3mr_stgt_priv_data *stgt_priv_data;struct mpi3mr_sdev_priv_data *sdev_priv_data;u16 dev_handle;u8 resp_code =0 ;int retval =FAILED , ret =0 ;
Quoted 7 lines
drivers/scsi/mpi3mr/mpi3mr_os.c static int mpi3mr_eh_target_reset(struct scsi_target *starget) · line 4160
Quoted 4 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +1
-3-sdev_printk (KERN_INFO , scmd->device, -"Attempting Device(lun) Reset! scmd(%p)\n" , scmd); -scsi_print_command (scmd); + sdev_printk(KERN_INFO, sdev,Nitpick: you can remove the line-break after
sdev,
See my comments to the previous patches. I'd rather do this in a separate patch.
Quoted 40 lines
Quoted 26 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +3
-2+ "Attempting Device(lun) Reset!\n"); - sdev_priv_data = scmd->device->hostdata; + sdev_priv_data = sdev->hostdata;if (!sdev_priv_data || !sdev_priv_data->tgt_priv_data) { -sdev_printk (KERN_INFO , scmd->device, +sdev_printk (KERN_INFO , sdev,"SCSI device is not available\n" ); retval =SUCCESS ; goto out;drivers/scsi/mpt3sas/mpt3sas_scsih.c +2
-4@@ -3376,20 +3376,17 @@ scsih_dev_reset(struct scsi_cmnd *scmd)u8 tr_timeout =30 ;int r; -struct scsi_target *starget = scmd->device->sdev_target; +struct scsi_target *starget = sdev->sdev_target;struct MPT3SAS_TARGET *target_priv_data = starget->hostdata; -sdev_printk (KERN_INFO , scmd->device, -"attempting device reset! scmd(0x%p)\n" , scmd); -_scsih_tm_display_info (ioc, scmd); + sdev_printk(KERN_INFO, sdev,...
Quoted 11 lines
drivers/scsi/mpt3sas/mpt3sas_scsih.c +2
-1+ "attempting device reset!\n"); - sas_device_priv_data = scmd->device->hostdata; + sas_device_priv_data = sdev->hostdata;drivers/scsi/pcmcia/nsp_cs.h +0
-0@@ -297,8 +297,6 @@ static int nsp_show_info (struct seq_file *m,static int nsp_queuecommand (struct Scsi_Host *h,struct scsi_cmnd *SCpnt);
Quoted 8 lines
drivers/scsi/pcmcia/nsp_cs.h static int nsp_show_info (struct seq_file *m, · line 301
Quoted 3 lines
drivers/scsi/pcmcia/nsp_cs.h +0
-2/* Error handler */ -/*static int nsp_eh_abort (struct scsi_cmnd *SCpnt);*/ -/*static int nsp_eh_device_reset(struct scsi_cmnd *SCpnt);*/ Hmm, this is a bit off-topic; is it? You don't change anything else in this header. Hmm, maybe because it's the old device-reset handler that still has
scsi_cmndas arg.
Yes. They've been commented out for ages, and will just serve to confuse users if they remain in the code. But I can drop this bit if you insist.
Quoted 43 lines
Quoted 30 lines
drivers/scsi/pcmcia/nsp_cs.h +0
-0static int nsp_eh_bus_reset (struct Scsi_Host *host,unsigned int channel);static int nsp_eh_host_reset (struct Scsi_Host *host);static int nsp_bus_reset (nsp_hw_data *data);drivers/scsi/qla1280.c +3
-3@@ -797,18 +797,18 @@ qla1280_wait_for_pending_commands(struct scsi_qla_host *ha, int bus, int target)* wait for the results (or time out). * * Input: +* sdev = Linux SCSI device * cmd = Linux SCSI command packet of the command that cause the * bus reset. -* action = error action to take (see action_t) * * Returns: * SUCCESS or FAILED * **************************************************************************/ static int -qla1280_error_action (struct scsi_cmnd *cmd,enum action action) +qla1280_error_action (struct scsi_device *sdev,struct scsi_cmnd *cmd) { -struct scsi_qla_host *ha; +struct scsi_qla_host *ha =shost_priv (sdev->host);int bus, target, lun;struct srb *sp;int i, found;drivers/scsi/qla1280.c qla1280_error_action(struct scsi_cmnd *cmd, enum action action) · line 823
Quoted 9 lines
drivers/scsi/qla1280.c +1
-1@@ -816,14 +816,14 @@ qla1280_error_action(struct scsi_cmnd *cmd, enum action action)int wait_for_bus=-1 ;int wait_for_target =-1 ;DECLARE_COMPLETION_ONSTACK (wait); +enum action action = cmd ?ABORT_COMMAND :DEVICE_RESET ;ENTER ("qla1280_error_action" ); - ha = (struct scsi_qla_host *)(CMD_HOST (cmd)->hostdata); sp =scsi_cmd_priv (cmd);That is wrong now that
cmdcan beNULL. In that case this will return something near address 0 and the rest of the function will fall apart.
Quoted 5 lines
static inline void *scsi_cmd_priv(struct scsi_cmnd *cmd)
{
return cmd + 1;
}Aw. Indeed. will be fixing it.
Quoted 22 lines
Quoted 14 lines
drivers/scsi/qla1280.c +3
-3- bus =SCSI_BUS_32 (cmd); - target =SCSI_TCN_32 (cmd); - lun =SCSI_LUN_32 (cmd); + bus = sdev->channel; + target = sdev->id; + lun = sdev->lun;dprintk (4 ,"error_action %i, istatus 0x%04x\n" , action,RD_REG_WORD (&ha->iobase->istatus));drivers/scsi/snic/snic_scsi.c +0
-0drivers/scsi/snic/snic_scsi.c snic_device_reset(struct scsi_cmnd *sc) · line 2101
Quoted 4 lines
drivers/scsi/snic/snic_scsi.c +1
-0@@ -2099,6 +2098,7 @@ snic_device_reset(struct scsi_cmnd *sc)int start_time = jiffies;int ret =FAILED ;int dr_supp =0 ; +struct scsi_cmnd tmf_sc, *sc = &tmf_sc;No quite sure why you need that
tmf_scand it's address insc?scis first used here:
Quoted 5 lines
sc = blk_mq_rq_to_pdu(req);which overwrites the value, and
tmf_scis not used at all. Or am I missing something?
I'll be checking. Thanks for the review.
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew Myers, Andrew McDonald, Martje Boudien Moerman
Re: [PATCH 04/10] scsi: Use scsi_device as argument to eh_device_reset_handler()
Quoted 17 lines · Hannes Reinecke
Quoted 8 lines · Benjamin Block
Quoted 7 lines · Hannes Reinecke
drivers/scsi/pcmcia/nsp_cs.h +0
-0@@ -297,8 +297,6 @@ static int nsp_show_info (struct seq_file *m,static int nsp_queuecommand (struct Scsi_Host *h,struct scsi_cmnd *SCpnt);Quoted 8 lines
drivers/scsi/pcmcia/nsp_cs.h static int nsp_show_info (struct seq_file *m, · line 301
Quoted 3 lines
drivers/scsi/pcmcia/nsp_cs.h +0
-2/* Error handler */ -/*static int nsp_eh_abort (struct scsi_cmnd *SCpnt);*/ -/*static int nsp_eh_device_reset(struct scsi_cmnd *SCpnt);*/ Hmm, this is a bit off-topic; is it? You don't change anything else in this header. Hmm, maybe because it's the old device-reset handler that still has
scsi_cmndas arg.
Quoted 3 lines
Yes. They've been commented out for ages, and will just serve to confuse users if they remain in the code.
But I can drop this bit if you insist.
Not particularly. The part about confusion because of the changed arg is true, so we might as well remove it.
Signature · 4 lines
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy Vors. Aufs.-R.: Gregor Pillen / Geschäftsführung: David Faller Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Hannes Reinecke
maintainerPATCH v8 5/10 scsi: set host byte after EH completed
In reply to Hannes ReineckeWhen SCSI EH completes we should be setting the host byte to DID_ABORT, DID_RESET, or DID_TRANSPORT_DISRUPTED to inform the caller that some EH processing has happened.
--- drivers/scsi/scsi_error.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-)
drivers/scsi/scsi_error.c +17 -12
@@ -1450,9 +1450,10 @@ static int scsi_eh_test_devices(struct list_head *cmd_list,if (scmd->device == sdev) {if (finish_cmds && (try_stu || -scsi_eh_action (scmd,SUCCESS ) ==SUCCESS )) +scsi_eh_action (scmd,SUCCESS ) ==SUCCESS )) { +set_host_byte (scmd,DID_RESET );scsi_eh_finish_cmd (scmd, done_q); -else + }else list_move_tail (&scmd->eh_entry, work_q); } }
@@ -1599,9 +1600,10 @@ static int scsi_eh_bus_device_reset(struct Scsi_Host *shost,list_for_each_entry_safe (scmd, next, work_q, eh_entry) {if (scmd->device == sdev && -scsi_eh_action (scmd, rtn) !=FAILED ) -scsi_eh_finish_cmd (scmd, - done_q); +scsi_eh_action (scmd, rtn) !=FAILED ) { +set_host_byte (scmd,DID_RESET ); +scsi_eh_finish_cmd (scmd, done_q); + } } } }else {
@@ -1670,9 +1672,10 @@ static int scsi_eh_target_reset(struct Scsi_Host *shost,if (rtn ==SUCCESS )list_move_tail (&scmd->eh_entry, &check_list); -else if (rtn ==FAST_IO_FAIL ) +else if (rtn ==FAST_IO_FAIL ) { +set_host_byte (scmd,DID_TRANSPORT_FAILFAST );scsi_eh_finish_cmd (scmd, done_q); -else + }else /* push back on work queue for further processing */ list_move (&scmd->eh_entry, work_q); }
@@ -1735,10 +1738,11 @@ static int scsi_eh_bus_reset(struct Scsi_Host *shost,if (rtn ==SUCCESS || rtn ==FAST_IO_FAIL ) {list_for_each_entry_safe (scmd, next, work_q, eh_entry) {if (channel ==scmd_channel (scmd)) { -if (rtn ==FAST_IO_FAIL ) -scsi_eh_finish_cmd (scmd, - done_q); -else +if (rtn ==FAST_IO_FAIL ) { +set_host_byte (scmd, +DID_TRANSPORT_FAILFAST ); +scsi_eh_finish_cmd (scmd, done_q); + }else list_move_tail (&scmd->eh_entry, &check_list); }
@@ -1781,7 +1785,8 @@ static int scsi_eh_host_reset(struct Scsi_Host *shost,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); +set_host_byte (scmd,DID_TRANSPORT_FAILFAST ); +scsi_eh_finish_cmd (scmd, done_q); } }else { SCSI_LOG_ERROR_RECOVERY(3,
Signature · 1 line
2.35.3
Re: [PATCH 05/10] scsi: set host byte after EH completed
Quoted 9 lines · Hannes Reinecke
When SCSI EH completes we should be setting the host byte to
DID_ABORT,DID_RESET, orDID_TRANSPORT_DISRUPTEDto inform the caller that some EH processing has happened.Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/scsi_error.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-)
Looks good to me.
Signature · 4 lines
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy Vors. Aufs.-R.: Gregor Pillen / Geschäftsführung: David Faller Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Hannes Reinecke
maintainerPATCH v8 6/10 scsi_error: iterate over list of failed commands in scsi_eh_bus_reset()
In reply to Hannes ReineckeIterating over all possible bus number in scsi_eh_bus_reset() is inefficient as not all busses may be affected during SCSI EH. So rewrite the loop in scsi_eh_bus_reset() to match the loop in scsi_eh_target_reset() and only loop over failed commands.
--- drivers/scsi/scsi_error.c | 62 ++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 37 deletions(-)
drivers/scsi/scsi_error.c +25 -37
@@ -1694,21 +1694,20 @@ static int scsi_eh_bus_reset(struct Scsi_Host *shost,struct list_head *work_q, struct list_head *done_q) { - struct scsi_cmnd *scmd, *chan_scmd, *next; +LIST_HEAD (tmp_list );LIST_HEAD (check_list); -unsigned int channel; -enum scsi_disposition rtn; -/* -* we really want to loop over the various channels, and do this on -* a channel by channel basis. we should also check to see if any -* of the failed commands are on soft_reset devices, and if so, skip -* the reset. -*/ +list_splice_init (work_q, &tmp_list); + +while (!list_empty (&tmp_list)) { +struct scsi_cmnd *next, *scmd; +enum scsi_disposition rtn; +unsigned int channel; -for (channel =0 ; channel <= shost->max_channel; channel++) {if (scsi_host_eh_past_deadline (shost)) { +/* push back on work queue for further processing */ list_splice_init (&check_list, work_q); +list_splice_init (&tmp_list, work_q); SCSI_LOG_ERROR_RECOVERY(3, shost_printk(KERN_INFO, shost, "%s: skip BRST, past eh deadline\n",
@@ -1716,43 +1715,32 @@ static int scsi_eh_bus_reset(struct Scsi_Host *shost,return list_empty (work_q); } - chan_scmd =NULL ; -list_for_each_entry (scmd, work_q, eh_entry) { -if (channel ==scmd_channel (scmd)) { - chan_scmd = scmd; -break ; -/* -* FIXME add back in some support for -* soft_reset devices. -*/ - } - } + scmd = list_first_entry(&tmp_list, struct scsi_cmnd, eh_entry); + channel =scmd_channel (scmd); -if (!chan_scmd) -continue ;SCSI_LOG_ERROR_RECOVERY (3 ,shost_printk (KERN_INFO , shost,"%s: Sending BRST chan: %d\n" , current->comm, channel)); - rtn =scsi_try_bus_reset (chan_scmd); -if (rtn ==SUCCESS || rtn ==FAST_IO_FAIL ) { -list_for_each_entry_safe (scmd, next, work_q, eh_entry) { -if (channel ==scmd_channel (scmd)) { -if (rtn ==FAST_IO_FAIL ) { -set_host_byte (scmd, -DID_TRANSPORT_FAILFAST ); -scsi_eh_finish_cmd (scmd, done_q); - }else -list_move_tail (&scmd->eh_entry, - &check_list); - } - } - }else { + rtn =scsi_try_bus_reset (scmd); +if (rtn !=SUCCESS && rtn !=FAST_IO_FAIL ) {SCSI_LOG_ERROR_RECOVERY (3 ,shost_printk (KERN_INFO , shost,"%s: BRST failed chan: %d\n" , current->comm, channel)); } +list_for_each_entry_safe (scmd, next, work_q, eh_entry) { +if (scmd_channel (scmd) != channel) +continue ; + +if (rtn ==SUCCESS ) +list_move_tail (&scmd->eh_entry, &check_list); +else if (rtn ==FAST_IO_FAIL ) { +set_host_byte (scmd,DID_TRANSPORT_FAILFAST ); +scsi_eh_finish_cmd (scmd, done_q); + }else +list_move_tail (&scmd->eh_entry, work_q); + } }return scsi_eh_test_devices (&check_list, work_q, done_q,0 ); }
Signature · 1 line
2.35.3
Re: [PATCH 06/10] scsi_error: iterate over list of failed commands in scsi_eh_bus_reset()
Quoted 16 lines · Hannes Reinecke
Iterating over all possible bus number in
scsi_eh_bus_reset()is inefficient as not all busses may be affected during SCSI EH. So rewrite the loop inscsi_eh_bus_reset()to match the loop inscsi_eh_target_reset()and only loop over failed commands.Signed-off-by Hannes Reinecke <[email protected]>Reviewed-by Christoph Hellwig <[email protected]>--- drivers/scsi/scsi_error.c | 62 ++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 37 deletions(-)drivers/scsi/scsi_error.c +0
-0
drivers/scsi/scsi_error.c static int scsi_eh_bus_reset(struct Scsi_Host *shost, · line 1722
Quoted 8 lines
drivers/scsi/scsi_error.c +3
-0@@ -1716,43 +1715,32 @@ static int scsi_eh_bus_reset(struct Scsi_Host *shost, + rtn =scsi_try_bus_reset (scmd); +if (rtn !=SUCCESS && rtn !=FAST_IO_FAIL ) {SCSI_LOG_ERROR_RECOVERY (3 ,shost_printk (KERN_INFO , shost,"%s: BRST failed chan: %d\n" , current->comm, channel)); } +list_for_each_entry_safe (scmd, next, work_q, eh_entry) {
You probably want to iterate over the tmp_list, not the work_q.
Quoted 3 lines
drivers/scsi/scsi_error.c +3
-0+if (scmd_channel (scmd) != channel) +continue ; +
Signature · 4 lines
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy Vors. Aufs.-R.: Gregor Pillen / Geschäftsführung: David Faller Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Hannes Reinecke
maintainerPATCH v8 7/10 scsi: Do not allocate scsi command in scsi_ioctl_reset()
In reply to Hannes ReineckeAs we now have moved the error handler functions to not rely on a scsi command we can drop the out-of-band scsi command allocation from scsi_ioctl_reset().
--- drivers/scsi/scsi_error.c | 95 ++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 56 deletions(-)
drivers/scsi/scsi_error.c +39 -56
@@ -866,13 +866,12 @@ 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. +* @host: SCSI host to be reset. */ -static enum scsi_disposition scsi_try_host_reset (struct scsi_cmnd *scmd) +static enum scsi_disposition scsi_try_host_reset (struct Scsi_Host *host) {unsigned long flags;enum scsi_disposition rtn; -struct Scsi_Host *host = scmd->device->host;const struct scsi_host_template *hostt = host->hostt; SCSI_LOG_ERROR_RECOVERY(3,
@@ -887,7 +886,7 @@ static enum scsi_disposition 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); }
@@ -896,28 +895,29 @@ static enum scsi_disposition scsi_try_host_reset(struct scsi_cmnd *scmd)/** * scsi_try_bus_reset - ask host to perform a bus reset -* @scmd: SCSI cmd to send bus reset. +* @host: SCSI host to send bus reset. +* @channel: Number of the bus to be reset */ -static enum scsi_disposition scsi_try_bus_reset (struct scsi_cmnd *scmd) +static enum scsi_disposition scsi_try_bus_reset (struct Scsi_Host *host, +int channel) {unsigned long flags;enum scsi_disposition rtn; -struct Scsi_Host *host = scmd->device->host;const struct scsi_host_template *hostt = host->hostt; -SCSI_LOG_ERROR_RECOVERY (3 ,scmd_printk (KERN_INFO , scmd, -"%s: Snd Bus RST\n" , __func__)); +SCSI_LOG_ERROR_RECOVERY (3 ,shost_printk (KERN_INFO , host, +"%s: Snd Bus RST to bus %d\n" , __func__, channel));if (!hostt->eh_bus_reset_handler)return FAILED ; - rtn = hostt->eh_bus_reset_handler (host,scmd_channel (scmd)); + rtn = hostt->eh_bus_reset_handler (host, channel);if (rtn ==SUCCESS ) {if (!hostt->skip_settle_delay)ssleep (BUS_RESET_SETTLE_TIME );spin_lock_irqsave (host->host_lock, flags); -scsi_report_bus_reset (host,scmd_channel (scmd)); +scsi_report_bus_reset (host, channel);spin_unlock_irqrestore (host->host_lock, flags); }
@@ -932,7 +932,8 @@ static void __scsi_report_device_reset(struct scsi_device *sdev, void *data)/** * scsi_try_target_reset - Ask host to perform a target reset -* @scmd: SCSI cmd used to send a target reset +* @host: SCSI Host +* @starget: SCSI target to be reset * * Notes: * There is no timeout for this operation. if this operation is
@@ -940,13 +941,12 @@ static void __scsi_report_device_reset(struct scsi_device *sdev, void *data)* timer on it, and set the host back to a consistent state prior to * returning. */ -static enum scsi_disposition scsi_try_target_reset (struct scsi_cmnd *scmd) +static enum scsi_disposition scsi_try_target_reset (struct Scsi_Host *host, +struct scsi_target *starget) {unsigned long flags;enum scsi_disposition rtn; -struct Scsi_Host *host = scmd->device->host;const struct scsi_host_template *hostt = host->hostt; -struct scsi_target *starget =scsi_target (scmd->device);if (!hostt->eh_target_reset_handler)return FAILED ;
@@ -964,7 +964,7 @@ static enum scsi_disposition scsi_try_target_reset(struct scsi_cmnd *scmd)/** * scsi_try_bus_device_reset - Ask host to perform a BDR on a dev -* @scmd: SCSI cmd used to send BDR +* @sdev: SCSI device to perform the BDR on * * Notes: * There is no timeout for this operation. if this operation is
@@ -972,17 +972,17 @@ static enum scsi_disposition scsi_try_target_reset(struct scsi_cmnd *scmd)* timer on it, and set the host back to a consistent state prior to * returning. */ -static enum scsi_disposition scsi_try_bus_device_reset (struct scsi_cmnd *scmd) +static enum scsi_disposition scsi_try_bus_device_reset (struct scsi_device *sdev) {enum scsi_disposition rtn; -const struct scsi_host_template *hostt = scmd->device->host->hostt; +const struct scsi_host_template *hostt = sdev->host->hostt;if (!hostt->eh_device_reset_handler)return FAILED ; - rtn = hostt->eh_device_reset_handler (scmd->device); + rtn = hostt->eh_device_reset_handler (sdev);if (rtn ==SUCCESS ) -__scsi_report_device_reset (scmd->device,NULL ); +__scsi_report_device_reset (sdev,NULL );return rtn; }
@@ -1014,11 +1014,15 @@ scsi_try_to_abort_cmd(const struct scsi_host_template *hostt, struct scsi_cmnd *static void scsi_abort_eh_cmnd (struct scsi_cmnd *scmd) { -if (scsi_try_to_abort_cmd (scmd->device->host->hostt, scmd) !=SUCCESS ) -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); +struct Scsi_Host *host = scmd->device->host; +struct scsi_target *starget =scsi_target (scmd->device); +int channel = scmd->device->channel; + +if (scsi_try_to_abort_cmd (host->hostt, scmd) !=SUCCESS ) +if (scsi_try_bus_device_reset (scmd->device) !=SUCCESS ) +if (scsi_try_target_reset (host, starget) !=SUCCESS ) +if (scsi_try_bus_reset (host, channel) !=SUCCESS ) +scsi_try_host_reset (host); }/**
@@ -1592,7 +1596,7 @@ static int scsi_eh_bus_device_reset(struct Scsi_Host *shost,SCSI_LOG_ERROR_RECOVERY (3 ,sdev_printk (KERN_INFO , sdev,"%s: Sending BDR\n" , current->comm)); - rtn =scsi_try_bus_device_reset (bdr_scmd); + rtn =scsi_try_bus_device_reset (sdev);if (rtn ==SUCCESS || rtn ==FAST_IO_FAIL ) { if (!scsi_device_online(sdev) || rtn == FAST_IO_FAIL ||
@@ -1658,7 +1662,7 @@ static int scsi_eh_target_reset(struct Scsi_Host *shost,shost_printk (KERN_INFO , shost,"%s: Sending target reset to target %d\n" , current->comm, id)); - rtn =scsi_try_target_reset (scmd); + rtn =scsi_try_target_reset (shost,scsi_target (scmd->device));if (rtn !=SUCCESS && rtn !=FAST_IO_FAIL ) SCSI_LOG_ERROR_RECOVERY(3, shost_printk(KERN_INFO, shost,
@@ -1722,7 +1726,7 @@ static int scsi_eh_bus_reset(struct Scsi_Host *shost,shost_printk (KERN_INFO , shost,"%s: Sending BRST chan: %d\n" , current->comm, channel)); - rtn =scsi_try_bus_reset (scmd); + rtn =scsi_try_bus_reset (shost, channel);if (rtn !=SUCCESS && rtn !=FAST_IO_FAIL ) { SCSI_LOG_ERROR_RECOVERY(3, shost_printk(KERN_INFO, shost,
@@ -1768,7 +1772,7 @@ static int scsi_eh_host_reset(struct Scsi_Host *shost,"%s: Sending HRST\n" , current->comm)); - rtn =scsi_try_host_reset (scmd); + rtn =scsi_try_host_reset (shost);if (rtn ==SUCCESS ) {list_splice_init (work_q, &check_list); }else if (rtn ==FAST_IO_FAIL ) {
@@ -2379,7 +2383,7 @@ void scsi_report_bus_reset(struct Scsi_Host *shost, unsigned 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 ); } }
@@ -2427,9 +2431,8 @@ EXPORT_SYMBOL(scsi_report_device_reset);int scsi_ioctl_reset (struct scsi_device *dev,int __user *arg) { -struct scsi_cmnd *scmd;struct Scsi_Host *shost = dev->host; -struct request *rq; +struct scsi_target *starget =scsi_target (dev);unsigned long flags;int error =0 , val;enum scsi_disposition rtn;
@@ -2444,23 +2447,6 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg)if (scsi_autopm_get_host (shost) <0 )return -EIO ; - error = -EIO ; - rq =kzalloc (sizeof (struct request ) +sizeof (struct scsi_cmnd ) + - shost->hostt->cmd_size,GFP_KERNEL ); -if (!rq) - goto out_put_autopm_host; -blk_rq_init (NULL , rq); - - scmd = (struct scsi_cmnd *)(rq +1 ); -scsi_init_command (dev, scmd); - - scmd->submitter =SUBMITTED_BY_SCSI_RESET_IOCTL ; -memset (&scmd->sdb,0 ,sizeof (scmd->sdb)); - - scmd->cmd_len =0 ; - - scmd->sc_data_direction =DMA_BIDIRECTIONAL ; -spin_lock_irqsave (shost->host_lock, flags); shost->tmf_in_progress =1 ;spin_unlock_irqrestore (shost->host_lock, flags);
@@ -2470,22 +2456,22 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg) rtn =SUCCESS ;break ;case SG_SCSI_RESET_DEVICE : - rtn =scsi_try_bus_device_reset (scmd); + rtn =scsi_try_bus_device_reset (dev);if (rtn ==SUCCESS || (val &SG_SCSI_RESET_NO_ESCALATE ))break ; fallthrough;case SG_SCSI_RESET_TARGET : - rtn =scsi_try_target_reset (scmd); + rtn =scsi_try_target_reset (shost, starget);if (rtn ==SUCCESS || (val &SG_SCSI_RESET_NO_ESCALATE ))break ; fallthrough;case SG_SCSI_RESET_BUS : - rtn =scsi_try_bus_reset (scmd); + rtn =scsi_try_bus_reset (shost, dev->channel);if (rtn ==SUCCESS || (val &SG_SCSI_RESET_NO_ESCALATE ))break ; fallthrough;case SG_SCSI_RESET_HOST : - rtn =scsi_try_host_reset (scmd); + rtn =scsi_try_host_reset (shost);if (rtn ==SUCCESS )break ; fallthrough;
@@ -2511,9 +2497,6 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg)wake_up (&shost->host_wait);scsi_run_host_queues (shost); -kfree (rq); - -out_put_autopm_host:scsi_autopm_put_host (shost);return error; }
Signature · 1 line
2.35.3
Re: [PATCH 07/10] scsi: Do not allocate scsi command in scsi_ioctl_reset()
Quoted 17 lines · Hannes Reinecke
As we now have moved the error handler functions to not rely on a scsi command we can drop the out-of-band scsi command allocation from
scsi_ioctl_reset().Signed-off-by Hannes Reinecke <[email protected]>Reviewed-by Bart Van Assche <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Reviewed-by Christoph Hellwig <[email protected]>--- drivers/scsi/scsi_error.c | 95 ++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 56 deletions(-)drivers/scsi/scsi_error.c +0
-0
drivers/scsi/scsi_error.c static enum scsi_disposition scsi_try_host_reset(struct scsi_cmnd *scmd) · line 902
Quoted 10 lines
drivers/scsi/scsi_error.c +4
-2@@ -896,28 +895,29 @@ static enum scsi_disposition scsi_try_host_reset(struct scsi_cmnd *scmd)/** * scsi_try_bus_reset - ask host to perform a bus reset -* @scmd: SCSI cmd to send bus reset. +* @host: SCSI host to send bus reset. +* @channel: Number of the bus to be reset */ -static enum scsi_disposition scsi_try_bus_reset (struct scsi_cmnd *scmd) +static enum scsi_disposition scsi_try_bus_reset (struct Scsi_Host *host, +int channel)
This should be unsigned int, to align with eh_bus_reset_handler().
drivers/scsi/scsi_error.c static enum scsi_disposition scsi_try_host_reset(struct scsi_cmnd *scmd) · line 909
Quoted 10 lines
drivers/scsi/scsi_error.c +2
-3{unsigned long flags;enum scsi_disposition rtn; -struct Scsi_Host *host = scmd->device->host;const struct scsi_host_template *hostt = host->hostt; -SCSI_LOG_ERROR_RECOVERY (3 ,scmd_printk (KERN_INFO , scmd, -"%s: Snd Bus RST\n" , __func__)); +SCSI_LOG_ERROR_RECOVERY (3 ,shost_printk (KERN_INFO , host, +"%s: Snd Bus RST to bus %d\n" , __func__, channel));
And then this should be %u ^^
Quoted 8 lines
drivers/scsi/scsi_error.c +1
-1if (!hostt->eh_bus_reset_handler)return FAILED ; - rtn = hostt->eh_bus_reset_handler (host,scmd_channel (scmd)); + rtn = hostt->eh_bus_reset_handler (host, channel);@@ -1014,11 +1014,15 @@ scsi_try_to_abort_cmd(const struct scsi_host_template *hostt, struct scsi_cmnd *
drivers/scsi/scsi_error.c scsi_try_to_abort_cmd(const struct scsi_host_template *hostt, struct scsi_cmnd * · line 1019
Quoted 10 lines
drivers/scsi/scsi_error.c +3
-5static void scsi_abort_eh_cmnd (struct scsi_cmnd *scmd) { -if (scsi_try_to_abort_cmd (scmd->device->host->hostt, scmd) !=SUCCESS ) -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); +struct Scsi_Host *host = scmd->device->host; +struct scsi_target *starget =scsi_target (scmd->device); +int channel = scmd->device->channel;
Probably better
unsigned int channel = scmd_channel(scmd);
Quoted 10 lines
drivers/scsi/scsi_error.c +6
-0+ +if (scsi_try_to_abort_cmd (host->hostt, scmd) !=SUCCESS ) +if (scsi_try_bus_device_reset (scmd->device) !=SUCCESS ) +if (scsi_try_target_reset (host, starget) !=SUCCESS ) +if (scsi_try_bus_reset (host, channel) !=SUCCESS ) +scsi_try_host_reset (host); }/**
drivers/scsi/scsi_error.c scsi_ioctl_reset(struct scsi_device *dev, int __user *arg) · line 2459
Quoted 5 lines
drivers/scsi/scsi_error.c +1
-1@@ -2470,22 +2456,22 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg)break ; fallthrough;case SG_SCSI_RESET_BUS : - rtn =scsi_try_bus_reset (scmd); + rtn =scsi_try_bus_reset (shost, dev->channel);
Probably also use sdev_channel(dev)
Quoted 3 lines
drivers/scsi/scsi_error.c +0
-0if (rtn ==SUCCESS || (val &SG_SCSI_RESET_NO_ESCALATE ))break ; fallthrough;
Signature · 4 lines
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy Vors. Aufs.-R.: Gregor Pillen / Geschäftsführung: David Faller Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Hannes Reinecke
maintainerPATCH v8 8/10 scsi_error: iterate over list of failed commands in scsi_eh_bus_device_reset()
In reply to Hannes ReineckeIterating over all devices in scsi_eh_bus_device_reset() is inefficient as not all devices may be affected during SCSI EH. There also is no reason to open-code scsi_eh_test_devices() as for FAST_IO_FAIL we really should just return the commands without further ado.
So rewrite the loop in scsi_eh_bus_device_reset() to match the loop in scsi_eh_target_reset() and scsi_eh_bus_reset().
--- drivers/scsi/scsi_error.c | 58 ++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 31 deletions(-)
drivers/scsi/scsi_error.c +27 -31
@@ -1570,54 +1570,50 @@ static int scsi_eh_bus_device_reset(struct Scsi_Host *shost,struct list_head *work_q, struct list_head *done_q) { - struct scsi_cmnd *scmd, *bdr_scmd, *next; -struct scsi_device *sdev; -enum scsi_disposition rtn; + struct scsi_cmnd *scmd, *next; +LIST_HEAD (tmp_list); +LIST_HEAD (check_list); + +list_splice_init (work_q, &tmp_list); + +while (!list_empty (&tmp_list)) { +struct scsi_device *sdev; +enum scsi_disposition rtn; + + scmd = list_entry(tmp_list.next, struct scsi_cmnd, eh_entry); + sdev = scmd->device; -shost_for_each_device (sdev, shost) {if (scsi_host_eh_past_deadline (shost)) { +/* push back on work queue for further processing */ +list_splice_init (&check_list, work_q); +list_splice_init (&tmp_list, work_q);SCSI_LOG_ERROR_RECOVERY (3 ,sdev_printk (KERN_INFO , sdev,"%s: skip BDR, past eh deadline\n" , current->comm)); -scsi_device_put (sdev); -break ; +return list_empty (work_q); } - bdr_scmd =NULL ; -list_for_each_entry (scmd, work_q, eh_entry) -if (scmd->device == sdev) { - bdr_scmd = scmd; -break ; - } - -if (!bdr_scmd) -continue ; -SCSI_LOG_ERROR_RECOVERY (3 ,sdev_printk (KERN_INFO , sdev,"%s: Sending BDR\n" , current->comm)); rtn =scsi_try_bus_device_reset (sdev); -if (rtn ==SUCCESS || rtn ==FAST_IO_FAIL ) { -if (!scsi_device_online (sdev) || - rtn ==FAST_IO_FAIL || - !scsi_eh_tur (bdr_scmd)) { -list_for_each_entry_safe (scmd, next, - work_q, eh_entry) { -if (scmd->device == sdev && -scsi_eh_action (scmd, rtn) !=FAILED ) { -set_host_byte (scmd,DID_RESET ); -scsi_eh_finish_cmd (scmd, done_q); - } - } - } - }else { +if (rtn !=SUCCESS && rtn !=FAST_IO_FAIL )SCSI_LOG_ERROR_RECOVERY (3 ,sdev_printk (KERN_INFO , sdev,"%s: BDR failed\n" , current->comm)); +list_for_each_entry_safe (scmd, next, work_q, eh_entry) { +if (scmd->device != sdev) +continue ; +if (rtn ==SUCCESS ) +list_move_tail (&scmd->eh_entry, &check_list); +else if (rtn ==FAST_IO_FAIL ) { +set_host_byte (scmd,DID_TRANSPORT_FAILFAST ); +scsi_eh_finish_cmd (scmd, done_q); + } } } -return list_empty (work_q); +return scsi_eh_test_devices (&check_list, work_q, done_q,0 ); }/**
Signature · 1 line
2.35.3
Re: [PATCH 08/10] scsi_error: iterate over list of failed commands in scsi_eh_bus_device_reset()
drivers/scsi/scsi_error.c static int scsi_eh_bus_device_reset(struct Scsi_Host *shost, · line 1604
Quoted 4 lines · Hannes Reinecke
drivers/scsi/scsi_error.c +1
-0SCSI_LOG_ERROR_RECOVERY (3 ,sdev_printk (KERN_INFO , sdev,"%s: BDR failed\n" , current->comm)); +list_for_each_entry_safe (scmd, next, work_q, eh_entry) {
Same as before, you want to loop over the new tmp_list, work_q should be empty here.
Quoted 9 lines
drivers/scsi/scsi_error.c +8
-0+if (scmd->device != sdev) +continue ; +if (rtn ==SUCCESS ) +list_move_tail (&scmd->eh_entry, &check_list); +else if (rtn ==FAST_IO_FAIL ) { +set_host_byte (scmd,DID_TRANSPORT_FAILFAST ); +scsi_eh_finish_cmd (scmd, done_q); + } }
Signature · 4 lines
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy Vors. Aufs.-R.: Gregor Pillen / Geschäftsführung: David Faller Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Hannes Reinecke
maintainerPATCH v8 9/10 scsi_error: map FAST_IO_FAIL to -EAGAIN in SCSI EH
In reply to Hannes ReineckeReturning FAST_IO_FAIL from any of the SCSI EH functions is perfectly valid, and indicates that the request could not be executed due to the transport being busy.
But that is not an I/O error, and we should return -EAGAIN from scsi_ioctl_reset() to correctly inform userspace.
--- drivers/scsi/scsi_error.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
drivers/scsi/scsi_error.c +18 -5
@@ -2453,22 +2453,25 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg)break ;case SG_SCSI_RESET_DEVICE : rtn =scsi_try_bus_device_reset (dev); -if (rtn ==SUCCESS || (val &SG_SCSI_RESET_NO_ESCALATE )) +if (rtn ==SUCCESS || rtn ==FAST_IO_FAIL || + (val &SG_SCSI_RESET_NO_ESCALATE ))break ; fallthrough;case SG_SCSI_RESET_TARGET : rtn =scsi_try_target_reset (shost, starget); -if (rtn ==SUCCESS || (val &SG_SCSI_RESET_NO_ESCALATE )) +if (rtn ==SUCCESS || rtn ==FAST_IO_FAIL || + (val &SG_SCSI_RESET_NO_ESCALATE ))break ; fallthrough;case SG_SCSI_RESET_BUS : rtn =scsi_try_bus_reset (shost, dev->channel); -if (rtn ==SUCCESS || (val &SG_SCSI_RESET_NO_ESCALATE )) +if (rtn ==SUCCESS || rtn ==FAST_IO_FAIL || + (val &SG_SCSI_RESET_NO_ESCALATE ))break ; fallthrough;case SG_SCSI_RESET_HOST : rtn =scsi_try_host_reset (shost); -if (rtn ==SUCCESS ) +if (rtn ==SUCCESS || rtn ==FAST_IO_FAIL )break ; fallthrough;default :
@@ -2476,7 +2479,17 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg)break ; } - error = (rtn ==SUCCESS ) ?0 : -EIO ; +switch (rtn) { +case SUCCESS : + error =0 ; +break ; +case FAST_IO_FAIL : + error = -EAGAIN ; +break ; +default : + error = -EIO ; +break ; + }spin_lock_irqsave (shost->host_lock, flags); shost->tmf_in_progress =0 ;
Signature · 1 line
2.35.3
Re: [PATCH 09/10] scsi_error: map FAST_IO_FAIL to -EAGAIN in SCSI EH
Quoted 5 lines · Hannes Reinecke
Returning
FAST_IO_FAILfrom any of the SCSI EH functions is perfectly valid, and indicates that the request could not be executed due to the transport being busy.
But that is not an I/O error, and we should return-EAGAINfromscsi_ioctl_reset()to correctly inform userspace.
I've had a short look at at least one user of this interface sg_reset, and that seems to handle this already:
https://github.com/doug-gilbert/sg3_utils/blob/0e955c48621f7dc512e34554a060fe9f5cbc8d67/src/sg_reset.c#L251-L267
So this looks good to me.
Quoted 7 lines
Suggested-by Benjamin Block <[email protected]>Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/scsi_error.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
Signature · 4 lines
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy Vors. Aufs.-R.: Gregor Pillen / Geschäftsführung: David Faller Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Mike Christie
maintainerRe: [PATCH 09/10] scsi_error: map FAST_IO_FAIL to -EAGAIN in SCSI EH
In reply to Hannes ReineckeQuoted 3 lines · Hannes Reinecke
Returning
FAST_IO_FAILfrom any of the SCSI EH functions is perfectly valid, and indicates that the request could not be executed due to the transport being busy.
I'm not sure if that's completely correct or maybe we have a different view of what it means to be busy.
FC, iSCSI and SRP normally return it when the transport is marked as offline/lost, so for normal IO we fail it upwards and userspace gets an error.
What drivers use it as temp busy error code? Is it the lpfc one or a snic one?
Quoted 2 lines
But that is not an I/O error, and we should return
-EAGAINfromscsi_ioctl_reset()to correctly inform userspace.
For the sg_reset example, if you tried to run sg_reset again it would fail. When sg_reset tries to open the device the open function will return failure in the open call because the device is in the transport-offline state for FC/iSCSI/SRP.
If you are going to change the return value why not sync it with what we return for normal IO and return BLK_STS_TRANSPORT/-ENOLINK?
Hannes Reinecke
maintainerRe: [PATCH 09/10] scsi_error: map FAST_IO_FAIL to -EAGAIN in SCSI EH
Quoted 8 lines · Mike Christie
Quoted 3 lines · Hannes Reinecke
Returning
FAST_IO_FAILfrom any of the SCSI EH functions is perfectly valid, and indicates that the request could not be executed due to the transport being busy.I'm not sure if that's completely correct or maybe we have a different view of what it means to be busy.
Quoted 7 lines
FC, iSCSI and SRP normally return it when the transport is marked as offline/lost, so for normal IO we fail it upwards and userspace gets an error.
What drivers use it as temp busy error code? Is it the lpfc one or a snic one?
This patch is primarily for sg_reset(), which would return -EIO whenever one of the EH functions would return FAST_IO_FAIL.
It got triggered by my patch to zfcp, which now returns FAST_IO_FAIL from host reset as remote port login is happening from a worker thread, and the devices are not (yet) available.
Quoted 9 lines
Quoted 2 lines
But that is not an I/O error, and we should return
-EAGAINfromscsi_ioctl_reset()to correctly inform userspace.For the
sg_resetexample, if you tried to runsg_resetagain it would fail. Whensg_resettries to open the device the open function will return failure in the open call because the device is in the transport-offline state for FC/iSCSI/SRP.If you are going to change the return value why not sync it with what we return for normal IO and return BLK_STS_TRANSPORT/-ENOLINK?
Good point.
The alternative would be to map FAST_IO_FAIL back to SUCCESS as after all the host reset completed successfully, and blocked ports are not really an error.
Lemme check.
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew Myers, Andrew McDonald, Martje Boudien Moerman
Hannes Reinecke
maintainerPATCH v8 10/10 scsi: remove SUBMITTED_BY_SCSI_RESET_IOCTL
In reply to Hannes ReineckeUnused now.
--- drivers/scsi/scsi_lib.c | 2 -- include/scsi/scsi_cmnd.h | 1 - 2 files changed, 3 deletions(-)
drivers/scsi/scsi_lib.c +0 -2
@@ -1616,8 +1616,6 @@ static void scsi_done_internal(struct scsi_cmnd *cmd, bool complete_directly)break ;case SUBMITTED_BY_SCSI_ERROR_HANDLER :return scsi_eh_done (cmd); -case SUBMITTED_BY_SCSI_RESET_IOCTL : -return ; }if (unlikely (blk_should_fake_timeout (scsi_cmd_to_rq (cmd)->q)))
include/scsi/scsi_cmnd.h +0 -1
@@ -68,7 +68,6 @@ struct scsi_pointer {enum scsi_cmnd_submitter {SUBMITTED_BY_BLOCK_LAYER =0 ,SUBMITTED_BY_SCSI_ERROR_HANDLER =1 , -SUBMITTED_BY_SCSI_RESET_IOCTL =2 , } __packed;struct scsi_cmnd {
Signature · 1 line
2.35.3
Re: [PATCH 10/10] scsi: remove SUBMITTED_BY_SCSI_RESET_IOCTL
Quoted 11 lines · Hannes Reinecke
Unused now.
Signed-off-by Hannes Reinecke <[email protected]>Reviewed-by Bart Van Assche <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Reviewed-by Christoph Hellwig <[email protected]>--- drivers/scsi/scsi_lib.c | 2 -- include/scsi/scsi_cmnd.h | 1 - 2 files changed, 3 deletions(-)
Signature · 4 lines
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy Vors. Aufs.-R.: Gregor Pillen / Geschäftsführung: David Faller Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Hey Hannes,
Quoted 14 lines · Hannes Reinecke
Hi all,
(taking up an old thread:)
here's now the main part of my EH rework.
It modifies the reset callbacks for SCSI EH such that each callback (eh_host_reset_handler,eh_bus_reset_handler,eh_target_reset_handler,eh_device_reset_handler) only references the actual entity it needs to work on
(ie 'Scsi_Host', (scsi bus), 'scsi_target', 'scsi_device'), and the 'structscsi_cmnd' is dropped from the argument list. This simplifies the handler themselves as they don't need to exclude some 'magic' command, and we don't need to allocate a mock 'structscsi_cmnd' when issuing a reset via SCSI ioctl.
Quoted 4 lines
The entire patchset can be found at:
https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
branch eh-rework.v8
This doesn't exist (yet?). I also tried to somehow get both part 2 of the preparations and this series applied on some tree, but failed. Preparations part 2 seems to be based on some form of Linus' master tree, and this on Martin's staging tree?
Maybe I'm just unlucky :D
Signature · 4 lines
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy Vors. Aufs.-R.: Gregor Pillen / Geschäftsführung: David Faller Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Hannes Reinecke
maintainerQuoted 19 lines · Benjamin Block
Hey Hannes,
Quoted 16 lines · Hannes Reinecke
Hi all,
(taking up an old thread:)
here's now the main part of my EH rework.
It modifies the reset callbacks for SCSI EH such that each callback (eh_host_reset_handler,eh_bus_reset_handler,eh_target_reset_handler,eh_device_reset_handler) only references the actual entity it needs to work on
(ie 'Scsi_Host', (scsi bus), 'scsi_target', 'scsi_device'), and the 'structscsi_cmnd' is dropped from the argument list. This simplifies the handler themselves as they don't need to exclude some 'magic' command, and we don't need to allocate a mock 'structscsi_cmnd' when issuing a reset via SCSI ioctl.The entire patchset can be found at:
Quoted 9 lines
Quoted 2 lines
https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
branch eh-rework.v8This doesn't exist (yet?). I also tried to somehow get both part 2 of the preparations and this series applied on some tree, but failed. Preparations part 2 seems to be based on some form of Linus' master tree, and this on Martin's staging tree?
Maybe I'm just unlucky :D
Maybe you are.
Pushed now, please try again.
Cheers,
Hannes
Quoted 7 lines · Hannes Reinecke
Quoted 6 lines · Benjamin Block
Quoted 4 lines · Hannes Reinecke
The entire patchset can be found at:
https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
branch eh-rework.v8
Quoted 8 lines
Quoted 6 lines
This doesn't exist (yet?). I also tried to somehow get both part 2 of the preparations and this series applied on some tree, but failed. Preparations part 2 seems to be based on some form of Linus' master tree, and this on Martin's staging tree?
Maybe I'm just unlucky :DMaybe you are.
Pushed now, please try again.
That was v9, but I guess that works as well, thanks.
Signature · 4 lines
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy Vors. Aufs.-R.: Gregor Pillen / Geschäftsführung: David Faller Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Quoted 14 lines · Hannes Reinecke
Hi all,
(taking up an old thread:)
here's now the main part of my EH rework.
It modifies the reset callbacks for SCSI EH such that each callback (eh_host_reset_handler,eh_bus_reset_handler,eh_target_reset_handler,eh_device_reset_handler) only references the actual entity it needs to work on
(ie 'Scsi_Host', (scsi bus), 'scsi_target', 'scsi_device'), and the 'structscsi_cmnd' is dropped from the argument list. This simplifies the handler themselves as they don't need to exclude some 'magic' command, and we don't need to allocate a mock 'structscsi_cmnd' when issuing a reset via SCSI ioctl.
Quoted 7 lines
The entire patchset can be found at:
https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
branch eh-rework.v8As usual, comments and reviews are welcome.
Hi Hannes,
It seems a long time, is this work still going on?
Quoted 23 lines
Changes to v6:
- Include reviews from Bart
- Add patch to return-EAGAINfromscsi_ioctl_reset()Changes to v5:
- Improve description for patch to modifyscsi_eh_bus_device_reset()
- Add patch to modify the iteratrion inscsi_eh_bus_reset()Hannes Reinecke (10):
scsi: UseScsi_Hostas argument foreh_host_reset_handler
scsi: UseScsi_Hostand channel number as argument for
eh_bus_reset_handler()
scsi: Usescsi_targetas argument foreh_target_reset_handler()
scsi: Usescsi_deviceas argument toeh_device_reset_handler()
scsi: set host byte after EH completed
scsi_error: iterate over list of failed commands inscsi_eh_bus_reset()scsi: Do not allocate scsi command in
scsi_ioctl_reset()
scsi_error: iterate over list of failed commands in
scsi_eh_bus_device_reset()
scsi_error: mapFAST_IO_FAILto-EAGAINin SCSI EH
scsi: removeSUBMITTED_BY_SCSI_RESET_IOCTL
Hello Hannes,
Quoted 14 lines · Hannes Reinecke
Hi all,
(taking up an old thread:)
here's now the main part of my EH rework.
It modifies the reset callbacks for SCSI EH such that each callback (eh_host_reset_handler,eh_bus_reset_handler,eh_target_reset_handler,eh_device_reset_handler) only references the actual entity it needs to work on
(ie 'Scsi_Host', (scsi bus), 'scsi_target', 'scsi_device'), and the 'structscsi_cmnd' is dropped from the argument list. This simplifies the handler themselves as they don't need to exclude some 'magic' command, and we don't need to allocate a mock 'structscsi_cmnd' when issuing a reset via SCSI ioctl.
Quoted 6 lines
The entire patchset can be found at:
https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
branch eh-rework.v8As usual, comments and reviews are welcome.
This seems to be the latest version of your EH rework.
Do you have any plans to send a v9?
Kind regards,
Niklas
Hannes Reinecke
maintainerQuoted 19 lines · Niklas Cassel
Hello Hannes,
Quoted 16 lines · Hannes Reinecke
Hi all,
(taking up an old thread:)
here's now the main part of my EH rework.
It modifies the reset callbacks for SCSI EH such that each callback (eh_host_reset_handler,eh_bus_reset_handler,eh_target_reset_handler,eh_device_reset_handler) only references the actual entity it needs to work on
(ie 'Scsi_Host', (scsi bus), 'scsi_target', 'scsi_device'), and the 'structscsi_cmnd' is dropped from the argument list. This simplifies the handler themselves as they don't need to exclude some 'magic' command, and we don't need to allocate a mock 'structscsi_cmnd' when issuing a reset via SCSI ioctl.The entire patchset can be found at:
Quoted 9 lines
Quoted 4 lines
https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
branch eh-rework.v8As usual, comments and reviews are welcome.
This seems to be the latest version of your EH rework.
Do you have any plans to send a v9?
Weelll ... I didn't really proceed with that, as that requires for some LLDDs to set a side a command tag for TMF.
It was relatively easy pre-multiqueue times (where you could just reduce max_commands by 1), but for blk-mq that now longer works.
We need to do some really cumbersome things (just look at fnic ...) and I hoped I could get the 'reserved commands for TMF' patchset in first, so then this one would be easy.
Alas, this hasn't happened, and so I didn't continue on that work. But I'll see if I can resurrect it.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich
Hello Hannes,
Quoted 32 lines · Hannes Reinecke
Quoted 19 lines · Niklas Cassel
Hello Hannes,
Quoted 16 lines · Hannes Reinecke
Hi all,
(taking up an old thread:)
here's now the main part of my EH rework.
It modifies the reset callbacks for SCSI EH such that each callback (eh_host_reset_handler,eh_bus_reset_handler,eh_target_reset_handler,eh_device_reset_handler) only references the actual entity it needs to work on
(ie 'Scsi_Host', (scsi bus), 'scsi_target', 'scsi_device'), and the 'structscsi_cmnd' is dropped from the argument list. This simplifies the handler themselves as they don't need to exclude some 'magic' command, and we don't need to allocate a mock 'structscsi_cmnd' when issuing a reset via SCSI ioctl.The entire patchset can be found at:
Quoted 9 lines
Quoted 4 lines
https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
branch eh-rework.v8As usual, comments and reviews are welcome.
This seems to be the latest version of your EH rework.
Do you have any plans to send a v9?
Weelll ... I didn't really proceed with that, as that requires for some LLDDs to set a side a command tag for TMF.
Quoted 6 lines
It was relatively easy pre-multiqueue times (where you could just reduce
max_commandsby 1), but for blk-mq that now longer works.We need to do some really cumbersome things (just look at fnic ...) and I hoped I could get the 'reserved commands for TMF' patchset in first, so then this one would be easy.
I see, I didn't realize that the series had outstanding dependencies.
For anyone else looking for the actual series in lore, here there are:
EH rework prep patches, part 1:
https://lore.kernel.org/linux-scsi/[email protected]/
- This series has been merged by Martin, and was included in v6.7.
EH rework prep patches, part 2:
https://lore.kernel.org/linux-scsi/[email protected]/
- This series has not been merged, and is most likely the 'reserved commands for TMF' series that Hannes is referring to.
EH rework, main part (or part 3):
https://lore.kernel.org/linux-scsi/[email protected]/
- Depends on part 2 (which has not been merged yet).
Quoted 3 lines
Alas, this hasn't happened, and so I didn't continue on that work. But I'll see if I can resurrect it.