SCSI EH argument reshuffle part II
Subsystems (59)
Hannes Reinecke
maintainercover SCSI EH argument reshuffle part II
Hi all,
finally here's the patchset to revamp the SCSI EH callback arguments which I promised to do (some years ago ...).
The overall idea is to match the scope of the eh_XXX callbacks with the appropriate argument, eg eh_device_reset_handler() should have a scsi device as argument etc.
Relying on the scsi command has the problem that
a) we're holding a reference on that command for the entire lifetime of the error handling and
b) it leads to some 'interesting' driver implementations; some higher-level EH callback implementations go through the list of outstanding commands and try to abort this particular command only; makes one wonder what'll happen to the other commands ...
However, this patchset has the nice side-effect that we don't need to allocate an out-of-order scsi command in scsi_ioctl_reset(), but can call the function directly.
As per request from hch the patchset has been split in two parts; this is the second part which rearranges the individual EH handler implementation to not rely on the passed in scsi command and do the final conversion to the new calling convention.
The entire patchset can be found at
https://git.kernel.org/hare/scsi-devel/h/eh-reset.v3
As usual, comments and reviews are welcome.
Hannes Reinecke (47):
aacraid: split off functions to generate reset FIB
aacraid: split off host reset
aacraid: split off device, target, and bus reset
aacraid: use aac_tmf_callback for reset fib
aacraid: enable sending of TMFs from aac_hba_send()
aacraid: add fib flag to mark scsi command callback
aacraid: complete all commands during bus reset
sym53c8xx_2: split off bus reset from host reset
zfcp: open-code fc_block_scsi_eh() for host reset
ips: Do not try to abort command from host reset
snic: reserve tag for TMF
qla1280: separate out host reset function from qla1280_error_action()
megaraid: pass in NULL scb for host reset
scsi: Use Scsi_Host as argument for eh_host_reset_handler
scsi_transport_fc: Use fc_rport as argument for fc_block_scsi_eh
mptfc: simplify mpt_fc_block_error_handler()
mptfusion: correct definitions for mptscsih_dev_reset()
mptfc: open-code mptfc_block_error_handler() for bus reset
pmcraid: Select device in pmcraid_eh_bus_reset_handler()
scsi: Use Scsi_Host and channel number as argument for
eh_bus_reset_handler()
libiscsi: use cls_session as argument for target and session reset
bnx2fc: Do not rely on a scsi command when issueing lun or target
reset
zfcp: do not rely on scsi command for debugging message
zfcp: use scsi device as argument for zfcp_task_mgmt_function()
ibmvfc: open-code reset loop for target reset
lpfc: use rport as argument for lpfc_send_taskmgmt()
lpfc: use rport as argument for lpfc_chk_tgt_mapped()
qla2xxx: open-code qla2xxx_generic_reset()
qedf: use fc rport as argument for qedf_initiate_tmf()
sym53c8xx_2: rework reset handling
bfa: Do not use scsi command to signal TMF status
scsi: Use scsi_target as argument for eh_target_reset_handler()
cxlflash: use dedicated reset command in send_tmf()
aha152x: look for stuck command when resetting device
fnic: use dedicated device reset command
a1000u2w: do not rely on the command for inia100_device_reset()
aic79xx: use scsi device as argument for BUILD_SCSIID()
aic7xxx: use scsi device as argument for BUILD_SCSIID()
aic79xx: do not reference scsi command when resetting device
aic7xxx: do not reference scsi command when resetting device
xen-scsifront: add scsi device as argument to scsifront_do_request()
xen-scsifront: call scsifront_action_handler() with a NULL command
argument
fas216: Rework device reset to not rely on SCSI command pointer
csiostor: use separate TMF command
snic: use dedicated device reset command
scsi: Move eh_device_reset_handler() to use scsi_device as argument
scsi: Do not allocate scsi command in scsi_ioctl_reset()
Documentation/scsi/scsi_eh.txt | 6 +- Documentation/scsi/scsi_mid_low_api.txt | 13 +- arch/ia64/hp/sim/simscsi.c | 2 +- drivers/block/cciss_scsi.c | 14 +- drivers/infiniband/ulp/srp/ib_srp.c | 14 +- drivers/message/fusion/mptfc.c | 99 +++++--- drivers/message/fusion/mptsas.c | 10 +- drivers/message/fusion/mptscsih.c | 117 ++++++--- drivers/message/fusion/mptscsih.h | 7 +- drivers/message/fusion/mptspi.c | 8 +- drivers/s390/scsi/zfcp_dbf.c | 28 +-- drivers/s390/scsi/zfcp_dbf.h | 10 +- drivers/s390/scsi/zfcp_ext.h | 6 +- drivers/s390/scsi/zfcp_fc.h | 9 +- drivers/s390/scsi/zfcp_fsf.c | 21 +- drivers/s390/scsi/zfcp_scsi.c | 73 ++++-- drivers/scsi/3w-9xxx.c | 11 +- drivers/scsi/3w-sas.c | 11 +- drivers/scsi/3w-xxxx.c | 11 +- drivers/scsi/53c700.c | 39 +-- drivers/scsi/BusLogic.c | 14 +- drivers/scsi/NCR5380.c | 5 +- drivers/scsi/NCR53c406a.c | 6 +- drivers/scsi/a100u2w.c | 52 ++-- drivers/scsi/aacraid/aacraid.h | 1 + drivers/scsi/aacraid/commsup.c | 3 +- drivers/scsi/aacraid/linit.c | 318 +++++++++++++++++------- drivers/scsi/advansys.c | 26 +- drivers/scsi/aha152x.c | 39 ++- drivers/scsi/aha152x.h | 2 +- drivers/scsi/aha1542.c | 27 +- drivers/scsi/aic7xxx/aic79xx_osm.c | 64 ++--- drivers/scsi/aic7xxx/aic7xxx_osm.c | 120 ++++----- drivers/scsi/arcmsr/arcmsr_hba.c | 9 +- drivers/scsi/arm/fas216.c | 67 +++-- drivers/scsi/arm/fas216.h | 11 +- drivers/scsi/atari_scsi.c | 4 +- drivers/scsi/be2iscsi/be_main.c | 18 +- drivers/scsi/bfa/bfad_im.c | 113 +++++---- drivers/scsi/bfa/bfad_im.h | 2 + drivers/scsi/bnx2fc/bnx2fc.h | 5 +- drivers/scsi/bnx2fc/bnx2fc_hwi.c | 14 +- drivers/scsi/bnx2fc/bnx2fc_io.c | 97 ++++---- drivers/scsi/csiostor/csio_hw.h | 2 + drivers/scsi/csiostor/csio_init.c | 2 +- drivers/scsi/csiostor/csio_scsi.c | 53 ++-- drivers/scsi/cxlflash/common.h | 3 +- drivers/scsi/cxlflash/main.c | 51 ++-- drivers/scsi/dc395x.c | 25 +- drivers/scsi/dpt_i2o.c | 43 ++-- drivers/scsi/dpti.h | 6 +- drivers/scsi/eata.c | 10 +- drivers/scsi/eata_pio.c | 29 ++- drivers/scsi/esas2r/esas2r.h | 8 +- drivers/scsi/esas2r/esas2r_main.c | 55 ++-- drivers/scsi/esp_scsi.c | 8 +- drivers/scsi/fdomain.c | 2 +- drivers/scsi/fdomain.h | 2 +- drivers/scsi/fnic/fnic.h | 4 +- drivers/scsi/fnic/fnic_main.c | 2 + drivers/scsi/fnic/fnic_scsi.c | 117 ++++----- drivers/scsi/gdth.c | 16 +- drivers/scsi/hpsa.c | 14 +- drivers/scsi/hptiop.c | 6 +- drivers/scsi/ibmvscsi/ibmvfc.c | 58 +++-- drivers/scsi/ibmvscsi/ibmvscsi.c | 23 +- drivers/scsi/imm.c | 6 +- drivers/scsi/initio.c | 11 +- drivers/scsi/ipr.c | 35 +-- drivers/scsi/ips.c | 40 +-- drivers/scsi/libfc/fc_fcp.c | 18 +- drivers/scsi/libiscsi.c | 38 ++- drivers/scsi/libsas/sas_scsi_host.c | 21 +- drivers/scsi/lpfc/lpfc_scsi.c | 67 +++-- drivers/scsi/mac53c94.c | 8 +- drivers/scsi/megaraid.c | 46 ++-- drivers/scsi/megaraid.h | 2 +- drivers/scsi/megaraid/megaraid_mbox.c | 14 +- drivers/scsi/megaraid/megaraid_sas.h | 3 +- drivers/scsi/megaraid/megaraid_sas_base.c | 38 ++- drivers/scsi/megaraid/megaraid_sas_fusion.c | 47 ++-- drivers/scsi/mesh.c | 10 +- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 77 +++--- drivers/scsi/mvumi.c | 7 +- drivers/scsi/ncr53c8xx.c | 4 +- drivers/scsi/nsp32.c | 12 +- drivers/scsi/pcmcia/aha152x_stub.c | 2 +- drivers/scsi/pcmcia/nsp_cs.c | 10 +- drivers/scsi/pcmcia/qlogic_stub.c | 4 +- drivers/scsi/pcmcia/sym53c500_cs.c | 8 +- drivers/scsi/pmcraid.c | 75 ++++-- drivers/scsi/ppa.c | 6 +- drivers/scsi/qedf/qedf.h | 5 +- drivers/scsi/qedf/qedf_io.c | 48 ++-- drivers/scsi/qedf/qedf_main.c | 16 +- drivers/scsi/qedi/qedi_iscsi.c | 3 +- drivers/scsi/qla1280.c | 72 +++--- drivers/scsi/qla2xxx/qla_os.c | 167 +++++++------ drivers/scsi/qla4xxx/ql4_os.c | 85 ++++--- drivers/scsi/qlogicfas408.c | 10 +- drivers/scsi/qlogicfas408.h | 2 +- drivers/scsi/scsi_debug.c | 86 +++---- drivers/scsi/scsi_error.c | 160 ++++++------ drivers/scsi/scsi_transport_fc.c | 7 +- drivers/scsi/scsi_transport_iscsi.c | 6 +- drivers/scsi/smartpqi/smartpqi_init.c | 6 +- drivers/scsi/snic/snic.h | 6 +- drivers/scsi/snic/snic_main.c | 3 + drivers/scsi/snic/snic_scsi.c | 126 ++++------ drivers/scsi/stex.c | 7 +- drivers/scsi/storvsc_drv.c | 4 +- drivers/scsi/sym53c416.c | 16 +- drivers/scsi/sym53c8xx_2/sym_glue.c | 190 ++++++++------ drivers/scsi/ufs/ufshcd.c | 24 +- drivers/scsi/virtio_scsi.c | 14 +- drivers/scsi/vmw_pvscsi.c | 20 +- drivers/scsi/wd33c93.c | 4 +- drivers/scsi/wd33c93.h | 2 +- drivers/scsi/wd719x.c | 17 +- drivers/scsi/xen-scsifront.c | 54 ++-- drivers/staging/rts5208/rtsx.c | 4 +- drivers/staging/unisys/visorhba/visorhba_main.c | 42 ++-- drivers/target/loopback/tcm_loop.c | 17 +- 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 | 6 +- include/scsi/libsas.h | 4 +- include/scsi/scsi_host.h | 8 +- include/scsi/scsi_transport_fc.h | 2 +- include/scsi/scsi_transport_iscsi.h | 2 +- 132 files changed, 2093 insertions(+), 1845 deletions(-)
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 1/47 aacraid: split off functions to generate reset FIB
Split off reset FIB generation into separate functions.
--- drivers/scsi/aacraid/linit.c | 83 ++++++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 33 deletions(-)
drivers/scsi/aacraid/linit.c +50 -33
@@ -814,6 +814,52 @@ static int aac_eh_abort(struct scsi_cmnd* cmd)return ret; } +static u8 aac_eh_tmf_lun_reset_fib (struct aac_dev *aac,struct fib *fib, +int bus,int cid,u64 tmf_lun) +{ +struct aac_hba_tm_req *tmf; +u64 address; + +/* start a HBA_TMF_LUN_RESET TMF request */ + tmf = (struct aac_hba_tm_req *)fib->hw_fib_va; +memset (tmf,0 ,sizeof (*tmf)); + tmf->tmf =HBA_TMF_LUN_RESET ; + tmf->it_nexus = aac->hba_map[bus][cid].rmw_nexus; +int_to_scsilun (tmf_lun, (struct scsi_lun *)tmf->lun); + + address = (u64 )fib->hw_error_pa; + tmf->error_ptr_hi =cpu_to_le32 + ((u32)(address >>32 )); + tmf->error_ptr_lo =cpu_to_le32 + ((u32)(address &0xffffffff )); + tmf->error_length =cpu_to_le32 (FW_ERROR_BUFFER_SIZE ); + fib->hbacmd_size =sizeof (*tmf); + +return HBA_IU_TYPE_SCSI_TM_REQ ; +} + +static u8 aac_eh_tmf_hard_reset_fib (struct aac_dev *aac,struct fib *fib, +int bus,int cid) +{ +struct aac_hba_reset_req *rst; +u64 address; + +/* already tried, start a hard reset now */ + rst = (struct aac_hba_reset_req *)fib->hw_fib_va; +memset (rst,0 ,sizeof (*rst)); +/* reset_type is already zero... */ + rst->it_nexus = aac->hba_map[bus][cid].rmw_nexus; + + address = (u64 )fib->hw_error_pa; + rst->error_ptr_hi =cpu_to_le32 ((u32)(address >>32 )); + rst->error_ptr_lo =cpu_to_le32 + ((u32)(address &0xffffffff )); + rst->error_length =cpu_to_le32 (FW_ERROR_BUFFER_SIZE ); + fib->hbacmd_size =sizeof (*rst); + +return HBA_IU_TYPE_SATA_REQ ; +} +/* * aac_eh_reset - Reset command handling * @scsi_cmd: SCSI command block causing the reset
@@ -840,7 +886,6 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) aac->hba_map[bus][cid].devtype == AAC_DEVTYPE_NATIVE_RAW) {struct fib *fib;int status; -u64 address;u8 command; pr_err("%s: Host adapter reset request. SCSI hang ?\n",
@@ -852,42 +897,14 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)if (aac->hba_map[bus][cid].reset_state ==0 ) { -struct aac_hba_tm_req *tmf; -/* start a HBA_TMF_LUN_RESET TMF request */ - tmf = (struct aac_hba_tm_req *)fib->hw_fib_va; -memset (tmf,0 ,sizeof (*tmf)); - tmf->tmf =HBA_TMF_LUN_RESET ; - tmf->it_nexus = aac->hba_map[bus][cid].rmw_nexus; - tmf->lun[1 ] = cmd->device->lun; - - address = (u64 )fib->hw_error_pa; - tmf->error_ptr_hi =cpu_to_le32 - ((u32)(address >>32 )); - tmf->error_ptr_lo =cpu_to_le32 - ((u32)(address &0xffffffff )); - tmf->error_length =cpu_to_le32 (FW_ERROR_BUFFER_SIZE ); - fib->hbacmd_size =sizeof (*tmf); - - command =HBA_IU_TYPE_SCSI_TM_REQ ; + command =aac_eh_tmf_lun_reset_fib (aac, fib, + bus, cid, + cmd->device->lun); aac->hba_map[bus][cid].reset_state++; }else if (aac->hba_map[bus][cid].reset_state >=1 ) { -struct aac_hba_reset_req *rst; -/* already tried, start a hard reset now */ - rst = (struct aac_hba_reset_req *)fib->hw_fib_va; -memset (rst,0 ,sizeof (*rst)); -/* reset_type is already zero... */ - rst->it_nexus = aac->hba_map[bus][cid].rmw_nexus; - - address = (u64 )fib->hw_error_pa; - rst->error_ptr_hi =cpu_to_le32 ((u32)(address >>32 )); - rst->error_ptr_lo =cpu_to_le32 - ((u32)(address &0xffffffff )); - rst->error_length =cpu_to_le32 (FW_ERROR_BUFFER_SIZE ); - fib->hbacmd_size =sizeof (*rst); - - command =HBA_IU_TYPE_SATA_REQ ; + command =aac_eh_tmf_hard_reset_fib (aac, fib, bus, cid); aac->hba_map[bus][cid].reset_state =0 ; } cmd->SCp.sent_command =0 ;
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 2/47 aacraid: split off host reset
In reply to Hannes ReineckeSplit off the host reset parts of aac_eh_reset() into a separate host reset function.
--- drivers/scsi/aacraid/linit.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-)
drivers/scsi/aacraid/linit.c +22 -11
@@ -874,10 +874,6 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)u32 bus, cid;int ret =FAILED ;int status =0 ; -__le32 supported_options2 =0 ; -bool is_mu_reset; -bool is_ignore_reset; -bool is_doorbell_reset; bus =aac_logical_to_phys (scmd_channel (cmd));
@@ -923,7 +919,7 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) }if (ret ==SUCCESS ) - goto out; +return ret; }else {
@@ -952,8 +948,24 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)dev_err (&aac->pdev->dev,"Adapter health - %d\n" , status); count =get_num_of_incomplete_fibs (aac); -if (count ==0 ) -return SUCCESS ; +return (count ==0 ) ?SUCCESS :FAILED ; +} + +/* +* aac_eh_host_reset - Host reset command handling +* @scsi_cmd: SCSI command block causing the reset +* +*/ +int aac_eh_host_reset (struct scsi_cmnd *cmd) +{ +struct scsi_device * dev = cmd->device; +struct Scsi_Host * host = dev->host; +struct aac_dev * aac = (struct aac_dev *)host->hostdata; +int ret =FAILED ; +__le32 supported_options2 =0 ; +bool is_mu_reset; +bool is_ignore_reset; +bool is_doorbell_reset;/* * Check if reset is supported by the firmware
@@ -972,10 +984,8 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) && (aac_check_reset != -1 || !is_ignore_reset)) {/* Bypass wait for command quiesce */ aac_reset_adapter (aac,2 ,IOP_HWSOFT_RESET ); + ret =SUCCESS ; } - ret =SUCCESS ; - -out:return ret; }
@@ -1399,7 +1409,8 @@ ssize_t aac_get_serial_number(struct device *device, char *buf) .change_queue_depth = aac_change_queue_depth, .sdev_attrs = aac_dev_attrs, .eh_abort_handler = aac_eh_abort, - .eh_host_reset_handler = aac_eh_reset, + .eh_bus_reset_handler = aac_eh_reset, + .eh_host_reset_handler = aac_eh_host_reset, .can_queue = AAC_NUM_IO_FIB, .this_id = MAXIMUM_NUM_CONTAINERS, .sg_tablesize = 16,
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 3/47 aacraid: split off device, target, and bus reset
In reply to Hannes ReineckeSplit off device, target, and bus reset functionality into individual functions.
--- drivers/scsi/aacraid/linit.c | 141 +++++++++++++++++++++++++++++++------------ 1 file changed, 102 insertions(+), 39 deletions(-)
drivers/scsi/aacraid/linit.c +102 -39
@@ -861,68 +861,129 @@ static u8 aac_eh_tmf_hard_reset_fib(struct aac_dev *aac, struct fib *fib, }/* -* aac_eh_reset - Reset command handling +* aac_eh_dev_reset - Device reset command handling * @scsi_cmd: SCSI command block causing the reset * */ -static int aac_eh_reset (struct scsi_cmnd * cmd) +static int aac_eh_dev_reset (struct scsi_cmnd *cmd) {struct scsi_device * dev = cmd->device;struct Scsi_Host * host = dev->host;struct aac_dev * aac = (struct aac_dev *)host->hostdata;int count;u32 bus, cid; +struct fib *fib;int ret =FAILED ; -int status =0 ; - +int status; +u8 command; bus =aac_logical_to_phys (scmd_channel (cmd)); cid =scmd_id (cmd); -if (bus <AAC_MAX_BUSES && cid <AAC_MAX_TARGETS && - aac->hba_map[bus][cid].devtype ==AAC_DEVTYPE_NATIVE_RAW ) { -struct fib *fib; -int status; -u8 command; +if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || + aac->hba_map[bus][cid].devtype !=AAC_DEVTYPE_NATIVE_RAW ) +return FAILED ; -pr_err ("%s: Host adapter reset request. SCSI hang ?\n" , -AAC_DRIVERNAME ); +pr_err ("%s: Host adapter reset request. SCSI hang ?\n" , +AAC_DRIVERNAME ); - fib =aac_fib_alloc (aac); -if (!fib) -return ret; + fib =aac_fib_alloc (aac); +if (!fib) +return ret; -if (aac->hba_map[bus][cid].reset_state ==0 ) { -/* start a HBA_TMF_LUN_RESET TMF request */ - command =aac_eh_tmf_lun_reset_fib (aac, fib, - bus, cid, - cmd->device->lun); - aac->hba_map[bus][cid].reset_state++; - }else if (aac->hba_map[bus][cid].reset_state >=1 ) { -/* already tried, start a hard reset now */ - command =aac_eh_tmf_hard_reset_fib (aac, fib, bus, cid); - aac->hba_map[bus][cid].reset_state =0 ; +/* start a HBA_TMF_LUN_RESET TMF request */ + command =aac_eh_tmf_lun_reset_fib (aac, fib, bus, cid, + cmd->device->lun); + + cmd->SCp.sent_command =0 ; + + status =aac_hba_send (command, fib, + (fib_callback ) aac_hba_callback, + (void *) cmd); + +/* Wait up to 15 seconds for completion */ +for (count =0 ; count <15 ; ++count) { +if (cmd->SCp.sent_command) { + ret =SUCCESS ; +break ; } - cmd->SCp.sent_command =0 ; +msleep (1000 ); + } - status =aac_hba_send (command, fib, - (fib_callback ) aac_hba_callback, - (void *) cmd); +return ret; +} -/* Wait up to 15 seconds for completion */ -for (count =0 ; count <15 ; ++count) { -if (cmd->SCp.sent_command) { - ret =SUCCESS ; -break ; - } -msleep (1000 ); +/* +* aac_eh_target_reset - Target reset command handling +* @scsi_cmd: SCSI command block causing the reset +* +*/ +static int aac_eh_target_reset (struct scsi_cmnd *cmd) +{ +struct scsi_device * dev = cmd->device; +struct Scsi_Host * host = dev->host; +struct aac_dev * aac = (struct aac_dev *)host->hostdata; +int count; +u32 bus, cid; +int ret =FAILED ; +struct fib *fib; +int status; +u8 command; + + bus =aac_logical_to_phys (scmd_channel (cmd)); + cid =scmd_id (cmd); +if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || + aac->hba_map[bus][cid].devtype !=AAC_DEVTYPE_NATIVE_RAW ) +return FAILED ; + +pr_err ("%s: Host adapter reset request. SCSI hang ?\n" , +AAC_DRIVERNAME ); + + fib =aac_fib_alloc (aac); +if (!fib) +return ret; + + +/* already tried, start a hard reset now */ + command =aac_eh_tmf_hard_reset_fib (aac, fib, bus, cid); + + cmd->SCp.sent_command =0 ; + + status =aac_hba_send (command, fib, + (fib_callback ) aac_hba_callback, + (void *) cmd); + +/* Wait up to 15 seconds for completion */ +for (count =0 ; count <15 ; ++count) { +if (cmd->SCp.sent_command) { + ret =SUCCESS ; +break ; } +msleep (1000 ); + } -if (ret ==SUCCESS ) -return ret; +return ret; +} + +/* +* aac_eh_bus_reset - Bus reset command handling +* @scsi_cmd: SCSI command block causing the reset +* +*/ +static int aac_eh_bus_reset (struct scsi_cmnd * cmd) +{ +struct scsi_device * dev = cmd->device; +struct Scsi_Host * host = dev->host; +struct aac_dev * aac = (struct aac_dev *)host->hostdata; +int count; +u32 bus, cid; +int status =0 ; - }else { + bus =aac_logical_to_phys (scmd_channel (cmd)); + cid =scmd_id (cmd); +if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || + aac->hba_map[bus][cid].devtype !=AAC_DEVTYPE_NATIVE_RAW ) {/* Mark the assoc. FIB to not complete, eh handler does this */ for (count = 0; count < (host->can_queue + AAC_NUM_MGT_FIB);
@@ -1409,7 +1470,9 @@ ssize_t aac_get_serial_number(struct device *device, char *buf) .change_queue_depth = aac_change_queue_depth, .sdev_attrs = aac_dev_attrs, .eh_abort_handler = aac_eh_abort, - .eh_bus_reset_handler = aac_eh_reset, + .eh_device_reset_handler = aac_eh_dev_reset, + .eh_target_reset_handler = aac_eh_target_reset, + .eh_bus_reset_handler = aac_eh_bus_reset, .eh_host_reset_handler = aac_eh_host_reset, .can_queue = AAC_NUM_IO_FIB, .this_id = MAXIMUM_NUM_CONTAINERS,
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 4/47 aacraid: use aac_tmf_callback for reset fib
In reply to Hannes ReineckeWhen sending a reset fib we shouldn't rely on the scsi command, but rather set the TMF status in the map_info->reset_state variable. That allows us to send a TMF independent on a scsi command.
--- drivers/scsi/aacraid/linit.c | 96 ++++++++++++++++++++++++++++++++------------ 1 file changed, 71 insertions(+), 25 deletions(-)
drivers/scsi/aacraid/linit.c +71 -25
@@ -814,8 +814,8 @@ static int aac_eh_abort(struct scsi_cmnd* cmd)return ret; } -static u8 aac_eh_tmf_lun_reset_fib (struct aac_dev *aac,struct fib *fib, -int bus,int cid,u64 tmf_lun) +static u8 aac_eh_tmf_lun_reset_fib (struct aac_hba_map_info *info, +struct fib *fib,u64 tmf_lun) {struct aac_hba_tm_req *tmf;u64 address;
@@ -824,7 +824,7 @@ static u8 aac_eh_tmf_lun_reset_fib(struct aac_dev *aac, struct fib *fib, tmf = (struct aac_hba_tm_req *)fib->hw_fib_va;memset (tmf,0 ,sizeof (*tmf)); tmf->tmf =HBA_TMF_LUN_RESET ; - tmf->it_nexus = aac->hba_map[bus][cid].rmw_nexus; + tmf->it_nexus = info->rmw_nexus;int_to_scsilun (tmf_lun, (struct scsi_lun *)tmf->lun); address = (u64 )fib->hw_error_pa;
@@ -838,8 +838,8 @@ static u8 aac_eh_tmf_lun_reset_fib(struct aac_dev *aac, struct fib *fib,return HBA_IU_TYPE_SCSI_TM_REQ ; } -static u8 aac_eh_tmf_hard_reset_fib (struct aac_dev *aac,struct fib *fib, -int bus,int cid) +static u8 aac_eh_tmf_hard_reset_fib (struct aac_hba_map_info *info, +struct fib *fib) {struct aac_hba_reset_req *rst;u64 address;
@@ -847,8 +847,7 @@ static u8 aac_eh_tmf_hard_reset_fib(struct aac_dev *aac, struct fib *fib,/* already tried, start a hard reset now */ rst = (struct aac_hba_reset_req *)fib->hw_fib_va;memset (rst,0 ,sizeof (*rst)); -/* reset_type is already zero... */ - rst->it_nexus = aac->hba_map[bus][cid].rmw_nexus; + rst->it_nexus = info->rmw_nexus; address = (u64 )fib->hw_error_pa; rst->error_ptr_hi =cpu_to_le32 ((u32)(address >>32 ));
@@ -860,6 +859,33 @@ static u8 aac_eh_tmf_hard_reset_fib(struct aac_dev *aac, struct fib *fib,return HBA_IU_TYPE_SATA_REQ ; } +void aac_tmf_callback (void *context,struct fib *fibptr) +{ +struct aac_hba_resp *err = + &((struct aac_native_hba *)fibptr->hw_fib_va)->resp.err; +struct aac_hba_map_info *info = context; +int res; + +switch (err->service_response) { +case HBA_RESP_SVCRES_TMF_REJECTED : + res =-1 ; +break ; +case HBA_RESP_SVCRES_TMF_LUN_INVALID : + res =0 ; +break ; +case HBA_RESP_SVCRES_TMF_COMPLETE : +case HBA_RESP_SVCRES_TMF_SUCCEEDED : + res =0 ; +break ; +default : + res =-2 ; +break ; + } +aac_fib_complete (fibptr); + + info->reset_state = res; +} +/* * aac_eh_dev_reset - Device reset command handling * @scsi_cmd: SCSI command block causing the reset
@@ -870,6 +896,7 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd)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;int count;u32 bus, cid;struct fib *fib;
@@ -879,8 +906,12 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd) bus =aac_logical_to_phys (scmd_channel (cmd)); cid =scmd_id (cmd); + info = &aac->hba_map[bus][cid];if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || - aac->hba_map[bus][cid].devtype !=AAC_DEVTYPE_NATIVE_RAW ) + info->devtype !=AAC_DEVTYPE_NATIVE_RAW ) +return FAILED ; + +if (info->reset_state >0 )return FAILED ; pr_err("%s: Host adapter reset request. SCSI hang ?\n",
@@ -890,21 +921,19 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd)if (!fib)return ret; -/* start a HBA_TMF_LUN_RESET TMF request */ - command =aac_eh_tmf_lun_reset_fib (aac, fib, bus, cid, - cmd->device->lun); + command =aac_eh_tmf_lun_reset_fib (info, fib, dev->lun); - cmd->SCp.sent_command =0 ; + info->reset_state =1 ; status =aac_hba_send (command, fib, - (fib_callback ) aac_hba_callback, - (void *) cmd); + (fib_callback ) aac_tmf_callback, + (void *) info);/* Wait up to 15 seconds for completion */ for (count =0 ; count <15 ; ++count) { -if (cmd->SCp.sent_command) { - ret =SUCCESS ; +if (info->reset_state ==0 ) { + ret = info->reset_state ==0 ?SUCCESS :FAILED ;break ; }msleep (1000 );
@@ -923,6 +952,7 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd)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;int count;u32 bus, cid;int ret =FAILED ;
@@ -932,8 +962,9 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd) bus =aac_logical_to_phys (scmd_channel (cmd)); cid =scmd_id (cmd); + info = &aac->hba_map[bus][cid];if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || - aac->hba_map[bus][cid].devtype !=AAC_DEVTYPE_NATIVE_RAW ) + info->devtype !=AAC_DEVTYPE_NATIVE_RAW )return FAILED ; pr_err("%s: Host adapter reset request. SCSI hang ?\n",
@@ -945,18 +976,18 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd)/* already tried, start a hard reset now */ - command =aac_eh_tmf_hard_reset_fib (aac, fib, bus, cid); + command =aac_eh_tmf_hard_reset_fib (info, fib); - cmd->SCp.sent_command =0 ; + info->reset_state =2 ; status =aac_hba_send (command, fib, - (fib_callback ) aac_hba_callback, - (void *) cmd); + (fib_callback ) aac_tmf_callback, + (void *) info);/* Wait up to 15 seconds for completion */ for (count =0 ; count <15 ; ++count) { -if (cmd->SCp.sent_command) { - ret =SUCCESS ; +if (info->reset_state <=0 ) { + ret = info->reset_state ==0 ?SUCCESS :FAILED ;break ; }msleep (1000 );
@@ -1044,8 +1075,23 @@ int aac_eh_host_reset(struct scsi_cmnd *cmd) && aac_check_reset && (aac_check_reset != -1 || !is_ignore_reset)) {/* Bypass wait for command quiesce */ -aac_reset_adapter (aac,2 ,IOP_HWSOFT_RESET ); - ret =SUCCESS ; +if (aac_reset_adapter (aac,2 ,IOP_HWSOFT_RESET ) ==0 ) + ret =SUCCESS ; + } +/* +* Reset EH state +*/ +if (ret ==SUCCESS ) { +int bus, cid; +struct aac_hba_map_info *info; + +for (bus =0 ; bus <AAC_MAX_BUSES ; bus++) { +for (cid =0 ; cid <AAC_MAX_TARGETS ; cid++) { + info = &aac->hba_map[bus][cid]; +if (info->devtype ==AAC_DEVTYPE_NATIVE_RAW ) + info->reset_state =0 ; + } + } }return ret; }
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 5/47 aacraid: enable sending of TMFs from aac_hba_send()
In reply to Hannes Reineckeaac_hba_send() will return FAILED for any non-SCSI command requests, failing any TMFs. This patch updates the check to allow TMFs.
--- drivers/scsi/aacraid/commsup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/aacraid/commsup.c +1 -1
@@ -770,7 +770,7 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback,/* bit1 of request_id must be 0 */ hbacmd->request_id =cpu_to_le32 ((((u32)(fibptr - dev->fibs)) <<2 ) +1 ); - }else + }else if (command !=HBA_IU_TYPE_SCSI_TM_REQ )return -EINVAL ;
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 6/47 aacraid: add fib flag to mark scsi command callback
In reply to Hannes ReineckeTo correctly identify which fib has a scsi command callback this patch implements a flag FIB_CONTEXT_FLAG_SCSI_CMD.
--- drivers/scsi/aacraid/aacraid.h | 1 + drivers/scsi/aacraid/commsup.c | 1 + 2 files changed, 2 insertions(+)
drivers/scsi/aacraid/aacraid.h +1 -0
@@ -1723,6 +1723,7 @@ struct aac_dev#define FIB_CONTEXT_FLAG_FASTRESP (0x00000008)#define FIB_CONTEXT_FLAG_NATIVE_HBA (0x00000010)#define FIB_CONTEXT_FLAG_NATIVE_HBA_TMF (0x00000020) +#define FIB_CONTEXT_FLAG_SCSI_CMD (0x00000040)/* * Define the command values
drivers/scsi/aacraid/commsup.c +1 -0
@@ -770,6 +770,7 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback,/* bit1 of request_id must be 0 */ hbacmd->request_id =cpu_to_le32 ((((u32)(fibptr - dev->fibs)) <<2 ) +1 ); + fibptr->flags |=FIB_CONTEXT_FLAG_SCSI_CMD ; }else if (command !=HBA_IU_TYPE_SCSI_TM_REQ )return -EINVAL ;
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 7/47 aacraid: complete all commands during bus reset
In reply to Hannes ReineckeWhen issuing a bus reset we should complete all commands, not just the command triggering the reset.
--- drivers/scsi/aacraid/linit.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-)
drivers/scsi/aacraid/linit.c +20 -14
@@ -1007,23 +1007,29 @@ static int aac_eh_bus_reset(struct scsi_cmnd* cmd)struct Scsi_Host * host = dev->host;struct aac_dev * aac = (struct aac_dev *)host->hostdata;int count; -u32 bus, cid; +u32 cmd_bus;int status =0 ; - bus =aac_logical_to_phys (scmd_channel (cmd)); - cid =scmd_id (cmd); -if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || - aac->hba_map[bus][cid].devtype !=AAC_DEVTYPE_NATIVE_RAW ) { -/* 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]; - -if (fib->hw_fib_va->header.XferState && - (fib->flags &FIB_CONTEXT_FLAG ) && - (fib->callback_data == cmd)) { + cmd_bus =aac_logical_to_phys (scmd_channel (cmd)); +/* 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]; + +if (fib->hw_fib_va->header.XferState && + (fib->flags &FIB_CONTEXT_FLAG ) && + (fib->flags &FIB_CONTEXT_FLAG_SCSI_CMD )) { +struct aac_hba_map_info *info; +u32 bus, cid; + + cmd = (struct scsi_cmnd *)fib->callback_data; + bus =aac_logical_to_phys (scmd_channel (cmd)); +if (bus != cmd_bus) +continue ; + cid =scmd_id (cmd); + info = &aac->hba_map[bus][cid]; +if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || + info->devtype !=AAC_DEVTYPE_NATIVE_RAW ) { fib->flags |=FIB_CONTEXT_FLAG_TIMED_OUT ; cmd->SCp.phase =AAC_OWNER_ERROR_HANDLER ; }
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 9/47 zfcp: open-code fc_block_scsi_eh() for host reset
In reply to Hannes ReineckeWhen issuing a host reset we should be waiting for all ports to become unblocked; just waiting for one might be resulting in host reset to return too early.
--- drivers/s390/scsi/zfcp_scsi.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)
drivers/s390/scsi/zfcp_scsi.c +23 -4
@@ -311,13 +311,32 @@ static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt)static int zfcp_scsi_eh_host_reset_handler (struct scsi_cmnd *scpnt) { -struct zfcp_scsi_dev *zfcp_sdev =sdev_to_zfcp (scpnt->device); -struct zfcp_adapter *adapter = zfcp_sdev->port->adapter; -int ret; +struct Scsi_Host *host = scpnt->device->host; +struct zfcp_adapter *adapter = (struct zfcp_adapter *)host->hostdata[0 ]; +int ret =0 ; +unsigned long flags; +struct zfcp_port *port;zfcp_erp_adapter_reopen (adapter,0 ,"schrh_1" );zfcp_erp_wait (adapter); - ret =fc_block_scsi_eh (scpnt); +retry_rport_blocked: +spin_lock_irqsave (host->host_lock, flags); +list_for_each_entry (port, &adapter->port_list, list) { +struct fc_rport *rport = port->rport; + +if (rport->port_state ==FC_PORTSTATE_BLOCKED ) { +if (rport->flags &FC_RPORT_FAST_FAIL_TIMEDOUT ) + ret =FAST_IO_FAIL ; +else + ret =NEEDS_RETRY ; +break ; + } + } +spin_unlock_irqrestore (host->host_lock, flags); +if (ret ==NEEDS_RETRY ) { +msleep (1000 ); + goto retry_rport_blocked; + }if (ret)return ret;
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 8/47 sym53c8xx_2: split off bus reset from host reset
In reply to Hannes ReineckeThe current handler does both, bus reset and host reset. So split them off into two distinct functions.
--- drivers/scsi/sym53c8xx_2/sym_glue.c | 107 ++++++++++++++++++++++-------------- 1 file changed, 66 insertions(+), 41 deletions(-)
drivers/scsi/sym53c8xx_2/sym_glue.c +66 -41
@@ -581,8 +581,6 @@ static void sym53c8xx_timer(unsigned long npref)*/ #define SYM_EH_ABORT 0#define SYM_EH_DEVICE_RESET 1 -#define SYM_EH_BUS_RESET 2 -#define SYM_EH_HOST_RESET 3/* * Generic method for our eh processing.
@@ -602,35 +600,11 @@ static int sym_eh_handler(int op, char *opname, struct scsi_cmnd *cmd)scmd_printk (KERN_WARNING , cmd,"%s operation started\n" , opname); -/* We may be in an error condition because the PCI bus -* went down. In this case, we need to wait until the -* PCI bus is reset, the card is reset, and only then -* proceed with the scsi error recovery. There's no -* point in hurrying; take a leisurely wait. +/* +* Escalate to host reset if the PCI bus went down */ -#define WAIT_FOR_PCI_RECOVERY 35 -if (pci_channel_offline (pdev)) { -int finished_reset =0 ; -init_completion (&eh_done); -spin_lock_irq (shost->host_lock); -/* Make sure we didn't race */ -if (pci_channel_offline (pdev)) { -BUG_ON (sym_data->io_reset); - sym_data->io_reset = &eh_done; - }else { - finished_reset =1 ; - } -spin_unlock_irq (shost->host_lock); -if (!finished_reset) - finished_reset =wait_for_completion_timeout - (sym_data->io_reset, -WAIT_FOR_PCI_RECOVERY *HZ ); -spin_lock_irq (shost->host_lock); - sym_data->io_reset =NULL ; -spin_unlock_irq (shost->host_lock); -if (!finished_reset) -return SCSI_FAILED ; - } +if (pci_channel_offline (pdev)) +return SCSI_FAILED ;spin_lock_irq (shost->host_lock);/* This one is queued in some place -> to wait for completion */
@@ -651,15 +625,6 @@ static int sym_eh_handler(int op, char *opname, struct scsi_cmnd *cmd)case SYM_EH_DEVICE_RESET : sts =sym_reset_scsi_target (np, cmd->device->id);break ; -case SYM_EH_BUS_RESET : -sym_reset_scsi_bus (np,1 ); - sts =0 ; -break ; -case SYM_EH_HOST_RESET : -sym_reset_scsi_bus (np,0 ); -sym_start_up (shost,1 ); - sts =0 ; -break ;default :break ; }
@@ -701,12 +666,72 @@ static int sym53c8xx_eh_device_reset_handler(struct scsi_cmnd *cmd)static int sym53c8xx_eh_bus_reset_handler (struct scsi_cmnd *cmd) { -return sym_eh_handler (SYM_EH_BUS_RESET ,"BUS RESET" , cmd); +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" ); + +/* +* Escalate to host reset if the PCI bus went down +*/ +if (pci_channel_offline (pdev)) +return SCSI_FAILED ; + +spin_lock_irq (shost->host_lock); +sym_reset_scsi_bus (np,1 ); +spin_unlock_irq (shost->host_lock); + +dev_warn (&cmd->device->sdev_gendev,"BUS RESET operation complete.\n" ); +return SCSI_SUCCESS ; }static int sym53c8xx_eh_host_reset_handler (struct scsi_cmnd *cmd) { -return sym_eh_handler (SYM_EH_HOST_RESET ,"HOST RESET" , cmd); +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; +struct completion eh_done; +int finished_reset =1 ; + +shost_printk (KERN_WARNING , shost,"HOST RESET operation started\n" ); + +/* We may be in an error condition because the PCI bus +* went down. In this case, we need to wait until the +* PCI bus is reset, the card is reset, and only then +* proceed with the scsi error recovery. There's no +* point in hurrying; take a leisurely wait. +*/ +#define WAIT_FOR_PCI_RECOVERY 35 +if (pci_channel_offline (pdev)) { +init_completion (&eh_done); +spin_lock_irq (shost->host_lock); +/* Make sure we didn't race */ +if (pci_channel_offline (pdev)) { +BUG_ON (sym_data->io_reset); + sym_data->io_reset = &eh_done; + finished_reset =0 ; + } +spin_unlock_irq (shost->host_lock); +if (!finished_reset) + finished_reset =wait_for_completion_timeout + (sym_data->io_reset, +WAIT_FOR_PCI_RECOVERY *HZ ); +spin_lock_irq (shost->host_lock); + sym_data->io_reset =NULL ; +spin_unlock_irq (shost->host_lock); + } + +if (finished_reset) { +sym_reset_scsi_bus (np,0 ); +sym_start_up (shost,1 ); + } + +shost_printk (KERN_WARNING , shost,"HOST RESET operation %s.\n" , + finished_reset==1 ?"complete" :"failed" ); +return finished_reset ?SCSI_SUCCESS :SCSI_FAILED ; }/*
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 10/47 ips: Do not try to abort command from host reset
In reply to Hannes ReineckeThe code for aborting an outstanding command is a copy of the functionality from command abort. As we already have called this function once we reach host reset there's no point in trying to do so again.
--- drivers/scsi/ips.c | 17 ----------------- 1 file changed, 17 deletions(-)
drivers/scsi/ips.c +0 -17
@@ -865,23 +865,6 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)if (!ha->active)return (FAILED ); -/* See if the command is on the copp queue */ - item = ha->copp_waitlist.head; -while ((item) && (item->scsi_cmd !=SC )) - item = item->next; - -if (item) { -/* Found it */ -ips_removeq_copp (&ha->copp_waitlist, item); -return (SUCCESS ); - } - -/* See if the command is on the wait queue */ -if (ips_removeq_wait (&ha->scb_waitlist,SC )) { -/* command not sent yet */ -return (SUCCESS ); - } -/* An explanation for the casual observer: */ /* Part of the function of a RAID controller is automatic error */ /* detection and recovery. As such, the only problem that physically */
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 11/47 snic: reserve tag for TMF
In reply to Hannes ReineckeRather than re-using the failed command the snic driver should reserve one command for TMFs.
--- drivers/scsi/snic/snic.h | 3 ++- drivers/scsi/snic/snic_main.c | 3 +++ drivers/scsi/snic/snic_scsi.c | 51 ++++++++++++++++++------------------------- 3 files changed, 26 insertions(+), 31 deletions(-)
drivers/scsi/snic/snic.h +2 -1
@@ -310,6 +310,7 @@ struct snic {struct list_head spl_cmd_list;unsigned int max_tag_id; +unsigned int tmf_tag_id;atomic_t ios_inflight;/* io in flight counter */ struct vnic_snic_config config;
@@ -380,7 +381,7 @@ struct snic_global {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 *,struct scsi_cmnd *); +int snic_reset (struct Scsi_Host *);void snic_shutdown_scsi_cleanup (struct snic *);
drivers/scsi/snic/snic_main.c +3 -0
@@ -538,6 +538,9 @@ max_t(u32, SNIC_MIN_IO_REQ, max_ios)); snic->max_tag_id = shost->can_queue; +/* Reserve one reset command */ + shost->can_queue--; + snic->tmf_tag_id = shost->can_queue; shost->max_lun = snic->config.luns_per_tgt; shost->max_id =SNIC_MAX_TARGET ;
drivers/scsi/snic/snic_scsi.c +21 -30
109 lines not on this page · raw message
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 12/47 qla1280: separate out host reset function from qla1280_error_action()
In reply to Hannes ReineckeThere's not much in common between host reset and all other error handlers, so use a separate function here.
--- drivers/scsi/qla1280.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-)
drivers/scsi/qla1280.c +21 -19
@@ -754,7 +754,6 @@ enum action {ABORT_COMMAND ,DEVICE_RESET , BUS_RESET, - ADAPTER_RESET, };
@@ -936,22 +935,9 @@ static void qla1280_mailbox_timeout(unsigned long __data) }break ; -case ADAPTER_RESET :default : -if (qla1280_verbose) { -printk (KERN_INFO -"scsi(%ld): Issued ADAPTER RESET\n" , - ha->host_no); -printk (KERN_INFO "scsi(%ld): I/O processing will " -"continue automatically\n" , ha->host_no); - } - ha->flags.reset_active =1 ; - -if (qla1280_abort_isp (ha) !=0 ) {/* it's dead */ - result =FAILED ; - } - - ha->flags.reset_active =0 ; +dprintk (1 ,"RESET invalid action %d\n" , action); +return FAILED ; }/*
@@ -1050,10 +1036,26 @@ static void qla1280_mailbox_timeout(unsigned long __data) qla1280_eh_adapter_reset(struct scsi_cmnd *cmd) {int rc; +struct Scsi_Host *shost = cmd->device->host; +struct scsi_qla_host *ha = (struct scsi_qla_host *)shost->hostdata; -spin_lock_irq (cmd->device->host->host_lock); - rc =qla1280_error_action (cmd,ADAPTER_RESET ); -spin_unlock_irq (cmd->device->host->host_lock); +spin_lock_irq (shost->host_lock); +if (qla1280_verbose) { +printk (KERN_INFO +"scsi(%ld): Issued ADAPTER RESET\n" , + ha->host_no); +printk (KERN_INFO "scsi(%ld): I/O processing will " +"continue automatically\n" , ha->host_no); + } + ha->flags.reset_active =1 ; + +if (qla1280_abort_isp (ha) !=0 ) {/* it's dead */ + rc =FAILED ; + } + + ha->flags.reset_active =0 ; + +spin_unlock_irq (shost->host_lock);return rc; }
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 13/47 megaraid: pass in NULL scb for host reset
In reply to Hannes ReineckeWhen calling a host reset we shouldn't rely on the command triggering the reset, so allow megaraid_abort_and_reset() to be called with a NULL scb.
And drop the pointless 'bus_reset' and 'target_reset' handlers, which just call the same function as host_reset.
--- drivers/scsi/megaraid.c | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-)
drivers/scsi/megaraid.c +16 -26
@@ -1909,7 +1909,7 @@ static DEF_SCSI_QCMD(megaraid_queue)spin_lock_irq (&adapter->lock); - rval =megaraid_abort_and_reset (adapter, cmd,SCB_RESET ); + rval =megaraid_abort_and_reset (adapter,NULL ,SCB_RESET );/* * This is required here to complete any completed requests
@@ -1948,7 +1948,7 @@ static DEF_SCSI_QCMD(megaraid_queue) scb =list_entry (pos, scb_t, list); -if (scb->cmd == cmd) {/* Found command */ +if (!cmd || scb->cmd == cmd) {/* Found command */ scb->state |= aor;
@@ -1967,31 +1967,23 @@ static DEF_SCSI_QCMD(megaraid_queue)return FAILED ; } -else { - -/* -* Not yet issued! Remove from the pending -* list -*/ -dev_warn (&adapter->dev->dev, -"%s-[%x], driver owner\n" , - (aor==SCB_ABORT ) ?"ABORTING" :"RESET" , - scb->idx); - -mega_free_scb (adapter, scb); - -if ( aor ==SCB_ABORT ) { - cmd->result = (DID_ABORT <<16 ); - } -else { - cmd->result = (DID_RESET <<16 ); - } +/* +* Not yet issued! Remove from the pending +* list +*/ +dev_warn (&adapter->dev->dev, +"%s-[%x], driver owner\n" , + (cmd) ?"ABORTING" :"RESET" , + scb->idx); +mega_free_scb (adapter, scb); +if (cmd) { + cmd->result = (DID_ABORT <<16 );list_add_tail (SCSI_LIST (cmd), - &adapter->completed_list); - -return SUCCESS ; + &adapter->completed_list); } + +return SUCCESS ; } }
@@ -4180,8 +4172,6 @@ static inline void mega_create_proc_entry(int index, struct proc_dir_entry *pare .cmd_per_lun = DEF_CMD_PER_LUN, .use_clustering = ENABLE_CLUSTERING, .eh_abort_handler = megaraid_abort, - .eh_device_reset_handler = megaraid_reset, - .eh_bus_reset_handler = megaraid_reset, .eh_host_reset_handler = megaraid_reset, .no_write_same = 1, };
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 15/47 scsi_transport_fc: Use fc_rport as argument for fc_block_scsi_eh
In reply to Hannes Reineckefc_block_scsi_eh() works on a remote port, so we should be using that as an argument, and not the scsi command.
--- drivers/s390/scsi/zfcp_scsi.c | 6 ++++-- drivers/scsi/bnx2fc/bnx2fc_io.c | 4 ++-- drivers/scsi/csiostor/csio_scsi.c | 4 ++-- drivers/scsi/fnic/fnic_scsi.c | 18 ++++++++++++------ drivers/scsi/ibmvscsi/ibmvfc.c | 9 ++++++--- drivers/scsi/libfc/fc_fcp.c | 5 +++-- drivers/scsi/lpfc/lpfc_scsi.c | 10 +++++++--- drivers/scsi/qla2xxx/qla_os.c | 21 +++++++++++++-------- drivers/scsi/scsi_transport_fc.c | 7 +++---- include/scsi/scsi_transport_fc.h | 2 +- 10 files changed, 53 insertions(+), 33 deletions(-)
drivers/s390/scsi/zfcp_scsi.c +4 -2
@@ -150,6 +150,7 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)struct zfcp_adapter *adapter = (struct zfcp_adapter *) scsi_host->hostdata[0 ];struct zfcp_fsf_req *old_req, *abrt_req; +struct fc_rport *rport =starget_to_rport (scsi_target (scpnt->device));unsigned long flags;unsigned long old_reqid = (unsigned long ) scpnt->host_scribble;int retval =SUCCESS , ret;
@@ -176,7 +177,7 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)break ;zfcp_erp_wait (adapter); - ret =fc_block_scsi_eh (scpnt); + ret =fc_block_scsi_eh (rport);if (ret) {zfcp_dbf_scsi_abort ("abrt_bl" , scpnt,NULL );return ret;
@@ -262,6 +263,7 @@ static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags) {struct zfcp_scsi_dev *zfcp_sdev =sdev_to_zfcp (scpnt->device);struct zfcp_adapter *adapter = zfcp_sdev->port->adapter; +struct fc_port *rport = zfcp_sdev->port->rport;struct zfcp_fsf_req *fsf_req =NULL ;int retval =SUCCESS , ret;int retry =3 ;
@@ -272,7 +274,7 @@ static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags)break ;zfcp_erp_wait (adapter); - ret =fc_block_scsi_eh (scpnt); + ret =fc_block_scsi_eh (rport);if (ret)return ret;
drivers/scsi/bnx2fc/bnx2fc_io.c +2 -2
@@ -691,7 +691,7 @@ static int bnx2fc_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags) } rp = rport->dd_data; - rc =fc_block_scsi_eh (sc_cmd); + rc =fc_block_scsi_eh (rport);if (rc)return rc;
@@ -1119,7 +1119,7 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)struct bnx2fc_rport *tgt;int rc; - rc =fc_block_scsi_eh (sc_cmd); + rc =fc_block_scsi_eh (rport);if (rc)return rc;
drivers/scsi/csiostor/csio_scsi.c +2 -2
@@ -1920,7 +1920,7 @@ static DEVICE_ATTR(dbg_level, S_IRUGO | S_IWUSR, csio_show_dbg_level,int rv;struct csio_rnode *rn = (struct csio_rnode *)(cmnd->device->hostdata); - ret =fc_block_scsi_eh (cmnd); + ret =fc_block_scsi_eh (rn->rport);if (ret)return ret;
@@ -2087,7 +2087,7 @@ static DEVICE_ATTR(dbg_level, S_IRUGO | S_IWUSR, csio_show_dbg_level, }/* Lnode is ready, now wait on rport node readiness */ - ret =fc_block_scsi_eh (cmnd); + ret =fc_block_scsi_eh (rn->rport);if (ret)return ret;
drivers/scsi/fnic/fnic_scsi.c +12 -6
@@ -1818,7 +1818,7 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)spinlock_t *io_lock;unsigned long flags;unsigned long start_time =0 ; -int ret =SUCCESS ; +int ret;u32 task_req =0 ;struct scsi_lun fc_lun;struct fnic_stats *fnic_stats;
@@ -1830,8 +1830,12 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)DECLARE_COMPLETION_ONSTACK (tm_done);/* Wait for rport to unblock */ -fc_block_scsi_eh (sc); + rport =starget_to_rport (scsi_target (sc->device)); + ret =fc_block_scsi_eh (rport); +if (ret) +return ret; + ret =SUCCESS ;/* Get local-port, check ready and link up */ lp =shost_priv (sc->device->host);
@@ -1840,7 +1844,6 @@ int fnic_abort_cmd(struct scsi_cmnd *sc) abts_stats = &fnic->fnic_stats.abts_stats; term_stats = &fnic->fnic_stats.term_stats; - rport =starget_to_rport (scsi_target (sc->device)); tag = sc->request->tag; FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
@@ -2336,7 +2339,7 @@ int fnic_device_reset(struct scsi_cmnd *sc)struct fnic_io_req *io_req =NULL ;struct fc_rport *rport;int status; -int ret =FAILED ; +int ret;spinlock_t *io_lock;unsigned long flags;unsigned long start_time =0 ;
@@ -2349,8 +2352,12 @@ int fnic_device_reset(struct scsi_cmnd *sc)bool new_sc =0 ;/* Wait for rport to unblock */ -fc_block_scsi_eh (sc); + rport =starget_to_rport (scsi_target (sc->device)); + ret =fc_block_scsi_eh (rport); +if (ret) +return ret; + ret =FAILED ;/* Get local-port, check ready and link up */ lp =shost_priv (sc->device->host);
@@ -2360,7 +2367,6 @@ int fnic_device_reset(struct scsi_cmnd *sc)atomic64_inc (&reset_stats->device_resets); - rport =starget_to_rport (scsi_target (sc->device));FNIC_SCSI_DBG (KERN_DEBUG , fnic->lport->host,"Device reset called FCID 0x%x, LUN 0x%llx sc 0x%p\n" , rport->port_id, sc->device->lun, sc);
drivers/scsi/ibmvscsi/ibmvfc.c +6 -3
@@ -2406,11 +2406,12 @@ static int ibmvfc_eh_abort_handler(struct scsi_cmnd *cmd) {struct scsi_device *sdev = cmd->device;struct ibmvfc_host *vhost =shost_priv (sdev->host); +struct fc_rport *rport =starget_to_rport (scsi_target (sdev));int cancel_rc, block_rc;int rc =FAILED ;ENTER ; - block_rc =fc_block_scsi_eh (cmd); + block_rc =fc_block_scsi_eh (rport);ibmvfc_wait_while_resetting (vhost);if (block_rc !=FAST_IO_FAIL ) { cancel_rc =ibmvfc_cancel_all (sdev,IBMVFC_TMF_ABORT_TASK_SET );
@@ -2439,11 +2440,12 @@ static int ibmvfc_eh_device_reset_handler(struct scsi_cmnd *cmd) {struct scsi_device *sdev = cmd->device;struct ibmvfc_host *vhost =shost_priv (sdev->host); +struct fc_rport *rport =starget_to_rport (scsi_target (sdev));int cancel_rc, block_rc, reset_rc =0 ;int rc =FAILED ;ENTER ; - block_rc =fc_block_scsi_eh (cmd); + block_rc =fc_block_scsi_eh (rport);ibmvfc_wait_while_resetting (vhost);if (block_rc !=FAST_IO_FAIL ) { cancel_rc =ibmvfc_cancel_all (sdev,IBMVFC_TMF_LUN_RESET );
@@ -2497,13 +2499,14 @@ static int ibmvfc_eh_target_reset_handler(struct scsi_cmnd *cmd)struct scsi_device *sdev = cmd->device;struct ibmvfc_host *vhost =shost_priv (sdev->host);struct scsi_target *starget =scsi_target (sdev); +struct fc_rport *rport =starget_to_rport (starget);int block_rc;int reset_rc =0 ;int rc =FAILED ;unsigned long cancel_rc =0 ;ENTER ; - block_rc =fc_block_scsi_eh (cmd); + block_rc =fc_block_scsi_eh (rport);ibmvfc_wait_while_resetting (vhost);if (block_rc !=FAST_IO_FAIL ) {starget_for_each_device (starget, &cancel_rc, ibmvfc_dev_cancel_all_reset);
drivers/scsi/libfc/fc_fcp.c +3 -2
@@ -2118,11 +2118,12 @@ int fc_eh_abort(struct scsi_cmnd *sc_cmd)struct fc_fcp_pkt *fsp;struct fc_lport *lport;struct fc_fcp_internal *si; +struct fc_rport *rport =starget_to_rport (scsi_target (sc_cmd->device));int rc =FAILED ;unsigned long flags;int rval; - rval =fc_block_scsi_eh (sc_cmd); + rval =fc_block_scsi_eh (rport);if (rval)return rval;
@@ -2174,7 +2175,7 @@ int fc_eh_device_reset(struct scsi_cmnd *sc_cmd)int rc =FAILED ;int rval; - rval =fc_block_scsi_eh (sc_cmd); + rval =fc_block_scsi_eh (rport);if (rval)return rval;
drivers/scsi/lpfc/lpfc_scsi.c +7 -3
@@ -4696,6 +4696,7 @@ void lpfc_poll_timeout(unsigned long ptr)struct lpfc_iocbq *iocb;struct lpfc_iocbq *abtsiocb;struct lpfc_scsi_buf *lpfc_cmd; +struct fc_rport *rport =starget_to_rport (scsi_target (cmnd->device));IOCB_t *cmd, *icmd;int ret =SUCCESS , status =0 ;struct lpfc_sli_ring *pring_s4;
@@ -4703,7 +4704,7 @@ void lpfc_poll_timeout(unsigned long ptr)unsigned long flags, iflags;DECLARE_WAIT_QUEUE_HEAD_ONSTACK (waitq); - status =fc_block_scsi_eh (cmnd); + status =fc_block_scsi_eh (rport);if (status !=0 && status !=SUCCESS )return status;
@@ -5166,6 +5167,7 @@ void lpfc_poll_timeout(unsigned long ptr)unsigned tgt_id = cmnd->device->id;uint64_t lun_id = cmnd->device->lun;struct lpfc_scsi_event_header scsi_event; +struct fc_rport *rport =starget_to_rport (scsi_target (cmnd->device));int status; rdata =lpfc_rport_data_from_scsi_device (cmnd->device);
@@ -5176,7 +5178,7 @@ void lpfc_poll_timeout(unsigned long ptr)return FAILED ; } pnode = rdata->pnode; - status =fc_block_scsi_eh (cmnd); + status =fc_block_scsi_eh (rport);if (status !=0 && status !=SUCCESS )return status;
@@ -5237,6 +5239,7 @@ void lpfc_poll_timeout(unsigned long ptr)unsigned tgt_id = cmnd->device->id;uint64_t lun_id = cmnd->device->lun;struct lpfc_scsi_event_header scsi_event; +struct fc_rport *rport =starget_to_rport (scsi_target (cmnd->device));int status; rdata =lpfc_rport_data_from_scsi_device (cmnd->device);
@@ -5246,7 +5249,7 @@ void lpfc_poll_timeout(unsigned long ptr)return FAILED ; } pnode = rdata->pnode; - status =fc_block_scsi_eh (cmnd); + status =fc_block_scsi_eh (rport);if (status !=0 && status !=SUCCESS )return status;
@@ -5294,6 +5297,7 @@ void lpfc_poll_timeout(unsigned long ptr) }/** +_scsi_eh * lpfc_host_reset_handler - scsi_host_template eh_host_reset_handler entry pt * @cmnd: Pointer to scsi_cmnd data structure. *
drivers/scsi/qla2xxx/qla_os.c +13 -8
@@ -1247,6 +1247,7 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha) qla2xxx_eh_abort(struct scsi_cmnd *cmd) {scsi_qla_host_t *vha =shost_priv (cmd->device->host); +struct fc_rport *rport =starget_to_rport (scsi_target (cmd->device));srb_t *sp;int ret;unsigned int id;
@@ -1263,7 +1264,7 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha)if (!CMD_SP (cmd))return SUCCESS ; - ret =fc_block_scsi_eh (cmd); + ret =fc_block_scsi_eh (rport);if (ret !=0 )return ret; ret =SUCCESS ;
@@ -1394,9 +1395,11 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha)return FAILED ; } - err =fc_block_scsi_eh (cmd); -if (err !=0 ) -return err; +if (fcport->rport) { + err =fc_block_scsi_eh (fcport->rport); +if (err !=0 ) +return err; + } ql_log(ql_log_info, vha, 0x8009, "%s RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", name, vha->host_no,
@@ -1507,10 +1510,12 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha)return ret; } - ret =fc_block_scsi_eh (cmd); -if (ret !=0 ) -return ret; - ret =FAILED ; +if (fcport->rport) { + ret =fc_block_scsi_eh (fcport->rport); +if (ret !=0 ) +return ret; + ret =FAILED ; + }ql_log (ql_log_info, vha,0x8012 ,"BUS RESET ISSUED nexus=%ld:%d:%llu.\n" , vha->host_no, id, lun);
drivers/scsi/scsi_transport_fc.c +3 -4
@@ -3273,7 +3273,7 @@ struct fc_rport */** * fc_block_scsi_eh - Block SCSI eh thread for blocked fc_rport -* @cmnd: SCSI command that scsi_eh is trying to recover +* @rport: remote port to be checked * * This routine can be called from a FC LLD scsi_eh callback. It * blocks the scsi_eh thread until the fc_rport leaves the
@@ -3285,10 +3285,9 @@ struct fc_rport ** FAST_IO_FAIL if the fast_io_fail_tmo fired, this should be * passed back to scsi_eh. */ -int fc_block_scsi_eh (struct scsi_cmnd *cmnd) +int fc_block_scsi_eh (struct fc_rport *rport) { -struct Scsi_Host *shost = cmnd->device->host; -struct fc_rport *rport =starget_to_rport (scsi_target (cmnd->device)); +struct Scsi_Host *shost =rport_to_shost (rport);unsigned long flags;spin_lock_irqsave (shost->host_lock, flags);
include/scsi/scsi_transport_fc.h +1 -1
@@ -804,7 +804,7 @@ void fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,struct fc_vport *fc_vport_create (struct Scsi_Host *shost,int channel,struct fc_vport_identifiers *);int fc_vport_terminate (struct fc_vport *vport); -int fc_block_scsi_eh (struct scsi_cmnd *cmnd); +int fc_block_scsi_eh (struct fc_rport *rport);enum blk_eh_timer_return fc_eh_timed_out (struct scsi_cmnd *scmd);static inline struct Scsi_Host *fc_bsg_to_shost (struct bsg_job *job)
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 16/47 mptfc: simplify mpt_fc_block_error_handler()
In reply to Hannes ReineckeInstead of passing the a function we can as well return a status and call the function directly afterwards.
--- drivers/message/fusion/mptfc.c | 83 +++++++++++++++++++++++++++--------------- 1 file changed, 54 insertions(+), 29 deletions(-)
drivers/message/fusion/mptfc.c +54 -29
@@ -184,73 +184,98 @@ };static int -mptfc_block_error_handler (struct scsi_cmnd *SCpnt, -int (*func)(struct scsi_cmnd *SCpnt), -const char *caller) +mptfc_block_error_handler (struct fc_rport *rport) {MPT_SCSI_HOST *hd; -struct scsi_device *sdev = SCpnt->device; -struct Scsi_Host *shost = sdev->host; -struct fc_rport *rport =starget_to_rport (scsi_target (sdev)); +struct Scsi_Host *shost =rport_to_shost (rport);unsigned long flags;int ready; -MPT_ADAPTER *ioc; +MPT_ADAPTER *ioc;int loops =40 ;/* seconds */ - hd =shost_priv (SCpnt->device->host); + hd =shost_priv (shost); ioc = hd->ioc;spin_lock_irqsave (shost->host_lock, flags);while ((ready =fc_remote_port_chkready (rport) >>16 ) ==DID_IMM_RETRY || (loops >0 && ioc->active ==0 )) {spin_unlock_irqrestore (shost->host_lock, flags);dfcprintk (ioc,printk (MYIOC_s_DEBUG_FMT -"mptfc_block_error_handler.%d: %d:%llu, port status is " -"%x, active flag %d, deferring %s recovery.\n" , +"mptfc_block_error_handler.%d: %s, port status is " +"%x, active flag %d, deferring recovery.\n" , ioc->name, ioc->sh->host_no, - SCpnt->device->id, SCpnt->device->lun, - ready, ioc->active, caller)); +dev_name (&rport->dev), ready, ioc->active));msleep (1000 );spin_lock_irqsave (shost->host_lock, flags); loops --; }spin_unlock_irqrestore (shost->host_lock, flags); -if (ready ==DID_NO_CONNECT || !SCpnt->device->hostdata - || ioc->active ==0 ) { +if (ready ==DID_NO_CONNECT || ioc->active ==0 ) {dfcprintk (ioc,printk (MYIOC_s_DEBUG_FMT -"%s.%d: %d:%llu, failing recovery, " -"port state %x, active %d, vdevice %p.\n" , caller, +"mpt_block_error_handler.%d: %s, failing recovery, " +"port state %x, active %d.\n" , ioc->name, ioc->sh->host_no, - SCpnt->device->id, SCpnt->device->lun, ready, - ioc->active, SCpnt->device->hostdata)); +dev_name (&rport->dev), ready, ioc->active));return FAILED ; } -dfcprintk (ioc,printk (MYIOC_s_DEBUG_FMT -"%s.%d: %d:%llu, executing recovery.\n" , caller, - ioc->name, ioc->sh->host_no, - SCpnt->device->id, SCpnt->device->lun)); -return (*func)(SCpnt); +return SUCCESS ; }static int mptfc_abort (struct scsi_cmnd *SCpnt) { -return -mptfc_block_error_handler (SCpnt, mptscsih_abort, __func__); +struct Scsi_Host *shost = SCpnt->device->host; +struct fc_rport *rport =starget_to_rport (scsi_target (SCpnt->device)); +MPT_SCSI_HOST __maybe_unused *hd =shost_priv (shost); +int rtn; + + rtn =mptfc_block_error_handler (rport); +if (rtn ==SUCCESS ) { +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_abort (SCpnt); + } +return rtn; }static int mptfc_dev_reset (struct scsi_cmnd *SCpnt) { -return -mptfc_block_error_handler (SCpnt, mptscsih_dev_reset, __func__); +struct Scsi_Host *shost = SCpnt->device->host; +struct fc_rport *rport =starget_to_rport (scsi_target (SCpnt->device)); +MPT_SCSI_HOST __maybe_unused *hd =shost_priv (shost); +int rtn; + + rtn =mptfc_block_error_handler (rport); +if (rtn ==SUCCESS ) { +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); + } +return rtn; }static int mptfc_bus_reset (struct scsi_cmnd *SCpnt) { -return -mptfc_block_error_handler (SCpnt, mptscsih_bus_reset, __func__); +struct Scsi_Host *shost = SCpnt->device->host; +struct fc_rport *rport =starget_to_rport (scsi_target (SCpnt->device)); +MPT_SCSI_HOST *hd =shost_priv (shost); +int rtn; + + rtn =mptfc_block_error_handler (rport); +if (rtn ==SUCCESS ) { +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); + } +return rtn; } static void
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 18/47 mptfc: open-code mptfc_block_error_handler() for bus reset
In reply to Hannes ReineckeWhen calling bus_reset we have potentially several ports to be reset, so this patch open-codes the existing mptfc_block_error_handler() to wait for all ports attached to this bus.
--- drivers/message/fusion/mptfc.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/message/fusion/mptfc.c +14 -3
@@ -263,12 +263,23 @@ mptfc_bus_reset(struct scsi_cmnd *SCpnt) {struct Scsi_Host *shost = SCpnt->device->host; -struct fc_rport *rport =starget_to_rport (scsi_target (SCpnt->device));MPT_SCSI_HOST *hd =shost_priv (shost); +int channel = SCpnt->device->channel; +struct mptfc_rport_info *ri;int rtn; - rtn =mptfc_block_error_handler (rport); -if (rtn ==SUCCESS ) { +list_for_each_entry (ri, &hd->ioc->fc_rports, list) { +if (ri->flags &MPT_RPORT_INFO_FLAGS_REGISTERED ) { +VirtTarget *vtarget = ri->starget->hostdata; + +if (!vtarget || vtarget->channel != channel) +continue ; + rtn =fc_block_scsi_eh (ri->rport); +if (rtn !=0 ) +break ; + } + } +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,
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 20/47 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.txt | 2 +- Documentation/scsi/scsi_mid_low_api.txt | 5 ++-- drivers/message/fusion/mptfc.c | 13 ++++------- drivers/message/fusion/mptscsih.c | 21 +++++++---------- drivers/message/fusion/mptscsih.h | 2 +- drivers/scsi/a100u2w.c | 4 ++-- drivers/scsi/aacraid/linit.c | 11 ++++----- 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 | 9 +++---- drivers/scsi/arm/fas216.c | 9 +++---- drivers/scsi/arm/fas216.h | 5 ++-- drivers/scsi/dc395x.c | 25 ++++++++++---------- drivers/scsi/dpt_i2o.c | 9 +++---- drivers/scsi/dpti.h | 2 +- drivers/scsi/esas2r/esas2r.h | 2 +- drivers/scsi/esas2r/esas2r_main.c | 4 +--- drivers/scsi/esp_scsi.c | 4 ++-- drivers/scsi/gdth.c | 16 ++++--------- drivers/scsi/initio.c | 11 +++++---- drivers/scsi/ncr53c8xx.c | 4 ++-- drivers/scsi/pcmcia/nsp_cs.c | 6 ++--- drivers/scsi/pmcraid.c | 7 +++--- drivers/scsi/qla1280.c | 10 ++++---- drivers/scsi/qla2xxx/qla_os.c | 29 +++++------------------ drivers/scsi/scsi_debug.c | 31 +++++++++---------------- drivers/scsi/scsi_error.c | 2 +- drivers/scsi/sym53c8xx_2/sym_glue.c | 7 +++--- drivers/scsi/vmw_pvscsi.c | 5 ++-- drivers/scsi/wd719x.c | 11 +++++---- drivers/staging/unisys/visorhba/visorhba_main.c | 24 ++++++++++--------- drivers/usb/storage/scsiglue.c | 4 ++-- include/scsi/scsi_host.h | 2 +- 34 files changed, 139 insertions(+), 177 deletions(-)
Documentation/scsi/scsi_eh.txt +1 -1
@@ -207,7 +207,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 *, 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.txt +3 -2
@@ -855,7 +855,8 @@ Details: /** * eh_bus_reset_handler - issue SCSI bus reset - * @scp: SCSI bus that contains this device should be reset + * @shost: SCSI host that contains the bus which should be reset + * @channel: Number of the SCSI bus which should be reset * * Returns SUCCESS if command aborted else FAILED *
@@ -868,7 +869,7 @@ Details: * * Optionally defined in: LLD **/ - int eh_bus_reset_handler(struct scsi_cmnd * scp) + int eh_bus_reset_handler(struct Scsi_Host * shost, int channel) /**
drivers/message/fusion/mptfc.c +5 -8
@@ -103,7 +103,7 @@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,int channel);static struct scsi_host_template mptfc_driver_template = { .module =THIS_MODULE ,
@@ -260,11 +260,9 @@ }static int -mptfc_bus_reset (struct scsi_cmnd *SCpnt) +mptfc_bus_reset (struct Scsi_Host *shost,int channel) { -struct Scsi_Host *shost = SCpnt->device->host;MPT_SCSI_HOST *hd =shost_priv (shost); -int channel = SCpnt->device->channel;struct mptfc_rport_info *ri;int rtn;
@@ -281,10 +279,9 @@ }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 +8 -13
@@ -1912,39 +1912,34 @@ int mptscsih_show_info(struct seq_file *m, struct Scsi_Host *host)* Returns SUCCESS or FAILED. **/ int -mptscsih_bus_reset (struct scsi_cmnd * SCpnt) +mptscsih_bus_reset (struct Scsi_Host * shost,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_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel,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 *,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 +2 -2
@@ -956,10 +956,10 @@ static int inia100_abort(struct scsi_cmnd * cmd)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,int channel) {/* I need Host Control Block Information */ struct orc_host *host; - host = (struct orc_host *) cmd->device->host->hostdata; + host = (struct orc_host *) shost->hostdata;return orc_reset_scsi_bus (host); }
drivers/scsi/aacraid/linit.c +5 -6
@@ -998,20 +998,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,int channel) { -struct scsi_device * dev = cmd->device; -struct Scsi_Host * host = dev->host;struct aac_dev * aac = (struct aac_dev *)host->hostdata;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];
@@ -1019,6 +1017,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/aha1542.c +2 -2
@@ -910,9 +910,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,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
@@ -877,21 +877,21 @@ static DEF_SCSI_QCMD(ahd_linux_queue)* Reset the SCSI bus. */ static int -ahd_linux_bus_reset (struct scsi_cmnd *cmd) +ahd_linux_bus_reset (struct Scsi_Host *shost,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 %d\n" , +ahd_name (ahd), channel);#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
@@ -769,16 +769,16 @@ static DEF_SCSI_QCMD(ahc_linux_queue)* Reset the SCSI bus. */ static int -ahc_linux_bus_reset (struct scsi_cmnd *cmd) +ahc_linux_bus_reset (struct Scsi_Host *shost,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 +5 -4
@@ -83,7 +83,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 *,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);
@@ -3726,14 +3726,15 @@ 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,int channel) {struct AdapterControlBlock *acb;uint32_t intmask_org, outbound_doorbell;int retry_count =0 ;int rtn =FAILED ; - acb = (struct AdapterControlBlock *) cmd->device->host->hostdata; -printk (KERN_ERR "arcmsr: executing bus reset eh.....num_resets = %d, num_aborts = %d \n" , acb->num_resets, acb->num_aborts); + acb = (struct AdapterControlBlock *) shost->hostdata; +printk (KERN_ERR "arcmsr: executing bus reset eh.....num_resets = %d, " +"num_aborts = %d \n" , acb->num_resets, acb->num_aborts); acb->num_resets++;switch (acb->adapter_type){
drivers/scsi/arm/fas216.c +5 -4
@@ -2544,15 +2544,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,int channel) { -FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; +FAS216_Info *info = (FAS216_Info *)shost->hostdata;unsigned long flags;struct scsi_device *SDpnt;
drivers/scsi/arm/fas216.h +3 -2
@@ -378,10 +378,11 @@/* 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,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 -13
@@ -1296,19 +1296,18 @@ static void reset_dev_param(struct AdapterCtlBlk *acb)* @cmd - some command for this host (for fetching hooks) * 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,int channel) {struct AdapterCtlBlk *acb = - (struct AdapterCtlBlk *)cmd->device->host->hostdata; + (struct AdapterCtlBlk *)shost->hostdata;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 );
@@ -1324,7 +1323,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 );
@@ -1334,7 +1333,7 @@ static int __dc395x_eh_bus_reset(struct scsi_cmnd *cmd)set_basic_config (acb);reset_dev_param (acb); -doing_srb_done (acb,DID_RESET , cmd,0 ); +doing_srb_done (acb,DID_RESET ,NULL ,0 ); acb->active_dcb =NULL ; acb->acb_flag =0 ;/* RESET_DETECT, RESET_DONE ,RESET_DEV */ waiting_process_next (acb);
@@ -1342,13 +1341,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,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; }
@@ -3520,7 +3519,7 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,/* abort all cmds in our queues */ static void doing_srb_done (struct AdapterCtlBlk *acb,u8 did_flag, -struct scsi_cmnd *cmd,u8 force) +struct scsi_cmnd *cmd,u8 force) {struct DeviceCtlBlk *dcb;dprintkl (KERN_INFO ,"doing_srb_done: pids " );
@@ -3574,7 +3573,7 @@ static void doing_srb_done(struct AdapterCtlBlk *acb, u8 did_flag, p->result = result;pci_unmap_srb_sense (acb, srb);pci_unmap_srb (acb, srb); -if (force) { +if (force && cmd) {/* For new EH, we normally don't need to give commands back, * as they all complete or all time out */ cmd->scsi_done (cmd);
drivers/scsi/dpt_i2o.c +5 -4
@@ -769,17 +769,18 @@ static int adpt_device_reset(struct scsi_cmnd* cmd)#define I2O_HBA_BUS_RESET 0x87// This version of bus reset is called by the eh_error handler -static int adpt_bus_reset (struct scsi_cmnd * cmd) +static int adpt_bus_reset (struct Scsi_Host *shost,int channel) {adpt_hba * pHba;u32 msg[4 ];u32 rcode; - pHba = (adpt_hba *)cmd->device->host->hostdata[0 ]; + pHba = (adpt_hba *)shost->hostdata[0 ];memset (msg,0 ,sizeof (msg)); -printk (KERN_WARNING "%s: Bus reset: SCSI Bus %d: tid: %d\n" ,pHba->name, cmd->device->channel,pHba->channel[cmd->device->channel].tid ); +printk (KERN_WARNING "%s: Bus reset: SCSI Bus %d: tid: %d\n" , + pHba->name, channel, pHba->channel[channel].tid ); msg[0 ] =FOUR_WORD_MSG_SIZE |SGL_OFFSET_0 ; - msg[1 ] = (I2O_HBA_BUS_RESET <<24 |HOST_TID <<12 |pHba->channel[cmd->device->channel].tid); + msg[1 ] = (I2O_HBA_BUS_RESET <<24 |HOST_TID <<12 |pHba->channel[channel].tid); msg[2 ] =0 ; msg[3 ] =0 ;if (pHba->host)
drivers/scsi/dpti.h +1 -1
@@ -39,7 +39,7 @@static int adpt_bios_param (struct scsi_device * sdev,struct block_device *dev,sector_t ,int geom[]); -static int adpt_bus_reset (struct scsi_cmnd * cmd); +static int adpt_bus_reset (struct Scsi_Host * shost,int channel);static int adpt_device_reset (struct scsi_cmnd * cmd);
drivers/scsi/esas2r/esas2r.h +1 -1
@@ -978,7 +978,7 @@ u8 handle_hba_ioctl(struct esas2r_adapter *a,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,int channel);int esas2r_target_reset (struct scsi_cmnd *cmd);/* Internal functions */
drivers/scsi/esas2r/esas2r_main.c +1 -3
@@ -1157,10 +1157,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,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 +2 -2
@@ -2619,9 +2619,9 @@ 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,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/gdth.c +4 -12
@@ -3911,9 +3911,9 @@ static enum blk_eh_timer_return gdth_timed_out(struct scsi_cmnd *scp) } -static int gdth_eh_bus_reset (Scsi_Cmnd *scp) +static int gdth_eh_bus_reset (struct Scsi_Host *sh,int channel) { -gdth_ha_str *ha =shost_priv (scp->device->host); +gdth_ha_str *ha =shost_priv (sh);int i;unsigned long flags;Scsi_Cmnd *cmnd;
@@ -3921,7 +3921,7 @@ static int gdth_eh_bus_reset(Scsi_Cmnd *scp)TRACE2 (("gdth_eh_bus_reset()\n" )); - b = scp->device->channel; + b = channel;/* clear command tab */ spin_lock_irqsave (&ha->smp_lock, flags);
@@ -4467,7 +4467,6 @@ static int ioc_rescan(void __user *arg, char *cmnd)static int gdth_ioctl (struct file *filep,unsigned int cmd,unsigned long arg) {gdth_ha_str *ha; -Scsi_Cmnd *scp;unsigned long flags;char cmnd[MAX_COMMAND_SIZE ];void __user *argp = (void __user *)arg;
@@ -4588,15 +4587,8 @@ static int gdth_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) (NULL == (ha = gdth_find_ha(res.ionode))))return -EFAULT ; - scp =kzalloc (sizeof (*scp),GFP_KERNEL ); -if (!scp) -return -ENOMEM ; - scp->device = ha->sdev; - scp->cmd_len =12 ; - scp->device->channel = res.number; - rval =gdth_eh_bus_reset (scp); + rval =gdth_eh_bus_reset (ha->shost, res.number); res.status = (rval ==SUCCESS ?S_OK :S_GENERR ); -kfree (scp);if (copy_to_user (argp, &res,sizeof (gdth_ioctl_reset)))return -EFAULT ;
drivers/scsi/initio.c +6 -5
@@ -2644,20 +2644,21 @@ 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,int channel) {struct initio_host *host; - host = (struct initio_host *) cmnd->device->host->hostdata; + host = (struct initio_host *) shost->hostdata; -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/ncr53c8xx.c +2 -2
@@ -8109,9 +8109,9 @@ static void ncr53c8xx_timeout(unsigned long npref)ncr_flush_done_cmds (done_list); } -static int ncr53c8xx_bus_reset (struct scsi_cmnd *cmd) +static int ncr53c8xx_bus_reset (struct Scsi_Host *host,int channel) { -struct ncb *np = ((struct host_data *) cmd->device->host->hostdata)->ncb; +struct ncb *np = ((struct host_data *) host->hostdata)->ncb;int sts;unsigned long flags;struct scsi_cmnd *done_list;
drivers/scsi/pcmcia/nsp_cs.c +3 -3
@@ -1476,11 +1476,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,int channel) { -nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; +nsp_hw_data *data = (nsp_hw_data *)host->hostdata; -nsp_dbg (NSP_DEBUG_BUSRESET ,"SCpnt=0x%p" , SCpnt); +nsp_dbg (NSP_DEBUG_BUSRESET ,"channel=0x%d" , channel);return nsp_bus_reset (data); }
drivers/scsi/pmcraid.c +3 -4
@@ -3068,9 +3068,8 @@ 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,int channel) { -struct Scsi_Host *host = scmd->device->host;struct pmcraid_instance *pinstance = (struct pmcraid_instance *)host->hostdata;struct pmcraid_resource_entry *res =NULL ;
@@ -3084,11 +3083,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 +6 -4
@@ -1017,13 +1017,15 @@ static void qla1280_mailbox_timeout(unsigned long __data)* Reset the specified bus. **************************************************************************/ static int -qla1280_eh_bus_reset (struct scsi_cmnd *cmd) +qla1280_eh_bus_reset (struct Scsi_Host *shost,int bus) {int rc; +struct scsi_qla_host *ha = (struct scsi_qla_host *)shost->hostdata; -spin_lock_irq (cmd->device->host->host_lock); - rc =qla1280_error_action (cmd,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; }
drivers/scsi/qla2xxx/qla_os.c +6 -23
@@ -274,7 +274,7 @@static int qla2xxx_eh_abort (struct scsi_cmnd *);static int qla2xxx_eh_device_reset (struct scsi_cmnd *);static int qla2xxx_eh_target_reset (struct scsi_cmnd *); -static int qla2xxx_eh_bus_reset (struct scsi_cmnd *); +static int qla2xxx_eh_bus_reset (struct Scsi_Host *,int );static int qla2xxx_eh_host_reset (struct Scsi_Host *);static void qla2x00_clear_drv_active (struct qla_hw_data *);
@@ -1488,13 +1488,10 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha)* **************************************************************************/ static int -qla2xxx_eh_bus_reset (struct scsi_cmnd *cmd) +qla2xxx_eh_bus_reset (struct Scsi_Host *shost,int channel) { -scsi_qla_host_t *vha =shost_priv (cmd->device->host); -fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; +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)) {
@@ -1503,22 +1500,8 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha)return FAILED ; } - id = cmd->device->id; - lun = cmd->device->lun; - -if (!fcport) { -return ret; - } - -if (fcport->rport) { - ret =fc_block_scsi_eh (fcport->rport); -if (ret !=0 ) -return ret; - ret =FAILED ; - } -ql_log (ql_log_info, vha,0x8012 , -"BUS RESET ISSUED nexus=%ld:%d:%llu.\n" , vha->host_no, id, lun); +"BUS RESET ISSUED channel=%ld:%d.\n" , vha->host_no, channel);if (qla2x00_wait_for_hba_online (vha) !=QLA_SUCCESS ) { ql_log(ql_log_fatal, vha, 0x8013,
@@ -1542,8 +1525,8 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha) 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:%d.\n" , + (ret ==FAILED ) ?"FAILED" :"SUCCEEDED" , vha->host_no, channel);return ret; }
drivers/scsi/scsi_debug.c +11 -20
@@ -3845,36 +3845,27 @@ 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,int channel) { -struct sdebug_host_info *sdbg_host; +struct sdebug_host_info *sdbg_host = + *(struct sdebug_host_info **)shost_priv (hp);struct sdebug_dev_info *devip; -struct scsi_device * sdp; -struct Scsi_Host * hp;int k =0 ; ++num_bus_resets; -if (!(SCpnt && SCpnt->device)) - goto lie; - sdp = SCpnt->device;if (SDEBUG_OPT_ALL_NOISE & sdebug_opts) -sdev_printk (KERN_INFO , sdp,"%s\n" , __func__); - hp = sdp->host; -if (hp) { - sdbg_host = *(struct sdebug_host_info **)shost_priv (hp); -if (sdbg_host) { -list_for_each_entry (devip, - &sdbg_host->dev_info_list, - dev_list) { -set_bit (SDEBUG_UA_BUS_RESET , devip->uas_bm); - ++k; - } +shost_printk (KERN_INFO , hp,"%s\n" , __func__); +if (sdbg_host) { +list_for_each_entry (devip, + &sdbg_host->dev_info_list, + dev_list) { +set_bit (SDEBUG_UA_BUS_RESET , devip->uas_bm); + ++k; } }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); -lie:return SUCCESS ; }
drivers/scsi/scsi_error.c +1 -1
@@ -775,7 +775,7 @@ static int 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)
drivers/scsi/sym53c8xx_2/sym_glue.c +3 -4
@@ -664,14 +664,13 @@ static int sym53c8xx_eh_device_reset_handler(struct scsi_cmnd *cmd)return sym_eh_handler (SYM_EH_DEVICE_RESET ,"DEVICE RESET" , cmd); } -static int sym53c8xx_eh_bus_reset_handler (struct scsi_cmnd *cmd) +static int sym53c8xx_eh_bus_reset_handler (struct Scsi_Host *shost,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
@@ -683,7 +682,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
@@ -926,13 +926,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,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
@@ -481,11 +481,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);dev_info (&wd->pdev->dev,"%s reset requested\n" , (opcode ==WD719X_CMD_BUSRESET ) ?"bus" :"device" );
@@ -502,12 +502,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,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/staging/unisys/visorhba/visorhba_main.c +13 -11
@@ -101,6 +101,10 @@ struct visorhba_devices_open {struct visorhba_devdata *devdata; }; +#define for_each_vbus_match (iter, list, match) \ + for (iter = &list->head; iter->next; iter = iter->next) \ + if ((iter->channel == match->channel)) +/* * visor_thread_start - starts a thread for the device * @threadfn: Function the thread starts
@@ -413,25 +417,23 @@ static int visorhba_device_reset_handler(struct scsi_cmnd *scsicmd)* * Returns SUCCESS */ -static int visorhba_bus_reset_handler (struct scsi_cmnd *scsicmd) +static int visorhba_bus_reset_handler (struct Scsi_Host *scsihost,int channel) { -struct scsi_device *scsidev; +struct scsi_device *scsidev =NULL , *tmp;struct visordisk_info *vdisk; -int rtn; +int rtn =SUCCESS ; - scsidev = scsicmd->device; -shost_for_each_device (scsidev, scsidev->host) { - vdisk = scsidev->hostdata; +shost_for_each_device (tmp, scsihost) { + vdisk = tmp->hostdata;if (atomic_read (&vdisk->error_count) <VISORHBA_ERROR_COUNT )atomic_inc (&vdisk->error_count);else atomic_set (&vdisk->ios_threshold,IOS_ERROR_THRESHOLD ); +if (!scsidev) + scsidev = tmp; } - rtn =forward_taskmgmt_command (TASK_MGMT_BUS_RESET , scsidev); -if (rtn ==SUCCESS ) { - scsicmd->result =DID_RESET <<16 ; - scsicmd->scsi_done (scsicmd); - } +if (scsidev) + rtn =forward_taskmgmt_command (TASK_MGMT_BUS_RESET , scsidev);return rtn; }
drivers/usb/storage/scsiglue.c +2 -2
@@ -465,9 +465,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,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_host.h +1 -1
@@ -147,7 +147,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 *,int );int (* eh_host_reset_handler)(struct Scsi_Host *);/*
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 21/47 libiscsi: use cls_session as argument for target and session reset
In reply to Hannes Reineckeiscsi_eh_target_reset() and iscsi_eh_session_reset() only depend on the cls_session, so use that as an argument.
--- drivers/scsi/be2iscsi/be_main.c | 10 +++++++++- drivers/scsi/libiscsi.c | 21 +++++++++------------ include/scsi/libiscsi.h | 2 +- 3 files changed, 19 insertions(+), 14 deletions(-)
drivers/scsi/be2iscsi/be_main.c +9 -1
@@ -363,6 +363,14 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc)return rc; } +static int beiscsi_eh_session_reset (struct scsi_cmnd *sc) +{ +struct iscsi_cls_session *cls_session; + + cls_session =starget_to_session (scsi_target (sc->device)); +return iscsi_eh_session_reset (cls_session); +} +/*------------------- PCI Driver operations and data ----------------- */ static const struct pci_device_id beiscsi_pci_id_table[] = { {PCI_DEVICE (BE_VENDOR_ID ,BE_DEVICE_ID1 ) },
@@ -387,7 +395,7 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc) .eh_timed_out = iscsi_eh_cmd_timed_out, .eh_abort_handler = beiscsi_eh_abort, .eh_device_reset_handler = beiscsi_eh_device_reset, - .eh_target_reset_handler = iscsi_eh_session_reset, + .eh_target_reset_handler = beiscsi_eh_session_reset, .shost_attrs = beiscsi_attrs, .sg_tablesize = BEISCSI_SGLIST_ELEMENTS, .can_queue = BE2_IO_DEPTH,
drivers/scsi/libiscsi.c +9 -12
@@ -2378,13 +2378,11 @@ void iscsi_session_recovery_timedout(struct iscsi_cls_session *cls_session)* This function will wait for a relogin, session termination from * userspace, or a recovery/replacement timeout. */ -int iscsi_eh_session_reset (struct scsi_cmnd *sc) +int iscsi_eh_session_reset (struct iscsi_cls_session *cls_session) { -struct iscsi_cls_session *cls_session;struct iscsi_session *session;struct iscsi_conn *conn; - cls_session =starget_to_session (scsi_target (sc->device)); session = cls_session->dd_data; conn = session->leadconn;
@@ -2431,7 +2429,7 @@ int iscsi_eh_session_reset(struct scsi_cmnd *sc) }EXPORT_SYMBOL_GPL (iscsi_eh_session_reset); -static void iscsi_prep_tgt_reset_pdu (struct scsi_cmnd *sc,struct iscsi_tm *hdr) +static void iscsi_prep_tgt_reset_pdu (struct iscsi_tm *hdr) {memset (hdr,0 ,sizeof (*hdr)); hdr->opcode =ISCSI_OP_SCSI_TMFUNC |ISCSI_OP_IMMEDIATE ;
@@ -2446,19 +2444,16 @@ static void iscsi_prep_tgt_reset_pdu(struct scsi_cmnd *sc, struct iscsi_tm *hdr)* * This will attempt to send a warm target reset. */ -static int iscsi_eh_target_reset (struct scsi_cmnd *sc) +static int iscsi_eh_target_reset (struct iscsi_cls_session *cls_session) { -struct iscsi_cls_session *cls_session;struct iscsi_session *session;struct iscsi_conn *conn;struct iscsi_tm *hdr;int rc =FAILED ; - cls_session =starget_to_session (scsi_target (sc->device)); session = cls_session->dd_data; -ISCSI_DBG_EH (session,"tgt Reset [sc %p tgt %s]\n" , sc, - session->targetname); +ISCSI_DBG_EH (session,"tgt Reset [tgt %s]\n" , session->targetname);mutex_lock (&session->eh_mutex);spin_lock_bh (&session->frwd_lock);
@@ -2476,7 +2471,7 @@ static int iscsi_eh_target_reset(struct scsi_cmnd *sc) conn->tmf_state =TMF_QUEUED ; hdr = &conn->tmhdr; -iscsi_prep_tgt_reset_pdu (sc, hdr); +iscsi_prep_tgt_reset_pdu (hdr);if (iscsi_exec_task_mgmt_fn (conn, hdr, session->age, session->tgt_reset_timeout)) {
@@ -2528,11 +2523,13 @@ static int iscsi_eh_target_reset(struct scsi_cmnd *sc)*/ int iscsi_eh_recover_target (struct scsi_cmnd *sc) { +struct iscsi_cls_session *cls_session;int rc; - rc =iscsi_eh_target_reset (sc); + cls_session =starget_to_session (scsi_target (sc->device)); + rc =iscsi_eh_target_reset (cls_session);if (rc ==FAILED ) - rc =iscsi_eh_session_reset (sc); + rc =iscsi_eh_session_reset (cls_session);return rc; }EXPORT_SYMBOL_GPL (iscsi_eh_recover_target);
include/scsi/libiscsi.h +1 -1
@@ -382,7 +382,7 @@ struct iscsi_host {*/ extern int iscsi_eh_abort (struct scsi_cmnd *sc);extern int iscsi_eh_recover_target (struct scsi_cmnd *sc); -extern int iscsi_eh_session_reset (struct scsi_cmnd *sc); +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);extern enum blk_eh_timer_return iscsi_eh_cmd_timed_out (struct scsi_cmnd *sc);
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 14/47 scsi: Use Scsi_Host as argument for eh_host_reset_handler
In reply to Hannes ReineckeIssuing a host reset should not rely on any commands. So use Scsi_Host as argument for eh_host_reset_handler.
--- Documentation/scsi/scsi_eh.txt | 2 +- Documentation/scsi/scsi_mid_low_api.txt | 4 +-- arch/ia64/hp/sim/simscsi.c | 2 +- drivers/infiniband/ulp/srp/ib_srp.c | 6 ++-- drivers/message/fusion/mptscsih.c | 21 +++++++------ drivers/message/fusion/mptscsih.h | 2 +- drivers/s390/scsi/zfcp_scsi.c | 3 +- drivers/scsi/3w-9xxx.c | 11 +++---- drivers/scsi/3w-sas.c | 11 +++---- drivers/scsi/3w-xxxx.c | 11 ++++--- drivers/scsi/53c700.c | 39 +++++++++++++------------ drivers/scsi/BusLogic.c | 14 +++------ drivers/scsi/NCR5380.c | 5 ++-- drivers/scsi/NCR53c406a.c | 6 ++-- drivers/scsi/aacraid/linit.c | 6 ++-- drivers/scsi/advansys.c | 26 +++++++++-------- drivers/scsi/aha152x.c | 11 +------ drivers/scsi/aha152x.h | 2 +- drivers/scsi/aha1542.c | 17 +++++------ drivers/scsi/arm/fas216.c | 4 +-- drivers/scsi/arm/fas216.h | 6 ++-- drivers/scsi/atari_scsi.c | 4 +-- drivers/scsi/cxlflash/main.c | 13 ++------- drivers/scsi/dpt_i2o.c | 14 ++++----- drivers/scsi/dpti.h | 2 +- drivers/scsi/eata.c | 10 ++----- drivers/scsi/eata_pio.c | 29 +++++++++--------- drivers/scsi/esas2r/esas2r.h | 2 +- drivers/scsi/esas2r/esas2r_main.c | 16 +++++----- drivers/scsi/esp_scsi.c | 4 +-- drivers/scsi/fdomain.c | 2 +- drivers/scsi/fdomain.h | 2 +- drivers/scsi/fnic/fnic.h | 2 +- drivers/scsi/fnic/fnic_scsi.c | 3 +- drivers/scsi/hptiop.c | 6 ++-- drivers/scsi/ibmvscsi/ibmvfc.c | 4 +-- drivers/scsi/ibmvscsi/ibmvscsi.c | 4 +-- drivers/scsi/imm.c | 6 ++-- drivers/scsi/ipr.c | 4 +-- drivers/scsi/ips.c | 23 +++++---------- drivers/scsi/libfc/fc_fcp.c | 5 ++-- drivers/scsi/lpfc/lpfc_scsi.c | 3 +- drivers/scsi/mac53c94.c | 8 ++--- drivers/scsi/megaraid.c | 4 +-- drivers/scsi/megaraid.h | 2 +- drivers/scsi/megaraid/megaraid_mbox.c | 14 +++------ drivers/scsi/megaraid/megaraid_sas_base.c | 28 +++++++----------- drivers/scsi/mesh.c | 10 +++---- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 13 ++++----- drivers/scsi/mvumi.c | 7 ++--- drivers/scsi/nsp32.c | 12 ++++---- drivers/scsi/pcmcia/aha152x_stub.c | 2 +- drivers/scsi/pcmcia/nsp_cs.c | 4 +-- drivers/scsi/pcmcia/qlogic_stub.c | 4 +-- drivers/scsi/pcmcia/sym53c500_cs.c | 8 ++--- drivers/scsi/pmcraid.c | 6 ++-- drivers/scsi/ppa.c | 6 ++-- drivers/scsi/qedf/qedf_main.c | 4 +-- drivers/scsi/qedi/qedi_iscsi.c | 3 +- drivers/scsi/qla1280.c | 3 +- drivers/scsi/qla2xxx/qla_os.c | 20 +++++-------- drivers/scsi/qla4xxx/ql4_os.c | 18 +++++------- drivers/scsi/qlogicfas408.c | 10 +++---- drivers/scsi/qlogicfas408.h | 2 +- drivers/scsi/scsi_debug.c | 16 +++++----- drivers/scsi/scsi_error.c | 2 +- drivers/scsi/snic/snic.h | 3 +- drivers/scsi/snic/snic_scsi.c | 29 +++++------------- drivers/scsi/stex.c | 7 ++--- drivers/scsi/storvsc_drv.c | 4 +-- drivers/scsi/sym53c416.c | 16 ++++------ drivers/scsi/sym53c8xx_2/sym_glue.c | 3 +- drivers/scsi/ufs/ufshcd.c | 8 ++--- drivers/scsi/vmw_pvscsi.c | 5 ++-- drivers/scsi/wd33c93.c | 4 +-- drivers/scsi/wd33c93.h | 2 +- drivers/scsi/wd719x.c | 4 +-- drivers/staging/unisys/visorhba/visorhba_main.c | 4 +-- drivers/usb/image/microtek.c | 4 +-- include/scsi/libfc.h | 2 +- include/scsi/scsi_host.h | 2 +- 81 files changed, 290 insertions(+), 380 deletions(-)
Documentation/scsi/scsi_eh.txt +1 -1
@@ -208,7 +208,7 @@ considered to fail always. int (* eh_abort_handler)(struct scsi_cmnd *); int (* eh_device_reset_handler)(struct scsi_cmnd *); int (* eh_bus_reset_handler)(struct scsi_cmnd *); -int (* eh_host_reset_handler)(struct scsi_cmnd *); +int (* eh_host_reset_handler)(struct Scsi_Host *); Higher-severity actions are taken only when lower-severity actions cannot recover some of failed scmds. Also, note that failure of the
Documentation/scsi/scsi_mid_low_api.txt +2 -2
@@ -891,7 +891,7 @@ Details: /** * eh_host_reset_handler - reset host (host bus adapter) - * @scp: SCSI host that contains this device should be reset + * @shost: SCSI host that should be reset * * Returns SUCCESS if command aborted else FAILED *
@@ -908,7 +908,7 @@ Details: * * Optionally defined in: LLD **/ - int eh_host_reset_handler(struct scsi_cmnd * scp) + int eh_host_reset_handler(struct Scsi_Host * shost) /**
arch/ia64/hp/sim/simscsi.c +1 -1
@@ -329,7 +329,7 @@ struct disk_stat {static DEF_SCSI_QCMD (simscsi_queuecommand) static int -simscsi_host_reset (struct scsi_cmnd *sc) +simscsi_host_reset (struct Scsi_Host *shost) {printk (KERN_ERR "simscsi_host_reset: not implemented\n" );return 0 ;
drivers/infiniband/ulp/srp/ib_srp.c +3 -3
@@ -2679,11 +2679,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 +10 -11
@@ -1902,15 +1902,15 @@ int mptscsih_show_info(struct seq_file *m, struct Scsi_Host *host)/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /** -* 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;int status =SUCCESS ;
@@ -1918,9 +1918,8 @@ int mptscsih_show_info(struct seq_file *m, struct Scsi_Host *host)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); +if ((hd =shost_priv (sh)) ==NULL ){ + printk(KERN_ERR MYNAM ": host reset: Can't locate host!\n");return FAILED ; }
@@ -1928,20 +1927,20 @@ int mptscsih_show_info(struct seq_file *m, struct Scsi_Host *host)mptscsih_flush_running_cmds (hd); ioc = hd->ioc; -printk (MYIOC_s_INFO_FMT"attempting host reset! (sc=%p)\n" , - ioc->name, SCpnt); +printk (MYIOC_s_INFO_FMT"attempting host reset!\n" , + ioc->name);/* If our attempts to reset the host failed, then return a failed * status. The host will be taken off line by the SCSI mid-layer. */ - retval =mpt_Soft_Hard_ResetHandler (ioc,CAN_SLEEP ); + retval =mpt_Soft_Hard_ResetHandler (ioc,CAN_SLEEP );if (retval <0 ) status =FAILED ;else status =SUCCESS ; -printk (MYIOC_s_INFO_FMT"host reset: %s (sc=%p)\n" , - ioc->name, ((retval ==0 ) ?"SUCCESS" :"FAILED" ), SCpnt); +printk (MYIOC_s_INFO_FMT"host reset: %s\n" , + ioc->name, ((retval ==0 ) ?"SUCCESS" :"FAILED" ));return status; }
drivers/message/fusion/mptscsih.h +1 -1
@@ -121,7 +121,7 @@ extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel,extern int mptscsih_abort (struct scsi_cmnd * SCpnt);extern int mptscsih_dev_reset (struct scsi_cmnd * SCpnt);extern int mptscsih_bus_reset (struct scsi_cmnd * SCpnt); -extern int mptscsih_host_reset (struct scsi_cmnd *SCpnt); +extern int mptscsih_host_reset (struct Scsi_Host *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 +1 -2
@@ -309,9 +309,8 @@ static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt)return zfcp_task_mgmt_function (scpnt,FCP_TMF_TGT_RESET ); } -static int zfcp_scsi_eh_host_reset_handler (struct scsi_cmnd *scpnt) +static int zfcp_scsi_eh_host_reset_handler (struct Scsi_Host *host) { -struct Scsi_Host *host = scpnt->device->host;struct zfcp_adapter *adapter = (struct zfcp_adapter *)host->hostdata[0 ];int ret =0 ;unsigned long flags;
drivers/scsi/3w-9xxx.c +6 -5
@@ -1715,18 +1715,19 @@ static int twa_scsi_biosparam(struct scsi_device *sdev, struct block_device *bde }/* End twa_scsi_biosparam() */ /* This is the new scsi eh reset function */ -static int twa_scsi_eh_reset (struct scsi_cmnd *SCpnt) +static int twa_scsi_eh_reset (struct Scsi_Host *shost) {TW_Device_Extension *tw_dev =NULL ;int retval =FAILED ; - tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; + tw_dev = (TW_Device_Extension *)shost->hostdata; tw_dev->num_resets++; -sdev_printk (KERN_WARNING , SCpnt->device, -"WARNING: (0x%02X:0x%04X): Command (0x%x) timed out, resetting card.\n" , -TW_DRIVER ,0x2c , SCpnt->cmnd[0 ]); +shost_printk (KERN_WARNING , shost, +"WARNING: (0x%02X:0x%04X): " +"Command timed out, resetting card.\n" , +TW_DRIVER ,0x2c );/* Make sure we are not issuing an ioctl or resetting from ioctl */ mutex_lock (&tw_dev->ioctl_lock);
drivers/scsi/3w-sas.c +6 -5
@@ -1428,18 +1428,19 @@ static int twl_scsi_biosparam(struct scsi_device *sdev, struct block_device *bde }/* End twl_scsi_biosparam() */ /* This is the new scsi eh reset function */ -static int twl_scsi_eh_reset (struct scsi_cmnd *SCpnt) +static int twl_scsi_eh_reset (struct Scsi_Host *shost) {TW_Device_Extension *tw_dev =NULL ;int retval =FAILED ; - tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; + tw_dev = (TW_Device_Extension *)shost->hostdata; tw_dev->num_resets++; -sdev_printk (KERN_WARNING , SCpnt->device, -"WARNING: (0x%02X:0x%04X): Command (0x%x) timed out, resetting card.\n" , -TW_DRIVER ,0x2c , SCpnt->cmnd[0 ]); +shost_printk (KERN_WARNING , shost, +"WARNING: (0x%02X:0x%04X): " +"Command timed out, resetting card.\n" , +TW_DRIVER ,0x2c );/* Make sure we are not issuing an ioctl or resetting from ioctl */ mutex_lock (&tw_dev->ioctl_lock);
drivers/scsi/3w-xxxx.c +5 -6
@@ -1357,25 +1357,24 @@ static int tw_scsi_biosparam(struct scsi_device *sdev, struct block_device *bdev }/* End tw_scsi_biosparam() */ /* This is the new scsi eh reset function */ -static int tw_scsi_eh_reset (struct scsi_cmnd *SCpnt) +static int tw_scsi_eh_reset (struct Scsi_Host *shost) {TW_Device_Extension *tw_dev=NULL ;int retval =FAILED ; - tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; + tw_dev = (TW_Device_Extension *)shost->hostdata; tw_dev->num_resets++; -sdev_printk (KERN_WARNING , SCpnt->device, -"WARNING: Command (0x%x) timed out, resetting card.\n" , - SCpnt->cmnd[0 ]); +shost_printk (KERN_WARNING , shost, +"WARNING: Command timed out, resetting card.\n" );/* Make sure we are not issuing an ioctl or resetting from ioctl */ mutex_lock (&tw_dev->ioctl_lock);/* Now reset the card and some of the device extension data */ if (tw_reset_device_extension (tw_dev)) { -printk (KERN_WARNING "3w-xxxx: scsi%d: Reset failed.\n" , tw_dev->host->host_no); +shost_printk (KERN_WARNING , shost,"Reset failed.\n" ); goto out; }
drivers/scsi/53c700.c +20 -19
@@ -168,7 +168,7 @@ 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);
@@ -1937,40 +1937,41 @@ STATIC DEF_SCSI_QCMD(NCR_700_queuecommand) } 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 +4 -10
@@ -2998,21 +2998,15 @@ static bool blogic_write_outbox(struct blogic_adapter *adapter,/* Error Handling (EH) support */ -static int blogic_hostreset (struct scsi_cmnd *SCpnt) +static int blogic_hostreset (struct Scsi_Host *shost) {struct blogic_adapter *adapter = - (struct blogic_adapter *) SCpnt->device->host->hostdata; - -unsigned int id = SCpnt->device->id; -struct blogic_tgt_stats *stats = &adapter->tgt_stats[id]; + (struct blogic_adapter *) shost->hostdata;int rc; -spin_lock_irq (SCpnt->device->host->host_lock); - -blogic_inc_count (&stats->adapter_reset_req); - +spin_lock_irq (shost->host_lock); rc =blogic_resetadapter (adapter, false); -spin_unlock_irq (SCpnt->device->host->host_lock); +spin_unlock_irq (shost->host_lock);return rc; }
drivers/scsi/NCR5380.c +2 -3
@@ -2297,14 +2297,13 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)/** * 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);int i;unsigned long flags;
drivers/scsi/NCR53c406a.c +3 -3
@@ -728,11 +728,11 @@ static int NCR53c406a_queue_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))static DEF_SCSI_QCMD (NCR53c406a_queue) -static int NCR53c406a_host_reset(Scsi_Cmnd * SCpnt) +static int NCR53c406a_host_reset(struct Scsi_Host * shost) {DEB (printk ("NCR53c406a_reset called\n" )); -spin_lock_irq (SCpnt->device->host->host_lock); +spin_lock_irq (shost->host_lock);outb (C4_IMG ,CONFIG4 );/* Select reg set 0 */ outb (CHIP_RESET ,CMD_REG );
@@ -742,7 +742,7 @@ static int NCR53c406a_host_reset(Scsi_Cmnd * SCpnt)rtrc (2 ); -spin_unlock_irq (SCpnt->device->host->host_lock); +spin_unlock_irq (shost->host_lock);return SUCCESS ; }
drivers/scsi/aacraid/linit.c +2 -4
@@ -1051,13 +1051,11 @@ 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 * */ -int aac_eh_host_reset (struct scsi_cmnd *cmd) +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;int ret =FAILED ;__le32 supported_options2 =0 ;
drivers/scsi/advansys.c +14 -12
@@ -7108,9 +7108,8 @@ static int AscISR(ASC_DVC_VAR *asc_dvc)* 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;
@@ -7120,7 +7119,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;
@@ -7131,16 +7130,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" );
@@ -7157,12 +7158,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/aha152x.c +1 -10
@@ -1205,7 +1205,7 @@ static void reset_ports(struct Scsi_Host *shpnt)* Reset the host (bus and controller) * */ -int aha152x_host_reset_host (struct Scsi_Host *shpnt) +int aha152x_host_reset (struct Scsi_Host *shpnt) {aha152x_bus_reset_host (shpnt);reset_ports (shpnt);
@@ -1214,15 +1214,6 @@ int aha152x_host_reset_host(struct Scsi_Host *shpnt) }/* -* Reset the host (bus and controller) -* -*/ -static int aha152x_host_reset (Scsi_Cmnd *SCpnt) -{ -return aha152x_host_reset_host (SCpnt->device->host); -} - -/* * Return the "logical geometry" * */
drivers/scsi/aha152x.h +1 -1
@@ -332,6 +332,6 @@ struct aha152x_setup {struct Scsi_Host *aha152x_probe_one (struct aha152x_setup *);void aha152x_release (struct Scsi_Host *); -int aha152x_host_reset_host (struct Scsi_Host *); +int aha152x_host_reset (struct Scsi_Host *);#endif /* _AHA152X_H */
drivers/scsi/aha1542.c +8 -9
@@ -849,9 +849,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;
@@ -863,9 +862,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 ;
@@ -876,7 +875,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,
@@ -884,7 +883,7 @@ 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" , cmd->device->host->host_no);for (i =0 ; i <AHA1542_MAILBOXES ; i++) {if (aha1542->int_cmds[i] !=NULL ) {
@@ -913,12 +912,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/fas216.c +2 -2
@@ -2650,9 +2650,9 @@ static void fas216_init_chip(FAS216_Info *info)* Returns: FAILED if unable to reset. * Notes: io_request_lock is taken, and irqs are disabled */ -int fas216_eh_host_reset (struct scsi_cmnd *SCpnt) +int fas216_eh_host_reset (struct Scsi_Host *shost) { -FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; +FAS216_Info *info = (FAS216_Info *)shost->hostdata;spin_lock_irq (info->host->host_lock);
drivers/scsi/arm/fas216.h +3 -3
@@ -383,11 +383,11 @@*/ 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
@@ -671,7 +671,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;
@@ -688,7 +688,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 +3 -10
@@ -2466,7 +2466,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
@@ -2477,21 +2477,14 @@ 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; -dev_dbg (dev,"%s: (scp=%p) %d/%d/%d/%llu " -"cdb=(%08x-%08x-%08x-%08x)\n" , __func__, scp, host->host_no, - scp->device->channel, scp->device->id, scp->device->lun, -get_unaligned_be32 (&((u32 *)scp->cmnd)[0 ]), -get_unaligned_be32 (&((u32 *)scp->cmnd)[1 ]), -get_unaligned_be32 (&((u32 *)scp->cmnd)[2 ]), -get_unaligned_be32 (&((u32 *)scp->cmnd)[3 ])); +dev_dbg (dev,"%s: %d/-1/-1/-1\n" , __func__, host->host_no);switch (cfg->state) {case STATE_NORMAL :
drivers/scsi/dpt_i2o.c +7 -7
@@ -797,12 +797,12 @@ static int adpt_bus_reset(struct scsi_cmnd* cmd) }// This version of reset is called by the eh_error_handler -static int __adpt_reset (struct scsi_cmnd * cmd) +static int __adpt_reset (struct Scsi_Host * shost) {adpt_hba * pHba;int rcode; - pHba = (adpt_hba *)cmd->device->host->hostdata[0 ]; -printk (KERN_WARNING "%s: Hba Reset: scsi id %d: tid: %d\n" ,pHba->name,cmd->device->channel,pHba->channel[cmd->device->channel].tid ); + pHba = (adpt_hba *)shost->hostdata[0 ]; +printk (KERN_WARNING "%s: Hba Reset\n" ,pHba->name); rcode =adpt_hba_reset (pHba);if (rcode ==0 ){printk (KERN_WARNING "%s: HBA reset complete\n" ,pHba->name);
@@ -813,13 +813,13 @@ static int __adpt_reset(struct scsi_cmnd* cmd) } } -static int adpt_reset (struct scsi_cmnd * cmd) +static int adpt_reset (struct Scsi_Host * shost) {int rc; -spin_lock_irq (cmd->device->host->host_lock); - rc =__adpt_reset (cmd); -spin_unlock_irq (cmd->device->host->host_lock); +spin_lock_irq (shost->host_lock); + rc =__adpt_reset (shost); +spin_unlock_irq (shost->host_lock);return rc; }
drivers/scsi/dpti.h +1 -1
@@ -31,7 +31,7 @@static int adpt_detect (struct scsi_host_template * sht);static int adpt_queue (struct Scsi_Host *h,struct scsi_cmnd * cmd);static int adpt_abort (struct scsi_cmnd * cmd); -static int adpt_reset (struct scsi_cmnd * cmd); +static int adpt_reset (struct Scsi_Host * host);static int adpt_release (struct Scsi_Host *host);static int adpt_slave_configure (struct scsi_device *);
drivers/scsi/eata.c +3 -7
@@ -507,7 +507,7 @@static int eata2x_release (struct Scsi_Host *);static int eata2x_queuecommand (struct Scsi_Host *,struct scsi_cmnd *);static int eata2x_eh_abort (struct scsi_cmnd *); -static int eata2x_eh_host_reset (struct scsi_cmnd *); +static int eata2x_eh_host_reset (struct Scsi_Host *);static int eata2x_bios_param (struct scsi_device *,struct block_device *,sector_t ,int *);static int eata2x_slave_configure (struct scsi_device *);
@@ -1896,20 +1896,16 @@ static int eata2x_eh_abort(struct scsi_cmnd *SCarg)panic ("%s: abort, mbox %d, invalid cp_stat.\n" , ha->board_name, i); } -static int eata2x_eh_host_reset (struct scsi_cmnd *SCarg) +static int eata2x_eh_host_reset (struct Scsi_Host *shost) {unsigned int i, time, k, c, limit =0 ;struct scsi_cmnd *SCpnt; -struct Scsi_Host *shost = SCarg->device->host;struct hostdata *ha = (struct hostdata *)shost->hostdata; -scmd_printk (KERN_INFO , SCarg,"reset, enter.\n" ); +shost_printk (KERN_INFO , shost,"reset, enter.\n" );spin_lock_irq (shost->host_lock); -if (SCarg->host_scribble ==NULL ) -printk ("%s: reset, inactive.\n" , ha->board_name); -if (ha->in_reset) {printk ("%s: reset, exit, already in reset.\n" , ha->board_name);spin_unlock_irq (shost->host_lock);
drivers/scsi/eata_pio.c +14 -15
@@ -435,19 +435,18 @@ static int eata_pio_abort(struct scsi_cmnd *cmd)panic ("eata_pio: abort: invalid slot status\n" ); } -static int eata_pio_host_reset (struct scsi_cmnd *cmd) +static int eata_pio_host_reset (struct Scsi_Host *host) {unsigned int x, limit =0 ;unsigned char success =0 ;struct scsi_cmnd *sp; -struct Scsi_Host *host = cmd->device->host; -DBG (DBG_ABNORM ,scmd_printk (KERN_WARNING , cmd, +DBG (DBG_ABNORM ,shost_printk (KERN_WARNING , host,"eata_pio_reset called\n" ));spin_lock_irq (host->host_lock); -if (HD (cmd)->state ==RESET ) { +if (SD (host)->state ==RESET ) {printk (KERN_WARNING "eata_pio_reset: exit, already in reset.\n" );spin_unlock_irq (host->host_lock);return FAILED ;
@@ -455,13 +454,13 @@ static int eata_pio_host_reset(struct scsi_cmnd *cmd)/* force all slots to be free */ -for (x =0 ; x < cmd->device->host->can_queue; x++) { +for (x =0 ; x < host->can_queue; x++) { -if (HD (cmd)->ccb[x].status ==FREE ) +if (SD (host)->ccb[x].status ==FREE )continue ; - sp =HD (cmd)->ccb[x].cmd; -HD (cmd)->ccb[x].status =RESET ; + sp =SD (host)->ccb[x].cmd; +SD (host)->ccb[x].status =RESET ;printk (KERN_WARNING "eata_pio_reset: slot %d in reset.\n" , x);if (sp ==NULL )
@@ -469,10 +468,10 @@ static int eata_pio_host_reset(struct scsi_cmnd *cmd) }/* hard reset the HBA */ -outb (EATA_CMD_RESET , cmd->device->host->base +HA_WCOMMAND ); +outb (EATA_CMD_RESET , host->base +HA_WCOMMAND );DBG (DBG_ABNORM ,printk (KERN_WARNING "eata_pio_reset: board reset done.\n" )); -HD (cmd)->state =RESET ; +SD (host)->state =RESET ;spin_unlock_irq (host->host_lock);msleep (3000 );
@@ -480,23 +479,23 @@ static int eata_pio_host_reset(struct scsi_cmnd *cmd)DBG (DBG_ABNORM ,printk (KERN_WARNING "eata_pio_reset: interrupts disabled, " "loops %d.\n" , limit)); -for (x =0 ; x < cmd->device->host->can_queue; x++) { +for (x =0 ; x < host->can_queue; x++) {/* Skip slots already set free by interrupt */ -if (HD (cmd)->ccb[x].status !=RESET ) +if (SD (host)->ccb[x].status !=RESET )continue ; - sp =HD (cmd)->ccb[x].cmd; + sp =SD (host)->ccb[x].cmd; sp->result =DID_RESET <<16 ;/* This mailbox is terminated */ printk (KERN_WARNING "eata_pio_reset: reset ccb %d.\n" , x); -HD (cmd)->ccb[x].status =FREE ; +SD (host)->ccb[x].status =FREE ; sp->scsi_done (sp); } -HD (cmd)->state =0 ; +SD (host)->state =0 ;spin_unlock_irq (host->host_lock);
drivers/scsi/esas2r/esas2r.h +1 -1
@@ -977,7 +977,7 @@ u8 handle_hba_ioctl(struct esas2r_adapter *a,/* SCSI error handler (eh) functions */ int esas2r_eh_abort (struct scsi_cmnd *cmd);int esas2r_device_reset (struct scsi_cmnd *cmd); -int esas2r_host_reset (struct scsi_cmnd *cmd); +int esas2r_host_reset (struct Scsi_Host *shost);int esas2r_bus_reset (struct scsi_cmnd *cmd);int esas2r_target_reset (struct scsi_cmnd *cmd);
drivers/scsi/esas2r/esas2r_main.c +9 -7
@@ -1122,10 +1122,10 @@ 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 *)shost->hostdata;if (test_bit (AF_DEGRADED_MODE , &a->flags))return FAILED ;
@@ -1150,18 +1150,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
@@ -2655,9 +2655,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 -1
@@ -1568,7 +1568,7 @@ static int fdomain_16x0_abort(struct scsi_cmnd *SCpnt)return SUCCESS ; } -int fdomain_16x0_host_reset (struct scsi_cmnd *SCpnt) +int fdomain_16x0_host_reset (struct Scsi_Host *shost) {unsigned long flags;
drivers/scsi/fdomain.h +1 -1
@@ -21,4 +21,4 @@extern struct scsi_host_template fdomain_driver_template;extern int fdomain_setup (char *str);extern struct Scsi_Host *__fdomain_16x0_detect (struct scsi_host_template *tpnt ); -extern int fdomain_16x0_host_reset (struct scsi_cmnd *SCpnt); +extern int fdomain_16x0_host_reset (struct Scsi_Host *shost);
drivers/scsi/fnic/fnic.h +1 -1
@@ -343,7 +343,7 @@ static inline struct fnic *fnic_from_ctlr(struct fcoe_ctlr *fip)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
@@ -2629,11 +2629,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
@@ -1104,12 +1104,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 = (struct hptiop_hba *)host->hostdata;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 +2 -2
@@ -2526,10 +2526,10 @@ static int ibmvfc_eh_target_reset_handler(struct scsi_cmnd *cmd)* @cmd: struct scsi_cmnd having problems * **/ -static int ibmvfc_eh_host_reset_handler (struct scsi_cmnd *cmd) +static int ibmvfc_eh_host_reset_handler (struct Scsi_Host *shost) {int rc; -struct ibmvfc_host *vhost =shost_priv (cmd->device->host); +struct ibmvfc_host *vhost =shost_priv (shost);dev_err (vhost->dev,"Resetting connection due to error recovery\n" ); rc =ibmvfc_issue_fc_host_lip (vhost->host);
drivers/scsi/ibmvscsi/ibmvscsi.c +2 -2
@@ -1731,10 +1731,10 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)* ibmvscsi_eh_host_reset_handler - Reset the connection to the server * @cmd: struct scsi_cmnd having problems */ -static int ibmvscsi_eh_host_reset_handler (struct scsi_cmnd *cmd) +static int ibmvscsi_eh_host_reset_handler (struct Scsi_Host *shost) {unsigned long wait_switch =0 ; -struct ibmvscsi_host_data *hostdata =shost_priv (cmd->device->host); +struct ibmvscsi_host_data *hostdata =shost_priv (shost);dev_err (hostdata->dev,"Resetting connection due to error recovery\n" );
drivers/scsi/imm.c +3 -3
@@ -986,11 +986,11 @@ static void imm_reset_pulse(unsigned int base)w_ctr (base,0x04 ); } -static int imm_reset (struct scsi_cmnd *cmd) +static int imm_reset (struct Scsi_Host *shost) { -imm_struct *dev =imm_dev (cmd->device->host); +imm_struct *dev =imm_dev (shost); -if (cmd->SCp.phase) +if (dev->cur_cmd->SCp.phase)imm_disconnect (dev); dev->cur_cmd =NULL ;/* Forget the problem */
drivers/scsi/ipr.c +2 -2
@@ -5152,14 +5152,14 @@ 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;unsigned long lock_flags =0 ;int rc =SUCCESS ;ENTER ; - ioa_cfg = (struct ipr_ioa_cfg *) cmd->device->host->hostdata; + ioa_cfg = (struct ipr_ioa_cfg *) shost->hostdata;spin_lock_irqsave (ioa_cfg->host->host_lock, lock_flags);if (!ioa_cfg->in_reset_reload && !ioa_cfg->hrrq[IPR_INIT_HRRQ ].ioa_is_dead) {
drivers/scsi/ips.c +8 -15
@@ -227,7 +227,7 @@static int ips_detect (struct scsi_host_template *);static int ips_release (struct Scsi_Host *);static int ips_eh_abort (struct scsi_cmnd *); -static int ips_eh_reset (struct scsi_cmnd *); +static int ips_eh_reset (struct Scsi_Host *);static int ips_queue (struct Scsi_Host *,struct scsi_cmnd *);static const char *ips_info (struct Scsi_Host *);static irqreturn_t do_ipsintr (int ,void *);
@@ -834,13 +834,12 @@ int ips_eh_abort(struct scsi_cmnd *SC)/* NOTE: this routine is called under the io_request_lock spinlock */ /* */ /****************************************************************************/ -static int __ips_eh_reset (struct scsi_cmnd *SC ) +static int __ips_eh_reset (struct Scsi_Host *shost) {int ret;int i;ips_ha_t *ha;ips_scb_t *scb; -ips_copp_wait_item_t *item;METHOD_TRACE ("ips_eh_reset" ,1 );
@@ -848,13 +847,7 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)return (FAILED );#else -if (!SC ) { -DEBUG (1 ,"Reset called with NULL scsi command" ); - -return (FAILED ); - } - - ha = (ips_ha_t *)SC ->device->host->hostdata; + ha = (ips_ha_t *) shost->hostdata;if (!ha) {DEBUG (1 ,"Reset called with NULL ha struct" );
@@ -1003,13 +996,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; }
@@ -1088,7 +1081,7 @@ static int ips_queue_lck(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *)return (0 ); } ha->ioctl_reset =1 ;/* This reset request is from an IOCTL */ -__ips_eh_reset (SC ); +__ips_eh_reset (SC ->device->host);SC ->result =DID_OK <<16 ;SC ->scsi_done (SC );return (0 );
drivers/scsi/libfc/fc_fcp.c +2 -3
@@ -2212,11 +2212,10 @@ int fc_eh_device_reset(struct scsi_cmnd *sc_cmd)/** * fc_eh_host_reset() - Reset a Scsi_Host. -* @sc_cmd: The SCSI command that identifies the SCSI host to be reset +* @shost: The SCSI host to be reset */ -int fc_eh_host_reset (struct scsi_cmnd *sc_cmd) +int fc_eh_host_reset (struct Scsi_Host *shost) { -struct Scsi_Host *shost = sc_cmd->device->host;struct fc_lport *lport =shost_priv (shost);unsigned long wait_tmo;
drivers/scsi/lpfc/lpfc_scsi.c +1 -2
@@ -5310,9 +5310,8 @@ void lpfc_poll_timeout(unsigned long ptr)* 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
@@ -101,14 +101,14 @@ static int mac53c94_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmstatic DEF_SCSI_QCMD (mac53c94_queue) -static int mac53c94_host_reset(struct scsi_cmnd *cmd) +static int mac53c94_host_reset(struct Scsi_Host *shost) { -struct fsc_state *state = (struct fsc_state *) cmd->device->host->hostdata; +struct fsc_state *state = (struct fsc_state *) shost->hostdata;struct mac53c94_regs __iomem *regs = state->regs;struct dbdma_regs __iomem *dma = state->dma;unsigned long flags; -spin_lock_irqsave (cmd->device->host->host_lock, flags); +spin_lock_irqsave (shost->host_lock, flags);writel ((RUN |PAUSE |FLUSH |WAKE ) <<16 , &dma->control);writeb (CMD_SCSI_RESET , ®s->command);/* assert RST */
@@ -118,7 +118,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 -2
@@ -1887,13 +1887,13 @@ static DEF_SCSI_QCMD(megaraid_queue)static int -megaraid_reset (struct scsi_cmnd *cmd) +megaraid_reset (struct Scsi_Host *shost) {adapter_t *adapter;megacmd_t mc;int rval; - adapter = (adapter_t *)cmd->device->host->hostdata; + adapter = (adapter_t *)shost->hostdata;#if MEGA_HAVE_CLUSTERING mc.cmd =MEGA_CLUSTER_CMD ;
drivers/scsi/megaraid.h +1 -1
@@ -963,7 +963,7 @@ struct mega_hbas {static void mega_free_scb (adapter_t *,scb_t *);static int megaraid_abort (Scsi_Cmnd *); -static int megaraid_reset (Scsi_Cmnd *); +static int megaraid_reset (struct Scsi_Host *);static int megaraid_abort_and_reset (adapter_t *,Scsi_Cmnd *,int );static int megaraid_biosparam (struct scsi_device *,struct block_device *,sector_t ,int []);
drivers/scsi/megaraid/megaraid_mbox.c +4 -10
@@ -97,7 +97,7 @@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 []);
@@ -2567,7 +2567,7 @@ static DEF_SCSI_QCMD(megaraid_queue_command)* host. **/ static int -megaraid_reset_handler (struct scsi_cmnd *scp) +megaraid_reset_handler (struct Scsi_Host *shost) {adapter_t *adapter;scb_t *scb;
@@ -2581,7 +2581,7 @@ static DEF_SCSI_QCMD(megaraid_queue_command)int i;uioc_t *kioc; - adapter =SCP2ADAPTER (scp); + adapter = (adapter_t *)SCSIHOST2ADAP (shost); raid_dev =ADAP2RAIDDEV (adapter);// return failure if adapter is not responding
@@ -2613,15 +2613,9 @@ static DEF_SCSI_QCMD(megaraid_queue_command)megaraid_mbox_mm_done (adapter, scb); }else { -if (scb->scp == scp) {// Found command -con_log (CL_ANN , (KERN_WARNING -"megaraid: %d[%d:%d], reset from pending list\n" , - scb->sno, scb->dev_channel, scb->dev_target)); - }else { -con_log (CL_ANN , (KERN_WARNING +con_log (CL_ANN , (KERN_WARNING "megaraid: IO packet with %d[%d:%d] being reset\n" , scb->sno, scb->dev_channel, scb->dev_target)); - } scb->scp->result = (DID_RESET <<16 ); scb->scp->scsi_done (scb->scp);
drivers/scsi/megaraid/megaraid_sas_base.c +11 -17
@@ -2691,15 +2691,14 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)* reset requests. Device, bus and host specific reset handlers can use this * function after they do their specific tasks. */ -static int megasas_generic_reset (struct scsi_cmnd *scmd) +static int megasas_generic_reset (struct Scsi_Host *shost) {int ret_val;struct megasas_instance *instance; - instance = (struct megasas_instance *)scmd->device->host->hostdata; + instance = (struct megasas_instance *)shost->hostdata; -scmd_printk (KERN_NOTICE , scmd,"megasas: RESET cmd=%x retries=%x\n" , - scmd->cmnd[0 ], scmd->retries); +shost_printk (KERN_NOTICE , shost,"megasas: RESET\n" );if (atomic_read (&instance->adprecovery) ==MEGASAS_HW_CRITICAL_ERROR ) {dev_err (&instance->pdev->dev,"cannot recover from previous reset failures\n" );
@@ -2768,34 +2767,29 @@ blk_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd)/** * megasas_reset_bus_host - Bus & host reset handler entry point */ -static int megasas_reset_bus_host (struct scsi_cmnd *scmd) +static int megasas_reset_bus_host (struct Scsi_Host *shost) {int ret;struct megasas_instance *instance; - instance = (struct megasas_instance *)scmd->device->host->hostdata; + instance = (struct megasas_instance *)shost->hostdata; -scmd_printk (KERN_INFO , scmd, +shost_printk (KERN_INFO , shost,"Controller reset is requested due to IO timeout\n" -"SCSI command pointer: (%p)\t SCSI host state: %d\t" +"SCSI host state: %d\t" " SCSI host busy: %d\t FW outstanding: %d\n" , - scmd, scmd->device->host->shost_state, -atomic_read ((atomic_t *)&scmd->device->host->host_busy), + shost->shost_state, +atomic_read (&shost->host_busy),atomic_read (&instance->fw_outstanding));/* * First wait for all commands to complete */ if (instance->ctrl_context) { -struct megasas_cmd_fusion *cmd; - cmd = (struct megasas_cmd_fusion *)scmd->SCp.ptr; -if (cmd) -megasas_dump_frame (cmd->io_request, -sizeof (struct MPI2_RAID_SCSI_IO_REQUEST )); - ret =megasas_reset_fusion (scmd->device->host, + ret =megasas_reset_fusion (shost,SCSIIO_TIMEOUT_OCR ); }else - ret =megasas_generic_reset (scmd); + ret =megasas_generic_reset (shost);return ret; }
drivers/scsi/mesh.c +5 -5
@@ -1700,9 +1700,9 @@ static int mesh_abort(struct scsi_cmnd *cmd)* The midlayer will wait for devices to come back, we don't need * to do that ourselves */ -static int mesh_host_reset (struct scsi_cmnd *cmd) +static int mesh_host_reset (struct Scsi_Host *shost) { -struct mesh_state *ms = (struct mesh_state *) cmd->device->host->hostdata; +struct mesh_state *ms = (struct mesh_state *) shost->hostdata;volatile struct mesh_regs __iomem *mr = ms->mesh;volatile struct dbdma_regs __iomem *md = ms->dma;unsigned long flags;
@@ -1716,7 +1716,7 @@ static int mesh_host_reset(struct scsi_cmnd *cmd)out_8 (&mr->exception,0xff );/* clear all exception bits */ out_8 (&mr->error,0xff );/* clear all error bits */ out_8 (&mr->sequence,SEQ_RESETMESH ); -mesh_flush_io (mr); +mesh_flush_io (mr);udelay (1 );out_8 (&mr->intr_mask,INT_ERROR |INT_EXCEPTION |INT_CMDDONE );out_8 (&mr->source_id, ms->host->this_id);
@@ -1725,13 +1725,13 @@ static int mesh_host_reset(struct scsi_cmnd *cmd)/* Reset the bus */ out_8 (&mr->bus_status1,BS1_RST );/* assert RST */ -mesh_flush_io (mr); +mesh_flush_io (mr);udelay (30 );/* leave it on for >= 25us */ out_8 (&mr->bus_status1,0 );/* negate RST */ /* Complete pending commands */ handle_reset (ms); - +spin_unlock_irqrestore (ms->host->host_lock, flags);return SUCCESS ; }
drivers/scsi/mpt3sas/mpt3sas_scsih.c +6 -7
@@ -2643,14 +2643,13 @@ int mpt3sas_scsih_issue_locked_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle,* Returns SUCCESS if command aborted else FAILED */ static int -scsih_host_reset (struct scsi_cmnd *scmd) +scsih_host_reset (struct Scsi_Host *shost) { -struct MPT3SAS_ADAPTER *ioc =shost_priv (scmd->device->host); +struct MPT3SAS_ADAPTER *ioc =shost_priv (shost);int r, retval; -pr_info (MPT3SAS_FMT "attempting host reset! scmd(%p)\n" , - ioc->name, scmd); -scsi_print_command (scmd); +pr_info (MPT3SAS_FMT "attempting host reset!\n" , + ioc->name);if (ioc->is_driver_loading) { pr_info(MPT3SAS_FMT "Blocking the host reset\n",
@@ -2662,8 +2661,8 @@ int mpt3sas_scsih_issue_locked_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, retval =mpt3sas_base_hard_reset_handler (ioc,FORCE_BIG_HAMMER ); r = (retval <0 ) ?FAILED :SUCCESS ; out: -pr_info (MPT3SAS_FMT "host reset: %s scmd(%p)\n" , - ioc->name, ((r ==SUCCESS ) ?"SUCCESS" :"FAILED" ), scmd); +pr_info (MPT3SAS_FMT "host reset: %s\n" , + ioc->name, ((r ==SUCCESS ) ?"SUCCESS" :"FAILED" ));return r; }
drivers/scsi/mvumi.c +3 -4
@@ -709,14 +709,13 @@ static int mvumi_reset_host_9143(struct mvumi_hba *mhba)return mvumi_wait_for_outstanding (mhba); } -static int mvumi_host_reset (struct scsi_cmnd *scmd) +static int mvumi_host_reset (struct Scsi_Host *shost) {struct mvumi_hba *mhba; - mhba = (struct mvumi_hba *) scmd->device->host->hostdata; + mhba = (struct mvumi_hba *) shost->hostdata; -scmd_printk (KERN_NOTICE , scmd,"RESET -%ld cmd=%x retries=%x\n" , - scmd->serial_number, scmd->cmnd[0 ], scmd->retries); +shost_printk (KERN_NOTICE , shost,"RESET\n" );return mhba->instancet->reset_host (mhba); }
drivers/scsi/nsp32.c +5 -7
@@ -2885,23 +2885,21 @@ static void nsp32_do_bus_reset(nsp32_hw_data *data) data->CurrentSC =NULL ; } -static int nsp32_eh_host_reset (struct scsi_cmnd *SCpnt) +static int nsp32_eh_host_reset (struct Scsi_Host *host) { -struct Scsi_Host *host = SCpnt->device->host; -unsigned int base = SCpnt->device->host->io_port; +unsigned int base = host->io_port;nsp32_hw_data *data = (nsp32_hw_data *)host->hostdata; -nsp32_msg (KERN_INFO ,"Host Reset" ); -nsp32_dbg (NSP32_DEBUG_BUSRESET ,"SCpnt=0x%x" , SCpnt); +nsp32_msg (KERN_INFO ,"Host Reset" ); -spin_lock_irq (SCpnt->device->host->host_lock); +spin_lock_irq (host->host_lock);nsp32hw_init (data);nsp32_write2 (base,IRQ_CONTROL ,IRQ_CONTROL_ALL_IRQ_MASK );nsp32_do_bus_reset (data);nsp32_write2 (base,IRQ_CONTROL ,0 ); -spin_unlock_irq (SCpnt->device->host->host_lock); +spin_unlock_irq (host->host_lock);return SUCCESS ;/* Host reset is succeeded at any time. */ }
drivers/scsi/pcmcia/aha152x_stub.c +1 -1
@@ -197,7 +197,7 @@ static int aha152x_resume(struct pcmcia_device *link) {scsi_info_t *info = link->priv; -aha152x_host_reset_host (info->host); +aha152x_host_reset (info->host);return 0 ; }
drivers/scsi/pcmcia/nsp_cs.c +2 -2
@@ -1485,9 +1485,9 @@ static int nsp_eh_bus_reset(struct scsi_cmnd *SCpnt)return nsp_bus_reset (data); } -static int nsp_eh_host_reset (struct scsi_cmnd *SCpnt) +static int nsp_eh_host_reset (struct Scsi_Host *host) { -nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; +nsp_hw_data *data = (nsp_hw_data *)host->hostdata;nsp_dbg (NSP_DEBUG_BUSRESET ,"in" );
drivers/scsi/pcmcia/qlogic_stub.c +2 -2
@@ -263,8 +263,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
@@ -586,14 +586,14 @@ enum Phase {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 -3
@@ -3089,19 +3089,19 @@ 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 *)(shost->hostdata);/* wait for an additional 150 seconds just in case firmware could come
drivers/scsi/ppa.c +3 -3
@@ -857,11 +857,11 @@ static void ppa_reset_pulse(unsigned int base)w_ctr (base,0xc ); } -static int ppa_reset (struct scsi_cmnd *cmd) +static int ppa_reset (struct Scsi_Host *shost) { -ppa_struct *dev =ppa_dev (cmd->device->host); +ppa_struct *dev =ppa_dev (shost); -if (cmd->SCp.phase) +if (dev->cur_cmd->SCp.phase)ppa_disconnect (dev); dev->cur_cmd =NULL ;/* Forget the problem */
drivers/scsi/qedf/qedf_main.c +2 -2
@@ -666,12 +666,12 @@ static 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
@@ -33,9 +33,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 +1 -2
@@ -1033,10 +1033,9 @@ static void qla1280_mailbox_timeout(unsigned long __data)* Reset the specified adapter (both channels) **************************************************************************/ static int -qla1280_eh_adapter_reset (struct scsi_cmnd *cmd) +qla1280_eh_adapter_reset (struct Scsi_Host *shost) {int rc; -struct Scsi_Host *shost = cmd->device->host;struct scsi_qla_host *ha = (struct scsi_qla_host *)shost->hostdata;spin_lock_irq (shost->host_lock);
drivers/scsi/qla2xxx/qla_os.c +7 -13
@@ -275,7 +275,7 @@static int qla2xxx_eh_device_reset (struct scsi_cmnd *);static int qla2xxx_eh_target_reset (struct scsi_cmnd *);static int qla2xxx_eh_bus_reset (struct scsi_cmnd *); -static int qla2xxx_eh_host_reset (struct scsi_cmnd *); +static int qla2xxx_eh_host_reset (struct Scsi_Host *);static void qla2x00_clear_drv_active (struct qla_hw_data *);static void qla2x00_free_device (scsi_qla_host_t *);
@@ -1550,8 +1550,7 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha)* 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.
@@ -1559,13 +1558,11 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha)* 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)) {
@@ -1575,11 +1572,8 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha)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
@@ -1625,8 +1619,8 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha) 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
@@ -160,7 +160,7 @@ static int qla4xxx_set_chap_entry(struct Scsi_Host *shost, void *data,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);
@@ -9367,17 +9367,17 @@ 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; - ha =to_qla_host (cmd->device->host); + ha =to_qla_host (host);if ((is_qla8032 (ha) ||is_qla8042 (ha)) && ql4xdontresethba)qla4_83xx_set_idc_dontreset (ha);
@@ -9393,20 +9393,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
@@ -498,20 +498,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
@@ -108,7 +108,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/scsi_debug.c +8 -8
@@ -3878,27 +3878,27 @@ 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;int k =0 ; ++num_host_resets; -if ((SCpnt->device) && (SDEBUG_OPT_ALL_NOISE & sdebug_opts)) -sdev_printk (KERN_INFO , SCpnt->device,"%s\n" , __func__); -spin_lock (&sdebug_host_list_lock); -list_for_each_entry (sdbg_host, &sdebug_host_list, host_list) { +if (SDEBUG_OPT_ALL_NOISE & sdebug_opts) +shost_printk (KERN_INFO , shost,"%s\n" , __func__); +spin_lock (&sdebug_host_list_lock); +list_for_each_entry (sdbg_host, &sdebug_host_list, host_list) {list_for_each_entry (devip, &sdbg_host->dev_info_list, dev_list) {set_bit (SDEBUG_UA_BUS_RESET , devip->uas_bm); ++k; } - } -spin_unlock (&sdebug_host_list_lock); + } +spin_unlock (&sdebug_host_list_lock);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
@@ -745,7 +745,7 @@ static int scsi_try_host_reset(struct scsi_cmnd *scmd)if (!hostt->eh_host_reset_handler)return FAILED ; - rtn = hostt->eh_host_reset_handler (scmd); + rtn = hostt->eh_host_reset_handler (host);if (rtn ==SUCCESS ) {if (!hostt->skip_settle_delay)
drivers/scsi/snic/snic.h +1 -2
@@ -380,8 +380,7 @@ struct snic_global {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 -21
@@ -2307,8 +2307,15 @@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);struct scsi_cmnd *sc =NULL ;
@@ -2373,26 +2380,6 @@ 0, 0, 0);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; - -SNIC_SCSI_DBG (shost, -"host reset:sc %p sc_cmd 0x%x req %p tag %d flags 0x%llx\n" , - sc, sc->cmnd[0 ], sc->request, -snic_cmd_tag (sc),CMD_FLAGS (sc)); - -return snic_reset (shost); }/* end of snic_host_reset */ /*
drivers/scsi/stex.c +3 -4
@@ -1441,14 +1441,13 @@ static int stex_do_reset(struct st_hba *hba)return -1 ; } -static int stex_reset (struct scsi_cmnd *cmd) +static int stex_reset (struct Scsi_Host *shost) {struct st_hba *hba; - hba = (struct st_hba *) &cmd->device->host->hostdata[0 ]; + hba = (struct st_hba *) &shost->hostdata[0 ]; -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
@@ -1437,9 +1437,9 @@ static int storvsc_get_chs(struct scsi_device *sdev, struct block_device * bdev,return 0 ; } -static int storvsc_host_reset_handler (struct scsi_cmnd *scmnd) +static int storvsc_host_reset_handler (struct Scsi_Host *shost) { -struct hv_host_device *host_dev =shost_priv (scmnd->device->host); +struct hv_host_device *host_dev =shost_priv (shost);struct hv_device *device = host_dev->dev;struct storvsc_device *stor_device;
drivers/scsi/sym53c416.c +5 -11
@@ -723,12 +723,9 @@ const char *sym53c416_info(struct Scsi_Host *SChost)int i;int base = SChost->io_port;int irq = SChost->irq; -int scsi_id =0 ; +int scsi_id = SChost->this_id;int rev =inb (base +TC_HIGH ); -for (i =0 ; i < host_index; i++) -if (hosts[i].base == base) - scsi_id = hosts[i].scsi_id;sprintf (info,"Symbios Logic 53c416 (rev. %d) at 0x%03x, irq %d, SCSI-ID %d, %s pio" , rev, base, irq, scsi_id, (fastpio)?"fast" :"slow" );return info; }
@@ -762,21 +759,18 @@ static int sym53c416_queuecommand_lck(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *DEF_SCSI_QCMD (sym53c416_queuecommand) -static int sym53c416_host_reset(Scsi_Cmnd *SCpnt) +static int sym53c416_host_reset(struct Scsi_Host *SChost) {int base; -int scsi_id =-1 ; +int scsi_id;int i;unsigned long flags;spin_lock_irqsave (&sym53c416_lock, flags);/* printk("sym53c416_reset\n"); */ - base = SCpnt->device->host->io_port; -/* search scsi_id - fixme, we shouldn't need to iterate for this! */ -for (i =0 ; i < host_index && scsi_id ==-1 ; i++) -if (hosts[i].base == base) - scsi_id = hosts[i].scsi_id; + base = SChost->io_port; + scsi_id = SChost->this_id;outb (RESET_CHIP , base +COMMAND_REG );outb (NOOP |PIO_MODE , base +COMMAND_REG );outb (RESET_SCSI_BUS , base +COMMAND_REG );
drivers/scsi/sym53c8xx_2/sym_glue.c +1 -2
@@ -687,9 +687,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/ufs/ufshcd.c +4 -4
@@ -214,7 +214,7 @@ enum {static void 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);
@@ -5585,7 +5585,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)* handling stage: reset and restore. */ if (lrbp->lun ==UFS_UPIU_UFS_DEVICE_WLUN ) -return ufshcd_eh_host_reset_handler (cmd); +return ufshcd_eh_host_reset_handler (host);ufshcd_hold (hba, false); reg =ufshcd_readl (hba,REG_UTP_TRANSFER_REQ_DOOR_BELL );
@@ -5791,13 +5791,13 @@ static int ufshcd_reset_and_restore(struct ufs_hba *hba)* * Returns SUCCESS/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;unsigned long flags;struct ufs_hba *hba; - hba =shost_priv (cmd->device->host); + hba =shost_priv (shost);ufshcd_hold (hba, false);/*
drivers/scsi/vmw_pvscsi.c +2 -3
@@ -873,14 +873,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 +1 -3
@@ -1571,13 +1571,11 @@ }int -wd33c93_host_reset (struct scsi_cmnd * SCpnt) +wd33c93_host_reset (struct Scsi_Host * instance) { -struct Scsi_Host *instance;struct WD33C93_hostdata *hostdata;int i; - instance = SCpnt->device->host;spin_lock_irq (instance->host_lock); hostdata = (struct WD33C93_hostdata *) instance->hostdata;
drivers/scsi/wd33c93.h +1 -1
@@ -347,6 +347,6 @@ void wd33c93_init (struct Scsi_Host *instance, const wd33c93_regs regs,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
@@ -510,9 +510,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;int result;
drivers/staging/unisys/visorhba/visorhba_main.c +2 -2
@@ -437,13 +437,13 @@ static int visorhba_bus_reset_handler(struct scsi_cmnd *scsicmd)/* * visorhba_host_reset_handler - Not supported -* @scsicmd: The scsicmd that needs aborted +* @shost: The scsi host that needs resetting * * Not supported, return SUCCESS * Returns SUCCESS */ static int -visorhba_host_reset_handler (struct scsi_cmnd *scsicmd) +visorhba_host_reset_handler (struct Scsi_Host *shost) {/* issue TASK_MGMT_TARGET_RESET for each target on each bus for host */ return SUCCESS ;
drivers/usb/image/microtek.c +2 -2
@@ -344,9 +344,9 @@ static int mts_scsi_abort(struct scsi_cmnd *srb)return FAILED ; } -static int mts_scsi_host_reset (struct scsi_cmnd *srb) +static int mts_scsi_host_reset (struct Scsi_Host *shost) { -struct mts_desc * desc = (struct mts_desc *)(srb->device->host->hostdata[0 ]); +struct mts_desc * desc = (struct mts_desc *)(shost->hostdata[0 ]);int result;MTS_DEBUG_GOT_HERE ();
include/scsi/libfc.h +1 -1
@@ -953,7 +953,7 @@ static inline struct fc_lport *fc_disc_lport(struct fc_disc *disc)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
@@ -148,7 +148,7 @@ struct scsi_host_template {int (* eh_device_reset_handler)(struct scsi_cmnd *);int (* eh_target_reset_handler)(struct scsi_cmnd *);int (* eh_bus_reset_handler)(struct scsi_cmnd *); -int (* eh_host_reset_handler)(struct scsi_cmnd *); +int (* eh_host_reset_handler)(struct Scsi_Host *);/* * Before the mid layer attempts to scan for a new device where none
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 17/47 mptfusion: correct definitions for mptscsih_dev_reset()
In reply to Hannes ReineckeFrom: Hannes Reinecke <[email protected]>
mptscsih_dev_reset() is _not_ a device reset, but rather a target reset. Nevertheless it's being used for either purpose. This patch is adding a correct implementation for mptscsih_dev_reset(), and renames the original function to mptscsih_target_reset.
--- drivers/message/fusion/mptscsih.c | 55 ++++++++++++++++++++++++++++++++++++++- drivers/message/fusion/mptscsih.h | 1 + 2 files changed, 55 insertions(+), 1 deletion(-)
drivers/message/fusion/mptscsih.c +54 -1
@@ -1792,7 +1792,7 @@ int mptscsih_show_info(struct seq_file *m, struct Scsi_Host *host)/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /** -* mptscsih_dev_reset - Perform a SCSI TARGET_RESET! new_eh variant +* mptscsih_dev_reset - Perform a SCSI LOGICAL_UNIT_RESET! * @SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to * * (linux scsi_host_template.eh_dev_reset_handler routine)
@@ -1810,6 +1810,58 @@ int mptscsih_show_info(struct seq_file *m, struct Scsi_Host *host)/* 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 ; + } + + ioc = hd->ioc; +printk (MYIOC_s_INFO_FMT"attempting lun reset! (sc=%p)\n" , + ioc->name, SCpnt); +scsi_print_command (SCpnt); + + vdevice = SCpnt->device->hostdata; +if (!vdevice || !vdevice->vtarget) { + retval =0 ; + goto out; + } + + retval =mptscsih_IssueTaskMgmt (hd, +MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET , + vdevice->vtarget->channel, + vdevice->vtarget->id, vdevice->lun,0 , +mptscsih_get_tm_timeout (ioc)); + + out: +printk (MYIOC_s_INFO_FMT"lun reset: %s (sc=%p)\n" , + ioc->name, ((retval ==0 ) ?"SUCCESS" :"FAILED" ), SCpnt); + +if (retval ==0 ) +return SUCCESS ; +else +return FAILED ; +} + +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ +/** +* mptscsih_target_reset - Perform a SCSI TARGET_RESET! +* @SCpnt: Pointer to scsi_cmnd structure, IO 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) +{ +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 ){ printk(KERN_ERR MYNAM ": target reset: " "Can't locate host! (sc=%p)\n", SCpnt);return FAILED ;
@@ -3246,6 +3298,7 @@ struct device_attribute *mptscsih_host_attrs[] = {EXPORT_SYMBOL (mptscsih_slave_configure);EXPORT_SYMBOL (mptscsih_abort);EXPORT_SYMBOL (mptscsih_dev_reset); +EXPORT_SYMBOL (mptscsih_target_reset);EXPORT_SYMBOL (mptscsih_bus_reset);EXPORT_SYMBOL (mptscsih_host_reset);EXPORT_SYMBOL (mptscsih_bios_param);
drivers/message/fusion/mptscsih.h +1 -0
@@ -120,6 +120,7 @@ extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel,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_host_reset (struct Scsi_Host *sh);extern int mptscsih_bios_param (struct scsi_device * sdev,struct block_device *bdev,sector_t capacity,int geom[]);
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 19/47 pmcraid: Select device in pmcraid_eh_bus_reset_handler()
In reply to Hannes ReineckeThe reset code requires a device to be selected, but we shouldn't rely on the command to provide a device for us. So select the first device on the bus when sending down a bus reset.
--- drivers/scsi/pmcraid.c | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-)
drivers/scsi/pmcraid.c +38 -8
@@ -2733,7 +2733,7 @@ static int pmcraid_error_handler(struct pmcraid_cmd *cmd)* SUCCESS / FAILED */ static int pmcraid_reset_device ( -struct scsi_cmnd *scsi_cmd, +struct scsi_device *scsi_dev,unsigned long timeout,u8 modifier )
@@ -2746,11 +2746,11 @@ static int pmcraid_reset_device(u32 ioasc; pinstance = - (struct pmcraid_instance *)scsi_cmd->device->host->hostdata; - res = scsi_cmd->device->hostdata; + (struct pmcraid_instance *)scsi_dev->host->hostdata; + res = scsi_dev->hostdata;if (!res) { -sdev_printk (KERN_ERR , scsi_cmd->device, +sdev_printk (KERN_ERR , scsi_dev,"reset_device: NULL resource pointer\n" );return FAILED ; }
@@ -3063,16 +3063,46 @@ static int pmcraid_eh_device_reset_handler(struct scsi_cmnd *scmd) {scmd_printk (KERN_INFO , scmd,"resetting device due to an I/O command timeout.\n" ); -return pmcraid_reset_device (scmd, +return pmcraid_reset_device (scmd->device,PMCRAID_INTERNAL_TIMEOUT ,RESET_DEVICE_LUN ); }static int pmcraid_eh_bus_reset_handler (struct scsi_cmnd *scmd) { -scmd_printk (KERN_INFO , scmd, +struct Scsi_Host *host = scmd->device->host; +struct pmcraid_instance *pinstance = + (struct pmcraid_instance *)host->hostdata; +struct pmcraid_resource_entry *res =NULL ; +struct pmcraid_resource_entry *temp; +struct scsi_device *sdev =NULL ; +unsigned long lock_flags; + +/* +* The reset device code insists on us passing down +* a device, so grab the first device on the bus. +*/ +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 && +RES_IS_VSET (temp->cfg_entry)) { + res = temp; +break ; + }else if (scmd->device->channel ==PMCRAID_PHYS_BUS_ID && +RES_IS_GSCSI (temp->cfg_entry)) { + res = temp; +break ; + } + } +if (res) + sdev = res->scsi_dev; +spin_unlock_irqrestore (&pinstance->resource_lock, lock_flags); +if (!sdev) +return FAILED ; + +sdev_printk (KERN_INFO , sdev,"Doing bus reset due to an I/O command timeout.\n" ); -return pmcraid_reset_device (scmd, +return pmcraid_reset_device (sdev,PMCRAID_RESET_BUS_TIMEOUT ,RESET_DEVICE_BUS ); }
@@ -3081,7 +3111,7 @@ static int pmcraid_eh_target_reset_handler(struct scsi_cmnd *scmd) {scmd_printk (KERN_INFO , scmd,"Doing target reset due to an I/O command timeout.\n" ); -return pmcraid_reset_device (scmd, +return pmcraid_reset_device (scmd->device,PMCRAID_INTERNAL_TIMEOUT ,RESET_DEVICE_TARGET ); }
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 22/47 bnx2fc: Do not rely on a scsi command when issueing lun or target reset
In reply to Hannes ReineckeWhen a LUN or target reset is issued we should not rely on a scsi command to be present; this isn't very reliable and is going away with the next patch anyway.
--- drivers/scsi/bnx2fc/bnx2fc.h | 1 + drivers/scsi/bnx2fc/bnx2fc_hwi.c | 14 ++++--- drivers/scsi/bnx2fc/bnx2fc_io.c | 89 +++++++++++++++++++--------------------- 3 files changed, 52 insertions(+), 52 deletions(-)
drivers/scsi/bnx2fc/bnx2fc.h +1 -0
@@ -386,6 +386,7 @@ struct bnx2fc_rport { };struct bnx2fc_mp_req { +u64 tm_lun;u8 tm_flags;u32 req_len;
drivers/scsi/bnx2fc/bnx2fc_hwi.c +9 -5
@@ -1691,7 +1691,8 @@ void bnx2fc_init_task(struct bnx2fc_cmd *io_req,struct fcoe_cached_sge_ctx *cached_sge;struct fcoe_ext_mul_sges_ctx *sgl;int dev_type = tgt->dev_type; -u64 *fcp_cmnd; +struct fcp_cmnd *fcp_cmnd; +u64 *raw_fcp_cmnd;u64 tmp_fcp_cmnd[4 ];u32 context_id;int cnt, i;
@@ -1760,16 +1761,19 @@ void bnx2fc_init_task(struct bnx2fc_cmd *io_req, task->txwr_rxrd.union_ctx.tx_seq.ctx.seq_cnt =1 ;/* Fill FCP_CMND IU */ - fcp_cmnd = (u64 *) + fcp_cmnd = (struct fcp_cmnd *)&tmp_fcp_cmnd; +bnx2fc_build_fcp_cmnd (io_req, fcp_cmnd); +int_to_scsilun (sc_cmd->device->lun, &fcp_cmnd->fc_lun); +memcpy (fcp_cmnd->fc_cdb, sc_cmd->cmnd, sc_cmd->cmd_len); + raw_fcp_cmnd = (u64 *) task->txwr_rxrd.union_ctx.fcp_cmd.opaque; -bnx2fc_build_fcp_cmnd (io_req, (struct fcp_cmnd *)&tmp_fcp_cmnd);/* swap fcp_cmnd */ cnt =sizeof (struct fcp_cmnd ) /sizeof (u64);for (i =0 ; i < cnt; i++) { - *fcp_cmnd =cpu_to_be64 (tmp_fcp_cmnd[i]); - fcp_cmnd++; + *raw_fcp_cmnd =cpu_to_be64 (tmp_fcp_cmnd[i]); + raw_fcp_cmnd++; }/* Rx Write Tx Read */
drivers/scsi/bnx2fc/bnx2fc_io.c +42 -47
181 lines not on this page · raw message
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 24/47 zfcp: use scsi device as argument for zfcp_task_mgmt_function()
In reply to Hannes Reineckezfcp_task_mgmt_function() is only used for lun and device reset, so it should be using the scsi device as an argument, not the scsi command.
--- drivers/s390/scsi/zfcp_ext.h | 2 +- drivers/s390/scsi/zfcp_fc.h | 9 +-------- drivers/s390/scsi/zfcp_fsf.c | 21 +++++++++++---------- drivers/s390/scsi/zfcp_scsi.c | 12 ++++++------ 4 files changed, 19 insertions(+), 25 deletions(-)
drivers/s390/scsi/zfcp_ext.h +1 -1
@@ -117,7 +117,7 @@ extern int zfcp_fsf_send_els(struct zfcp_adapter *, u32, struct zfcp_fsf_ct_els *, unsigned int);extern int zfcp_fsf_fcp_cmnd (struct scsi_cmnd *);extern void zfcp_fsf_req_free (struct zfcp_fsf_req *); -extern struct zfcp_fsf_req *zfcp_fsf_fcp_task_mgmt (struct scsi_cmnd *,u8 ); +extern struct zfcp_fsf_req *zfcp_fsf_fcp_task_mgmt (struct scsi_device *,u8 );extern struct zfcp_fsf_req *zfcp_fsf_abort_fcp_cmnd (struct scsi_cmnd *);extern void zfcp_fsf_reqid_check (struct zfcp_qdio *,int );
drivers/s390/scsi/zfcp_fc.h +1 -8
@@ -206,19 +206,12 @@ struct zfcp_fc_wka_ports {* zfcp_fc_scsi_to_fcp - setup FCP command with data from scsi_cmnd * @fcp: fcp_cmnd to setup * @scsi: scsi_cmnd where to get LUN, task attributes/flags and CDB -* @tm: task management flags to setup task management command */ static inline -void zfcp_fc_scsi_to_fcp (struct fcp_cmnd *fcp,struct scsi_cmnd *scsi, -u8 tm_flags) +void zfcp_fc_scsi_to_fcp (struct fcp_cmnd *fcp,struct scsi_cmnd *scsi) {int_to_scsilun (scsi->device->lun, (struct scsi_lun *) &fcp->fc_lun); -if (unlikely (tm_flags)) { - fcp->fc_tm_flags = tm_flags; -return ; - } - fcp->fc_pri_ta =FCP_PTA_SIMPLE ;if (scsi->sc_data_direction ==DMA_FROM_DEVICE )
drivers/s390/scsi/zfcp_fsf.c +11 -10
@@ -2036,10 +2036,9 @@ static void zfcp_fsf_req_trace(struct zfcp_fsf_req *req, struct scsi_cmnd *scsi) sizeof(blktrc)); } -static void zfcp_fsf_fcp_handler_common (struct zfcp_fsf_req *req) +static void zfcp_fsf_fcp_handler_common (struct zfcp_fsf_req *req, +struct scsi_device *sdev) { -struct scsi_cmnd *scmnd = req->data; -struct scsi_device *sdev = scmnd->device;struct zfcp_scsi_dev *zfcp_sdev;struct fsf_qtcb_header *header = &req->qtcb->header;
@@ -2120,7 +2119,7 @@ static void zfcp_fsf_fcp_cmnd_handler(struct zfcp_fsf_req *req)return ; } -zfcp_fsf_fcp_handler_common (req); +zfcp_fsf_fcp_handler_common (req, scpnt->device);if (unlikely (req->status &ZFCP_STATUS_FSFREQ_ERROR )) {set_host_byte (scpnt,DID_TRANSPORT_DISRUPTED );
@@ -2256,7 +2255,7 @@ int zfcp_fsf_fcp_cmnd(struct scsi_cmnd *scsi_cmnd) goto failed_scsi_cmnd; fcp_cmnd = (struct fcp_cmnd *) &req->qtcb->bottom.io.fcp_cmnd; -zfcp_fc_scsi_to_fcp (fcp_cmnd, scsi_cmnd,0 ); +zfcp_fc_scsi_to_fcp (fcp_cmnd, scsi_cmnd);if (scsi_prot_sg_count (scsi_cmnd)) { zfcp_qdio_set_data_div(qdio, &req->qdio_req,
@@ -2296,8 +2295,9 @@ static void zfcp_fsf_fcp_task_mgmt_handler(struct zfcp_fsf_req *req) {struct fcp_resp_with_ext *fcp_rsp;struct fcp_resp_rsp_info *rsp_info; +struct scsi_device *sdev = req->data; -zfcp_fsf_fcp_handler_common (req); +zfcp_fsf_fcp_handler_common (req, sdev); fcp_rsp = (struct fcp_resp_with_ext *) &req->qtcb->bottom.io.fcp_rsp; rsp_info = (struct fcp_resp_rsp_info *) &fcp_rsp[1 ];
@@ -2313,12 +2313,12 @@ static void zfcp_fsf_fcp_task_mgmt_handler(struct zfcp_fsf_req *req)* @tm_flags: unsigned byte for task management flags * Returns: on success pointer to struct fsf_req, NULL otherwise */ -struct zfcp_fsf_req *zfcp_fsf_fcp_task_mgmt (struct scsi_cmnd *scmnd, +struct zfcp_fsf_req *zfcp_fsf_fcp_task_mgmt (struct scsi_device *sdev,u8 tm_flags) {struct zfcp_fsf_req *req =NULL ;struct fcp_cmnd *fcp_cmnd; -struct zfcp_scsi_dev *zfcp_sdev =sdev_to_zfcp (scmnd->device); +struct zfcp_scsi_dev *zfcp_sdev =sdev_to_zfcp (sdev);struct zfcp_qdio *qdio = zfcp_sdev->port->adapter->qdio; if (unlikely(!(atomic_read(&zfcp_sdev->status) &
@@ -2338,7 +2338,7 @@ struct zfcp_fsf_req *zfcp_fsf_fcp_task_mgmt(struct scsi_cmnd *scmnd, goto out; } - req->data = scmnd; + req->data = sdev; req->handler = zfcp_fsf_fcp_task_mgmt_handler; req->qtcb->header.lun_handle = zfcp_sdev->lun_handle; req->qtcb->header.port_handle = zfcp_sdev->port->handle;
@@ -2349,7 +2349,8 @@ struct zfcp_fsf_req *zfcp_fsf_fcp_task_mgmt(struct scsi_cmnd *scmnd,zfcp_qdio_set_sbale_last (qdio, &req->qdio_req); fcp_cmnd = (struct fcp_cmnd *) &req->qtcb->bottom.io.fcp_cmnd; -zfcp_fc_scsi_to_fcp (fcp_cmnd, scmnd, tm_flags); +int_to_scsilun (sdev->lun, (struct scsi_lun *)&fcp_cmnd->fc_lun); + fcp_cmnd->fc_tm_flags = tm_flags;zfcp_fsf_start_timer (req,ZFCP_SCSI_ER_TIMEOUT );if (!zfcp_fsf_req_send (req))
drivers/s390/scsi/zfcp_scsi.c +6 -6
@@ -259,17 +259,17 @@ static void zfcp_scsi_forget_cmnds(struct zfcp_scsi_dev *zsdev, u8 tm_flags)write_unlock_irqrestore (&adapter->abort_lock, flags); } -static int zfcp_task_mgmt_function (struct scsi_cmnd *scpnt,u8 tm_flags) +static int zfcp_task_mgmt_function (struct scsi_device *sdev,u8 tm_flags) { -struct zfcp_scsi_dev *zfcp_sdev =sdev_to_zfcp (scpnt->device); +struct zfcp_scsi_dev *zfcp_sdev =sdev_to_zfcp (sdev);struct zfcp_adapter *adapter = zfcp_sdev->port->adapter; -struct fc_port *rport = zfcp_sdev->port->rport; +struct fc_rport *rport = zfcp_sdev->port->rport;struct zfcp_fsf_req *fsf_req =NULL ;int retval =SUCCESS , ret;int retry =3 ;while (retry--) { - fsf_req =zfcp_fsf_fcp_task_mgmt (scpnt, tm_flags); + fsf_req =zfcp_fsf_fcp_task_mgmt (sdev, tm_flags);if (fsf_req)break ;
@@ -306,12 +306,12 @@ static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags)static int zfcp_scsi_eh_device_reset_handler (struct scsi_cmnd *scpnt) { -return zfcp_task_mgmt_function (scpnt,FCP_TMF_LUN_RESET ); +return zfcp_task_mgmt_function (scpnt->device,FCP_TMF_LUN_RESET ); }static int zfcp_scsi_eh_target_reset_handler (struct scsi_cmnd *scpnt) { -return zfcp_task_mgmt_function (scpnt,FCP_TMF_TGT_RESET ); +return zfcp_task_mgmt_function (scpnt->device,FCP_TMF_TGT_RESET ); }static int zfcp_scsi_eh_host_reset_handler (struct Scsi_Host *host)
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 27/47 lpfc: use rport as argument for lpfc_chk_tgt_mapped()
In reply to Hannes ReineckeWe only need the rport structure for lpfc_chk_tgt_mapped().
--- drivers/scsi/lpfc/lpfc_scsi.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-)
drivers/scsi/lpfc/lpfc_scsi.c +10 -14
@@ -5055,7 +5055,7 @@ void lpfc_poll_timeout(unsigned long ptr)/** * lpfc_chk_tgt_mapped - * @vport: The virtual port to check on -* @cmnd: Pointer to scsi_cmnd data structure. +* @rport: Pointer to fc_rport data structure. * * This routine delays until the scsi target (aka rport) for the * command exists (is present and logged in) or we declare it non-existent.
@@ -5065,19 +5065,15 @@ void lpfc_poll_timeout(unsigned long ptr)* 0x2002 - Success **/ static int -lpfc_chk_tgt_mapped (struct lpfc_vport *vport,struct scsi_cmnd *cmnd) +lpfc_chk_tgt_mapped (struct lpfc_vport *vport,struct fc_rport *rport) {struct lpfc_rport_data *rdata; -struct lpfc_nodelist *pnode; +struct lpfc_nodelist *pnode =NULL ;unsigned long later; - rdata =lpfc_rport_data_from_scsi_device (cmnd->device); -if (!rdata) { -lpfc_printf_vlog (vport,KERN_INFO ,LOG_FCP , -"0797 Tgt Map rport failure: rdata x%p\n" , rdata); -return FAILED ; - } - pnode = rdata->pnode; + rdata = rport->dd_data; +if (rdata) + pnode = rdata->pnode;/* * If target is not in a MAPPED state, delay until * target is rediscovered or devloss timeout expires.
@@ -5089,7 +5085,7 @@ void lpfc_poll_timeout(unsigned long ptr)if (pnode->nlp_state ==NLP_STE_MAPPED_NODE )return SUCCESS ;schedule_timeout_uninterruptible (msecs_to_jiffies (500 )); - rdata =lpfc_rport_data_from_scsi_device (cmnd->device); + rdata = rport->dd_data;if (!rdata)return FAILED ; pnode = rdata->pnode;
@@ -5182,7 +5178,7 @@ void lpfc_poll_timeout(unsigned long ptr)if (status !=0 && status !=SUCCESS )return status; - status =lpfc_chk_tgt_mapped (vport, cmnd); + status =lpfc_chk_tgt_mapped (vport, rport);if (status ==FAILED ) {lpfc_printf_vlog (vport,KERN_ERR ,LOG_FCP ,"0721 Device Reset rport failure: rdata x%p\n" , rdata);
@@ -5242,7 +5238,7 @@ void lpfc_poll_timeout(unsigned long ptr)struct fc_rport *rport =starget_to_rport (scsi_target (cmnd->device));int status; - rdata =lpfc_rport_data_from_scsi_device (cmnd->device); + rdata = rport->dd_data;if (!rdata) {lpfc_printf_vlog (vport,KERN_ERR ,LOG_FCP ,"0799 Target Reset rport failure: rdata x%p\n" , rdata);
@@ -5253,7 +5249,7 @@ void lpfc_poll_timeout(unsigned long ptr)if (status !=0 && status !=SUCCESS )return status; - status =lpfc_chk_tgt_mapped (vport, cmnd); + status =lpfc_chk_tgt_mapped (vport, rport);if (status ==FAILED ) {lpfc_printf_vlog (vport,KERN_ERR ,LOG_FCP ,"0722 Target Reset rport failure: rdata x%p\n" , rdata);
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 23/47 zfcp: do not rely on scsi command for debugging message
In reply to Hannes ReineckeWhen generating debugging messages the code should not rely on a scsi command to be present.
--- drivers/s390/scsi/zfcp_dbf.c | 28 ++++++++++++++-------------- drivers/s390/scsi/zfcp_dbf.h | 10 +++++++--- drivers/s390/scsi/zfcp_ext.h | 4 ++-- drivers/s390/scsi/zfcp_scsi.c | 9 ++++++--- 4 files changed, 29 insertions(+), 22 deletions(-)
drivers/s390/scsi/zfcp_dbf.c +14 -14
@@ -535,11 +535,10 @@ void zfcp_dbf_san_in_els(char *tag, struct zfcp_fsf_req *fsf)* @sc: pointer to struct scsi_cmnd * @fsf: pointer to struct zfcp_fsf_req */ -void zfcp_dbf_scsi (char *tag,int level,struct scsi_cmnd *sc, -struct zfcp_fsf_req *fsf) +void zfcp_dbf_scsi (struct zfcp_adapter *adapter,char *tag,int level, +int scsi_id,u64 scsi_lun, +struct scsi_cmnd *sc,struct zfcp_fsf_req *fsf) { -struct zfcp_adapter *adapter = - (struct zfcp_adapter *) sc->device->host->hostdata[0 ];struct zfcp_dbf *dbf = adapter->dbf;struct zfcp_dbf_scsi *rec = &dbf->scsi_buf;struct fcp_resp_with_ext *fcp_rsp;
@@ -551,17 +550,18 @@ void zfcp_dbf_scsi(char *tag, int level, struct scsi_cmnd *sc,memcpy (rec->tag, tag,ZFCP_DBF_TAG_LEN ); rec->id =ZFCP_DBF_SCSI_CMND ; - rec->scsi_result = sc->result; - rec->scsi_retries = sc->retries; - rec->scsi_allowed = sc->allowed; - rec->scsi_id = sc->device->id; + rec->scsi_id = scsi_id;/* struct zfcp_dbf_scsi needs to be updated to handle 64bit LUNs */ - rec->scsi_lun = (u32 )sc->device->lun; - rec->host_scribble = (unsigned long )sc->host_scribble; - -memcpy (rec->scsi_opcode, sc->cmnd, -min ((int )sc->cmd_len,ZFCP_DBF_SCSI_OPCODE )); - + rec->scsi_lun = (u32 )scsi_lun; +if (sc) { + rec->scsi_result = sc->result; + rec->scsi_retries = sc->retries; + rec->scsi_allowed = sc->allowed; + rec->host_scribble = (unsigned long )sc->host_scribble; + +memcpy (rec->scsi_opcode, sc->cmnd, +min ((int )sc->cmd_len,ZFCP_DBF_SCSI_OPCODE )); + }if (fsf) { rec->fsf_req_id = fsf->req_id; fcp_rsp = (struct fcp_resp_with_ext *)
drivers/s390/scsi/zfcp_dbf.h +7 -3
@@ -352,7 +352,8 @@ void _zfcp_dbf_scsi(char *tag, int level, struct scsi_cmnd *scmd, scmd->device->host->hostdata[0 ];if (debug_level_enabled (adapter->dbf->scsi, level)) -zfcp_dbf_scsi (tag, level, scmd, req); +zfcp_dbf_scsi (adapter, tag, level, scmd->device->id, + scmd->device->lun, scmd, req); }/**
@@ -401,17 +402,20 @@ void zfcp_dbf_scsi_abort(char *tag, struct scsi_cmnd *scmd,* @flag: indicates type of reset (Target Reset, Logical Unit Reset) */ static inline -void zfcp_dbf_scsi_devreset (char *tag,struct scsi_cmnd *scmnd,u8 flag) +void zfcp_dbf_scsi_devreset (struct zfcp_adapter *adapter,char *tag, +int id,u64 lun,u8 flag) {char tmp_tag[ZFCP_DBF_TAG_LEN ]; +if (!debug_level_enabled (adapter->dbf->scsi,1 )) +return ;if (flag ==FCP_TMF_TGT_RESET )memcpy (tmp_tag,"tr_" ,3 );else memcpy (tmp_tag,"lr_" ,3 );memcpy (&tmp_tag[3 ], tag,4 ); -_zfcp_dbf_scsi (tmp_tag,1 , scmnd,NULL ); +zfcp_dbf_scsi (adapter, tmp_tag,1 , id, lun,NULL ,NULL ); }/**
drivers/s390/scsi/zfcp_ext.h +2 -2
@@ -47,8 +47,8 @@ extern void zfcp_dbf_rec_run_lvl(int level, char *tag,extern void zfcp_dbf_san_req (char *,struct zfcp_fsf_req *,u32 );extern void zfcp_dbf_san_res (char *,struct zfcp_fsf_req *);extern void zfcp_dbf_san_in_els (char *,struct zfcp_fsf_req *); -extern void zfcp_dbf_scsi (char *,int ,struct scsi_cmnd *, -struct zfcp_fsf_req *); +extern void zfcp_dbf_scsi (struct zfcp_adapter *,char *,int ,int , +u64 ,struct scsi_cmnd *,struct zfcp_fsf_req *);/* zfcp_erp.c */ extern void zfcp_erp_set_adapter_status (struct zfcp_adapter *,u32 );
drivers/s390/scsi/zfcp_scsi.c +6 -3
@@ -280,7 +280,8 @@ static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags)if (!(atomic_read (&adapter->status) &ZFCP_STATUS_COMMON_RUNNING )) { -zfcp_dbf_scsi_devreset ("nres" , scpnt, tm_flags); +zfcp_dbf_scsi_devreset (adapter,"nres" , sdev->id, + sdev->lun, tm_flags);return SUCCESS ; } }
@@ -290,10 +291,12 @@ static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags)wait_for_completion (&fsf_req->completion);if (fsf_req->status &ZFCP_STATUS_FSFREQ_TMFUNCFAILED ) { -zfcp_dbf_scsi_devreset ("fail" , scpnt, tm_flags); +zfcp_dbf_scsi_devreset (adapter,"fail" , sdev->id, + sdev->lun, tm_flags); retval =FAILED ; }else { -zfcp_dbf_scsi_devreset ("okay" , scpnt, tm_flags); +zfcp_dbf_scsi_devreset (adapter,"okay" , sdev->id, + sdev->lun, tm_flags);zfcp_scsi_forget_cmnds (zfcp_sdev, tm_flags); }
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 25/47 ibmvfc: open-code reset loop for target reset
In reply to Hannes ReineckeFrom: Hannes Reinecke <[email protected]>
For target reset we need a device to send the target reset to, so open-code the loop in target reset to send the target reset TMF to the correct device.
--- drivers/scsi/ibmvscsi/ibmvfc.c | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-)
drivers/scsi/ibmvscsi/ibmvfc.c +21 -18
@@ -2476,18 +2476,6 @@ static void ibmvfc_dev_cancel_all_noreset(struct scsi_device *sdev, void *data) }/** -* ibmvfc_dev_cancel_all_reset - Device iterated cancel all function -* @sdev: scsi device struct -* @data: return code -* -**/ -static void ibmvfc_dev_cancel_all_reset (struct scsi_device *sdev,void *data) -{ -unsigned long *rc = data; - *rc |=ibmvfc_cancel_all (sdev,IBMVFC_TMF_TGT_RESET ); -} - -/** * ibmvfc_eh_target_reset_handler - Reset the target * @cmd: scsi command struct *
@@ -2496,23 +2484,38 @@ static void ibmvfc_dev_cancel_all_reset(struct scsi_device *sdev, void *data)**/ static int ibmvfc_eh_target_reset_handler (struct scsi_cmnd *cmd) { -struct scsi_device *sdev = cmd->device; -struct ibmvfc_host *vhost =shost_priv (sdev->host); -struct scsi_target *starget =scsi_target (sdev); +struct 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);int block_rc;int reset_rc =0 ;int rc =FAILED ;unsigned long cancel_rc =0 ; +bool tgt_reset = false;ENTER ; block_rc =fc_block_scsi_eh (rport);ibmvfc_wait_while_resetting (vhost);if (block_rc !=FAST_IO_FAIL ) { -starget_for_each_device (starget, &cancel_rc, ibmvfc_dev_cancel_all_reset); - reset_rc =ibmvfc_reset_device (sdev,IBMVFC_TARGET_RESET ,"target" ); +struct scsi_device *sdev; + +shost_for_each_device (sdev, shost) { +if ((sdev->channel != starget->channel) || + (sdev->id != starget->id)) +continue ; + + cancel_rc |=ibmvfc_cancel_all (sdev, +IBMVFC_TMF_TGT_RESET ); +if (!tgt_reset) { + reset_rc =ibmvfc_reset_device (sdev, +IBMVFC_TARGET_RESET ,"target" ); + tgt_reset = true; + } + } }else -starget_for_each_device (starget, &cancel_rc, ibmvfc_dev_cancel_all_noreset); +starget_for_each_device (starget, &cancel_rc, + ibmvfc_dev_cancel_all_noreset);if (!cancel_rc && !reset_rc) rc =ibmvfc_wait_for_ops (vhost, starget, ibmvfc_match_target);
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 26/47 lpfc: use rport as argument for lpfc_send_taskmgmt()
In reply to Hannes ReineckeInstead of passing in a scsi device we should be using the rport; we already have the target and lun id as parameters, so there's no need to pass the scsi device, too.
--- drivers/scsi/lpfc/lpfc_scsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/lpfc/lpfc_scsi.c +6 -6
@@ -4954,7 +4954,7 @@ void lpfc_poll_timeout(unsigned long ptr)/** * lpfc_send_taskmgmt - Generic SCSI Task Mgmt Handler * @vport: The virtual port for which this call is being executed. -* @rdata: Pointer to remote port local data +* @rport: Pointer to remote port * @tgt_id: Target ID of remote device. * @lun_id: Lun number for the TMF * @task_mgmt_cmd: type of TMF to send
@@ -4967,7 +4967,7 @@ void lpfc_poll_timeout(unsigned long ptr)* 0x2002 - Success. **/ static int -lpfc_send_taskmgmt (struct lpfc_vport *vport,struct scsi_cmnd *cmnd, +lpfc_send_taskmgmt (struct lpfc_vport *vport,struct fc_rport *rport,unsigned int tgt_id,uint64_t lun_id,uint8_t task_mgmt_cmd) {
@@ -4980,7 +4980,7 @@ void lpfc_poll_timeout(unsigned long ptr)int ret;int status; - rdata =lpfc_rport_data_from_scsi_device (cmnd->device); + rdata = rport->dd_data;if (!rdata || !rdata->pnode || !NLP_CHK_NODE_ACT (rdata->pnode))return FAILED ; pnode = rdata->pnode;
@@ -4990,7 +4990,7 @@ void lpfc_poll_timeout(unsigned long ptr)return FAILED ; lpfc_cmd->timeout = phba->cfg_task_mgmt_tmo; lpfc_cmd->rdata = rdata; - lpfc_cmd->pCmd = cmnd; + lpfc_cmd->pCmd =NULL ; status =lpfc_scsi_prep_task_mgmt_cmd (vport, lpfc_cmd, lun_id, task_mgmt_cmd);
@@ -5198,7 +5198,7 @@ void lpfc_poll_timeout(unsigned long ptr)fc_host_post_vendor_event (shost,fc_get_event_number (),sizeof (scsi_event), (char *)&scsi_event,LPFC_NL_VENDOR_ID ); - status =lpfc_send_taskmgmt (vport, cmnd, tgt_id, lun_id, + status =lpfc_send_taskmgmt (vport, rport, tgt_id, lun_id,FCP_LUN_RESET ); lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
@@ -5277,7 +5277,7 @@ void lpfc_poll_timeout(unsigned long ptr)fc_host_post_vendor_event (shost,fc_get_event_number (),sizeof (scsi_event), (char *)&scsi_event,LPFC_NL_VENDOR_ID ); - status =lpfc_send_taskmgmt (vport, cmnd, tgt_id, lun_id, + status =lpfc_send_taskmgmt (vport, rport, tgt_id, lun_id,FCP_TARGET_RESET ); lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 29/47 qedf: use fc rport as argument for qedf_initiate_tmf()
In reply to Hannes ReineckeWhen sending a TMF we're only concerned with the rport and the LUN ID, so use struct fc_rport as argument for qedf_initiate_tmf().
--- drivers/scsi/qedf/qedf.h | 5 +++-- drivers/scsi/qedf/qedf_io.c | 48 +++++++++++++++++++------------------------ drivers/scsi/qedf/qedf_main.c | 9 ++++++-- 3 files changed, 31 insertions(+), 31 deletions(-)
drivers/scsi/qedf/qedf.h +3 -2
@@ -119,6 +119,7 @@ struct qedf_ioreq {#define QEDF_CMD_SRR_SENT 0x3u8 io_req_flags;uint8_t tm_flags; +u64 tm_lun;struct qedf_rport *fcport;unsigned long flags;enum qedf_ioreq_event event;
@@ -453,7 +454,7 @@ extern void qedf_process_warning_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, struct qedf_ioreq *io_req);extern void qedf_process_error_detect (struct qedf_ctx *qedf,struct fcoe_cqe *cqe,struct qedf_ioreq *io_req); -extern void qedf_flush_active_ios (struct qedf_rport *fcport,int lun); +extern void qedf_flush_active_ios (struct qedf_rport *fcport,u64 lun);extern void qedf_release_cmd (struct kref *ref);extern int qedf_initiate_abts (struct qedf_ioreq *io_req,bool return_scsi_cmd_on_abts);
@@ -478,7 +479,7 @@ extern int qedf_initiate_cleanup(struct qedf_ioreq *io_req, bool return_scsi_cmd_on_abts);extern void qedf_process_cleanup_compl (struct qedf_ctx *qedf,struct fcoe_cqe *cqe,struct qedf_ioreq *io_req); -extern int qedf_initiate_tmf (struct scsi_cmnd *sc_cmd,u8 tm_flags); +extern int qedf_initiate_tmf (struct fc_rport *rport,u64 lun,u8 tm_flags);extern void qedf_process_tmf_compl (struct qedf_ctx *qedf,struct fcoe_cqe *cqe,struct qedf_ioreq *io_req);extern void qedf_process_cqe (struct qedf_ctx *qedf,struct fcoe_cqe *cqe);
drivers/scsi/qedf/qedf_io.c +21 -27
133 lines not on this page · raw message
drivers/scsi/qedf/qedf_main.c +7 -2
@@ -619,14 +619,19 @@ static int qedf_eh_abort(struct scsi_cmnd *sc_cmd)static int qedf_eh_target_reset (struct scsi_cmnd *sc_cmd) { +struct scsi_target *starget =scsi_target (sc_cmd->device); +struct fc_rport *rport =starget_to_rport (starget); +QEDF_ERR (NULL ,"TARGET RESET Issued..." ); -return qedf_initiate_tmf (sc_cmd,FCP_TMF_TGT_RESET ); +return qedf_initiate_tmf (rport,0 ,FCP_TMF_TGT_RESET ); }static int qedf_eh_device_reset (struct scsi_cmnd *sc_cmd) { +struct fc_rport *rport =starget_to_rport (scsi_target (sc_cmd->device)); +QEDF_ERR (NULL ,"LUN RESET Issued...\n" ); -return qedf_initiate_tmf (sc_cmd,FCP_TMF_LUN_RESET ); +return qedf_initiate_tmf (rport, sc_cmd->device->lun,FCP_TMF_LUN_RESET ); }void qedf_wait_for_upload (struct qedf_ctx *qedf)
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 28/47 qla2xxx: open-code qla2xxx_generic_reset()
In reply to Hannes ReineckeDevice and target reset will be using different calling sequences, so there's not point in trying to combine both.
--- drivers/scsi/qla2xxx/qla_os.c | 106 ++++++++++++++++++++++++++++-------------- 1 file changed, 71 insertions(+), 35 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +71 -35
@@ -1384,13 +1384,20 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha) };static int -__qla2xxx_eh_generic_reset (char *name,enum nexus_wait_type type, -struct scsi_cmnd *cmd,int (*do_reset)(struct fc_port *,uint64_t ,int )) +qla2xxx_eh_device_reset (struct scsi_cmnd *cmd) { -scsi_qla_host_t *vha =shost_priv (cmd->device->host); -fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; +struct scsi_device *sdev = cmd->device; +scsi_qla_host_t *vha =shost_priv (sdev->host); +struct qla_hw_data *ha = vha->hw; +fc_port_t *fcport = (struct fc_port *) sdev->hostdata;int err; +if (qla2x00_isp_reg_stat (ha)) { +ql_log (ql_log_info, vha,0x803e , +"PCI/Register disconnect, exiting.\n" ); +return FAILED ; + } +if (!fcport) {return FAILED ; }
@@ -1402,74 +1409,103 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha) }ql_log (ql_log_info, vha,0x8009 , -"%s RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n" , name, vha->host_no, - cmd->device->id, cmd->device->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 (do_reset (fcport, cmd->device->lun, cmd->request->cpu +1 ) +if (ha->isp_ops->lun_reset (fcport, sdev->lun,smp_processor_id () +1 ) !=QLA_SUCCESS ) { -ql_log (ql_log_warn, vha,0x800c , -"do_reset failed for cmd=%p.\n" , cmd); +ql_log (ql_log_warn, vha,0x800c ,"lun_reset failed.\n" ); goto eh_reset_failed; } err =3 ; -if (qla2x00_eh_wait_for_pending_commands (vha, cmd->device->id, - cmd->device->lun, type) !=QLA_SUCCESS ) { +if (qla2x00_eh_wait_for_pending_commands (vha, sdev->id, + 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 , -"%s RESET SUCCEEDED nexus:%ld:%d:%llu cmd=%p.\n" , name, - vha->host_no, cmd->device->id, cmd->device->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 , -"%s RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n" , name, - reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun, - cmd); +"DEVICE RESET FAILED: %s nexus=%ld:%d:%llu\n" , + reset_errors[err], vha->host_no, sdev->id, sdev->lun);return FAILED ; }static int -qla2xxx_eh_device_reset (struct scsi_cmnd *cmd) +qla2xxx_eh_target_reset (struct scsi_cmnd *cmd) { -scsi_qla_host_t *vha =shost_priv (cmd->device->host); +struct scsi_device *sdev = cmd->device; +struct fc_rport *rport =starget_to_rport (scsi_target (sdev)); +scsi_qla_host_t *vha =shost_priv (rport_to_shost (rport));struct qla_hw_data *ha = vha->hw; +fc_port_t *fcport = (struct fc_port *) rport->dd_data; +int err;if (qla2x00_isp_reg_stat (ha)) { -ql_log (ql_log_info, vha,0x803e , +ql_log (ql_log_info, vha,0x803f ,"PCI/Register disconnect, exiting.\n" );return FAILED ; } -return __qla2xxx_eh_generic_reset ("DEVICE" ,WAIT_LUN , cmd, - ha->isp_ops->lun_reset); -} +if (!fcport) { +return FAILED ; + } -static int -qla2xxx_eh_target_reset (struct scsi_cmnd *cmd) -{ -scsi_qla_host_t *vha =shost_priv (cmd->device->host); -struct qla_hw_data *ha = vha->hw; +if (fcport->rport) { + err =fc_block_scsi_eh (fcport->rport); +if (err !=0 ) +return err; + } -if (qla2x00_isp_reg_stat (ha)) { -ql_log (ql_log_info, vha,0x803f , -"PCI/Register disconnect, exiting.\n" ); -return FAILED ; +ql_log (ql_log_info, vha,0x8009 , +"TARGET RESET ISSUED nexus=%ld:%d:0.\n" , vha->host_no, + cmd->device->id); + + err =0 ; +if (qla2x00_wait_for_hba_online (vha) !=QLA_SUCCESS ) { +ql_log (ql_log_warn, vha,0x800a , +"Wait for hba online failed.\n" ); + goto eh_reset_failed; + } + err =2 ; +if (ha->isp_ops->target_reset (fcport,0 ,smp_processor_id () +1 ) + !=QLA_SUCCESS ) { +ql_log (ql_log_warn, vha,0x800c ,"do_reset failed.\n" ); + goto eh_reset_failed; + } + err =3 ; +if (qla2x00_eh_wait_for_pending_commands (vha, sdev->id, +0 ,WAIT_TARGET ) !=QLA_SUCCESS ) { +ql_log (ql_log_warn, vha,0x800d , +"wait for pending cmds failed.\n" ); + goto eh_reset_failed; } -return __qla2xxx_eh_generic_reset ("TARGET" ,WAIT_TARGET , cmd, - ha->isp_ops->target_reset); +ql_log (ql_log_info, vha,0x800e , +"TARGET RESET SUCCEEDED nexus:%ld:%d:0.\n" , + vha->host_no, sdev->id); + +return SUCCESS ; + +eh_reset_failed: +ql_log (ql_log_info, vha,0x800f , +"TARGET RESET FAILED: %s nexus=%ld:%d:0\n" , + reset_errors[err], vha->host_no, sdev->id); +return FAILED ; }/**************************************************************************
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 31/47 bfa: Do not use scsi command to signal TMF status
In reply to Hannes ReineckeThe bfa driver hijacks the scsi command to signal the TMF status, which will no longer work if the TMF handler will be converted. So rework TMF handling to not use a scsi command but rather add new TMF fields to the per-device structure.
--- drivers/scsi/bfa/bfad_im.c | 109 ++++++++++++++++++++++++--------------------- drivers/scsi/bfa/bfad_im.h | 2 + 2 files changed, 61 insertions(+), 50 deletions(-)
drivers/scsi/bfa/bfad_im.c +59 -50
@@ -158,13 +158,12 @@ static void bfad_im_fc_rport_add(struct bfad_im_port_s *im_port, bfa_cb_tskim_done(void *bfad, struct bfad_tskim_s *dtsk, enum bfi_tskim_status tsk_status) { -struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dtsk; +struct bfad_itnim_data_s *itnim_data = (struct bfad_itnim_data_s *)dtsk;wait_queue_head_t *wq; - cmnd->SCp.Status |= tsk_status <<1 ; -set_bit (IO_DONE_BIT , (unsigned long *)&cmnd->SCp.Status); - wq = (wait_queue_head_t *) cmnd->SCp.ptr; - cmnd->SCp.ptr =NULL ; + itnim_data->tmf_status |= tsk_status <<1 ; +set_bit (IO_DONE_BIT , &itnim_data->tmf_status); + wq = itnim_data->tmf_wq;if (wq)wake_up (wq);
@@ -249,15 +248,16 @@ static void bfad_im_fc_rport_add(struct bfad_im_port_s *im_port, }static bfa_status_t -bfad_im_target_reset_send (struct bfad_s *bfad,struct scsi_cmnd *cmnd, -struct bfad_itnim_s *itnim) +bfad_im_target_reset_send (struct bfad_s *bfad, +struct bfad_itnim_data_s *itnim_data) { +struct bfad_itnim_s *itnim = itnim_data->itnim;struct bfa_tskim_s *tskim;struct bfa_itnim_s *bfa_itnim;bfa_status_t rc =BFA_STATUS_OK ;struct scsi_lun scsilun; - tskim =bfa_tskim_alloc (&bfad->bfa, (struct bfad_tskim_s *) cmnd); + tskim =bfa_tskim_alloc (&bfad->bfa, (struct bfad_tskim_s *) itnim_data);if (!tskim) {BFA_LOG (KERN_ERR , bfad, bfa_log_level,"target reset, fail to allocate tskim\n" );
@@ -265,12 +265,6 @@ static void bfad_im_fc_rport_add(struct bfad_im_port_s *im_port, goto out; } -/* -* Set host_scribble to NULL to avoid aborting a task command if -* happens. -*/ - cmnd->host_scribble =NULL ; - cmnd->SCp.Status =0 ; bfa_itnim =bfa_fcs_itnim_get_halitn (&itnim->fcs_itnim);/* * bfa_itnim can be NULL if the port gets disconnected and the bfa
@@ -301,10 +295,11 @@ static void bfad_im_fc_rport_add(struct bfad_im_port_s *im_port,static int bfad_im_reset_lun_handler (struct scsi_cmnd *cmnd) { -struct Scsi_Host *shost = cmnd->device->host; +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 ]; -struct bfad_itnim_data_s *itnim_data = cmnd->device->hostdata; +struct bfad_itnim_data_s *itnim_data = sdev->hostdata;struct bfad_s *bfad = im_port->bfad;struct bfa_tskim_s *tskim;struct bfad_itnim_s *itnim;
@@ -316,14 +311,20 @@ static void bfad_im_fc_rport_add(struct bfad_im_port_s *im_port,struct scsi_lun scsilun;spin_lock_irqsave (&bfad->bfad_lock, flags); +if (itnim_data->tmf_wq) { +BFA_LOG (KERN_ERR , bfad, bfa_log_level, +"LUN reset, TMF already active" ); +spin_unlock_irqrestore (&bfad->bfad_lock, flags); + rc =FAILED ; + goto out; + } itnim = itnim_data->itnim;if (!itnim) {spin_unlock_irqrestore (&bfad->bfad_lock, flags); rc =FAILED ; goto out; } - - tskim =bfa_tskim_alloc (&bfad->bfa, (struct bfad_tskim_s *) cmnd); + tskim =bfa_tskim_alloc (&bfad->bfa, (struct bfad_tskim_s *) itnim_data);if (!tskim) {BFA_LOG (KERN_ERR , bfad, bfa_log_level,"LUN reset, fail to allocate tskim" );
@@ -332,13 +333,8 @@ static void bfad_im_fc_rport_add(struct bfad_im_port_s *im_port, goto out; } -/* -* Set host_scribble to NULL to avoid aborting a task command -* if happens. -*/ - cmnd->host_scribble =NULL ; - cmnd->SCp.ptr = (char *)&wq; - cmnd->SCp.Status =0 ; + itnim_data->tmf_wq = &wq; + itnim_data->tmf_status =0 ; bfa_itnim =bfa_fcs_itnim_get_halitn (&itnim->fcs_itnim);/* * bfa_itnim can be NULL if the port gets disconnected and the bfa
@@ -353,15 +349,16 @@ static void bfad_im_fc_rport_add(struct bfad_im_port_s *im_port, rc =FAILED ; goto out; } -int_to_scsilun (cmnd->device->lun, &scsilun); +int_to_scsilun (sdev->lun, &scsilun);bfa_tskim_start (tskim, bfa_itnim, scsilun,FCP_TM_LUN_RESET ,BFAD_LUN_RESET_TMO );spin_unlock_irqrestore (&bfad->bfad_lock, flags); -wait_event (wq,test_bit (IO_DONE_BIT , - (unsigned long *)&cmnd->SCp.Status)); - - task_status = cmnd->SCp.Status >>1 ; +wait_event (wq,test_bit (IO_DONE_BIT , &itnim_data->tmf_status)); +spin_lock_irqsave (&bfad->bfad_lock, flags); + itnim_data->tmf_wq =NULL ; + task_status = itnim_data->tmf_status >>1 ; +spin_unlock_irqrestore (&bfad->bfad_lock, flags);if (task_status !=BFI_TSKIM_STS_OK ) {BFA_LOG (KERN_ERR , bfad, bfa_log_level,"LUN reset failure, status: %d\n" , task_status);
@@ -378,37 +375,49 @@ static void bfad_im_fc_rport_add(struct bfad_im_port_s *im_port,static int bfad_im_reset_target_handler (struct scsi_cmnd *cmnd) { -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_itnim_data_s *itnim_data; +struct bfad_itnim_s *itnim;struct bfad_im_port_s *im_port = (struct bfad_im_port_s *) shost->hostdata[0 ];struct bfad_s *bfad = im_port->bfad; -struct bfad_itnim_s *itnim;unsigned long flags;u32 rc, rtn =FAILED ;DECLARE_WAIT_QUEUE_HEAD_ONSTACK (wq);enum bfi_tskim_status task_status;spin_lock_irqsave (&bfad->bfad_lock, flags); - itnim =bfad_get_itnim (im_port, starget->id); -if (itnim) { - cmnd->SCp.ptr = (char *)&wq; - rc =bfad_im_target_reset_send (bfad, cmnd, itnim); -if (rc ==BFA_STATUS_OK ) { -/* wait target reset to complete */ -spin_unlock_irqrestore (&bfad->bfad_lock, flags); -wait_event (wq,test_bit (IO_DONE_BIT , - (unsigned long *)&cmnd->SCp.Status)); -spin_lock_irqsave (&bfad->bfad_lock, flags); +if (!rport->dd_data) { +spin_unlock_irqrestore (&bfad->bfad_lock, flags); +return rtn; + } + itnim_data = rport->dd_data; +if (itnim_data->tmf_wq) { +BFA_LOG (KERN_ERR , bfad, bfa_log_level, +"target reset failed, TMF already active" ); +spin_unlock_irqrestore (&bfad->bfad_lock, flags); +return rtn; + } + itnim = itnim_data->itnim; - task_status = cmnd->SCp.Status >>1 ; -if (task_status !=BFI_TSKIM_STS_OK ) -BFA_LOG (KERN_ERR , bfad, bfa_log_level, -"target reset failure," -" status: %d\n" , task_status); -else - rtn =SUCCESS ; - } + itnim_data->tmf_wq = &wq; + itnim_data->tmf_status =0 ; + rc =bfad_im_target_reset_send (bfad, itnim_data); +if (rc ==BFA_STATUS_OK ) { +/* wait target reset to complete */ +spin_unlock_irqrestore (&bfad->bfad_lock, flags); +wait_event (wq,test_bit (IO_DONE_BIT , &itnim_data->tmf_status)); +spin_lock_irqsave (&bfad->bfad_lock, flags); + + task_status = itnim_data->tmf_status >>1 ; +if (task_status !=BFI_TSKIM_STS_OK ) +BFA_LOG (KERN_ERR , bfad, bfa_log_level, +"target reset failure," +" status: %d\n" , task_status); +else + rtn =SUCCESS ; }spin_unlock_irqrestore (&bfad->bfad_lock, flags);
drivers/scsi/bfa/bfad_im.h +2 -0
@@ -54,6 +54,8 @@ void bfad_im_scsi_host_free(struct bfad_s *bfad,struct bfad_itnim_data_s {struct bfad_itnim_s *itnim; +wait_queue_head_t *tmf_wq; +unsigned long tmf_status; };struct bfad_im_port_s {
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 32/47 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.
--- drivers/message/fusion/mptsas.c | 10 +++++- drivers/message/fusion/mptscsih.c | 27 +++++++---------- drivers/message/fusion/mptscsih.h | 2 +- drivers/message/fusion/mptspi.c | 8 ++++- drivers/s390/scsi/zfcp_scsi.c | 20 ++++++++++-- drivers/scsi/aacraid/linit.c | 9 +++--- drivers/scsi/be2iscsi/be_main.c | 4 +-- drivers/scsi/bfa/bfad_im.c | 3 +- drivers/scsi/bnx2fc/bnx2fc.h | 2 +- drivers/scsi/bnx2fc/bnx2fc_io.c | 4 +-- drivers/scsi/esas2r/esas2r.h | 2 +- drivers/scsi/esas2r/esas2r_main.c | 38 ++++++++++++----------- drivers/scsi/ibmvscsi/ibmvfc.c | 3 +- drivers/scsi/libiscsi.c | 4 +-- drivers/scsi/libsas/sas_scsi_host.c | 9 +++--- drivers/scsi/lpfc/lpfc_scsi.c | 10 +++--- drivers/scsi/megaraid/megaraid_sas.h | 3 +- drivers/scsi/megaraid/megaraid_sas_base.c | 10 +++--- drivers/scsi/megaraid/megaraid_sas_fusion.c | 47 +++++++++++++++-------------- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 35 +++++++++++---------- drivers/scsi/pmcraid.c | 24 +++++++++++---- drivers/scsi/qedf/qedf_main.c | 3 +- drivers/scsi/qla2xxx/qla_os.c | 18 +++++------ drivers/scsi/qla4xxx/ql4_os.c | 41 ++++++++++++++----------- drivers/scsi/scsi_debug.c | 21 ++++--------- drivers/scsi/scsi_error.c | 5 +-- drivers/scsi/scsi_transport_iscsi.c | 6 ++-- 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 +- include/scsi/scsi_transport_iscsi.h | 2 +- 33 files changed, 214 insertions(+), 174 deletions(-)
drivers/message/fusion/mptsas.c +9 -1
@@ -1970,6 +1970,14 @@ static enum blk_eh_timer_return 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 struct scsi_host_template mptsas_driver_template = { .module =THIS_MODULE , .proc_name ="mptsas" ,
@@ -1985,7 +1993,7 @@ static enum blk_eh_timer_return mptsas_eh_timed_out(struct scsi_cmnd *sc) .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 +11 -16
@@ -1852,48 +1852,43 @@ int mptscsih_show_info(struct seq_file *m, struct Scsi_Host *host)* 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;int retval; -VirtDevice *vdevice; +VirtTarget *vtarget;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); +if ((hd =shost_priv (shost)) ==NULL ){ + printk(KERN_ERR MYNAM ": target reset: Can't locate host!\n");return FAILED ; } ioc = hd->ioc; -printk (MYIOC_s_INFO_FMT"attempting target reset! (sc=%p)\n" , - ioc->name, SCpnt); -scsi_print_command (SCpnt); - - 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 int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel,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 *,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
@@ -825,6 +825,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 struct scsi_host_template mptspi_driver_template = { .module =THIS_MODULE , .proc_name ="mptspi" ,
@@ -839,7 +845,7 @@ static void mptspi_slave_destroy(struct scsi_device *sdev) .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 +18 -2
@@ -309,9 +309,25 @@ static int zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt)return zfcp_task_mgmt_function (scpnt->device,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) { -return zfcp_task_mgmt_function (scpnt->device,FCP_TMF_TGT_RESET ); +struct fc_rport *rport =starget_to_rport (starget); +struct Scsi_Host *shost =rport_to_shost (rport); +struct scsi_device *sdev =NULL , *tmp_sdev; + +shost_for_each_device (tmp_sdev, shost) { +if (tmp_sdev->id == starget->id) { + sdev = tmp_sdev; +break ; + } + } +if (!sdev) +return FAILED ; +return zfcp_task_mgmt_function (sdev,FCP_TMF_TGT_RESET ); }static int zfcp_scsi_eh_host_reset_handler (struct Scsi_Host *host)
drivers/scsi/aacraid/linit.c +4 -5
@@ -947,10 +947,9 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd)* @scsi_cmd: SCSI command block causing the 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;
@@ -960,8 +959,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; info = &aac->hba_map[bus][cid];if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || info->devtype !=AAC_DEVTYPE_NATIVE_RAW )
drivers/scsi/be2iscsi/be_main.c +2 -2
@@ -363,11 +363,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 +1 -2
@@ -373,9 +373,8 @@ static void bfad_im_fc_rport_add(struct bfad_im_port_s *im_port,* 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_target *starget =scsi_target (cmnd->device);struct fc_rport *rport =starget_to_rport (starget);struct Scsi_Host *shost =rport_to_shost (rport);struct bfad_itnim_data_s *itnim_data;
drivers/scsi/bnx2fc/bnx2fc.h +1 -1
@@ -540,7 +540,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 +2 -2
@@ -1058,9 +1058,9 @@ int bnx2fc_initiate_cleanup(struct bnx2fc_cmd *io_req)* 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
@@ -979,7 +979,7 @@ u8 handle_hba_ioctl(struct esas2r_adapter *a,int esas2r_device_reset (struct scsi_cmnd *cmd);int esas2r_host_reset (struct Scsi_Host *shost);int esas2r_bus_reset (struct Scsi_Host *shost,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 -18
@@ -1164,10 +1164,11 @@ int esas2r_bus_reset(struct Scsi_Host *shost, 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 *)shost->hostdata;struct esas2r_request *rq;u8 task_management_status =RS_PENDING ;bool completed;
@@ -1181,34 +1182,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 ); }
@@ -1242,17 +1239,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 +1 -2
@@ -2482,9 +2482,8 @@ static void ibmvfc_dev_cancel_all_noreset(struct scsi_device *sdev, void *data)* 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 +2 -2
@@ -2521,12 +2521,12 @@ static int iscsi_eh_target_reset(struct iscsi_cls_session *cls_session)* 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
@@ -526,11 +526,12 @@ int sas_eh_device_reset_handler(struct scsi_cmnd *cmd)return FAILED ; } -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)
@@ -562,7 +563,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 +5 -5
@@ -5226,16 +5226,16 @@ void lpfc_poll_timeout(unsigned long ptr)* 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 (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; -struct fc_rport *rport =starget_to_rport (scsi_target (cmnd->device));int status; rdata = rport->dd_data;
drivers/scsi/megaraid/megaraid_sas.h +2 -1
@@ -2485,7 +2485,8 @@ void megasas_return_mfi_mpt_pthr(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 +6 -4
@@ -2821,17 +2821,19 @@ static int megasas_task_abort(struct scsi_cmnd *scmd)* (supported only for fusion adapters) * @scmd: SCSI command pointer */ -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; + instance = (struct megasas_instance *)shost->hostdata;if (instance->ctrl_context) - 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 +25 -22
93 lines not on this page · raw message
drivers/scsi/mpt3sas/mpt3sas_scsih.c +19 -16
@@ -2580,26 +2580,30 @@ int mpt3sas_scsih_issue_locked_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle,* Returns SUCCESS if command aborted 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 Scsi_Host *shost =dev_to_shost (&starget->dev); +struct scsi_device *sdev =NULL , *tmp_sdev; +struct MPT3SAS_ADAPTER *ioc =shost_priv (shost);struct MPT3SAS_DEVICE *sas_device_priv_data;struct _sas_device *sas_device =NULL ;u16 handle;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(%p)\n" , - scmd); -_scsih_tm_display_info (ioc, scmd); +starget_printk (KERN_INFO , starget,"attempting target reset!\n" ); - sas_device_priv_data = scmd->device->hostdata; +shost_for_each_device (tmp_sdev, shost) { +if (scsi_target (tmp_sdev) == starget) { +if (!tmp_sdev->hostdata) +continue ; + sdev = tmp_sdev; +break ; + } + } + sas_device_priv_data = sdev->hostdata;if (!sas_device_priv_data || !sas_device_priv_data->sas_target) { -starget_printk (KERN_INFO , starget,"target been deleted! scmd(%p)\n" , - scmd); - scmd->result =DID_NO_CONNECT <<16 ; - scmd->scsi_done (scmd); +starget_printk (KERN_INFO , starget,"target been deleted!\n" ); r =SUCCESS ; goto out; }
@@ -2616,18 +2620,17 @@ int mpt3sas_scsih_issue_locked_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, handle = sas_device_priv_data->sas_target->handle;if (!handle) { - scmd->result =DID_RESET <<16 ; r =FAILED ; goto out; } - r =mpt3sas_scsih_issue_locked_tm (ioc, handle, scmd->device->channel, - scmd->device->id,0 ,MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET ,0 , + r =mpt3sas_scsih_issue_locked_tm (ioc, handle, starget->channel, + starget->id,0 ,MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET ,0 ,30 ); out: -starget_printk (KERN_INFO , starget,"target reset: %s scmd(%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 +18 -6
@@ -2738,6 +2738,7 @@ static int pmcraid_reset_device(u8 modifier ) { +struct Scsi_Host *shost = scsi_dev->host;struct pmcraid_cmd *cmd;struct pmcraid_instance *pinstance;struct pmcraid_resource_entry *res;
@@ -2745,10 +2746,9 @@ static int pmcraid_reset_device(unsigned long lock_flags;u32 ioasc; - pinstance = - (struct pmcraid_instance *)scsi_dev->host->hostdata; - res = scsi_dev->hostdata; + pinstance = (struct pmcraid_instance *)shost->hostdata; + res = scsi_dev->hostdata;if (!res) {sdev_printk (KERN_ERR , scsi_dev,"reset_device: NULL resource pointer\n" );
@@ -3106,11 +3106,23 @@ static int pmcraid_eh_bus_reset_handler(struct Scsi_Host *host, int channel) 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) { -scmd_printk (KERN_INFO , scmd, +struct Scsi_Host *shost =dev_to_shost (&starget->dev); +struct scsi_device *scsi_dev =NULL , *tmp; + +shost_for_each_device (tmp, shost) { +if ((tmp->channel == starget->channel) && + (tmp->id == starget->id)) { + scsi_dev = tmp; +break ; + } + } +if (!scsi_dev) +return FAILED ; +sdev_printk (KERN_INFO , scsi_dev,"Doing target reset due to an I/O command timeout.\n" ); -return pmcraid_reset_device (scmd->device, +return pmcraid_reset_device (scsi_dev,PMCRAID_INTERNAL_TIMEOUT ,RESET_DEVICE_TARGET ); }
drivers/scsi/qedf/qedf_main.c +1 -2
@@ -617,9 +617,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 +9 -9
@@ -273,7 +273,7 @@static int qla2xxx_queuecommand (struct Scsi_Host *h,struct scsi_cmnd *cmd);static int qla2xxx_eh_abort (struct scsi_cmnd *);static int qla2xxx_eh_device_reset (struct scsi_cmnd *); -static int qla2xxx_eh_target_reset (struct scsi_cmnd *); +static int qla2xxx_eh_target_reset (struct scsi_target *);static int qla2xxx_eh_bus_reset (struct Scsi_Host *,int );static int qla2xxx_eh_host_reset (struct Scsi_Host *);
@@ -1446,10 +1446,9 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha) }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 = (struct fc_port *) rport->dd_data;
@@ -1473,7 +1472,7 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha)ql_log (ql_log_info, vha,0x8009 ,"TARGET RESET ISSUED nexus=%ld:%d:0.\n" , vha->host_no, - cmd->device->id); + starget->id); err =0 ;if (qla2x00_wait_for_hba_online (vha) !=QLA_SUCCESS ) {
@@ -1482,13 +1481,14 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha) goto eh_reset_failed; } err =2 ; -if (ha->isp_ops->target_reset (fcport,0 ,smp_processor_id () +1 ) +if (ha->isp_ops->target_reset (fcport, starget->id, +smp_processor_id () +1 ) !=QLA_SUCCESS ) {ql_log (ql_log_warn, vha,0x800c ,"do_reset failed.\n" ); goto eh_reset_failed; } err =3 ; -if (qla2x00_eh_wait_for_pending_commands (vha, sdev->id, +if (qla2x00_eh_wait_for_pending_commands (vha, starget->id,0 ,WAIT_TARGET ) !=QLA_SUCCESS ) {ql_log (ql_log_warn, vha,0x800d ,"wait for pending cmds failed.\n" );
@@ -1497,14 +1497,14 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha)ql_log (ql_log_info, vha,0x800e ,"TARGET RESET SUCCEEDED nexus:%ld:%d:0.\n" , - vha->host_no, sdev->id); + vha->host_no, starget->id);return SUCCESS ; eh_reset_failed:ql_log (ql_log_info, vha,0x800f ,"TARGET RESET FAILED: %s nexus=%ld:%d:0\n" , - reset_errors[err], vha->host_no, sdev->id); + reset_errors[err], vha->host_no, starget->id);return FAILED ; }
drivers/scsi/qla4xxx/ql4_os.c +23 -18
96 lines not on this page · raw message
drivers/scsi/scsi_debug.c +6 -15
@@ -3809,39 +3809,30 @@ static int scsi_debug_device_reset(struct scsi_cmnd * SCpnt)return SUCCESS ; } -static int scsi_debug_target_reset (struct scsi_cmnd *SCpnt) +static int scsi_debug_target_reset (struct scsi_target *starget) { +struct Scsi_Host *hp =dev_to_shost (&starget->dev);struct sdebug_host_info *sdbg_host;struct sdebug_dev_info *devip; -struct scsi_device *sdp; -struct Scsi_Host *hp;int k =0 ; ++num_target_resets; -if (!SCpnt) - goto lie; - sdp = SCpnt->device; -if (!sdp) - goto lie;if (SDEBUG_OPT_ALL_NOISE & sdebug_opts) -sdev_printk (KERN_INFO , sdp,"%s\n" , __func__); - hp = sdp->host; -if (!hp) - goto lie; +starget_printk (KERN_INFO , starget,"%s\n" , __func__); sdbg_host = *(struct sdebug_host_info **)shost_priv (hp);if (sdbg_host) {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); -lie: +return SUCCESS ; }
drivers/scsi/scsi_error.c +3 -2
@@ -810,14 +810,15 @@ static int scsi_try_target_reset(struct scsi_cmnd *scmd)int rtn;struct Scsi_Host *host = scmd->device->host;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); }
drivers/scsi/scsi_transport_iscsi.c +2 -4
@@ -1855,17 +1855,15 @@ static void iscsi_scan_session(struct work_struct *work)/** * iscsi_block_scsi_eh - block scsi eh until session state has transistioned -* @cmd: scsi cmd passed to scsi eh handler +* @session: session to be blocked * * If the session is down this function will wait for the recovery * timer to fire or for the session to be logged back in. If the * recovery timer fires then FAST_IO_FAIL is returned. The caller * should pass this error value to the scsi eh. */ -int iscsi_block_scsi_eh (struct scsi_cmnd *cmd) +int iscsi_block_scsi_eh (struct iscsi_cls_session *session) { -struct iscsi_cls_session *session = -starget_to_session (scsi_target (cmd->device));unsigned long flags;int ret =0 ;
drivers/scsi/sym53c8xx_2/sym_glue.c +1 -2
@@ -641,9 +641,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
@@ -328,24 +328,25 @@ 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
@@ -381,7 +381,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
@@ -714,7 +714,7 @@ extern int sas_bios_param(struct scsi_device *,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
@@ -146,7 +146,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 *,int );int (* eh_host_reset_handler)(struct Scsi_Host *);
include/scsi/scsi_transport_iscsi.h +1 -1
@@ -444,7 +444,7 @@ extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *sess,extern struct iscsi_endpoint *iscsi_create_endpoint (int dd_size);extern void iscsi_destroy_endpoint (struct iscsi_endpoint *ep);extern struct iscsi_endpoint *iscsi_lookup_endpoint (u64 handle); -extern int iscsi_block_scsi_eh (struct scsi_cmnd *cmd); +extern int iscsi_block_scsi_eh (struct iscsi_cls_session *session); extern struct iscsi_iface *iscsi_create_iface(struct Scsi_Host *shost, struct iscsi_transport *t, uint32_t iface_type,
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 33/47 cxlflash: use dedicated reset command in send_tmf()
In reply to Hannes ReineckeFrom: Hannes Reinecke <[email protected]>
Reduce the queue depth by 1, and use this command as a dedicated reset command send_tmf().
--- drivers/scsi/cxlflash/common.h | 3 ++- drivers/scsi/cxlflash/main.c | 23 ++++++++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-)
drivers/scsi/cxlflash/common.h +2 -1
@@ -54,7 +54,8 @@/* Command management definitions */ #define CXLFLASH_MAX_CMDS 256 -#define CXLFLASH_MAX_CMDS_PER_LUN CXLFLASH_MAX_CMDS +#define CXLFLASH_MAX_CMDS_PER_LUN CXLFLASH_MAX_CMDS - 1 +#define CXLFLASH_RESET_CMD 255/* RRQ for master issued cmds */ #define NUM_RRQ_ENTRY CXLFLASH_MAX_CMDS
drivers/scsi/cxlflash/main.c +16 -7
@@ -23,6 +23,7 @@#include <scsi/scsi_cmnd.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include <uapi/scsi/cxlflash_ioctl.h> #include "main.h"
@@ -460,15 +461,16 @@ static u32 cmd_to_target_hwq(struct Scsi_Host *host, struct scsi_cmnd *scp,/** * send_tmf() - sends a Task Management Function (TMF) * @afu: AFU to checkout from. -* @scp: SCSI command from stack describing target. +* @sdev: SCSI device to reset. * @tmfcmd: TMF command to send. * * Return: * 0 on success, SCSI_MLQUEUE_HOST_BUSY or -errno on failure */ -static int send_tmf (struct afu *afu,struct scsi_cmnd *scp,u64 tmfcmd) +static int send_tmf (struct afu *afu,struct scsi_device *sdev,u64 tmfcmd) { -struct Scsi_Host *host = scp->device->host; +struct scsi_cmnd *scp; +struct Scsi_Host *host = sdev->host;struct cxlflash_cfg *cfg =shost_priv (host);struct afu_cmd *cmd =NULL ;struct device *dev = &cfg->dev->dev;
@@ -498,14 +500,21 @@ static int send_tmf(struct afu *afu, struct scsi_cmnd *scp, u64 tmfcmd) cfg->tmf_active = true;spin_unlock_irqrestore (&cfg->tmf_slock, lock_flags); + scp =scsi_host_find_tag (host,CXLFLASH_RESET_CMD ); + scp->device = sdev; + cmd =sc_to_afucz (scp); + hwq_index =cmd_to_target_hwq (host, scp, afu); + hwq =get_hwq (afu, hwq_index); + + cmd->scp = scp; cmd->parent = afu; cmd->cmd_tmf = true; cmd->hwq_index = hwq_index; cmd->rcb.ctx_id = hwq->ctx_hndl; cmd->rcb.msi =SISL_MSI_RRQ_UPDATED ; - cmd->rcb.port_sel =CHAN2PORTMASK (scp->device->channel); - cmd->rcb.lun_id =lun_to_lunid (scp->device->lun); + cmd->rcb.port_sel =CHAN2PORTMASK (sdev->channel); + cmd->rcb.lun_id =lun_to_lunid (sdev->lun); cmd->rcb.req_flags = (SISL_REQ_FLAGS_PORT_LUN_ID |SISL_REQ_FLAGS_SUP_UNDERRUN |SISL_REQ_FLAGS_TMF_CMD );
@@ -2448,7 +2457,7 @@ static int cxlflash_eh_device_reset_handler(struct scsi_cmnd *scp) retry:switch (cfg->state) {case STATE_NORMAL : - rcr =send_tmf (afu, scp,TMF_LUN_RESET ); + rcr =send_tmf (afu, sdev,TMF_LUN_RESET );if (unlikely (rcr)) rc =FAILED ;break ;
@@ -3139,7 +3148,7 @@ static ssize_t mode_show(struct device *dev, .eh_host_reset_handler = cxlflash_eh_host_reset_handler, .change_queue_depth = cxlflash_change_queue_depth, .cmd_per_lun = CXLFLASH_MAX_CMDS_PER_LUN, - .can_queue = CXLFLASH_MAX_CMDS, + .can_queue = CXLFLASH_MAX_CMDS - 1, .cmd_size = sizeof(struct afu_cmd) + __alignof__(struct afu_cmd) - 1, .this_id = -1, .sg_tablesize = 1, /* No scatter gather support */
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 30/47 sym53c8xx_2: rework reset handling
In reply to Hannes ReineckeSplit off the combined abort and device reset handling into distinct functions.
And the current device reset handler really is a target reset, so rename it.
--- drivers/scsi/sym53c8xx_2/sym_glue.c | 82 +++++++++++++++++++++++++------------ 1 file changed, 55 insertions(+), 27 deletions(-)
drivers/scsi/sym53c8xx_2/sym_glue.c +55 -27
@@ -586,7 +586,10 @@ static void sym53c8xx_timer(unsigned long npref)* Generic method for our eh processing. * The 'op' argument tells what we have to do. */ -static int sym_eh_handler (int op,char *opname,struct scsi_cmnd *cmd) +/* +* Error handlers called from the eh thread (one thread per HBA). +*/ +static int sym53c8xx_eh_abort_handler (struct scsi_cmnd *cmd) {struct sym_ucmd *ucmd =SYM_UCMD_PTR (cmd);struct Scsi_Host *shost = cmd->device->host;
@@ -598,7 +601,7 @@ static int sym_eh_handler(int op, char *opname, struct scsi_cmnd *cmd)int sts =-1 ;struct completion eh_done; -scmd_printk (KERN_WARNING , cmd,"%s operation started\n" , opname); +scmd_printk (KERN_WARNING , cmd,"ABORT operation started\n" );/* * Escalate to host reset if the PCI bus went down
@@ -616,19 +619,7 @@ static int sym_eh_handler(int op, char *opname, struct scsi_cmnd *cmd) } } -/* Try to proceed the operation we have been asked for */ - sts =-1 ; -switch (op) { -case SYM_EH_ABORT : - sts =sym_abort_scsiio (np, cmd,1 ); -break ; -case SYM_EH_DEVICE_RESET : - sts =sym_reset_scsi_target (np, cmd->device->id); -break ; -default : -break ; - } - + sts =sym_abort_scsiio (np, cmd,1 );/* On error, restore everything and cross fingers :) */ if (sts) cmd_queued =0 ;
@@ -645,23 +636,60 @@ static int sym_eh_handler(int op, char *opname, struct scsi_cmnd *cmd)spin_unlock_irq (shost->host_lock); } -dev_warn (&cmd->device->sdev_gendev,"%s operation %s.\n" , opname, +dev_warn (&cmd->device->sdev_gendev,"ABORT operation %s.\n" , sts==0 ?"complete" :sts==-2 ?"timed-out" :"failed" );return sts ?SCSI_FAILED :SCSI_SUCCESS ; } - -/* -* Error handlers called from the eh thread (one thread per HBA). -*/ -static int sym53c8xx_eh_abort_handler (struct scsi_cmnd *cmd) +static int sym53c8xx_eh_target_reset_handler (struct scsi_cmnd *cmd) { -return sym_eh_handler (SYM_EH_ABORT ,"ABORT" , cmd); -} +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; +struct sym_hcb *np = sym_data->ncb; +SYM_QUEHEAD *qp; +int sts; +struct completion eh_done; -static int sym53c8xx_eh_device_reset_handler (struct scsi_cmnd *cmd) -{ -return sym_eh_handler (SYM_EH_DEVICE_RESET ,"DEVICE RESET" , cmd); +starget_printk (KERN_WARNING , starget, +"TARGET RESET operation started\n" ); + +/* +* Escalate to host reset if the PCI bus went down +*/ +if (pci_channel_offline (pdev)) +return SCSI_FAILED ; + +spin_lock_irq (shost->host_lock); + sts =sym_reset_scsi_target (np, starget->id); +if (!sts) { + FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) { + struct sym_ccb *cp = sym_que_entry(qp, struct sym_ccb, + link_ccbq); +struct scsi_cmnd *cmd = cp->cmd; +struct sym_ucmd *ucmd; + +if (!cmd || cmd->device->channel != starget->channel || + cmd->device->id != starget->id) +continue ; + + ucmd =SYM_UCMD_PTR (cmd); +init_completion (&eh_done); + ucmd->eh_done = &eh_done; +spin_unlock_irq (shost->host_lock); +if (!wait_for_completion_timeout (&eh_done,5 *HZ )) { + ucmd->eh_done =NULL ; + sts =-2 ; + } +spin_lock_irq (shost->host_lock); + } + } +spin_unlock_irq (shost->host_lock); + +starget_printk (KERN_WARNING , starget,"TARGET RESET operation %s.\n" , + sts==0 ?"complete" :sts==-2 ?"timed-out" :"failed" ); +return SCSI_SUCCESS ; }static int sym53c8xx_eh_bus_reset_handler (struct Scsi_Host *shost,int channel)
@@ -1681,7 +1709,7 @@ static int sym_detach(struct Scsi_Host *shost, struct pci_dev *pdev) .slave_configure = sym53c8xx_slave_configure, .slave_destroy = sym53c8xx_slave_destroy, .eh_abort_handler = sym53c8xx_eh_abort_handler, - .eh_device_reset_handler = sym53c8xx_eh_device_reset_handler, + .eh_target_reset_handler = sym53c8xx_eh_target_reset_handler, .eh_bus_reset_handler = sym53c8xx_eh_bus_reset_handler, .eh_host_reset_handler = sym53c8xx_eh_host_reset_handler, .this_id = 7,
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 35/47 fnic: use dedicated device reset command
In reply to Hannes ReineckeUse a dedicated command to send a device reset instead of relying on using the command which triggered the device failure.
--- drivers/scsi/fnic/fnic_main.c | 2 ++ drivers/scsi/fnic/fnic_scsi.c | 78 +++++++++++++------------------------------ 2 files changed, 26 insertions(+), 54 deletions(-)
drivers/scsi/fnic/fnic_main.c +2 -0
@@ -706,6 +706,8 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) fnic->config.io_throttle_count)); } fnic->fnic_max_tag_id = host->can_queue; +/* Reserve the last tag for device reset */ + host->can_queue--; host->max_lun = fnic->config.luns_per_tgt; host->max_id =FNIC_MAX_FCP_TARGET ;
drivers/scsi/fnic/fnic_scsi.c +24 -54
140 lines not on this page · raw message
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 34/47 aha152x: look for stuck command when resetting device
In reply to Hannes ReineckeFrom: Hannes Reinecke <[email protected]>
The LLDD needs a command to send the reset with, so look at the list of outstanding commands to get one.
--- drivers/scsi/aha152x.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
drivers/scsi/aha152x.c +14 -10
@@ -1055,23 +1055,27 @@ static int aha152x_abort(Scsi_Cmnd *SCpnt)static int aha152x_device_reset (Scsi_Cmnd * SCpnt) {struct Scsi_Host *shpnt = SCpnt->device->host; +struct scsi_cmnd *SCprev =NULL ;DECLARE_COMPLETION (done);int ret, issued, disconnected; -unsigned char old_cmd_len = SCpnt->cmd_len; +unsigned char old_cmd_len;unsigned long flags;unsigned long timeleft; -if (CURRENT_SC ==SCpnt) { -scmd_printk (KERN_ERR , SCpnt,"cannot reset current device\n" ); -return FAILED ; - } -DO_LOCK (flags); - issued =remove_SC (&ISSUE_SC , SCpnt) ==NULL ; - disconnected = issued &&remove_SC (&DISCONNECTED_SC , SCpnt); +/* Look for the stuck command */ + SCpnt =remove_lun_SC (&ISSUE_SC , sdev->id, sdev->lun); +if (SCpnt) + issued =1 ; +else + SCpnt =remove_lun_SC (&DISCONNECTED_SC , sdev->id, sdev->lun); +if (!issued && SCpnt) + disconnected =1 ;DO_UNLOCK (flags); - - SCpnt->cmd_len =0 ; +if (!SCpnt) +return FAILED ; + old_cmd_len = SCpnt->cmd_len; + SCpnt->cmd_len =0 ;aha152x_internal_queue (SCpnt, &done, resetting, reset_done);
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 36/47 a1000u2w: do not rely on the command for inia100_device_reset()
In reply to Hannes ReineckeUse the scsi device as argument to orc_device_reset() instead of relying on the passed in scsi command.
--- drivers/scsi/a100u2w.c | 43 +++++++++++-------------------------------- 1 file changed, 11 insertions(+), 32 deletions(-)
drivers/scsi/a100u2w.c +11 -32
@@ -592,39 +592,20 @@ static int orc_reset_scsi_bus(struct orc_host * host)* commands for target w/o soft reset */ -static int orc_device_reset (struct orc_host * host,struct scsi_cmnd *cmd,unsigned int target) +static int orc_device_reset (struct orc_host * host,struct scsi_device *sdev) {/* I need Host Control Block Information */ struct orc_scb *scb;struct orc_extended_scb *escb; -struct orc_scb *host_scb; -u8 i;unsigned long flags;spin_lock_irqsave (&(host->allocation_lock), flags); scb = (struct orc_scb *)NULL ; escb = (struct orc_extended_scb *)NULL ; -/* setup scatter list address with one buffer */ - host_scb = host->scb_virt; -/* FIXME: is this safe if we then fail to issue the reset or race a completion ? */ init_alloc_map (host); -/* Find the scb corresponding to the command */ -for (i =0 ; i <ORC_MAXQUEUE ; i++) { - escb = host_scb->escb; -if (host_scb->status && escb->srb == cmd) -break ; - host_scb++; - } - -if (i ==ORC_MAXQUEUE ) { -printk (KERN_ERR "Unable to Reset - No SCB Found\n" ); -spin_unlock_irqrestore (&(host->allocation_lock), flags); -return FAILED ; - } -/* Allocate a new SCB for the reset command to the firmware */ if ((scb =__orc_alloc_scb (host)) ==NULL ) {/* Can't happen.. */
@@ -635,7 +616,7 @@ static int orc_device_reset(struct orc_host * host, struct scsi_cmnd *cmd, unsig/* Reset device is handled by the firmware, we fill in an SCB and fire it at the controller, it does the rest */ scb->opcode =ORC_BUSDEVRST ; - scb->target = target; + scb->target = sdev->id; scb->hastat =0 ; scb->tastat =0 ; scb->status =0x0 ;
@@ -645,8 +626,8 @@ static int orc_device_reset(struct orc_host * host, struct scsi_cmnd *cmd, unsig scb->xferlen =cpu_to_le32 (0 ); scb->sg_len =cpu_to_le32 (0 ); + escb = scb->escb; escb->srb =NULL ; - escb->srb = cmd;orc_exec_scb (host, scb);/* Start execute SCB */ spin_unlock_irqrestore (&host->allocation_lock, flags);return SUCCESS ;
@@ -974,7 +955,7 @@ static int inia100_device_reset(struct scsi_cmnd * cmd) {/* I need Host Control Block Information */ struct orc_host *host; host = (struct orc_host *) cmd->device->host->hostdata; -return orc_device_reset (host, cmd,scmd_id (cmd)); +return orc_device_reset (host, cmd->device); }
@@ -994,11 +975,7 @@ static void inia100_scb_handler(struct orc_host *host, struct orc_scb *scb)struct orc_extended_scb *escb; escb = scb->escb; -if ((cmd = (struct scsi_cmnd *) escb->srb) ==NULL ) { -printk (KERN_ERR "inia100_scb_handler: SRB pointer is empty\n" ); -orc_release_scb (host, scb);/* Release SCB for current channel */ -return ; - } + cmd = (struct scsi_cmnd *)escb->srb; escb->srb =NULL ;switch (scb->hastat) {
@@ -1036,13 +1013,15 @@ static void inia100_scb_handler(struct orc_host *host, struct orc_scb *scb)break ; } -if (scb->tastat ==2 ) {/* Check condition */ +if (cmd && scb->tastat ==2 ) {/* Check condition */ memcpy ((unsigned char *) &cmd->sense_buffer[0 ], (unsigned char *) &escb->sglist[0 ],SENSE_SIZE ); } - cmd->result = scb->tastat | (scb->hastat <<16 ); -scsi_dma_unmap (cmd); - cmd->scsi_done (cmd);/* Notify system DONE */ +if (cmd) { + cmd->result = scb->tastat | (scb->hastat <<16 ); +scsi_dma_unmap (cmd); + cmd->scsi_done (cmd);/* Notify system DONE */ + }orc_release_scb (host, scb);/* Release SCB for current channel */ }
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 37/47 aic79xx: use scsi device as argument for BUILD_SCSIID()
In reply to Hannes Reinecke--- drivers/scsi/aic7xxx/aic79xx_osm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/aic7xxx/aic79xx_osm.c +4 -4
@@ -541,8 +541,8 @@ void ahd_insb(struct ahd_softc * ahd, long port, }/******************************** Macros **************************************/ -#define BUILD_SCSIID (ahd, cmd) \ - (((scmd_id(cmd) << TID_SHIFT) & TID) | (ahd)->our_id) +#define BUILD_SCSIID (ahd, sdev) \ + (((sdev_id(sdev) << TID_SHIFT) & TID) | (ahd)->our_id)/* * Return a string describing the driver.
@@ -837,7 +837,7 @@ static DEF_SCSI_QCMD(ahd_linux_queue)ahd_set_sense_residual (reset_scb,0 ); reset_scb->platform_data->xfer_len =0 ; reset_scb->hscb->control =0 ; - reset_scb->hscb->scsiid =BUILD_SCSIID (ahd,cmd); + reset_scb->hscb->scsiid =BUILD_SCSIID (ahd, cmd->device); reset_scb->hscb->lun = cmd->device->lun; reset_scb->hscb->cdb_len =0 ; reset_scb->hscb->task_management =SIU_TASKMGMT_LUN_RESET ;
@@ -1598,7 +1598,7 @@ struct scsi_host_template aic79xx_driver_template = {* Fill out basics of the HSCB. */ hscb->control =0 ; - hscb->scsiid =BUILD_SCSIID (ahd, cmd); + hscb->scsiid =BUILD_SCSIID (ahd, cmd->device); hscb->lun = cmd->device->lun; scb->hscb->task_management =0 ; mask =SCB_GET_TARGET_MASK (ahd, scb);
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 38/47 aic7xxx: use scsi device as argument for BUILD_SCSIID()
In reply to Hannes Reinecke--- drivers/scsi/aic7xxx/aic7xxx_osm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/scsi/aic7xxx/aic7xxx_osm.c +5 -5
@@ -817,10 +817,10 @@ struct scsi_host_template aic7xxx_driver_template = {/**************************** Tasklet Handler *********************************/ /******************************** Macros **************************************/ -#define BUILD_SCSIID (ahc, cmd) \ - ((((cmd)->device->id << TID_SHIFT) & TID) \ - | (((cmd)->device->channel == 0) ? (ahc)->our_id : (ahc)->our_id_b) \ - | (((cmd)->device->channel == 0) ? 0 : TWIN_CHNLB)) +#define BUILD_SCSIID (ahc, sdev) \ + ((((sdev)->id << TID_SHIFT) & TID) \ + | (((sdev)->channel == 0) ? (ahc)->our_id : (ahc)->our_id_b) \ + | (((sdev)->channel == 0) ? 0 : TWIN_CHNLB))/******************************** Bus DMA *************************************/ int
@@ -1477,7 +1477,7 @@ struct scsi_host_template aic7xxx_driver_template = {* Fill out basics of the HSCB. */ hscb->control =0 ; - hscb->scsiid =BUILD_SCSIID (ahc, cmd); + hscb->scsiid =BUILD_SCSIID (ahc, cmd->device); hscb->lun = cmd->device->lun; mask =SCB_GET_TARGET_MASK (ahc, scb); tinfo = ahc_fetch_transinfo(ahc, SCB_GET_CHANNEL(ahc, scb),
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 41/47 xen-scsifront: add scsi device as argument to scsifront_do_request()
In reply to Hannes ReineckeAdd scsi device as argument to scsifront_do_request() so that it will be possible to call it with a NULL command pointer.
--- drivers/scsi/xen-scsifront.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-)
drivers/scsi/xen-scsifront.c +18 -14
@@ -175,7 +175,8 @@ static void scsifront_put_rqid(struct vscsifrnt_info *info, uint32_t id)scsifront_wake_up (info); } -static int scsifront_do_request (struct vscsifrnt_info *info, +static int scsifront_do_request (struct scsi_device *sdev, +struct vscsifrnt_info *info,struct vscsifrnt_shadow *shadow) {struct vscsiif_front_ring *ring = &(info->ring);
@@ -202,17 +203,20 @@ static int scsifront_do_request(struct vscsifrnt_info *info, ring_req->ref_rqid = shadow->ref_rqid; ring_req->nr_segments = shadow->nr_segments; - ring_req->id = sc->device->id; - ring_req->lun = sc->device->lun; - ring_req->channel = sc->device->channel; - ring_req->cmd_len = sc->cmd_len; - -BUG_ON (sc->cmd_len >VSCSIIF_MAX_COMMAND_SIZE ); - -memcpy (ring_req->cmnd, sc->cmnd, sc->cmd_len); - - ring_req->sc_data_direction = (uint8_t )sc->sc_data_direction; - ring_req->timeout_per_command = sc->request->timeout /HZ ; + ring_req->id = sdev->id; + ring_req->lun = sdev->lun; + ring_req->channel = sdev->channel; +if (sc) { + ring_req->cmd_len = sc->cmd_len; +BUG_ON (sc->cmd_len >VSCSIIF_MAX_COMMAND_SIZE ); +memcpy (ring_req->cmnd, sc->cmnd, sc->cmd_len); + ring_req->sc_data_direction = (uint8_t )sc->sc_data_direction; + ring_req->timeout_per_command = sc->request->timeout /HZ ; + }else { + ring_req->cmd_len =VSCSIIF_MAX_COMMAND_SIZE ; +memset (ring_req->cmnd,0 ,VSCSIIF_MAX_COMMAND_SIZE ); + ring_req->sc_data_direction =DMA_NONE ; + }for (i =0 ; i < (shadow->nr_segments & ~VSCSIIF_SG_GRANT ); i++) ring_req->seg[i] = shadow->seg[i];
@@ -556,7 +560,7 @@ static int scsifront_queuecommand(struct Scsi_Host *shost,return 0 ; } -if (scsifront_do_request (info, shadow)) { +if (scsifront_do_request (sc->device, info, shadow)) {scsifront_gnttab_done (info, shadow); goto busy; }
@@ -601,7 +605,7 @@ static int scsifront_action_handler(struct scsi_cmnd *sc, uint8_t act)if (scsifront_enter (info)) goto fail; -if (!scsifront_do_request (info, shadow)) +if (!scsifront_do_request (sc->device, info, shadow))break ;scsifront_return (info);
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 39/47 aic79xx: do not reference scsi command when resetting device
In reply to Hannes ReineckeWhen sending a device reset we should not take a reference to the scsi command.
--- drivers/scsi/aic7xxx/aic79xx_osm.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/scsi/aic7xxx/aic79xx_osm.c +15 -6
@@ -536,8 +536,10 @@ void ahd_insb(struct ahd_softc * ahd, long port,struct scsi_cmnd *cmd; cmd = scb->io_ctx; -ahd_sync_sglist (ahd, scb,BUS_DMASYNC_POSTWRITE ); -scsi_dma_unmap (cmd); +if (cmd) { +ahd_sync_sglist (ahd, scb,BUS_DMASYNC_POSTWRITE ); +scsi_dma_unmap (cmd); + } }/******************************** Macros **************************************/
@@ -830,7 +832,7 @@ static DEF_SCSI_QCMD(ahd_linux_queue) tinfo =ahd_fetch_transinfo (ahd,'A' , ahd->our_id, cmd->device->id, &tstate); - reset_scb->io_ctx = cmd; + reset_scb->io_ctx =NULL ; reset_scb->platform_data->dev = dev; reset_scb->sg_count =0 ;ahd_set_residual (reset_scb,0 );
@@ -1787,9 +1789,16 @@ struct scsi_host_template aic79xx_driver_template = { dev = scb->platform_data->dev; dev->active--; dev->openings++; -if ((cmd->result & (CAM_DEV_QFRZN <<16 )) !=0 ) { - cmd->result &= ~(CAM_DEV_QFRZN <<16 ); - dev->qfrozen--; +if (cmd) { +if ((cmd->result & (CAM_DEV_QFRZN <<16 )) !=0 ) { + cmd->result &= ~(CAM_DEV_QFRZN <<16 ); + dev->qfrozen--; + } + }else if (scb->flags &SCB_DEVICE_RESET ) { +if (ahd->platform_data->eh_done) +complete (ahd->platform_data->eh_done); +ahd_free_scb (ahd, scb); +return ; }ahd_linux_unmap_scb (ahd, scb);
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 45/47 snic: use dedicated device reset command
In reply to Hannes ReineckeUse a dedicated command to send a device reset instead of relying on using the command which triggered the device failure.
--- drivers/scsi/snic/snic_scsi.c | 52 ++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 28 deletions(-)
drivers/scsi/snic/snic_scsi.c +24 -28
@@ -2136,57 +2136,53 @@int snic_device_reset (struct scsi_cmnd *sc) { -struct Scsi_Host *shost = sc->device->host; +struct scsi_device *sdev = sc->device; +struct Scsi_Host *shost = sdev->host;struct snic *snic =shost_priv (shost);struct snic_req_info *rqi =NULL ; -int tag =snic_cmd_tag (sc);int start_time = jiffies;int ret =FAILED ;int dr_supp =0 ; -SNIC_SCSI_DBG (shost,"dev_reset:sc %p :0x%x :req = %p :tag = %d\n" , - sc, sc->cmnd[0 ], sc->request, -snic_cmd_tag (sc)); - dr_supp =snic_dev_reset_supported (sc->device); +SNIC_SCSI_DBG (shost,"dev_reset\n" ); + dr_supp =snic_dev_reset_supported (sdev);if (!dr_supp) {/* device reset op is not supported */ SNIC_HOST_INFO (shost,"LUN Reset Op not supported.\n" ); -snic_unlink_and_release_req (snic, sc,SNIC_DEV_RST_NOTSUP ); - goto dev_rst_end; }if (unlikely (snic_get_state (snic) !=SNIC_ONLINE )) { -snic_unlink_and_release_req (snic, sc,0 );SNIC_HOST_ERR (shost,"Devrst: Parent Devs are not online.\n" ); goto dev_rst_end; } -/* There is no tag when lun reset is issue through ioctl. */ -if (unlikely (tag <=SNIC_NO_TAG )) { -SNIC_HOST_INFO (snic->shost, -"Devrst: LUN Reset Recvd thru IOCTL.\n" ); - - rqi =snic_req_init (snic,0 ); -if (!rqi) - goto dev_rst_end; - -memset (scsi_cmd_priv (sc),0 , -sizeof (struct snic_internal_io_state )); -CMD_SP (sc) = (char *)rqi; -CMD_FLAGS (sc) =SNIC_NO_FLAGS ; + rqi =snic_req_init (snic,0 ); +if (!rqi) + goto dev_rst_end; -/* Add special tag for dr coming from user spc */ - rqi->tm_tag =SNIC_TAG_IOCTL_DEV_RST ; - rqi->sc = sc; +/* The last tag is reserved for device reset */ + sc =scsi_host_find_tag (snic->shost, snic->tmf_tag_id); +if (!sc ||CMD_SP (sc)) { +SNIC_HOST_ERR (snic->shost, +"Devrst: TMF busy\n" ); + goto dev_rst_end; } +memset (scsi_cmd_priv (sc),0 , +sizeof (struct snic_internal_io_state )); +CMD_SP (sc) = (char *)rqi; +CMD_FLAGS (sc) =SNIC_NO_FLAGS ; + +/* Add special tag for dr coming from user spc */ + rqi->tm_tag =SNIC_TAG_IOCTL_DEV_RST ; + rqi->sc = sc; ret =snic_send_dr_and_wait (snic, sc);if (ret) {SNIC_HOST_ERR (snic->shost,"Devrst: IO w/ Tag %x Failed w/ err = %d\n" , - tag, ret); +snic_cmd_tag (sc), ret);snic_unlink_and_release_req (snic, sc,0 );
@@ -2196,7 +2192,7 @@ ret =snic_dr_finish (snic, sc); dev_rst_end: -SNIC_TRC (snic->shost->host_no, tag, (ulong ) sc, +SNIC_TRC (snic->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));
@@ -2347,7 +2343,7 @@schedule_timeout (msecs_to_jiffies (1 )); sc =scsi_host_find_tag (shost, snic->tmf_tag_id); -if (!sc) { +if (!sc ||CMD_SP (sc)) {SNIC_HOST_ERR (shost,"reset:Host Reset Failed to allocate sc.\n" );spin_lock_irqsave (&snic->snic_lock, flags);
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 40/47 aic7xxx: do not reference scsi command when resetting device
In reply to Hannes ReineckeWhen sending a device reset we should not take a reference to the scsi command.
--- drivers/scsi/aic7xxx/aic7xxx_osm.c | 102 ++++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 48 deletions(-)
drivers/scsi/aic7xxx/aic7xxx_osm.c +54 -48
@@ -365,7 +365,8 @@ static void ahc_linux_queue_cmd_complete(struct ahc_softc *ahc, struct scsi_cmnd *cmd);static void ahc_linux_freeze_simq (struct ahc_softc *ahc);static void ahc_linux_release_simq (struct ahc_softc *ahc); -static int ahc_linux_queue_recovery_cmd (struct scsi_cmnd *cmd,scb_flag flag); +static int ahc_linux_queue_recovery_cmd (struct scsi_device *sdev, +struct scsi_cmnd *cmd);static void ahc_linux_initialize_scsi_bus (struct ahc_softc *ahc);static u_int ahc_linux_user_tagdepth (struct ahc_softc *ahc,struct ahc_devinfo *devinfo);
@@ -745,7 +746,7 @@ static DEF_SCSI_QCMD(ahc_linux_queue) {int error; - error =ahc_linux_queue_recovery_cmd (cmd,SCB_ABORT ); + error =ahc_linux_queue_recovery_cmd (cmd->device, cmd);if (error !=0 )printk ("aic7xxx_abort returns 0x%x\n" , error);return (error);
@@ -759,7 +760,7 @@ static DEF_SCSI_QCMD(ahc_linux_queue) {int error; - error =ahc_linux_queue_recovery_cmd (cmd,SCB_DEVICE_RESET ); + error =ahc_linux_queue_recovery_cmd (cmd->device,NULL );if (error !=0 )printk ("aic7xxx_dev_reset returns 0x%x\n" , error);return (error);
@@ -2050,11 +2051,12 @@ struct scsi_host_template aic7xxx_driver_template = { }static int -ahc_linux_queue_recovery_cmd (struct scsi_cmnd *cmd,scb_flag flag) +ahc_linux_queue_recovery_cmd (struct scsi_device *sdev, +struct scsi_cmnd *cmd) {struct ahc_softc *ahc;struct ahc_linux_device *dev; -struct scb *pending_scb; +struct scb *pending_scb =NULL , *scb;u_int saved_scbptr;u_int active_scb_index;u_int last_phase;
@@ -2067,18 +2069,19 @@ struct scsi_host_template aic7xxx_driver_template = {int disconnected;unsigned long flags; - pending_scb =NULL ; paused = FALSE; wait = FALSE; - ahc = *(struct ahc_softc **)cmd->device->host->hostdata; + ahc = *(struct ahc_softc **)sdev->host->hostdata; -scmd_printk (KERN_INFO , cmd,"Attempting to queue a%s message\n" , - flag ==SCB_ABORT ?"n ABORT" :" TARGET RESET" ); +sdev_printk (KERN_INFO , sdev,"Attempting to queue a%s message\n" , + cmd ?"n ABORT" :" TARGET RESET" ); -printk ("CDB:" ); -for (cdb_byte =0 ; cdb_byte < cmd->cmd_len; cdb_byte++) -printk (" 0x%x" , cmd->cmnd[cdb_byte]); -printk ("\n" ); +if (cmd) { +printk ("CDB:" ); +for (cdb_byte =0 ; cdb_byte < cmd->cmd_len; cdb_byte++) +printk (" 0x%x" , cmd->cmnd[cdb_byte]); +printk ("\n" ); + }ahc_lock (ahc, &flags);
@@ -2089,7 +2092,7 @@ struct scsi_host_template aic7xxx_driver_template = {* at all, and the system wanted us to just abort the * command, return success. */ - dev =scsi_transport_device_data (cmd->device); + dev =scsi_transport_device_data (sdev);if (dev ==NULL ) {/*
@@ -2097,13 +2100,12 @@ struct scsi_host_template aic7xxx_driver_template = {* so we must not still own the command. */ printk ("%s:%d:%d:%d: Is not an active device\n" , -ahc_name (ahc), cmd->device->channel, cmd->device->id, - (u8 )cmd->device->lun); +ahc_name (ahc), sdev->channel, sdev->id, (u8 )sdev->lun); retval =SUCCESS ; goto no_cmd; } -if ((dev->flags & (AHC_DEV_Q_BASIC |AHC_DEV_Q_TAGGED )) ==0 +if (cmd && (dev->flags & (AHC_DEV_Q_BASIC |AHC_DEV_Q_TAGGED )) ==0 && ahc_search_untagged_queues(ahc, cmd, cmd->device->id, cmd->device->channel + 'A', (u8)cmd->device->lun,
@@ -2118,25 +2120,28 @@ struct scsi_host_template aic7xxx_driver_template = {/* * See if we can find a matching cmd in the pending list. */ - LIST_FOREACH(pending_scb, &ahc->pending_scbs, pending_links) { -if (pending_scb->io_ctx == cmd) + LIST_FOREACH(scb, &ahc->pending_scbs, pending_links) { +if (cmd && scb->io_ctx == cmd) { + pending_scb = scb;break ; + } } -if (pending_scb ==NULL && flag ==SCB_DEVICE_RESET ) { - +if (!cmd) {/* Any SCB for this device will do for a target reset */ - LIST_FOREACH(pending_scb, &ahc->pending_scbs, pending_links) { -if (ahc_match_scb (ahc, pending_scb,scmd_id (cmd), -scmd_channel (cmd) +'A' , + LIST_FOREACH(scb, &ahc->pending_scbs, pending_links) { +if (ahc_match_scb (ahc, scb, sdev->id, + sdev->channel +'A' ,CAM_LUN_WILDCARD , -SCB_LIST_NULL ,ROLE_INITIATOR )) +SCB_LIST_NULL ,ROLE_INITIATOR )) { + pending_scb = scb;break ; + } } }if (pending_scb ==NULL ) { -scmd_printk (KERN_INFO , cmd,"Command not found\n" ); +sdev_printk (KERN_INFO , sdev,"Command not found\n" ); goto no_cmd; }
@@ -2167,22 +2172,22 @@ struct scsi_host_template aic7xxx_driver_template = {ahc_dump_card_state (ahc); disconnected = TRUE; -if (flag ==SCB_ABORT ) { -if (ahc_search_qinfifo (ahc, cmd->device->id, - cmd->device->channel +'A' , - cmd->device->lun, +if (cmd) { +if (ahc_search_qinfifo (ahc, sdev->id, + sdev->channel +'A' , + sdev->lun, pending_scb->hscb->tag,ROLE_INITIATOR ,CAM_REQ_ABORTED ,SEARCH_COMPLETE ) >0 ) {printk ("%s:%d:%d:%d: Cmd aborted from QINFIFO\n" , -ahc_name (ahc), cmd->device->channel, - cmd->device->id, (u8 )cmd->device->lun); +ahc_name (ahc), sdev->channel, + sdev->id, (u8 )sdev->lun); retval =SUCCESS ; goto done; } - }else if (ahc_search_qinfifo (ahc, cmd->device->id, - cmd->device->channel +'A' , - cmd->device->lun, + }else if (ahc_search_qinfifo (ahc, sdev->id, + sdev->channel +'A' , + sdev->lun, pending_scb->hscb->tag,ROLE_INITIATOR ,/*status*/ 0 ,SEARCH_COUNT ) >0 ) {
@@ -2195,7 +2200,7 @@ struct scsi_host_template aic7xxx_driver_template = { bus_scb =ahc_lookup_scb (ahc,ahc_inb (ahc,SCB_TAG ));if (bus_scb == pending_scb) disconnected = FALSE; -else if (flag !=SCB_ABORT +else if (!cmd &&ahc_inb (ahc,SAVED_SCSIID ) == pending_scb->hscb->scsiid &&ahc_inb (ahc,SAVED_LUN ) ==SCB_GET_LUN (pending_scb)) disconnected = FALSE;
@@ -2215,18 +2220,18 @@ struct scsi_host_template aic7xxx_driver_template = { saved_scsiid =ahc_inb (ahc,SAVED_SCSIID );if (last_phase !=P_BUSFREE && (pending_scb->hscb->tag == active_scb_index - || (flag ==SCB_DEVICE_RESET - &&SCSIID_TARGET (ahc, saved_scsiid) ==scmd_id (cmd)))) { + || (!cmd &&SCSIID_TARGET (ahc, saved_scsiid) == sdev->id))) {/* * We're active on the bus, so assert ATN * and hope that the target responds. */ pending_scb =ahc_lookup_scb (ahc, active_scb_index); - pending_scb->flags |=SCB_RECOVERY_SCB |flag; + pending_scb->flags |=SCB_RECOVERY_SCB ; + pending_scb->flags |= cmd ?SCB_ABORT :SCB_DEVICE_RESET ;ahc_outb (ahc,MSG_OUT ,HOST_MSG );ahc_outb (ahc,SCSISIGO , last_phase|ATNO ); -scmd_printk (KERN_INFO , cmd,"Device is active, asserting ATN\n" ); +sdev_printk (KERN_INFO , sdev,"Device is active, asserting ATN\n" ); wait = TRUE; }else if (disconnected) {
@@ -2247,7 +2252,8 @@ struct scsi_host_template aic7xxx_driver_template = {* an unsolicited reselection occurred. */ pending_scb->hscb->control |=MK_MESSAGE |DISCONNECTED ; - pending_scb->flags |=SCB_RECOVERY_SCB |flag; + pending_scb->flags |=SCB_RECOVERY_SCB ; + pending_scb->flags |= cmd ?SCB_ABORT :SCB_DEVICE_RESET ;/* * Remove any cached copy of this SCB in the
@@ -2256,9 +2262,9 @@ struct scsi_host_template aic7xxx_driver_template = {* same element in the SCB, SCB_NEXT, for * both the qinfifo and the disconnected list. */ -ahc_search_disc_list (ahc, cmd->device->id, - cmd->device->channel +'A' , - cmd->device->lun, pending_scb->hscb->tag, +ahc_search_disc_list (ahc, sdev->id, + sdev->channel +'A' , + sdev->lun, pending_scb->hscb->tag,/*stop_on_first*/ TRUE,/*remove*/ TRUE,/*save_state*/ FALSE);
@@ -2281,9 +2287,9 @@ struct scsi_host_template aic7xxx_driver_template = {* so we are the next SCB for this target * to run. */ -ahc_search_qinfifo (ahc, cmd->device->id, - cmd->device->channel +'A' , - cmd->device->lun,SCB_LIST_NULL , +ahc_search_qinfifo (ahc, sdev->id, + sdev->channel +'A' , + (u8 )sdev->lun,SCB_LIST_NULL ,ROLE_INITIATOR ,CAM_REQUEUE_REQ ,SEARCH_COMPLETE );ahc_qinfifo_requeue_tail (ahc, pending_scb);
@@ -2292,7 +2298,7 @@ struct scsi_host_template aic7xxx_driver_template = {printk ("Device is disconnected, re-queuing SCB\n" ); wait = TRUE; }else { -scmd_printk (KERN_INFO , cmd,"Unable to deliver message\n" ); +sdev_printk (KERN_INFO , sdev,"Unable to deliver message\n" ); retval =FAILED ; goto done; }
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 42/47 xen-scsifront: call scsifront_action_handler() with a NULL command argument
In reply to Hannes ReineckeFor device reset we shouldn't rely on the scsi command, so allow scsifront_action_handler() to be called with a NULL command argument.
--- drivers/scsi/xen-scsifront.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/scsi/xen-scsifront.c +13 -7
@@ -582,21 +582,27 @@ static int scsifront_queuecommand(struct Scsi_Host *shost,* We have to wait until an answer is returned. This answer contains the * result to be returned to the requestor. */ -static int scsifront_action_handler (struct scsi_cmnd *sc,uint8_t act) +static int scsifront_action_handler (struct scsi_device *sdev, +struct scsi_cmnd *sc) { -struct Scsi_Host *host = sc->device->host; +struct Scsi_Host *host = sdev->host;struct vscsifrnt_info *info =shost_priv (host); -struct vscsifrnt_shadow *shadow, *s =scsi_cmd_priv (sc); +struct vscsifrnt_shadow *shadow, *s;int err =0 ; shadow =kzalloc (sizeof (*shadow),GFP_NOIO );if (!shadow)return FAILED ; - shadow->act = act; shadow->rslt_reset =RSLT_RESET_WAITING ; shadow->sc = sc; - shadow->ref_rqid = s->rqid; +if (sc) { + s =scsi_cmd_priv (sc); + shadow->ref_rqid = s->rqid; + shadow->act =VSCSIIF_ACT_SCSI_ABORT ; + }else + shadow->act =VSCSIIF_ACT_SCSI_RESET ; +init_waitqueue_head (&shadow->wq_reset);spin_lock_irq (host->host_lock);
@@ -646,13 +652,13 @@ static int scsifront_action_handler(struct scsi_cmnd *sc, uint8_t act)static int scsifront_eh_abort_handler (struct scsi_cmnd *sc) {pr_debug ("%s\n" , __func__); -return scsifront_action_handler (sc,VSCSIIF_ACT_SCSI_ABORT ); +return scsifront_action_handler (sc->device, sc); }static int scsifront_dev_reset_handler (struct scsi_cmnd *sc) {pr_debug ("%s\n" , __func__); -return scsifront_action_handler (sc,VSCSIIF_ACT_SCSI_RESET ); +return scsifront_action_handler (sc->device,NULL ); }static int scsifront_sdev_configure (struct scsi_device *sdev)
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 47/47 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 | 124 +++++++++++++++++++--------------------------- 1 file changed, 50 insertions(+), 74 deletions(-)
drivers/scsi/scsi_error.c +50 -74
@@ -728,16 +728,22 @@ static void scsi_eh_done(struct scsi_cmnd *scmd)complete (eh_action); } +static void __scsi_report_device_reset (struct scsi_device *sdev) +{ + sdev->was_reset =1 ; + sdev->expecting_cc_ua =1 ; +} +/** * scsi_try_host_reset - ask host adapter to reset itself -* @scmd: SCSI cmd to send host reset. +* @host: SCSI host to be reset. */ -static int scsi_try_host_reset (struct scsi_cmnd *scmd) +static int scsi_try_host_reset (struct Scsi_Host *host) {unsigned long flags;int rtn; -struct Scsi_Host *host = scmd->device->host;struct scsi_host_template *hostt = host->hostt; +struct scsi_device *sdev;SCSI_LOG_ERROR_RECOVERY (3 ,shost_printk (KERN_INFO , host,"Snd Host RST\n" ));
@@ -751,7 +757,8 @@ static int scsi_try_host_reset(struct scsi_cmnd *scmd)if (!hostt->skip_settle_delay)ssleep (HOST_RESET_SETTLE_TIME );spin_lock_irqsave (host->host_lock, flags); -scsi_report_bus_reset (host,scmd_channel (scmd)); +__shost_for_each_device (sdev, host) +__scsi_report_device_reset (sdev);spin_unlock_irqrestore (host->host_lock, flags); }
@@ -760,43 +767,38 @@ static int 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: bus number to be reset. */ -static int scsi_try_bus_reset (struct scsi_cmnd *scmd) +static int scsi_try_bus_reset (struct Scsi_Host *host,int channel) {unsigned long flags;int rtn; -struct Scsi_Host *host = scmd->device->host;struct scsi_host_template *hostt = host->hostt; -SCSI_LOG_ERROR_RECOVERY (3 ,scmd_printk (KERN_INFO , scmd, +SCSI_LOG_ERROR_RECOVERY (3 ,shost_printk (KERN_INFO , host,"%s: Snd Bus RST\n" , __func__));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); }return rtn; } -static void __scsi_report_device_reset (struct scsi_device *sdev,void *data) -{ - sdev->was_reset =1 ; - sdev->expecting_cc_ua =1 ; -} -/** * scsi_try_target_reset - Ask host to perform a target reset -* @scmd: SCSI cmd used to send a target reset +* @shost: SCSI Host +* @starget: SCSI target to be reset * * Notes: * There is no timeout for this operation. if this operation is
@@ -804,13 +806,13 @@ 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 int scsi_try_target_reset (struct scsi_cmnd *scmd) +static int scsi_try_target_reset (struct Scsi_Host *host, +struct scsi_target *starget) {unsigned long flags;int rtn; -struct Scsi_Host *host = scmd->device->host; +struct scsi_device *sdev;struct scsi_host_template *hostt = host->hostt; -struct scsi_target *starget =scsi_target (scmd->device);if (!hostt->eh_target_reset_handler)return FAILED ;
@@ -818,8 +820,11 @@ static int scsi_try_target_reset(struct scsi_cmnd *scmd) rtn = hostt->eh_target_reset_handler (starget);if (rtn ==SUCCESS ) {spin_lock_irqsave (host->host_lock, flags); -__starget_for_each_device (starget,NULL , - __scsi_report_device_reset); +__shost_for_each_device (sdev, host) { +if ((sdev->channel == starget->channel) && + (sdev->id == starget->id)) +__scsi_report_device_reset (sdev); + }spin_unlock_irqrestore (host->host_lock, flags); }
@@ -836,17 +841,17 @@ static int scsi_try_target_reset(struct scsi_cmnd *scmd)* timer on it, and set the host back to a consistent state prior to * returning. */ -static int scsi_try_bus_device_reset (struct scsi_cmnd *scmd) +static int scsi_try_bus_device_reset (struct scsi_device *sdev) {int rtn; -struct scsi_host_template *hostt = scmd->device->host->hostt; +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);return rtn; }
@@ -878,11 +883,15 @@ static int scsi_try_to_abort_cmd(struct scsi_host_template *hostt,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); }/**
@@ -1430,7 +1439,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 ||
@@ -1495,7 +1504,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,
@@ -1570,7 +1579,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 (chan_scmd); + rtn =scsi_try_bus_reset (shost, channel);if (rtn ==SUCCESS || rtn ==FAST_IO_FAIL ) {list_for_each_entry_safe (scmd, next, work_q, eh_entry) {if (channel ==scmd_channel (scmd)) {
@@ -1608,15 +1617,12 @@ static int scsi_eh_host_reset(struct Scsi_Host *shost,int rtn;if (!list_empty (work_q)) { - scmd =list_entry (work_q->next, - struct scsi_cmnd, eh_entry); -SCSI_LOG_ERROR_RECOVERY (3 ,shost_printk (KERN_INFO , 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 ) {
@@ -2221,7 +2227,7 @@ void scsi_report_bus_reset(struct Scsi_Host *shost, int channel)__shost_for_each_device (sdev, shost) {if (channel ==sdev_channel (sdev)) -__scsi_report_device_reset (sdev,NULL ); +__scsi_report_device_reset (sdev); } }EXPORT_SYMBOL (scsi_report_bus_reset);
@@ -2255,16 +2261,11 @@ void scsi_report_device_reset(struct Scsi_Host *shost, int channel, int target)__shost_for_each_device (sdev, shost) {if (channel ==sdev_channel (sdev) && target ==sdev_id (sdev)) -__scsi_report_device_reset (sdev,NULL ); +__scsi_report_device_reset (sdev); } }EXPORT_SYMBOL (scsi_report_device_reset); -static void -scsi_reset_provider_done_command (struct scsi_cmnd *scmd) -{ -} -/** * scsi_ioctl_reset: explicitly reset a host/bus/target/device * @dev: scsi_device to operate on
@@ -2273,9 +2274,7 @@ void scsi_report_device_reset(struct Scsi_Host *shost, int channel, int target)int scsi_ioctl_reset (struct scsi_device *dev,int __user *arg) { -struct scsi_cmnd *scmd;struct Scsi_Host *shost = dev->host; -struct request *rq;unsigned long flags;int error =0 , rtn, val;
@@ -2290,24 +2289,6 @@ void scsi_report_device_reset(struct Scsi_Host *shost, int channel, int target)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->request = rq; - scmd->cmnd =scsi_req (rq)->cmd; - - scmd->scsi_done = scsi_reset_provider_done_command; -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);
@@ -2317,22 +2298,22 @@ void scsi_report_device_reset(struct Scsi_Host *shost, int channel, int target) 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,scsi_target (dev));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 ;default :
@@ -2357,11 +2338,6 @@ void scsi_report_device_reset(struct Scsi_Host *shost, int channel, int target)wake_up (&shost->host_wait);scsi_run_host_queues (shost); - -scsi_put_command (scmd); -kfree (rq); - -out_put_autopm_host:scsi_autopm_put_host (shost);return error; }
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 43/47 fas216: Rework device reset to not rely on SCSI command pointer
In reply to Hannes ReineckeThe device reset code should not rely on the SCSI command pointer; it will be going away with the device reset handler rework.
--- drivers/scsi/arm/fas216.c | 51 +++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 26 deletions(-)
drivers/scsi/arm/fas216.c +25 -26
@@ -1985,8 +1985,7 @@ static void fas216_devicereset_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, {fas216_log (info,LOG_ERROR ,"fas216 device reset complete" ); - info->rstSCpnt =NULL ; - info->rst_dev_status =1 ; + info->rst_dev_status =0 ;wake_up (&info->eh_wait); }
@@ -2139,12 +2138,12 @@ static void fas216_done(FAS216_Info *info, unsigned int result)fas216_checkmagic (info); -if (!info->SCpnt) +if (!info->SCpnt && !info->rst_dev_status) goto no_command; SCpnt = info->SCpnt; info->SCpnt =NULL ; - info->scsi.phase =PHASE_IDLE ; + info->scsi.phase =PHASE_IDLE ;if (info->scsi.aborting) {fas216_log (info,0 ,"uncaught abort - returning DID_ABORT" );
@@ -2156,7 +2155,7 @@ static void fas216_done(FAS216_Info *info, unsigned int result)* Sanity check the completion - if we have zero bytes left * to transfer, we should not have a valid pointer. */ -if (info->scsi.SCp.ptr && info->scsi.SCp.this_residual ==0 ) { +if (SCpnt && info->scsi.SCp.ptr && info->scsi.SCp.this_residual ==0 ) {scmd_printk (KERN_INFO , SCpnt,"zero bytes left to transfer, but buffer pointer still valid: ptr=%p len=%08x\n" , info->scsi.SCp.ptr, info->scsi.SCp.this_residual);
@@ -2169,12 +2168,18 @@ static void fas216_done(FAS216_Info *info, unsigned int result)* the sense information, fas216_kick will re-assert the busy * status. */ - info->device[SCpnt->device->id].parity_check =0 ; -clear_bit (SCpnt->device->id *8 + - (u8)(SCpnt->device->lun &0x7 ), info->busyluns); - - fn = (void (*)(FAS216_Info *,struct scsi_cmnd *,unsigned int ))SCpnt->host_scribble; -fn (info, SCpnt, result); +if (SCpnt) { + info->device[SCpnt->device->id].parity_check =0 ; +clear_bit (SCpnt->device->id *8 + + (u8)(SCpnt->device->lun &0x7 ), info->busyluns); + } +if (info->rst_dev_status) { + info->rst_dev_status =0 ; +wake_up (&info->eh_wait); + }else { + fn = (void (*)(FAS216_Info *,struct scsi_cmnd *,unsigned int ))SCpnt->host_scribble; +fn (info, SCpnt, result); + }if (info->scsi.irq) {spin_lock_irqsave (&info->host_lock, flags);
@@ -2326,9 +2331,9 @@ static void fas216_eh_timer(unsigned long data)del_timer (&info->eh_timer); -if (info->rst_bus_status ==0 ) +if (info->rst_bus_status ==1 ) info->rst_bus_status =-1 ; -if (info->rst_dev_status ==0 ) +if (info->rst_dev_status ==1 ) info->rst_dev_status =-1 ;wake_up (&info->eh_wait);
@@ -2471,9 +2476,10 @@ int fas216_eh_abort(struct scsi_cmnd *SCpnt)*/ int fas216_eh_device_reset (struct scsi_cmnd *SCpnt) { -FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; +struct scsi_device *sdev = SCpnt->device; +FAS216_Info *info = (FAS216_Info *)sdev->host->hostdata;unsigned long flags; -int i, res =FAILED , target = SCpnt->device->id; +int i, res =FAILED , target = sdev->id;fas216_log (info,LOG_ERROR ,"device reset for target %d" , target);
@@ -2487,7 +2493,7 @@ int fas216_eh_device_reset(struct scsi_cmnd *SCpnt)* and we need a bus reset. */ if (info->SCpnt && !info->scsi.disconnectable && - info->SCpnt->device->id == SCpnt->device->id) + info->SCpnt->device->id == sdev->id)break ;/*
@@ -2505,14 +2511,7 @@ int fas216_eh_device_reset(struct scsi_cmnd *SCpnt)for (i =0 ; i <8 ; i++)clear_bit (target *8 + i, info->busyluns); -/* -* Hijack this SCSI command structure to send -* a bus device reset message to this device. -*/ - SCpnt->host_scribble = (void *)fas216_devicereset_done; - - info->rst_dev_status =0 ; - info->rstSCpnt = SCpnt; + info->rst_dev_status =1 ;if (info->scsi.phase ==PHASE_IDLE )fas216_kick (info);
@@ -2523,13 +2522,13 @@ int fas216_eh_device_reset(struct scsi_cmnd *SCpnt)/* * Wait up to 30 seconds for the reset to complete. */ -wait_event (info->eh_wait, info->rst_dev_status); +wait_event (info->eh_wait, info->rst_dev_status <=0 );del_timer_sync (&info->eh_timer);spin_lock_irqsave (&info->host_lock, flags); info->rstSCpnt =NULL ; -if (info->rst_dev_status ==1 ) +if (info->rst_dev_status ==0 ) res =SUCCESS ; }while (0 );
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 44/47 csiostor: use separate TMF command
In reply to Hannes ReineckeSet one command aside as a TMF command, and use this command to send the TMF. This avoids having to rely on the passed-in scsi command when resetting the device.
--- drivers/scsi/csiostor/csio_hw.h | 2 ++ drivers/scsi/csiostor/csio_init.c | 2 +- drivers/scsi/csiostor/csio_scsi.c | 44 ++++++++++++++++++++++++++------------- 3 files changed, 32 insertions(+), 16 deletions(-)
drivers/scsi/csiostor/csio_hw.h +2 -0
@@ -68,6 +68,8 @@#define CSIO_MAX_LUN 0xFFFF#define CSIO_MAX_QUEUE 2048 +#define CSIO_TMF_TAG (CSIO_MAX_QUEUE - 1) +#define CSIO_MAX_CMD_PER_LUN 32#define CSIO_MAX_DDP_BUF_SIZE (1024 * 1024)#define CSIO_MAX_SECTOR_SIZE 128
drivers/scsi/csiostor/csio_init.c +1 -1
@@ -628,7 +628,7 @@ struct csio_lnode */* Link common lnode to this lnode */ ln->dev_num = (shost->host_no <<16 ); - shost->can_queue =CSIO_MAX_QUEUE ; + shost->can_queue =CSIO_MAX_QUEUE -1 ; shost->this_id =-1 ; shost->unique_id = shost->host_no; shost->max_cmd_len =16 ;/* Max CDB length supported */
drivers/scsi/csiostor/csio_scsi.c +29 -15
124 lines not on this page · raw message
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 46/47 scsi: Move eh_device_reset_handler() to use scsi_device as argument
In reply to Hannes ReineckeWhen resetting a device we shouldn't depend on an existing SCSI device, so use 'struct scsi_device' as argument for eh_device_reset_handler().
--- Documentation/scsi/scsi_eh.txt | 2 +- Documentation/scsi/scsi_mid_low_api.txt | 4 +-- drivers/block/cciss_scsi.c | 14 +++++----- drivers/infiniband/ulp/srp/ib_srp.c | 8 +++--- drivers/message/fusion/mptfc.c | 12 ++++----- drivers/message/fusion/mptscsih.c | 19 ++++++-------- drivers/message/fusion/mptscsih.h | 2 +- drivers/s390/scsi/zfcp_scsi.c | 4 +-- drivers/scsi/a100u2w.c | 7 +++-- 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/be2iscsi/be_main.c | 8 +++--- drivers/scsi/bfa/bfad_im.c | 3 +-- drivers/scsi/bnx2fc/bnx2fc.h | 2 +- drivers/scsi/bnx2fc/bnx2fc_io.c | 6 ++--- drivers/scsi/csiostor/csio_scsi.c | 7 +++-- drivers/scsi/cxlflash/main.c | 15 ++++------- drivers/scsi/dpt_i2o.c | 20 +++++++------- drivers/scsi/dpti.h | 2 +- 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 | 26 +++++++++--------- drivers/scsi/hpsa.c | 14 +++++----- drivers/scsi/ibmvscsi/ibmvfc.c | 5 ++-- drivers/scsi/ibmvscsi/ibmvscsi.c | 19 +++++++------- drivers/scsi/ipr.c | 31 +++++++++++----------- drivers/scsi/libfc/fc_fcp.c | 8 +++--- drivers/scsi/libiscsi.c | 15 +++++------ drivers/scsi/libsas/sas_scsi_host.c | 12 ++++----- drivers/scsi/lpfc/lpfc_scsi.c | 12 ++++----- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 29 +++++++++----------- drivers/scsi/pmcraid.c | 6 ++--- drivers/scsi/qedf/qedf_main.c | 6 ++--- drivers/scsi/qla1280.c | 21 +++++++++++---- drivers/scsi/qla2xxx/qla_os.c | 5 ++-- drivers/scsi/qla4xxx/ql4_os.c | 28 +++++++++----------- drivers/scsi/scsi_debug.c | 18 ++++++------- drivers/scsi/scsi_error.c | 35 +++++++++++++++++-------- drivers/scsi/smartpqi/smartpqi_init.c | 6 ++--- drivers/scsi/snic/snic.h | 2 +- drivers/scsi/snic/snic_scsi.c | 4 +-- drivers/scsi/ufs/ufshcd.c | 16 +++++------ drivers/scsi/virtio_scsi.c | 14 +++++----- drivers/scsi/vmw_pvscsi.c | 10 +++---- drivers/scsi/wd719x.c | 6 ++--- drivers/scsi/xen-scsifront.c | 4 +-- drivers/staging/rts5208/rtsx.c | 4 +-- drivers/staging/unisys/visorhba/visorhba_main.c | 14 +++------- drivers/target/loopback/tcm_loop.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, 287 insertions(+), 307 deletions(-)
Documentation/scsi/scsi_eh.txt +1 -1
@@ -206,7 +206,7 @@ hostt EH callbacks. Callbacks may be omitted and omitted ones are 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_bus_reset_handler)(struct Scsi_Host *, int); int (* eh_host_reset_handler)(struct Scsi_Host *);
Documentation/scsi/scsi_mid_low_api.txt +2 -2
@@ -874,7 +874,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 *
@@ -887,7 +887,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/block/cciss_scsi.c +6 -8
@@ -62,7 +62,7 @@ static int cciss_scsi_show_info(struct seq_file *m,static int cciss_scsi_queue_command (struct Scsi_Host *h,struct scsi_cmnd *cmd); -static int cciss_eh_device_reset_handler (struct scsi_cmnd *); +static int cciss_eh_device_reset_handler (struct scsi_device *);static int cciss_eh_abort_handler (struct scsi_cmnd *);static struct cciss_scsi_hba_t ccissscsi[MAX_CTLR ] = {
@@ -1591,23 +1591,21 @@ static int wait_for_device_to_become_ready(ctlr_info_t *h,* as a boot device (embedded controller on HP/Compaq systems.) */ -static int cciss_eh_device_reset_handler (struct scsi_cmnd *scsicmd) +static int cciss_eh_device_reset_handler (struct scsi_device *scsidev) {int rc; -CommandList_struct *cmd_in_trouble;unsigned char lunaddr[8 ];ctlr_info_t *h;/* find the controller to which the command to be aborted was sent */ - h = (ctlr_info_t *) scsicmd->device->host->hostdata[0 ]; + h = (ctlr_info_t *) scsidev->host->hostdata[0 ];if (h ==NULL )/* paranoia */ return FAILED ;dev_warn (&h->pdev->dev,"resetting tape drive or medium changer.\n" ); -/* find the command that's giving us trouble */ - cmd_in_trouble = (CommandList_struct *) scsicmd->host_scribble; -if (cmd_in_trouble ==NULL )/* paranoia */ + rc =lookup_scsi3addr (h, scsidev->channel, scsidev->id, + scsidev->lun, lunaddr); +if (rc !=0 )return FAILED ; -memcpy (lunaddr, &cmd_in_trouble->Header.LUN.LunAddrBytes[0 ],8 );/* send a reset to the SCSI LUN which the command was sent to */ rc =sendcmd_withirq (h,CCISS_RESET_MSG ,NULL ,0 ,0 , lunaddr,TYPE_MSG );
drivers/infiniband/ulp/srp/ib_srp.c +4 -4
@@ -2651,9 +2651,9 @@ 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;int i;u8 status;
@@ -2661,7 +2661,7 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)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)
@@ -2672,7 +2672,7 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)for (i =0 ; i < target->req_ring_size; ++i) {struct srp_request *req = &ch->req_ring[i]; -srp_finish_req (ch, req, scmnd->device,DID_RESET <<16 ); +srp_finish_req (ch, req, sdev,DID_RESET <<16 ); } }
drivers/message/fusion/mptfc.c +6 -6
@@ -102,7 +102,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_dev_reset (struct scsi_device *sdev);static int mptfc_bus_reset (struct Scsi_Host *shost,int channel);static struct scsi_host_template mptfc_driver_template = {
@@ -241,10 +241,10 @@ }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;
@@ -253,8 +253,8 @@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 -11
@@ -1793,14 +1793,14 @@ int mptscsih_show_info(struct seq_file *m, struct Scsi_Host *host)/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /** * 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;int retval;
@@ -1809,18 +1809,15 @@ int mptscsih_show_info(struct seq_file *m, struct Scsi_Host *host)/* 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); +if ((hd =shost_priv (device->host)) ==NULL ){ + printk(KERN_ERR MYNAM ": lun reset: Can't locate host!\n");return FAILED ; } 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;
@@ -1833,8 +1830,8 @@ int mptscsih_show_info(struct seq_file *m, struct Scsi_Host *host) 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 *,int );extern int mptscsih_host_reset (struct Scsi_Host *sh);
drivers/s390/scsi/zfcp_scsi.c +2 -2
@@ -304,9 +304,9 @@ static int zfcp_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) { -return zfcp_task_mgmt_function (scpnt->device,FCP_TMF_LUN_RESET ); +return zfcp_task_mgmt_function (sdev,FCP_TMF_LUN_RESET ); }/*
drivers/scsi/a100u2w.c +3 -4
@@ -951,12 +951,11 @@ static int inia100_bus_reset(struct Scsi_Host * shost, int channel)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
@@ -888,12 +888,11 @@ 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;
@@ -904,8 +903,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); info = &aac->hba_map[bus][cid];if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || info->devtype !=AAC_DEVTYPE_NATIVE_RAW )
drivers/scsi/aha152x.c +3 -3
@@ -1052,10 +1052,10 @@ static int aha152x_abort(Scsi_Cmnd *SCpnt)* Reset a device * */ -static int aha152x_device_reset (Scsi_Cmnd * SCpnt) +static int aha152x_device_reset (struct scsi_device * sdev) { -struct Scsi_Host *shpnt = SCpnt->device->host; -struct scsi_cmnd *SCprev =NULL ; +struct Scsi_Host *shpnt = sdev->host; +struct scsi_cmnd *SCpnt, *SCprev =NULL ;DECLARE_COMPLETION (done);int ret, issued, disconnected;unsigned char old_cmd_len;
drivers/scsi/aha1542.c +4 -4
@@ -792,14 +792,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
@@ -780,12 +780,11 @@ static DEF_SCSI_QCMD(ahd_linux_queue)* 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 ;int paused;int wait;
@@ -797,27 +796,22 @@ static DEF_SCSI_QCMD(ahd_linux_queue) reset_scb =NULL ; paused = FALSE; wait = FALSE; - 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 ; }
@@ -826,12 +820,12 @@ static DEF_SCSI_QCMD(ahd_linux_queue)*/ 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 ;
@@ -839,8 +833,8 @@ static DEF_SCSI_QCMD(ahd_linux_queue)ahd_set_sense_residual (reset_scb,0 ); reset_scb->platform_data->xfer_len =0 ; reset_scb->hscb->control =0 ; - reset_scb->hscb->scsiid =BUILD_SCSIID (ahd, cmd->device); - reset_scb->hscb->lun = cmd->device->lun; + reset_scb->hscb->scsiid =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 ;
@@ -1808,7 +1802,8 @@ struct scsi_host_template aic79xx_driver_template = {* 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 ) {uint32_t amount_xferred;
drivers/scsi/aic7xxx/aic7xxx_osm.c +2 -2
@@ -756,11 +756,11 @@ static DEF_SCSI_QCMD(ahc_linux_queue)* 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 !=0 )printk ("aic7xxx_dev_reset returns 0x%x\n" , error);return (error);
drivers/scsi/arm/fas216.c +2 -3
@@ -2467,16 +2467,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/be2iscsi/be_main.c +4 -4
@@ -260,7 +260,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 ];
@@ -276,7 +276,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);
@@ -304,7 +304,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
@@ -359,7 +359,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
@@ -293,9 +293,8 @@ static void bfad_im_fc_rport_add(struct bfad_im_port_s *im_port,* */ 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
@@ -541,7 +541,7 @@ void bnx2fc_init_task(struct bnx2fc_cmd *io_req,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 +3 -3
@@ -1074,12 +1074,12 @@ int bnx2fc_eh_target_reset(struct scsi_target *sc_tgt)* 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 +3 -4
@@ -2059,9 +2059,8 @@ static DEVICE_ATTR(dbg_level, S_IRUGO | S_IWUSR, csio_show_dbg_level, }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);
@@ -2172,12 +2171,12 @@ static DEVICE_ATTR(dbg_level, S_IRUGO | S_IWUSR, csio_show_dbg_level,csio_dbg (hw,"Waiting max %d secs for LUN reset completion\n" , count * (CSIO_SCSI_TM_POLL_MS /1000 ));/* Wait for completion */ -while ((((struct scsi_cmnd *)csio_scsi_cmnd (ioreq)) == cmnd) +while ((((struct scsi_cmnd *)csio_scsi_cmnd (ioreq)) == tmf_cmnd) && count--)msleep (CSIO_SCSI_TM_POLL_MS );/* LUN reset timed-out */ -if (((struct scsi_cmnd *)csio_scsi_cmnd (ioreq)) == cmnd) { +if (((struct scsi_cmnd *)csio_scsi_cmnd (ioreq)) == tmf_cmnd) {csio_err (hw,"LUN reset (%d:%llu) timed out\n" , sdev->id, sdev->lun);
drivers/scsi/cxlflash/main.c +5 -10
@@ -2431,28 +2431,23 @@ 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_Host *host = scp->device->host; +struct Scsi_Host *host = sdev->host;struct cxlflash_cfg *cfg =shost_priv (host);struct device *dev = &cfg->dev->dev;struct afu *afu = cfg->afu;int rcr =0 ; -dev_dbg (dev,"%s: (scp=%p) %d/%d/%d/%llu " -"cdb=(%08x-%08x-%08x-%08x)\n" , __func__, scp, host->host_no, - scp->device->channel, scp->device->id, scp->device->lun, -get_unaligned_be32 (&((u32 *)scp->cmnd)[0 ]), -get_unaligned_be32 (&((u32 *)scp->cmnd)[1 ]), -get_unaligned_be32 (&((u32 *)scp->cmnd)[2 ]), -get_unaligned_be32 (&((u32 *)scp->cmnd)[3 ])); +dev_dbg (dev,"%s: %d/%d/%d/%llu\n" , __func__, host->host_no, + sdev->channel, sdev->id, sdev->lun); retry:switch (cfg->state) {
drivers/scsi/dpt_i2o.c +11 -9
@@ -725,18 +725,19 @@ static int adpt_abort(struct scsi_cmnd * cmd)// This is the same for BLK and SCSI devices // NOTE this is wrong in the i2o.h definitions // This is not currently supported by our adapter but we issue it anyway -static int adpt_device_reset (struct scsi_cmnd * cmd) +static int adpt_device_reset (struct scsi_device * sdev) {adpt_hba * pHba;u32 msg[4 ];u32 rcode;int old_state; -struct adpt_device * d = cmd->device->hostdata; +struct adpt_device * d = sdev->hostdata; - pHba = (void *) cmd->device->host->hostdata[0 ]; -printk (KERN_INFO "%s: Trying to reset device\n" ,pHba->name); + pHba = (void *) sdev->host->hostdata[0 ]; +printk (KERN_INFO "%s: Trying to reset device\n" , pHba->name);if (!d) { -printk (KERN_INFO "%s: Reset Device: Device Not found\n" ,pHba->name); +printk (KERN_INFO "%s: Reset Device: Device Not found\n" , + pHba->name);return FAILED ; }memset (msg,0 ,sizeof (msg));
@@ -749,19 +750,20 @@ static int adpt_device_reset(struct scsi_cmnd* cmd)spin_lock_irq (pHba->host->host_lock); old_state = d->state; d->state |=DPTI_DEV_RESET ; - rcode =adpt_i2o_post_wait (pHba, msg,sizeof (msg),FOREVER ); + rcode =adpt_i2o_post_wait (pHba, msg,sizeof (msg),FOREVER ); d->state = old_state;if (pHba->host)spin_unlock_irq (pHba->host->host_lock);if (rcode !=0 ) {if (rcode == -EOPNOTSUPP ){ -printk (KERN_INFO "%s: Device reset not supported\n" ,pHba->name); +printk (KERN_INFO "%s: Device reset not supported\n" , + pHba->name);return FAILED ; } -printk (KERN_INFO "%s: Device reset failed\n" ,pHba->name); +printk (KERN_INFO "%s: Device reset failed\n" , pHba->name);return FAILED ; }else { -printk (KERN_INFO "%s: Device reset successful\n" ,pHba->name); +printk (KERN_INFO "%s: Device reset successful\n" , pHba->name);return SUCCESS ; } }
drivers/scsi/dpti.h +1 -1
@@ -40,7 +40,7 @@ static int adpt_bios_param(struct scsi_device * sdev, struct block_device *dev, sector_t, int geom[]);static int adpt_bus_reset (struct Scsi_Host * shost,int channel); -static int adpt_device_reset (struct scsi_cmnd * cmd); +static int adpt_device_reset (struct scsi_device * sdev);/*
drivers/scsi/esas2r/esas2r.h +1 -1
@@ -976,7 +976,7 @@ u8 handle_hba_ioctl(struct esas2r_adapter *a,/* 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,int channel);int esas2r_target_reset (struct scsi_target *starget);
drivers/scsi/esas2r/esas2r_main.c +1 -2
@@ -1237,9 +1237,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
@@ -342,7 +342,7 @@ static inline struct fnic *fnic_from_ctlr(struct fcoe_ctlr *fip)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 +13 -13
@@ -2330,9 +2330,8 @@ static int fnic_clean_pending_aborts(struct fnic *fnic,* fail to get aborted. It calls driver's eh_device_reset with a SCSI command * on the LUN. */ -int fnic_device_reset (struct scsi_cmnd *sc) +int fnic_device_reset (struct scsi_device *sdev) { -struct scsi_device *sdev = sc->device;struct fc_lport *lp;struct fnic *fnic;struct fnic_io_req *io_req =NULL ;
@@ -2345,8 +2344,10 @@ int fnic_device_reset(struct scsi_cmnd *sc)struct scsi_lun fc_lun;struct fnic_stats *fnic_stats;struct reset_stats *reset_stats; -int tag =0 ; +int tag; +u64 sc_state =0 ;DECLARE_COMPLETION_ONSTACK (tm_done); +struct scsi_cmnd *sc;/* Wait for rport to unblock */ rport =starget_to_rport (scsi_target (sdev));
@@ -2361,7 +2362,7 @@ int fnic_device_reset(struct scsi_cmnd *sc) fnic =lport_priv (lp); fnic_stats = &fnic->fnic_stats; reset_stats = &fnic->fnic_stats.reset_stats; - + tag = fnic->fnic_max_tag_id -1 ;atomic64_inc (&reset_stats->device_resets); FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
@@ -2377,10 +2378,10 @@ int fnic_device_reset(struct scsi_cmnd *sc) goto fnic_device_reset_end; }/* The last tag is reserved for device reset */ - sc =scsi_host_find_tag (sdev->host, fnic->fnic_max_tag_id -1 ); + sc =scsi_host_find_tag (sdev->host, tag); io_lock =fnic_io_lock_hash (fnic, sc);spin_lock_irqsave (io_lock, flags); -if (CMD_SP (sc)) { +if (!sc ||CMD_SP (sc)) {/* * Reset tag busy */
@@ -2541,13 +2542,12 @@ int fnic_device_reset(struct scsi_cmnd *sc) } fnic_device_reset_end: -FNIC_TRACE (fnic_device_reset, sc->device->host->host_no, - sc->request->tag, sc, -jiffies_to_msecs (jiffies - start_time), -0 , ((u64 )sc->cmnd[0 ] <<32 | - (u64 )sc->cmnd[2 ] <<24 | (u64 )sc->cmnd[3 ] <<16 | - (u64 )sc->cmnd[4 ] <<8 | sc->cmnd[5 ]), - (((u64 )CMD_FLAGS (sc) <<32 ) |CMD_STATE (sc))); +if (sc) + sc_state = ((u64 )CMD_FLAGS (sc) <<32 ) |CMD_STATE (sc); +FNIC_TRACE (fnic_device_reset, sdev->host->host_no, + tag, sc, +jiffies_to_msecs (jiffies - start_time), +0 ,0 , sc_state); FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, "Returning from device reset %s\n",
drivers/scsi/hpsa.c +6 -8
@@ -257,7 +257,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);
@@ -5748,7 +5748,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 ;struct ctlr_info *h;
@@ -5758,7 +5758,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 ;
@@ -5771,7 +5771,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 ;
@@ -5786,8 +5786,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;
@@ -5796,8 +5795,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 +2 -3
@@ -2431,14 +2431,13 @@ 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 ibmvfc_host *vhost =shost_priv (sdev->host);struct fc_rport *rport =starget_to_rport (scsi_target (sdev));int cancel_rc, block_rc, reset_rc =0 ;
drivers/scsi/ibmvscsi/ibmvscsi.c +10 -9
@@ -1620,16 +1620,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);
@@ -1638,7 +1638,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 ; }
@@ -1672,12 +1672,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);
@@ -1685,7 +1685,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 ; }
@@ -1697,7 +1698,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 ;
@@ -1708,7 +1709,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 +16 -15
@@ -5296,7 +5296,7 @@ static int ipr_sata_reset(struct ata_link *link, unsigned int *classes,/** * 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
@@ -5305,7 +5305,7 @@ static int ipr_sata_reset(struct ata_link *link, unsigned int *classes,* 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_cmnd *ipr_cmd;struct ipr_ioa_cfg *ioa_cfg;
@@ -5315,8 +5315,8 @@ static int __ipr_eh_dev_reset(struct scsi_cmnd *scsi_cmd)struct ipr_hrr_queue *hrrq;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
@@ -5333,7 +5333,8 @@ static int __ipr_eh_dev_reset(struct scsi_cmnd *scsi_cmd)for (i = hrrq->min_cmd_id; i <= hrrq->max_cmd_id; i++) { ipr_cmd = ioa_cfg->ipr_cmnd_list[i]; -if (ipr_cmd->ioarcb.res_handle == res->res_handle) { +if (ipr_cmd->scsi_cmd && + ipr_cmd->scsi_cmd->device == scsi_dev) {if (!ipr_cmd->qc)continue ;if (ipr_cmnd_is_free (ipr_cmd))
@@ -5349,13 +5350,13 @@ static int __ipr_eh_dev_reset(struct scsi_cmnd *scsi_cmd)spin_unlock (&hrrq->_lock); } res->resetting_device =1 ; -scmd_printk (KERN_ERR , scsi_cmd,"Resetting device\n" ); +sdev_printk (KERN_ERR , scsi_dev,"Resetting device\n" );if (ipr_is_gata (res) && res->sata_port) { ap = res->sata_port->ap; -spin_unlock_irq (scsi_cmd->device->host->host_lock); +spin_unlock_irq (scsi_dev->host->host_lock);ata_std_error_handler (ap); -spin_lock_irq (scsi_cmd->device->host->host_lock); +spin_lock_irq (scsi_dev->host->host_lock); }else rc =ipr_device_reset (ioa_cfg, res); res->resetting_device =0 ;
@@ -5365,27 +5366,27 @@ 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 ) {if (ipr_is_gata (res) && res->sata_port) rc =ipr_wait_for_ops (ioa_cfg, res, ipr_match_res);else - 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 +4 -4
@@ -2167,11 +2167,11 @@ int fc_eh_abort(struct scsi_cmnd *sc_cmd)* * 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;
@@ -2179,7 +2179,7 @@ int fc_eh_device_reset(struct scsi_cmnd *sc_cmd)if (rval)return rval; - lport =shost_priv (sc_cmd->device->host); + lport =shost_priv (sdev->host);if (lport->state !=LPORT_ST_READY )return rc;
@@ -2202,7 +2202,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
@@ -2273,17 +2273,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;
@@ -2291,11 +2291,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);
@@ -2313,7 +2312,7 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc) conn->tmf_state =TMF_QUEUED ; hdr = &conn->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)) {
@@ -2340,7 +2339,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 ); conn->tmf_state =TMF_INITIAL ;spin_unlock_bh (&session->frwd_lock);
drivers/scsi/libsas/sas_scsi_host.c +6 -6
@@ -503,18 +503,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,0 ); +return sas_queue_reset (dev,SAS_DEV_LU_RESET , sdev->lun,0 ); -int_to_scsilun (cmd->device->lun, &lun); +int_to_scsilun (sdev->lun, &lun);if (!i->dft->lldd_lu_reset)return FAILED ;
@@ -557,7 +557,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
@@ -5154,19 +5154,19 @@ void lpfc_poll_timeout(unsigned long ptr)* 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 Scsi_Host *shost = sdev->host;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; -struct fc_rport *rport =starget_to_rport (scsi_target (cmnd->device)); +struct fc_rport *rport =starget_to_rport (scsi_target (sdev));int status; - rdata =lpfc_rport_data_from_scsi_device (cmnd->device); + rdata =lpfc_rport_data_from_scsi_device (sdev);if (!rdata || !rdata->pnode) { lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, "0798 Device Reset rport failure: rdata x%p\n",
drivers/scsi/mpt3sas/mpt3sas_scsih.c +12 -17
@@ -2517,27 +2517,23 @@ int mpt3sas_scsih_issue_locked_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle,* Returns 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 ;u16 handle;int r; - -struct scsi_target *starget = scmd->device->sdev_target; +struct scsi_target *starget =scsi_target (sdev);struct MPT3SAS_TARGET *target_priv_data = starget->hostdata; -sdev_printk (KERN_INFO , scmd->device, -"attempting device reset! scmd(%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) { -sdev_printk (KERN_INFO , scmd->device, -"device been deleted! scmd(%p)\n" , scmd); - scmd->result =DID_NO_CONNECT <<16 ; - scmd->scsi_done (scmd); +sdev_printk (KERN_INFO , sdev, +"device been deleted!\n" ); r =SUCCESS ; goto out; }
@@ -2554,18 +2550,17 @@ int mpt3sas_scsih_issue_locked_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, handle = sas_device_priv_data->sas_target->handle;if (!handle) { - scmd->result =DID_RESET <<16 ; r =FAILED ; goto out; } - 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 ,30 ); out: -sdev_printk (KERN_INFO , scmd->device,"device reset: %s scmd(%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/pmcraid.c +3 -3
@@ -3059,11 +3059,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
@@ -625,12 +625,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 ); }void qedf_wait_for_upload (struct qedf_ctx *qedf)
drivers/scsi/qla1280.c +16 -5
@@ -1001,13 +1001,24 @@ static void qla1280_mailbox_timeout(unsigned long __data)* Reset the specified SCSI device **************************************************************************/ static int -qla1280_eh_device_reset (struct scsi_cmnd *cmd) +qla1280_eh_device_reset (struct scsi_device *sdev) { -int rc; +struct Scsi_Host *shost = sdev->host; +struct scsi_qla_host *ha = (struct scsi_qla_host *)shost->hostdata; +int rc =FAILED ; -spin_lock_irq (cmd->device->host->host_lock); - rc =qla1280_error_action (cmd,DEVICE_RESET ); -spin_unlock_irq (cmd->device->host->host_lock); +spin_lock_irq (shost->host_lock); +if (qla1280_verbose) +printk (KERN_INFO +"scsi(%ld:%d:%d:%llu): Queueing device reset " +"command.\n" , ha->host_no, sdev->channel, + sdev->id, sdev->lun); +if (qla1280_device_reset (ha, sdev->channel, sdev->id) ==0 ) { +/* issued device reset, set wait conditions */ + rc =qla1280_wait_for_pending_commands (ha, + sdev->channel, sdev->id); + } +spin_unlock_irq (shost->host_lock);return rc; }
drivers/scsi/qla2xxx/qla_os.c +2 -3
@@ -272,7 +272,7 @@static void qla2xxx_slave_destroy (struct scsi_device *);static int qla2xxx_queuecommand (struct Scsi_Host *h,struct scsi_cmnd *cmd);static int qla2xxx_eh_abort (struct scsi_cmnd *); -static int qla2xxx_eh_device_reset (struct scsi_cmnd *); +static int qla2xxx_eh_device_reset (struct scsi_device *);static int qla2xxx_eh_target_reset (struct scsi_target *);static int qla2xxx_eh_bus_reset (struct Scsi_Host *,int );static int qla2xxx_eh_host_reset (struct Scsi_Host *);
@@ -1384,9 +1384,8 @@ uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha) };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 qla_hw_data *ha = vha->hw;fc_port_t *fcport = (struct fc_port *) sdev->hostdata;
drivers/scsi/qla4xxx/ql4_os.c +12 -16
@@ -158,7 +158,7 @@ static int qla4xxx_set_chap_entry(struct Scsi_Host *shost, void *data,*/ 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);
@@ -9238,17 +9238,17 @@ static int qla4xxx_eh_abort(struct scsi_cmnd *cmd)* 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_qla_host *ha =to_qla_host (cmd->device->host); +struct scsi_qla_host *ha =to_qla_host (sdev->host);struct iscsi_cls_session *session; -struct ddb_entry *ddb_entry = cmd->device->hostdata; +struct ddb_entry *ddb_entry = sdev->hostdata;int ret =FAILED , stat;if (!ddb_entry)return ret; - session =starget_to_session (scsi_target (cmd->device)); + session =starget_to_session (scsi_target (sdev)); ret =iscsi_block_scsi_eh (session);if (ret)return ret;
@@ -9256,23 +9256,20 @@ 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, cmd->request->timeout /HZ , - ha->dpc_flags, cmd->result, cmd->allowed)); +"scsi%ld: DEVICE_RESET dpc_flags=%lx\n" , + ha->host_no, ha->dpc_flags));/* 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" );
@@ -9280,14 +9277,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 +8 -10
@@ -3793,19 +3793,17 @@ static int scsi_debug_abort(struct scsi_cmnd *SCpnt)return SUCCESS ; } -static int scsi_debug_device_reset (struct scsi_cmnd * SCpnt) +static int scsi_debug_device_reset (struct scsi_device * sdp) { +struct sdebug_dev_info *devip = + (struct sdebug_dev_info *)sdp->hostdata; + ++num_dev_resets; -if (SCpnt && SCpnt->device) { -struct scsi_device *sdp = SCpnt->device; -struct sdebug_dev_info *devip = - (struct sdebug_dev_info *)sdp->hostdata; -if (SDEBUG_OPT_ALL_NOISE & sdebug_opts) -sdev_printk (KERN_INFO , sdp,"%s\n" , __func__); -if (devip) -set_bit (SDEBUG_UA_POR , devip->uas_bm); - } +if (SDEBUG_OPT_ALL_NOISE & sdebug_opts) +sdev_printk (KERN_INFO , sdp,"%s\n" , __func__); +if (devip) +set_bit (SDEBUG_UA_POR , devip->uas_bm);return SUCCESS ; }
drivers/scsi/scsi_error.c +24 -11
@@ -844,7 +844,7 @@ static int 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;
@@ -1106,6 +1106,7 @@ static int scsi_eh_action(struct scsi_cmnd *scmd, int rtn)* scsi_eh_finish_cmd - Handle a cmd that eh is finished with. * @scmd: Original SCSI cmd that eh has finished. * @done_q: Queue for processed commands. +* @result: Final command status to be set * * Notes: * We don't want to use the normal command completion while we are are
@@ -1114,10 +1115,18 @@ static int scsi_eh_action(struct scsi_cmnd *scmd, int rtn)* keep a list of pending commands for final completion, and once we * are ready to leave error handling we handle completion for real. */ -void scsi_eh_finish_cmd (struct scsi_cmnd *scmd,struct list_head *done_q) +void __scsi_eh_finish_cmd (struct scsi_cmnd *scmd,struct list_head *done_q, +int host_byte) { +if (host_byte) +set_host_byte (scmd, host_byte);list_move_tail (&scmd->eh_entry, done_q); } + +void scsi_eh_finish_cmd (struct scsi_cmnd *scmd,struct list_head *done_q) +{ +__scsi_eh_finish_cmd (scmd, done_q,0 ); +}EXPORT_SYMBOL (scsi_eh_finish_cmd);/**
@@ -1284,7 +1293,8 @@ static int scsi_eh_test_devices(struct list_head *cmd_list,if (finish_cmds && (try_stu ||scsi_eh_action (scmd,SUCCESS ) ==SUCCESS )) -scsi_eh_finish_cmd (scmd, done_q); +__scsi_eh_finish_cmd (scmd, done_q, +DID_RESET );else list_move_tail (&scmd->eh_entry, work_q); }
@@ -1429,8 +1439,9 @@ static int scsi_eh_bus_device_reset(struct Scsi_Host *shost, work_q, eh_entry) {if (scmd->device == sdev &&scsi_eh_action (scmd, rtn) !=FAILED ) -scsi_eh_finish_cmd (scmd, - done_q); +__scsi_eh_finish_cmd (scmd, + done_q, +DID_RESET ); } } }else {
@@ -1498,7 +1509,8 @@ 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 ) -scsi_eh_finish_cmd (scmd, done_q); +__scsi_eh_finish_cmd (scmd, done_q, +DID_TRANSPORT_DISRUPTED );else /* push back on work queue for further processing */ list_move (&scmd->eh_entry, work_q);
@@ -1563,8 +1575,9 @@ static int scsi_eh_bus_reset(struct Scsi_Host *shost,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); +__scsi_eh_finish_cmd (scmd, + done_q, +DID_TRANSPORT_DISRUPTED );else list_move_tail (&scmd->eh_entry, &check_list);
@@ -1607,9 +1620,9 @@ static int scsi_eh_host_reset(struct Scsi_Host *shost,if (rtn ==SUCCESS ) {list_splice_init (work_q, &check_list); }else if (rtn ==FAST_IO_FAIL ) { -list_for_each_entry_safe (scmd, next, work_q, eh_entry) { -scsi_eh_finish_cmd (scmd, done_q); - } +list_for_each_entry_safe (scmd, next, work_q, eh_entry) +__scsi_eh_finish_cmd (scmd, done_q, +DID_TRANSPORT_DISRUPTED ); }else { SCSI_LOG_ERROR_RECOVERY(3, shost_printk(KERN_INFO, shost,
drivers/scsi/smartpqi/smartpqi_init.c +3 -3
@@ -5259,16 +5259,16 @@ static int pqi_device_reset(struct pqi_ctrl_info *ctrl_info,return rc ==0 ?SUCCESS :FAILED ; } -static int pqi_eh_device_reset_handler (struct scsi_cmnd *scmd) +static int pqi_eh_device_reset_handler (struct scsi_device *sdev) {int rc;struct Scsi_Host *shost;struct pqi_ctrl_info *ctrl_info;struct pqi_scsi_dev *device; - shost = scmd->device->host; + shost = sdev->host; ctrl_info =shost_to_hba (shost); - device = scmd->device->hostdata; + device = sdev->hostdata; dev_err(&ctrl_info->pci_dev->dev, "resetting scsi %d:%d:%d:%d\n",
drivers/scsi/snic/snic.h +1 -1
@@ -379,7 +379,7 @@ struct snic_global {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
@@ -2134,15 +2134,15 @@* 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 snic_req_info *rqi =NULL ;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/ufs/ufshcd.c +7 -9
@@ -5481,27 +5481,25 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, int lun_id, int task_id,/** * ufshcd_eh_device_reset_handler - device reset handler registered to * scsi layer. -* @cmd: SCSI command pointer +* @sdev: SCSI device pointer * * Returns SUCCESS/FAILED */ -static int ufshcd_eh_device_reset_handler (struct scsi_cmnd *cmd) +static int ufshcd_eh_device_reset_handler (struct scsi_device *sdev) {struct Scsi_Host *host;struct ufs_hba *hba; -unsigned int tag; +unsigned int lun;u32 pos;int err;u8 resp =0xF ; -struct ufshcd_lrb *lrbp;unsigned long flags; - host = cmd->device->host; + host = sdev->host; hba =shost_priv (host); - tag = cmd->request->tag; + lun =ufshcd_scsi_to_upiu_lun (sdev->lun); - lrbp = &hba->lrb[tag]; - err =ufshcd_issue_tm_cmd (hba, lrbp->lun,0 ,UFS_LOGICAL_RESET , &resp); + err =ufshcd_issue_tm_cmd (hba, lun,0 ,UFS_LOGICAL_RESET , &resp);if (err || resp !=UPIU_TASK_MANAGEMENT_FUNC_COMPL ) {if (!err) err = resp;
@@ -5510,7 +5508,7 @@ static int ufshcd_eh_device_reset_handler(struct scsi_cmnd *cmd)/* clear the commands that were pending for corresponding LUN */ for_each_set_bit (pos, &hba->outstanding_reqs, hba->nutrs) { -if (hba->lrb[pos].lun == lrbp->lun) { +if (hba->lrb[pos].lun == lun) { err =ufshcd_clear_cmd (hba, pos);if (err)break ;
drivers/scsi/virtio_scsi.c +7 -7
@@ -681,26 +681,26 @@ 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 ;memset (cmd,0 ,sizeof (*cmd)); - cmd->sc = sc; + cmd->sc =NULL ; cmd->req.tmf = (struct virtio_scsi_ctrl_tmf_req ){ .type =VIRTIO_SCSI_T_TMF , .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
@@ -950,14 +950,14 @@ static int pvscsi_bus_reset(struct Scsi_Host *host, 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
@@ -967,7 +967,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
@@ -500,10 +500,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,int channel)
drivers/scsi/xen-scsifront.c +2 -2
@@ -655,10 +655,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 +2 -2
@@ -196,9 +196,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 rtsx_dev *dev =host_to_rtsx (srb->device->host); +struct rtsx_dev *dev =host_to_rtsx (sdev->host);dev_info (&dev->pci->dev,"%s called\n" , __func__);
drivers/staging/unisys/visorhba/visorhba_main.c +3 -11
@@ -385,29 +385,21 @@ static int visorhba_abort_handler(struct scsi_cmnd *scsicmd)/* * visorhba_device_reset_handler - Send TASK_MGMT_LUN_RESET -* @scsicmd: The scsicmd that needs aborted +* @scsidev: The scsidev to be reset * * Returns SUCCESS if inserted, failure otherwise */ -static int visorhba_device_reset_handler (struct scsi_cmnd *scsicmd) +static int visorhba_device_reset_handler (struct scsi_device *scsidev) {/* issue TASK_MGMT_LUN_RESET */ -struct scsi_device *scsidev;struct visordisk_info *vdisk; -int rtn; - scsidev = scsicmd->device; vdisk = scsidev->hostdata;if (atomic_read (&vdisk->error_count) <VISORHBA_ERROR_COUNT )atomic_inc (&vdisk->error_count);else atomic_set (&vdisk->ios_threshold,IOS_ERROR_THRESHOLD ); - rtn =forward_taskmgmt_command (TASK_MGMT_LUN_RESET , scsidev); -if (rtn ==SUCCESS ) { - scsicmd->result =DID_RESET <<16 ; - scsicmd->scsi_done (scsicmd); - } -return rtn; +return forward_taskmgmt_command (TASK_MGMT_LUN_RESET , scsidev); }/*
drivers/target/loopback/tcm_loop.c +4 -4
@@ -311,7 +311,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;
@@ -320,10 +320,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/usb/storage/scsiglue.c +2 -2
@@ -449,9 +449,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
@@ -737,9 +737,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
@@ -952,7 +952,7 @@ static inline struct fc_lport *fc_disc_lport(struct fc_disc *disc)*****************************/ 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
@@ -383,7 +383,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 blk_eh_timer_return iscsi_eh_cmd_timed_out (struct scsi_cmnd *sc);
include/scsi/libsas.h +1 -1
@@ -713,7 +713,7 @@ extern int sas_bios_param(struct scsi_device *,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
@@ -145,7 +145,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 *,int );int (* eh_host_reset_handler)(struct Scsi_Host *);
Signature · 1 line
1.8.5.6
Re: [PATCH 01/47] aacraid: split off functions to generate reset FIB
In reply to Hannes ReineckeSignature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 02/47] aacraid: split off host reset
In reply to Hannes Reineckedrivers/scsi/aacraid/linit.c static int aac_eh_reset(struct scsi_cmnd* cmd) · line 963
Quoted 3 lines · Hannes Reinecke
drivers/scsi/aacraid/linit.c +3
-0+struct scsi_device * dev = cmd->device; +struct Scsi_Host * host = dev->host; +struct aac_dev * aac = (struct aac_dev *)host->hostdata;
Minor nit, if you happen to re-send, please remove the space between the asterisk and the variable names.
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 03/47] aacraid: split off device, target, and bus reset
In reply to Hannes ReineckeSignature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 05/47] aacraid: enable sending of TMFs from aac_hba_send()
In reply to Hannes ReineckeSignature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 06/47] aacraid: add fib flag to mark scsi command callback
In reply to Hannes ReineckeSignature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 07/47] aacraid: complete all commands during bus reset
In reply to Hannes ReineckeSignature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 08/47] sym53c8xx_2: split off bus reset from host reset
In reply to Hannes ReineckeSignature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 08/47] sym53c8xx_2: split off bus reset from host reset
In reply to Hannes ReineckeSignature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 10/47] ips: Do not try to abort command from host reset
In reply to Hannes ReineckeSignature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 11/47] snic: reserve tag for TMF
In reply to Hannes ReineckeSignature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 12/47] qla1280: separate out host reset function from qla1280_error_action()
In reply to Hannes ReineckeSignature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 13/47] megaraid: pass in NULL scb for host reset
In reply to Hannes ReineckeSignature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Sumit Saxena
maintainerRE: [PATCH 13/47] megaraid: pass in NULL scb for host reset
In reply to Hannes ReineckeQuoted 6 lines
-----Original Message-----
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Hannes Reinecke
Sent: Wednesday, June 28, 2017 2:03 PM
To: Christoph Hellwig
Cc: Martin K. Petersen; James Bottomley; [email protected];
Hannes
Quoted 6 lines
Reinecke; Hannes Reinecke
Subject: [PATCH 13/47] megaraid: pass in NULL scb for host resetWhen calling a host reset we shouldn't rely on the command triggering the reset, so allow
megaraid_abort_and_reset()to be called with a NULL scb. And drop the pointless 'bus_reset' and 'target_reset' handlers, which
just call
Quoted 1 line
the same function as
host_reset.
If this patch address any functional issue, then we should consider this. If it's code optimization, can we ignore this as this is being very old driver
and no more maintained by Broadcom/LSI ?
Quoted 11 lines
Signed-off-by Hannes Reinecke <[email protected]>---
drivers/scsi/megaraid.c| 42 ++++++++++++++++--------------------------1 file changed, 16 insertions(+), 26 deletions(-)drivers/scsi/megaraid.c index renamed from drivers/scsi/megaraid.c +0
-03c63c29..7e504d3 100644
drivers/scsi/megaraid.c static DEF_SCSI_QCMD(megaraid_queue) · line 1912
Quoted 5 lines
drivers/scsi/megaraid.c +1
-1@@ -1909,7 +1909,7 @@ static DEF_SCSI_QCMD(megaraid_queue)spin_lock_irq (&adapter->lock); - rval =megaraid_abort_and_reset (adapter, cmd,SCB_RESET ); + rval =megaraid_abort_and_reset (adapter,NULL ,SCB_RESET );
If cmd=NULL is passed, it will crash inside function megaraid_abort_and_reset() while dereferencing "cmd" pointer. Below is the code of function megaraid_abort_and_reset() where it will crash-
static intmegaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
{
struct list_head *pos, *next;
scb_t *scb;
dev_warn(&adapter->dev->dev, "%s cmd=%x <c=%d t=%d l=%d>\n",
(aor == SCB_ABORT)? "ABORTING":"RESET",
cmd->cmnd[0],
cmd->device->channel,>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>it should crash
here
cmd->device->id, (u32)cmd->device->lun);Please correct if I am missing something here.
drivers/scsi/megaraid.c static inline void mega_create_proc_entry(int
Quoted 60 lines
drivers/scsi/megaraid.c +0
-0/* * This is required here to complete any completed requests @@ - 1948,7 +1948,7 @@ static DEF_SCSI_QCMD(megaraid_queue) scb = list_entry(pos, scb_t, list);drivers/scsi/megaraid.c +1
-1-if (scb->cmd == cmd) {/* Found command */ +if (!cmd || scb->cmd == cmd) {/* Found command */ scb->state |= aor;drivers/scsi/megaraid.c +14
-22@@ -1967,31 +1967,23 @@ static DEF_SCSI_QCMD(megaraid_queue)return FAILED ; } -else { - -/* -* Not yet issued! Remove from the pending -* list -*/ -dev_warn (&adapter->dev->dev, -"%s-[%x], driver owner\n" , - (aor==SCB_ABORT ) ? "ABORTING":"RESET", - scb->idx); - -mega_free_scb (adapter, scb); - -if ( aor ==SCB_ABORT ) { - cmd->result = (DID_ABORT <<16 ); - } -else { - cmd->result = (DID_RESET <<16 ); - } +/* +* Not yet issued! Remove from the pending +* list +*/ +dev_warn (&adapter->dev->dev, +"%s-[%x], driver owner\n" , + (cmd) ?"ABORTING" :"RESET" , + scb->idx); +mega_free_scb (adapter, scb); +if (cmd) { + cmd->result = (DID_ABORT <<16 );list_add_tail (SCSI_LIST (cmd), - &adapter->completed_list); - -return SUCCESS ; + &adapter->completed_list); } + +return SUCCESS ; } }@@ -4180,8 +4172,6 @@ static inline void mega_create_proc_entry(int
index,
Quoted 11 lines
struct
proc_dir_entry*pare
.cmd_per_lun =DEF_CMD_PER_LUN,
.use_clustering =ENABLE_CLUSTERING,
.eh_abort_handler =megaraid_abort,drivers/scsi/megaraid.c +0
-2- .eh_device_reset_handler = megaraid_reset, - .eh_bus_reset_handler = megaraid_reset,.eh_host_reset_handler = megaraid_reset, .no_write_same = 1, };--
1.8.5.6
Quoted 3 lines · Hannes Reinecke
Hi all,
finally here's the patchset to revamp the SCSI EH callback arguments which I promised to do (some years ago ...).
Still looks like a way to big series to review. Once we got the first part 1 it might make sense to start resending just the various prep patches..
Hannes Reinecke
maintainerRe: [PATCH 13/47] megaraid: pass in NULL scb for host reset
In reply to Sumit SaxenaQuoted 13 lines · Sumit Saxena
Quoted 6 lines
-----Original Message-----
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Hannes Reinecke
Sent: Wednesday, June 28, 2017 2:03 PM
To: Christoph Hellwig
Cc: Martin K. Petersen; James Bottomley; [email protected];Hannes
Quoted 6 lines
Reinecke; Hannes Reinecke
Subject: [PATCH 13/47] megaraid: pass in NULL scb for host resetWhen calling a host reset we shouldn't rely on the command triggering the reset, so allow
megaraid_abort_and_reset()to be called with a NULL scb. And drop the pointless 'bus_reset' and 'target_reset' handlers, which
Quoted 8 lines
just call
Quoted 1 line
the same function as
host_reset.If this patch address any functional issue, then we should consider this. If it's code optimization, can we ignore this as this is being very old driver
and no more maintained by Broadcom/LSI ?
Sadly, ignoring is not an option.
I'm planning to update the calling convention for SCSI EH, to resolve the long-standing problem with sg_reset ioctls.sg_reset ioctl will allocate an out-of-band SCSI command, which does no longer work with the new command allocation scheme in multiqueue. So it's not possible to just 'ignore' it, as then SCSI EH will cease to function with that driver.
Sorry.
Quoted 35 lines
Quoted 11 lines
Signed-off-by Hannes Reinecke <[email protected]>---
drivers/scsi/megaraid.c| 42 ++++++++++++++++--------------------------1 file changed, 16 insertions(+), 26 deletions(-)drivers/scsi/megaraid.c index renamed from drivers/scsi/megaraid.c +0
-03c63c29..7e504d3 100644
drivers/scsi/megaraid.c static DEF_SCSI_QCMD(megaraid_queue) · line 1912
Quoted 5 lines
drivers/scsi/megaraid.c +1
-1@@ -1909,7 +1909,7 @@ static DEF_SCSI_QCMD(megaraid_queue)spin_lock_irq (&adapter->lock); - rval =megaraid_abort_and_reset (adapter, cmd,SCB_RESET ); + rval =megaraid_abort_and_reset (adapter,NULL ,SCB_RESET );If cmd=NULL is passed, it will crash inside function
megaraid_abort_and_reset()while dereferencing "cmd" pointer. Below is the code of functionmegaraid_abort_and_reset()where it will crash-static int
megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor){ struct list_head *pos, *next; scb_t *scb; dev_warn(&adapter->dev->dev, "%s cmd=%x <c=%d t=%d l=%d>\n", (aor == SCB_ABORT)? "ABORTING":"RESET", cmd->cmnd[0], cmd->device->channel,>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>it should crash here cmd->device->id, (u32)cmd->device->lun);
Quoted 1 line
Please correct if I am missing something here.Ah, correct. Will be fixing it up.
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Re: [PATCH 33/47] cxlflash: use dedicated reset command in send_tmf()
In reply to Hannes ReineckeHi Hannes,
We actually just reworked these paths in a series that was pulled in on Monday. While testing, I came across a bug in that series and was planning on sending out a fix for it. I'll include some patches that will ease the burden of incorporating your EH updates for cxlflash.
Many thanks for leading this effort, it really helps to clean up the SCSI EH paths! =)
-matt
Quoted 104 lines · Hannes Reinecke
From: Hannes Reinecke <[email protected]>
Reduce the queue depth by 1, and use this command as a dedicated reset command
send_tmf().Signed-off-by Hannes Reinecke <[email protected]>---
drivers/scsi/cxlflash/common.h| 3 ++-drivers/scsi/cxlflash/main.c| 23 ++++++++++++++++-------2 files changed, 18 insertions(+), 8 deletions(-)drivers/scsi/cxlflash/common.h +2
-1@@ -54,7 +54,8 @@/* Command management definitions */ #define CXLFLASH_MAX_CMDS 256 -#define CXLFLASH_MAX_CMDS_PER_LUN CXLFLASH_MAX_CMDS +#define CXLFLASH_MAX_CMDS_PER_LUN CXLFLASH_MAX_CMDS - 1 +#define CXLFLASH_RESET_CMD 255/* RRQ for master issued cmds */ #define NUM_RRQ_ENTRY CXLFLASH_MAX_CMDSdrivers/scsi/cxlflash/main.c +14
-5@@ -23,6 +23,7 @@#include <scsi/scsi_cmnd.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include <uapi/scsi/cxlflash_ioctl.h> #include "main.h" @@ -460,15 +461,16 @@ static u32 cmd_to_target_hwq(struct Scsi_Host *host, struct scsi_cmnd *scp,/** * send_tmf() - sends a Task Management Function (TMF) * @afu: AFU to checkout from. -* @scp: SCSI command from stack describing target. +* @sdev: SCSI device to reset. * @tmfcmd: TMF command to send. * * Return: * 0 on success, SCSI_MLQUEUE_HOST_BUSY or -errno on failure */ -static int send_tmf (struct afu *afu,struct scsi_cmnd *scp,u64 tmfcmd) +static int send_tmf (struct afu *afu,struct scsi_device *sdev,u64 tmfcmd) { -struct Scsi_Host *host = scp->device->host; +struct scsi_cmnd *scp; +struct Scsi_Host *host = sdev->host;struct cxlflash_cfg *cfg =shost_priv (host);struct afu_cmd *cmd =NULL ;struct device *dev = &cfg->dev->dev;@@ -498,14 +500,21 @@ static int send_tmf(struct afu *afu, struct scsi_cmnd *scp, u64 tmfcmd) cfg->tmf_active = true;spin_unlock_irqrestore (&cfg->tmf_slock, lock_flags); + scp =scsi_host_find_tag (host,CXLFLASH_RESET_CMD ); + scp->device = sdev; + cmd =sc_to_afucz (scp); + hwq_index =cmd_to_target_hwq (host, scp, afu); + hwq =get_hwq (afu, hwq_index); + + cmd->scp = scp; cmd->parent = afu; cmd->cmd_tmf = true; cmd->hwq_index = hwq_index; cmd->rcb.ctx_id = hwq->ctx_hndl; cmd->rcb.msi =SISL_MSI_RRQ_UPDATED ; - cmd->rcb.port_sel =CHAN2PORTMASK (scp->device->channel); - cmd->rcb.lun_id =lun_to_lunid (scp->device->lun); + cmd->rcb.port_sel =CHAN2PORTMASK (sdev->channel); + cmd->rcb.lun_id =lun_to_lunid (sdev->lun); cmd->rcb.req_flags = (SISL_REQ_FLAGS_PORT_LUN_ID |SISL_REQ_FLAGS_SUP_UNDERRUN |SISL_REQ_FLAGS_TMF_CMD );@@ -2448,7 +2457,7 @@ static int cxlflash_eh_device_reset_handler(struct scsi_cmnd *scp)retry:
switch (cfg->state) { case STATE_NORMAL:drivers/scsi/cxlflash/main.c +1
-1- rcr =send_tmf (afu, scp,TMF_LUN_RESET ); + rcr =send_tmf (afu, sdev,TMF_LUN_RESET );if (unlikely(rcr)) rc = FAILED; break;drivers/scsi/cxlflash/main.c +1
-1@@ -3139,7 +3148,7 @@ static ssize_t mode_show(struct device *dev, .eh_host_reset_handler = cxlflash_eh_host_reset_handler, .change_queue_depth = cxlflash_change_queue_depth, .cmd_per_lun = CXLFLASH_MAX_CMDS_PER_LUN, - .can_queue = CXLFLASH_MAX_CMDS, + .can_queue = CXLFLASH_MAX_CMDS - 1, .cmd_size = sizeof(struct afu_cmd) + __alignof__(struct afu_cmd) - 1, .this_id = -1, .sg_tablesize = 1, /* No scatter gather support */Signature · 1 line
1.8.5.6
Kashyap Desai
maintainerRE: [PATCH 13/47] megaraid: pass in NULL scb for host reset
In reply to Hannes ReineckeQuoted 33 lines
-----Original Message-----
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Hannes Reinecke
Sent: Wednesday, June 28, 2017 9:00 PM
To: Sumit Saxena; Christoph Hellwig
Cc: Martin K. Petersen; James Bottomley; [email protected]; Hannes
Reinecke
Subject: Re: [PATCH 13/47] megaraid: pass in NULL scb for host resetQuoted 6 lines · Sumit Saxena
Quoted 6 lines
-----Original Message-----
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Hannes Reinecke
Sent: Wednesday, June 28, 2017 2:03 PM
To: Christoph Hellwig
Cc: Martin K. Petersen; James Bottomley; [email protected];Quoted 6 lines
Hannes
Quoted 5 lines
Reinecke; Hannes Reinecke
Subject: [PATCH 13/47] megaraid: pass in NULL scb for host resetWhen calling a host reset we shouldn't rely on the command triggering the reset, so allow
megaraid_abort_and_reset()to be called with a NULLscb.
Quoted 9 lines
Quoted 1 line
And drop the pointless '
bus_reset' and 'target_reset' handlers, whichjust call
Quoted 1 line
the same function as
host_reset.If this patch address any functional issue, then we should consider this.
If it's code optimization, can we ignore this as this is being very old driver and no more maintained by Broadcom/LSI ?
Quoted 10 lines
Sadly, ignoring is not an option.
I'm planning to update the calling convention for SCSI EH, to resolve the long-
standing problem withsg_resetioctls.sg_resetioctl will allocate an out-of-band SCSI command, which does no longer
work with the new command allocation scheme in multiqueue.
So it's not possible to just 'ignore' it, as then SCSI EH will cease to function with
that driver.
Hannes - We are in process of sending megaraid and 3ware driver removal as LSI/Broadcom stopped supporting those products.
I agree we should review this closely, but lack of test coverage and end of life cycle of product is requesting us to know the rational. For now, let's consider NACK for this patch. We will be removing old megaraid (mbox) driver and 3Ware drivers soon.
Quoted 54 lines
Sorry.
Quoted 38 lines
Quoted 12 lines
Signed-off-by Hannes Reinecke <[email protected]>---
drivers/scsi/megaraid.c| 42
++++++++++++++++--------------------------1 file changed, 16 insertions(+), 26 deletions(-)drivers/scsi/megaraid.c index renamed from drivers/scsi/megaraid.c +0
-03c63c29..7e504d3 100644
drivers/scsi/megaraid.c static DEF_SCSI_QCMD(megaraid_queue) · line 1912
Quoted 5 lines
drivers/scsi/megaraid.c +1
-1@@ -1909,7 +1909,7 @@ static DEF_SCSI_QCMD(megaraid_queue)spin_lock_irq (&adapter->lock); - rval =megaraid_abort_and_reset (adapter, cmd,SCB_RESET ); + rval =megaraid_abort_and_reset (adapter,NULL ,SCB_RESET );If cmd=NULL is passed, it will crash inside function
megaraid_abort_and_reset()while dereferencing "cmd" pointer. Below is the code of functionmegaraid_abort_and_reset()where it will
crash-static int
megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor){ struct list_head *pos, *next; scb_t *scb; dev_warn(&adapter->dev->dev, "%s cmd=%x <c=%d t=%d l=%d>\n", (aor == SCB_ABORT)? "ABORTING":"RESET", cmd->cmnd[0], cmd->device->channel,>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>it should cmd->device->crash here cmd->device->id, (u32)cmd->device->lun);Quoted 2 lines
Please correct if I am missing something here.Ah, correct. Will be fixing it up.
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
[email protected] +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG
Nürnberg)
Re: [PATCH 13/47] megaraid: pass in NULL scb for host reset
In reply to a message not in the archiveQuoted 4 lines · adam radford
LSI/Broadcom isn't the maintainer of the 3ware drivers. See '
MAINTAINERS'.
Your attempts
to remove them may get a NACK from the Maintainer since I believe there are still users of these controllers.
Same for the legacy megaraid driver, but we can just mark that as orphan for now.
RE: [PATCH 04/47] aacraid: use aac_tmf_callback for reset fib
In reply to Hannes ReineckeQuoted 8 lines
When sending a reset fib we shouldn't rely on the scsi command, but rather set the TMF status in the
map_info->reset_statevariable.
That allows us to send a TMF independent on a scsi command.Signed-off-by Hannes Reinecke <[email protected]>---
<snip>
Quoted 4 lines
/*
*aac_eh_dev_reset- Device reset command handling
* @scsi_cmd: SCSI command block causing the reset
+921,19 @@ static intaac_eh_dev_reset(struct scsi_cmnd *cmd)
<snip>
drivers/scsi/aacraid/linit.c static int aac_eh_dev_reset(struct scsi_cmnd *cmd) · line 935
Quoted 6 lines
/* Wait up to 15 seconds for completion */ for (count = 0; count < 15; ++count) {drivers/scsi/aacraid/linit.c +1
-2-if (cmd->SCp.sent_command) { - ret =SUCCESS ; +if (info->reset_state ==0 ) {
Should this be <= 0, as in target reset? Otherwise it will always be success ...
-Dave
Quoted 2 lines
+ ret = info->reset_state == 0 ? SUCCESS : FAILED;
break;Hannes Reinecke
maintainerRe: [PATCH 13/47] megaraid: pass in NULL scb for host reset
In reply to Kashyap DesaiQuoted 44 lines · Kashyap Desai
Quoted 33 lines
-----Original Message-----
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Hannes Reinecke
Sent: Wednesday, June 28, 2017 9:00 PM
To: Sumit Saxena; Christoph Hellwig
Cc: Martin K. Petersen; James Bottomley; [email protected]; Hannes
Reinecke
Subject: Re: [PATCH 13/47] megaraid: pass in NULL scb for host resetQuoted 6 lines · Sumit Saxena
Quoted 6 lines
-----Original Message-----
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Hannes Reinecke
Sent: Wednesday, June 28, 2017 2:03 PM
To: Christoph Hellwig
Cc: Martin K. Petersen; James Bottomley; [email protected];Quoted 6 lines
Hannes
Quoted 5 lines
Reinecke; Hannes Reinecke
Subject: [PATCH 13/47] megaraid: pass in NULL scb for host resetWhen calling a host reset we shouldn't rely on the command triggering the reset, so allow
megaraid_abort_and_reset()to be called with a NULLscb.
Quoted 9 lines
Quoted 1 line
And drop the pointless '
bus_reset' and 'target_reset' handlers, whichjust call
Quoted 1 line
the same function as
host_reset.If this patch address any functional issue, then we should consider this.
If it's code optimization, can we ignore this as this is being very old driver and no more maintained by Broadcom/LSI ?Quoted 10 lines
Sadly, ignoring is not an option.
I'm planning to update the calling convention for SCSI EH, to resolve the long-
standing problem withsg_resetioctls.sg_resetioctl will allocate an out-of-band SCSI command, which does no longer
work with the new command allocation scheme in multiqueue.
So it's not possible to just 'ignore' it, as then SCSI EH will cease to function with
that driver.
Quoted 7 lines
Hannes - We are in process of sending megaraid and 3ware driver removal as LSI/Broadcom stopped supporting those products.
I agree we should review this closely, but lack of test coverage and end of life cycle of product is requesting us to know the rational. For now, let's consider NACK for this patch. We will be removing old megaraid (mbox) driver and 3Ware drivers soon.
Hmm.
Can't we do the removal now?
There is not a lot of testing involved with _that_, surely?
I'd be happy to do a patch if you like ...
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Sumit Saxena
maintainerRE: [PATCH 13/47] megaraid: pass in NULL scb for host reset
Quoted 61 lines
-----Original Message-----
From: Hannes Reinecke [mailto:[email protected]]
Sent: Thursday, June 29, 2017 11:23 AM
To: Kashyap Desai; Sumit Saxena; Christoph Hellwig
Cc: Martin K. Petersen; James Bottomley; [email protected]; Hannes Reinecke
Subject: Re: [PATCH 13/47] megaraid: pass in NULL scb for host resetQuoted 45 lines · Kashyap Desai
Quoted 35 lines
-----Original Message-----
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Hannes Reinecke
Sent: Wednesday, June 28, 2017 9:00 PM
To: Sumit Saxena; Christoph Hellwig
Cc: Martin K. Petersen; James Bottomley; [email protected]; Hannes Reinecke
Subject: Re: [PATCH 13/47] megaraid: pass in NULL scb for host resetQuoted 7 lines · Sumit Saxena
Quoted 7 lines
-----Original Message-----
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Hannes Reinecke
Sent: Wednesday, June 28, 2017 2:03 PM
To: Christoph Hellwig
Cc: Martin K. Petersen; James Bottomley; [email protected];Quoted 7 lines
Hannes
Quoted 6 lines
Reinecke; Hannes Reinecke
Subject: [PATCH 13/47] megaraid: pass in NULL scb for host resetWhen calling a host reset we shouldn't rely on the command triggering the reset, so allow
megaraid_abort_and_reset()to be called with a NULLscb.
Quoted 10 lines
Quoted 2 lines
And drop the pointless '
bus_reset' and 'target_reset' handlers, whichjust call
Quoted 1 line
the same function as
host_reset.If this patch address any functional issue, then we should consider this.
If it's code optimization, can we ignore this as this is being very old driver and no more maintained by Broadcom/LSI ?Quoted 9 lines
Sadly, ignoring is not an option.
I'm planning to update the calling convention for SCSI EH, to resolve the
long-
standing problem withsg_resetioctls.sg_resetioctl will allocate an out-of-band SCSI command, which does no longer work with the new command allocation scheme in multiqueue. So it's not possible to just 'ignore' it, as then SCSI EH will cease to function with that driver.Quoted 7 lines
Hannes - We are in process of sending megaraid and 3ware driver removal as LSI/Broadcom stopped supporting those products. I agree we should review this closely, but lack of test coverage and end of life cycle of product is requesting us to know the rational. For now, let's consider NACK for this patch. We will be removing old megaraid (mbox) driver and 3Ware drivers soon.
Quoted 5 lines
Hmm.
Can't we do the removal now?
There is not a lot of testing involved with _that_, surely?I'd be happy to do a patch if you like ...
We are fine with you submitting the patch to remove megaraid and megaraid_mm drivers. 3ware drivers are maintained by Adam Radford so we can not remove them.
Quoted 10 lines
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
[email protected] +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
RE: [PATCH 01/47] aacraid: split off functions to generate reset FIB
In reply to Hannes ReineckeQuoted 125 lines
-----Original Message-----
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Hannes Reinecke
Sent: Wednesday, June 28, 2017 1:32 AM
To: Christoph Hellwig <[email protected]>
Cc: Martin K. Petersen <[email protected]>; James Bottomley <[email protected]>; [email protected]; Hannes Reinecke <[email protected]>; Hannes Reinecke <[email protected]>
Subject: [PATCH 01/47] aacraid: split off functions to generate reset FIBEXTERNAL EMAIL
Split off reset FIB generation into separate functions.
Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/aacraid/linit.c | 83 ++++++++++++++++++++++++++-------------- ---- 1 file changed, 50 insertions(+), 33 deletions(-)drivers/scsi/aacraid/linit.c +49
-27@@ -814,6 +814,52 @@ static int aac_eh_abort(struct scsi_cmnd* cmd)return ret; } +static u8 aac_eh_tmf_lun_reset_fib (struct aac_dev *aac,struct fib *fib, +int bus,int cid,u64 tmf_lun) +{ +struct aac_hba_tm_req *tmf; +u64 address; + +/* start a HBA_TMF_LUN_RESET TMF request */ + tmf = (struct aac_hba_tm_req *)fib->hw_fib_va; +memset (tmf,0 ,sizeof (*tmf)); + tmf->tmf =HBA_TMF_LUN_RESET ; + tmf->it_nexus = aac->hba_map[bus][cid].rmw_nexus; +int_to_scsilun (tmf_lun, (struct scsi_lun *)tmf->lun); + + address = (u64 )fib->hw_error_pa; + tmf->error_ptr_hi =cpu_to_le32 + ((u32)(address >>32 )); + tmf->error_ptr_lo =cpu_to_le32 + ((u32)(address &0xffffffff )); + tmf->error_length =cpu_to_le32 (FW_ERROR_BUFFER_SIZE ); + fib->hbacmd_size =sizeof (*tmf); + +return HBA_IU_TYPE_SCSI_TM_REQ ; +} + +static u8 aac_eh_tmf_hard_reset_fib (struct aac_dev *aac,struct fib *fib, +int bus,int cid) +{ +struct aac_hba_reset_req *rst; +u64 address; + +/* already tried, start a hard reset now */ + rst = (struct aac_hba_reset_req *)fib->hw_fib_va; +memset (rst,0 ,sizeof (*rst)); +/* reset_type is already zero... */ + rst->it_nexus = aac->hba_map[bus][cid].rmw_nexus; + + address = (u64 )fib->hw_error_pa; + rst->error_ptr_hi =cpu_to_le32 ((u32)(address >>32 )); + rst->error_ptr_lo =cpu_to_le32 + ((u32)(address &0xffffffff )); + rst->error_length =cpu_to_le32 (FW_ERROR_BUFFER_SIZE ); + fib->hbacmd_size =sizeof (*rst); + +return HBA_IU_TYPE_SATA_REQ ; +} +/* * aac_eh_reset - Reset command handling * @scsi_cmd: SCSI command block causing the reset @@ -840,7 +886,6 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) aac->hba_map[bus][cid].devtype == AAC_DEVTYPE_NATIVE_RAW) {struct fib *fib;int status; -u64 address;u8 command; pr_err("%s: Host adapter reset request. SCSI hang ?\n",@@ -852,42 +897,14 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)if (aac->hba_map[bus][cid].reset_state ==0 ) { -struct aac_hba_tm_req *tmf; -/* start a HBA_TMF_LUN_RESET TMF request */ - tmf = (struct aac_hba_tm_req *)fib->hw_fib_va; -memset (tmf,0 ,sizeof (*tmf)); - tmf->tmf =HBA_TMF_LUN_RESET ; - tmf->it_nexus = aac->hba_map[bus][cid].rmw_nexus; - tmf->lun[1 ] = cmd->device->lun; - - address = (u64 )fib->hw_error_pa; - tmf->error_ptr_hi =cpu_to_le32 - ((u32)(address >>32 )); - tmf->error_ptr_lo =cpu_to_le32 - ((u32)(address &0xffffffff )); - tmf->error_length =cpu_to_le32 (FW_ERROR_BUFFER_SIZE ); - fib->hbacmd_size =sizeof (*tmf); - - command =HBA_IU_TYPE_SCSI_TM_REQ ; + command =aac_eh_tmf_lun_reset_fib (aac, fib, + bus, cid, + cmd->device->lun); aac->hba_map[bus][cid].reset_state++; }else if (aac->hba_map[bus][cid].reset_state >=1 ) { -struct aac_hba_reset_req *rst; -/* already tried, start a hard reset now */ - rst = (struct aac_hba_reset_req *)fib->hw_fib_va; -memset (rst,0 ,sizeof (*rst)); -/* reset_type is already zero... */ - rst->it_nexus = aac->hba_map[bus][cid].rmw_nexus; - - address = (u64 )fib->hw_error_pa; - rst->error_ptr_hi =cpu_to_le32 ((u32)(address >>32 ));
drivers/scsi/aacraid/linit.c static int aac_eh_reset(struct scsi_cmnd* cmd) · line 910
Quoted 10 lines
drivers/scsi/aacraid/linit.c +1
-6- rst->error_ptr_lo =cpu_to_le32 - ((u32)(address &0xffffffff )); - rst->error_length =cpu_to_le32 (FW_ERROR_BUFFER_SIZE ); - fib->hbacmd_size =sizeof (*rst); - - command =HBA_IU_TYPE_SATA_REQ ; + command =aac_eh_tmf_hard_reset_fib (aac, fib, bus, cid); aac->hba_map[bus][cid].reset_state =0 ; } cmd->SCp.sent_command =0 ;
RE: [PATCH 02/47] aacraid: split off host reset
In reply to Hannes ReineckeQuoted 96 lines
-----Original Message-----
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Hannes Reinecke
Sent: Wednesday, June 28, 2017 1:32 AM
To: Christoph Hellwig <[email protected]>
Cc: Martin K. Petersen <[email protected]>; James Bottomley <[email protected]>; [email protected]; Hannes Reinecke <[email protected]>; Hannes Reinecke <[email protected]>
Subject: [PATCH 02/47] aacraid: split off host resetEXTERNAL EMAIL
Split off the host reset parts of
aac_eh_reset()into a separate host reset function.Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/aacraid/linit.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-)drivers/scsi/aacraid/linit.c +22
-11@@ -874,10 +874,6 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)u32 bus, cid;int ret =FAILED ;int status =0 ; -__le32 supported_options2 =0 ; -bool is_mu_reset; -bool is_ignore_reset; -bool is_doorbell_reset; bus =aac_logical_to_phys (scmd_channel (cmd));@@ -923,7 +919,7 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) }if (ret ==SUCCESS ) - goto out; +return ret; }else {@@ -952,8 +948,24 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)dev_err (&aac->pdev->dev,"Adapter health - %d\n" , status); count =get_num_of_incomplete_fibs (aac); -if (count ==0 ) -return SUCCESS ; +return (count ==0 ) ?SUCCESS :FAILED ; +} + +/* +* aac_eh_host_reset - Host reset command handling +* @scsi_cmd: SCSI command block causing the reset +* +*/ +int aac_eh_host_reset (struct scsi_cmnd *cmd) +{ +struct scsi_device * dev = cmd->device; +struct Scsi_Host * host = dev->host; +struct aac_dev * aac = (struct aac_dev *)host->hostdata; +int ret =FAILED ; +__le32 supported_options2 =0 ; +bool is_mu_reset; +bool is_ignore_reset; +bool is_doorbell_reset;/* * Check if reset is supported by the firmware @@ -972,10 +984,8 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) && (aac_check_reset != -1 || !is_ignore_reset)) {/* Bypass wait for command quiesce */ aac_reset_adapter (aac,2 ,IOP_HWSOFT_RESET ); + ret =SUCCESS ; } - ret =SUCCESS ; - -out:return ret; }@@ -1399,7 +1409,8 @@ ssize_t aac_get_serial_number(struct device *device, char *buf) .change_queue_depth = aac_change_queue_depth, .sdev_attrs = aac_dev_attrs, .eh_abort_handler = aac_eh_abort, - .eh_host_reset_handler = aac_eh_reset, + .eh_bus_reset_handler = aac_eh_reset, + .eh_host_reset_handler = aac_eh_host_reset, .can_queue = AAC_NUM_IO_FIB, .this_id = MAXIMUM_NUM_CONTAINERS,
Quoted 1 line
.sg_tablesize = 16,
RE: [PATCH 03/47] aacraid: split off device, target, and bus reset
In reply to Hannes ReineckeQuoted 208 lines
-----Original Message-----
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Hannes Reinecke
Sent: Wednesday, June 28, 2017 1:32 AM
To: Christoph Hellwig <[email protected]>
Cc: Martin K. Petersen <[email protected]>; James Bottomley <[email protected]>; [email protected]; Hannes Reinecke <[email protected]>; Hannes Reinecke <[email protected]>
Subject: [PATCH 03/47] aacraid: split off device, target, and bus resetEXTERNAL EMAIL
Split off device, target, and bus reset functionality into individual functions.
Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/aacraid/linit.c | 141 +++++++++++++++++++++++++++++++----- ------- 1 file changed, 102 insertions(+), 39 deletions(-)drivers/scsi/aacraid/linit.c +99
-38@@ -861,68 +861,129 @@ static u8 aac_eh_tmf_hard_reset_fib(struct aac_dev *aac, struct fib *fib, }/* -* aac_eh_reset - Reset command handling +* aac_eh_dev_reset - Device reset command handling * @scsi_cmd: SCSI command block causing the reset * */ -static int aac_eh_reset (struct scsi_cmnd * cmd) +static int aac_eh_dev_reset (struct scsi_cmnd *cmd) {struct scsi_device * dev = cmd->device;struct Scsi_Host * host = dev->host;struct aac_dev * aac = (struct aac_dev *)host->hostdata;int count;u32 bus, cid; +struct fib *fib;int ret =FAILED ; -int status =0 ; - +int status; +u8 command; bus =aac_logical_to_phys (scmd_channel (cmd)); cid =scmd_id (cmd); -if (bus <AAC_MAX_BUSES && cid <AAC_MAX_TARGETS && - aac->hba_map[bus][cid].devtype ==AAC_DEVTYPE_NATIVE_RAW ) { -struct fib *fib; -int status; -u8 command; +if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || + aac->hba_map[bus][cid].devtype !=AAC_DEVTYPE_NATIVE_RAW ) +return FAILED ; -pr_err ("%s: Host adapter reset request. SCSI hang ?\n" , -AAC_DRIVERNAME ); +pr_err ("%s: Host adapter reset request. SCSI hang ?\n" , +AAC_DRIVERNAME ); - fib =aac_fib_alloc (aac); -if (!fib) -return ret; + fib =aac_fib_alloc (aac); +if (!fib) +return ret; -if (aac->hba_map[bus][cid].reset_state ==0 ) { -/* start a HBA_TMF_LUN_RESET TMF request */ - command =aac_eh_tmf_lun_reset_fib (aac, fib, - bus, cid, - cmd->device->lun); - aac->hba_map[bus][cid].reset_state++; - }else if (aac->hba_map[bus][cid].reset_state >=1 ) { -/* already tried, start a hard reset now */ - command =aac_eh_tmf_hard_reset_fib (aac, fib, bus, cid); - aac->hba_map[bus][cid].reset_state =0 ; +/* start a HBA_TMF_LUN_RESET TMF request */ + command =aac_eh_tmf_lun_reset_fib (aac, fib, bus, cid, + cmd->device->lun); + + cmd->SCp.sent_command =0 ; + + status =aac_hba_send (command, fib, + (fib_callback ) aac_hba_callback, + (void *) cmd); + +/* Wait up to 15 seconds for completion */ +for (count =0 ; count <15 ; ++count) { +if (cmd->SCp.sent_command) { + ret =SUCCESS ; +break ; } - cmd->SCp.sent_command =0 ; +msleep (1000 ); + } - status =aac_hba_send (command, fib, - (fib_callback ) aac_hba_callback, - (void *) cmd); +return ret; +} -/* Wait up to 15 seconds for completion */ -for (count =0 ; count <15 ; ++count) { -if (cmd->SCp.sent_command) { - ret =SUCCESS ; -break ; - } -msleep (1000 ); +/* +* aac_eh_target_reset - Target reset command handling +* @scsi_cmd: SCSI command block causing the reset +* +*/ +static int aac_eh_target_reset (struct scsi_cmnd *cmd) +{ +struct scsi_device * dev = cmd->device; +struct Scsi_Host * host = dev->host; +struct aac_dev * aac = (struct aac_dev *)host->hostdata; +int count; +u32 bus, cid; +int ret =FAILED ; +struct fib *fib; +int status; +u8 command; + + bus =aac_logical_to_phys (scmd_channel (cmd)); + cid =scmd_id (cmd); +if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || + aac->hba_map[bus][cid].devtype !=AAC_DEVTYPE_NATIVE_RAW ) +return FAILED ; + +pr_err ("%s: Host adapter reset request. SCSI hang ?\n" , +AAC_DRIVERNAME ); + + fib =aac_fib_alloc (aac); +if (!fib) +return ret; + + +/* already tried, start a hard reset now */ + command =aac_eh_tmf_hard_reset_fib (aac, fib, bus, cid); + + cmd->SCp.sent_command =0 ; + + status =aac_hba_send (command, fib, + (fib_callback ) aac_hba_callback, + (void *) cmd); + +/* Wait up to 15 seconds for completion */ +for (count =0 ; count <15 ; ++count) { +if (cmd->SCp.sent_command) { + ret =SUCCESS ; +break ; } +msleep (1000 ); + } -if (ret ==SUCCESS ) -return ret; +return ret; +} + +/* +* aac_eh_bus_reset - Bus reset command handling +* @scsi_cmd: SCSI command block causing the reset +* +*/ +static int aac_eh_bus_reset (struct scsi_cmnd * cmd) +{ +struct scsi_device * dev = cmd->device; +struct Scsi_Host * host = dev->host; +struct aac_dev * aac = (struct aac_dev *)host->hostdata; +int count; +u32 bus, cid; +int status =0 ; - }else { + bus =aac_logical_to_phys (scmd_channel (cmd)); + cid =scmd_id (cmd); +if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || + aac->hba_map[bus][cid].devtype !=AAC_DEVTYPE_NATIVE_RAW ) {/* Mark the assoc. FIB to not complete, eh handler does this */ for (count = 0;count < (host->can_queue + AAC_NUM_MGT_FIB);drivers/scsi/aacraid/linit.c +3
-1@@ -1409,7 +1470,9 @@ ssize_t aac_get_serial_number(struct device *device, char *buf) .change_queue_depth = aac_change_queue_depth, .sdev_attrs = aac_dev_attrs, .eh_abort_handler = aac_eh_abort, - .eh_bus_reset_handler = aac_eh_reset, + .eh_device_reset_handler = aac_eh_dev_reset, + .eh_target_reset_handler = aac_eh_target_reset, + .eh_bus_reset_handler = aac_eh_bus_reset, .eh_host_reset_handler = aac_eh_host_reset, .can_queue = AAC_NUM_IO_FIB,
Quoted 3 lines
.this_id =
MAXIMUM_NUM_CONTAINERS,
--
1.8.5.6
RE: [PATCH 04/47] aacraid: use aac_tmf_callback for reset fib
In reply to Hannes Reinecke[.....]
Quoted 1 line
(quoted diff) +0
-0@@ -879,8 +906,12 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd)
[......]
Quoted 10 lines
bus = aac_logical_to_phys(scmd_channel(cmd)); cid = scmd_id(cmd);drivers/scsi/aacraid/linit.c +5
-1+ info = &aac->hba_map[bus][cid];if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || - aac->hba_map[bus][cid].devtype !=AAC_DEVTYPE_NATIVE_RAW ) + info->devtype !=AAC_DEVTYPE_NATIVE_RAW ) +return FAILED ; + +if (info->reset_state >0 )return FAILED ;
[......]
drivers/scsi/aacraid/linit.c static int aac_eh_target_reset(struct scsi_cmnd · line 969
Quoted 10 lines
drivers/scsi/aacraid/linit.c +2
-1@@ -932,8 +962,9 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd) bus =aac_logical_to_phys (scmd_channel (cmd)); cid =scmd_id (cmd); + info = &aac->hba_map[bus][cid];if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || - aac->hba_map[bus][cid].devtype !=AAC_DEVTYPE_NATIVE_RAW ) + info->devtype !=AAC_DEVTYPE_NATIVE_RAW )return FAILED ;
Can we have a
If (info->reset_state > 0 Return FAILED;
here as well?
Quoted 4 lines
(quoted diff) +0
-0pr_err("%s: Host adapter reset request. SCSI hang ?\n",@@ -945,18 +976,18 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd)
[.....]
RE: [PATCH 05/47] aacraid: enable sending of TMFs from aac_hba_send()
In reply to Hannes ReineckeQuoted 39 lines
-----Original Message-----
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Hannes Reinecke
Sent: Wednesday, June 28, 2017 1:33 AM
To: Christoph Hellwig <[email protected]>
Cc: Martin K. Petersen <[email protected]>; James Bottomley <[email protected]>; [email protected]; Hannes Reinecke <[email protected]>; Hannes Reinecke <[email protected]>
Subject: [PATCH 05/47] aacraid: enable sending of TMFs fromaac_hba_send()EXTERNAL EMAIL
aac_hba_send()will return FAILED for any non-SCSI command requests, failing any TMFs. This patch updates the check to allow TMFs.Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/aacraid/commsup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/aacraid/commsup.c +1
-2@@ -770,7 +770,7 @@ int aac_hba_send(u8 command, struct fib *fibptr,fib_callback callback,/* bit1 of request_id must be 0 */ hbacmd->request_id =cpu_to_le32 ((((u32)(fibptr - dev->fibs)) <<2 ) +1 ); - }else + }else if (command !=HBA_IU_TYPE_SCSI_TM_REQ )return -EINVAL ; --
Quoted 1 line
1.8.5.6
RE: [PATCH 06/47] aacraid: add fib flag to mark scsi command callback
In reply to Hannes ReineckeQuoted 50 lines
-----Original Message-----
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Hannes Reinecke
Sent: Wednesday, June 28, 2017 1:33 AM
To: Christoph Hellwig <[email protected]>
Cc: Martin K. Petersen <[email protected]>; James Bottomley <[email protected]>; [email protected]; Hannes Reinecke <[email protected]>; Hannes Reinecke <[email protected]>
Subject: [PATCH 06/47] aacraid: add fib flag to mark scsi command callbackEXTERNAL EMAIL
To correctly identify which fib has a scsi command callback this patch implements a flag
FIB_CONTEXT_FLAG_SCSI_CMD.Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/aacraid/aacraid.h | 1 + drivers/scsi/aacraid/commsup.c | 1 + 2 files changed, 2 insertions(+)drivers/scsi/aacraid/aacraid.h +1
-0@@ -1723,6 +1723,7 @@ struct aac_dev#define FIB_CONTEXT_FLAG_FASTRESP (0x00000008)#define FIB_CONTEXT_FLAG_NATIVE_HBA (0x00000010)#define FIB_CONTEXT_FLAG_NATIVE_HBA_TMF (0x00000020) +#define FIB_CONTEXT_FLAG_SCSI_CMD (0x00000040)/* * Define the command values drivers/scsi/aacraid/commsup.c +1
-1@@ -770,6 +770,7 @@ int aac_hba_send(u8 command, struct fib *fibptr,fib_callback callback,/* bit1 of request_id must be 0 */ hbacmd->request_id =cpu_to_le32 ((((u32)(fibptr - dev->fibs)) <<2 ) +1 ); + fibptr->flags |=FIB_CONTEXT_FLAG_SCSI_CMD ; }else if (command !=HBA_IU_TYPE_SCSI_TM_REQ )return -EINVAL ; --
Quoted 1 line
1.8.5.6
RE: [PATCH 07/47] aacraid: complete all commands during bus reset
In reply to Hannes ReineckeQuoted 74 lines
-----Original Message-----
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Hannes Reinecke
Sent: Wednesday, June 28, 2017 1:33 AM
To: Christoph Hellwig <[email protected]>
Cc: Martin K. Petersen <[email protected]>; James Bottomley <[email protected]>; [email protected]; Hannes Reinecke <[email protected]>; Hannes Reinecke <[email protected]>
Subject: [PATCH 07/47] aacraid: complete all commands during bus resetEXTERNAL EMAIL
When issuing a bus reset we should complete all commands, not just the command triggering the reset.
Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/aacraid/linit.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-)drivers/scsi/aacraid/linit.c +21
-15@@ -1007,23 +1007,29 @@ static int aac_eh_bus_reset(struct scsi_cmnd* cmd)struct Scsi_Host * host = dev->host;struct aac_dev * aac = (struct aac_dev *)host->hostdata;int count; -u32 bus, cid; +u32 cmd_bus;int status =0 ; - bus =aac_logical_to_phys (scmd_channel (cmd)); - cid =scmd_id (cmd); -if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || - aac->hba_map[bus][cid].devtype !=AAC_DEVTYPE_NATIVE_RAW ) { -/* 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]; - -if (fib->hw_fib_va->header.XferState && - (fib->flags &FIB_CONTEXT_FLAG ) && - (fib->callback_data == cmd)) { + cmd_bus =aac_logical_to_phys (scmd_channel (cmd)); +/* 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]; + +if (fib->hw_fib_va->header.XferState && + (fib->flags &FIB_CONTEXT_FLAG ) && + (fib->flags &FIB_CONTEXT_FLAG_SCSI_CMD )) { +struct aac_hba_map_info *info; +u32 bus, cid; + + cmd = (struct scsi_cmnd *)fib->callback_data; + bus =aac_logical_to_phys (scmd_channel (cmd)); +if (bus != cmd_bus) +continue ; + cid =scmd_id (cmd); + info = &aac->hba_map[bus][cid]; +if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || + info->devtype !=AAC_DEVTYPE_NATIVE_RAW ) { fib->flags |=FIB_CONTEXT_FLAG_TIMED_OUT ; cmd->SCp.phase =AAC_OWNER_ERROR_HANDLER ; } --
Quoted 1 line
1.8.5.6
Hannes Reinecke
maintainerRe: [PATCH 04/47] aacraid: use aac_tmf_callback for reset fib
In reply to Raghava Aditya RenukuntaQuoted 27 lines · Raghava Aditya Renukunta
[.....]
Quoted 1 line
(quoted diff) +0
-0@@ -879,8 +906,12 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd)[......]
Quoted 10 lines
bus = aac_logical_to_phys(scmd_channel(cmd)); cid = scmd_id(cmd);drivers/scsi/aacraid/linit.c +5
-1+ info = &aac->hba_map[bus][cid];if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || - aac->hba_map[bus][cid].devtype !=AAC_DEVTYPE_NATIVE_RAW ) + info->devtype !=AAC_DEVTYPE_NATIVE_RAW ) +return FAILED ; + +if (info->reset_state >0 )return FAILED ;[......]
drivers/scsi/aacraid/linit.c static int aac_eh_target_reset(struct scsi_cmnd · line 969
Quoted 10 lines
drivers/scsi/aacraid/linit.c +2
-1@@ -932,8 +962,9 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd) bus =aac_logical_to_phys (scmd_channel (cmd)); cid =scmd_id (cmd); + info = &aac->hba_map[bus][cid];if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || - aac->hba_map[bus][cid].devtype !=AAC_DEVTYPE_NATIVE_RAW ) + info->devtype !=AAC_DEVTYPE_NATIVE_RAW )return FAILED ;Can we have a
Quoted 4 lines
If (info->reset_state > 0 Return FAILED;here as well?
Sure.
Thanks for the review.
Cheers
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Re: [PATCH 09/47] zfcp: open-code fc_block_scsi_eh() for host reset
In reply to Hannes ReineckeHi Hannes,
unfortunately I only realized now by accident that there's stuff to review. Would be nice to send it also explicitly to driver maintainers in addition to the list.
Since you've asked for this multiple times, I happened to just now code a patch series of 6 patches in order to decouple zfcp from scsi_cmnd for device, target, and host reset.
While I provide some review comments below, I think it might be clearer and easier to review if you would rebase your series on top of my decoupling.
Let me know how urgent you'd like to see my code. I planned to send it as RFC soon anyway. However, it hasn't seen any function testing yet. If you don't care, let me know and I can send it.
Quoted 21 lines · Hannes Reinecke
When issuing a host reset we should be waiting for all ports to become unblocked; just waiting for one might be resulting in host reset to return too early.
Signed-off-by Hannes Reinecke <[email protected]>--- drivers/s390/scsi/zfcp_scsi.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)drivers/s390/scsi/zfcp_scsi.c +1
-3@@ -311,13 +311,32 @@ static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt)static int zfcp_scsi_eh_host_reset_handler (struct scsi_cmnd *scpnt) { -struct zfcp_scsi_dev *zfcp_sdev =sdev_to_zfcp (scpnt->device); -struct zfcp_adapter *adapter = zfcp_sdev->port->adapter; -int ret; +struct Scsi_Host *host = scpnt->device->host;
drivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt) · line 323
Quoted 10 lines
drivers/s390/scsi/zfcp_scsi.c +6
-1+struct zfcp_adapter *adapter = (struct zfcp_adapter *)host->hostdata[0 ]; +int ret =0 ; +unsigned long flags; +struct zfcp_port *port;zfcp_erp_adapter_reopen (adapter,0 ,"schrh_1" );zfcp_erp_wait (adapter); - ret =fc_block_scsi_eh (scpnt); +retry_rport_blocked: +spin_lock_irqsave (host->host_lock, flags);
missing read_lock(&adapter->port_list_lock);
Hm, well, I have to think about lock ordering, because my patch has the port_list as outer loop and inside it calls fc_block_scsi_eh (also modified with fc_rport as argument). If there's any other location taking both locks we better get them in the same order.
drivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt) · line 325
Quoted 2 lines
drivers/s390/scsi/zfcp_scsi.c +2
-0+list_for_each_entry (port, &adapter->port_list, list) { +struct fc_rport *rport = port->rport;
port->rport can be NULL, so need to check
drivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt) · line 329
Quoted 4 lines
drivers/s390/scsi/zfcp_scsi.c +4
-0+ +if (rport->port_state ==FC_PORTSTATE_BLOCKED ) { +if (rport->flags &FC_RPORT_FAST_FAIL_TIMEDOUT ) + ret =FAST_IO_FAIL ;
Hm, doesn't this get lost if a next iteration hits ret=NEEDS_RETRY?
I was pondering in my own patch version what to return of just a subset of ports ran into fast_io_fail. And for now I thought just fast_io_fail would be good to let I/O bubble up for path failover, even if this would include of rport which meanwhile unblocked properly and would not need bubbling up pending requests because they could service them with a simple retry.
drivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt) · line 333
Quoted 4 lines
drivers/s390/scsi/zfcp_scsi.c +4
-0+else + ret =NEEDS_RETRY ; +break ; + }
Why do you open code fc_block_scsi_eh() instead of calling it with port->rport (if it's !=NULL)?
Typically all rports would be blocked after adapter recovery, until they become unblocked (via zfcp's async rport_work). So we can wait for each in turn which should still only wait in summary for the last one to unblock. E.g. if the first rport takes longest we wait for it, and the rest of the loop will be fast since the others happen to be unblocked (or fast_io_fail) already?
drivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt) · line 334
Quoted 1 line
drivers/s390/scsi/zfcp_scsi.c +1
-0+ }
missing read_unlock(&adapter->port_list_lock);
Quoted 8 lines
drivers/s390/scsi/zfcp_scsi.c +5
-0+spin_unlock_irqrestore (host->host_lock, flags); +if (ret ==NEEDS_RETRY ) { +msleep (1000 ); + goto retry_rport_blocked; + }if (ret)return ret;
Signature · 10 lines
Mit freundlichen Grüßen / Kind regards Steffen Maier Linux on z Systems Development IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz Geschaeftsfuehrung: Dirk Wittkopp Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
Re: [PATCH 09/47] zfcp: open-code fc_block_scsi_eh() for host reset
In reply to Hannes ReineckeQuoted 14 lines · Hannes Reinecke
When issuing a host reset we should be waiting for all ports to become unblocked; just waiting for one might be resulting in host reset to return too early.
Signed-off-by Hannes Reinecke <[email protected]>--- drivers/s390/scsi/zfcp_scsi.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)drivers/s390/scsi/zfcp_scsi.c +0
-0
drivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt) · line 315
Quoted 8 lines
drivers/s390/scsi/zfcp_scsi.c +2
-3@@ -311,13 +311,32 @@ static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt)static int zfcp_scsi_eh_host_reset_handler (struct scsi_cmnd *scpnt) { -struct zfcp_scsi_dev *zfcp_sdev =sdev_to_zfcp (scpnt->device); -struct zfcp_adapter *adapter = zfcp_sdev->port->adapter; -int ret; +struct Scsi_Host *host = scpnt->device->host; +struct zfcp_adapter *adapter = (struct zfcp_adapter *)host->hostdata[0 ];
Oh, only realized when reading the later "[PATCH 14/47] scsi: Use Scsi_Host as argument for eh_host_reset_handler" that this part already anticipates parts of that later patch. Seems not fully topically separated patches to me, if this one is only about the fc_block_scsi_eh aspect in zfcp_scsi_eh_host_reset_handler().
Signature · 10 lines
Mit freundlichen Grüßen / Kind regards Steffen Maier Linux on z Systems Development IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz Geschaeftsfuehrung: Dirk Wittkopp Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
Re: [PATCH 15/47] scsi_transport_fc: Use fc_rport as argument for fc_block_scsi_eh
In reply to Hannes ReineckeQuoted 16 lines · Hannes Reinecke
fc_block_scsi_eh()works on a remote port, so we should be using that as an argument, and not the scsi command.drivers/s390/scsi/zfcp_scsi.c +1
-0@@ -150,6 +150,7 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)struct zfcp_adapter *adapter = (struct zfcp_adapter *) scsi_host->hostdata[0 ];struct zfcp_fsf_req *old_req, *abrt_req; +struct fc_rport *rport =starget_to_rport (scsi_target (scpnt->device));unsigned long flags;unsigned long old_reqid = (unsigned long ) scpnt->host_scribble;int retval =SUCCESS , ret;
drivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt) · line 180
Quoted 5 lines
drivers/s390/scsi/zfcp_scsi.c +1
-1@@ -176,7 +177,7 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)break ;zfcp_erp_wait (adapter); - ret =fc_block_scsi_eh (scpnt); + ret =fc_block_scsi_eh (rport);
I think for abort handlers some original fc_block_scsi_eh with scsi_cmnd as argument would be perfectly valid as this really has the scope of a particular single command.
Do you really want to touch all abort handlers just because of this?
In my zfcp decoupling I had created a new fc_block_rport for TMFs/host_reset and kept using the old fc_block_scsi_eh (which does the argument lifting and simply delegates to the new fc_block_rport) for the abort handler. Admittedly, of course, I also did so because I did not touch all other users/callers of the old function with the scsi_cmnd argument.
drivers/s390/scsi/zfcp_scsi.c static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags) · line 266
Quoted 8 lines
drivers/s390/scsi/zfcp_scsi.c +1
-0if (ret) {zfcp_dbf_scsi_abort ("abrt_bl" , scpnt,NULL );return ret;@@ -262,6 +263,7 @@ static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags) {struct zfcp_scsi_dev *zfcp_sdev =sdev_to_zfcp (scpnt->device);struct zfcp_adapter *adapter = zfcp_sdev->port->adapter; +struct fc_port *rport = zfcp_sdev->port->rport;
port->rport could be NULL
[async zfcp_scsi_rport_block()]
Quoted 45 lines
drivers/s390/scsi/zfcp_scsi.c +1
-1struct zfcp_fsf_req *fsf_req =NULL ;int retval =SUCCESS , ret;int retry =3 ;@@ -272,7 +274,7 @@ static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags)break ;zfcp_erp_wait (adapter); - ret =fc_block_scsi_eh (scpnt); + ret =fc_block_scsi_eh (rport);if (ret)return ret;drivers/scsi/scsi_transport_fc.c +3
-4@@ -3273,7 +3273,7 @@ struct fc_rport */** * fc_block_scsi_eh - Block SCSI eh thread for blocked fc_rport -* @cmnd: SCSI command that scsi_eh is trying to recover +* @rport: remote port to be checked * * This routine can be called from a FC LLD scsi_eh callback. It * blocks the scsi_eh thread until the fc_rport leaves the @@ -3285,10 +3285,9 @@ struct fc_rport ** FAST_IO_FAIL if the fast_io_fail_tmo fired, this should be * passed back to scsi_eh. */ -int fc_block_scsi_eh (struct scsi_cmnd *cmnd) +int fc_block_scsi_eh (struct fc_rport *rport) { -struct Scsi_Host *shost = cmnd->device->host; -struct fc_rport *rport =starget_to_rport (scsi_target (cmnd->device)); +struct Scsi_Host *shost =rport_to_shost (rport);unsigned long flags;spin_lock_irqsave (shost->host_lock, flags);include/scsi/scsi_transport_fc.h +0
-0
include/scsi/scsi_transport_fc.h void fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number, · line 810
Quoted 8 lines
include/scsi/scsi_transport_fc.h +1
-1@@ -804,7 +804,7 @@ void fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,struct fc_vport *fc_vport_create (struct Scsi_Host *shost,int channel,struct fc_vport_identifiers *);int fc_vport_terminate (struct fc_vport *vport); -int fc_block_scsi_eh (struct scsi_cmnd *cmnd); +int fc_block_scsi_eh (struct fc_rport *rport);enum blk_eh_timer_return fc_eh_timed_out (struct scsi_cmnd *scmd);static inline struct Scsi_Host *fc_bsg_to_shost (struct bsg_job *job)
Aside from above thoughts, the coding of the argument change seems good.
Signature · 10 lines
Mit freundlichen Grüßen / Kind regards Steffen Maier Linux on z Systems Development IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz Geschaeftsfuehrung: Dirk Wittkopp Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294