SCSI EH argument reshuffling
Subsystems (63)
Hannes Reinecke
maintainercover SCSI EH argument reshuffling
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. Which should make hch happy :-)
It's marked as an RFC as I'm not sure if everyone agrees with this approach; hence speak up folks!
As usual, comments and reviews are welcome.
Hannes Reinecke (35):
scsi: fix comment in scsi_device_set_state()
mptfc: Do not call fc_block_scsi_eh() on host reset
ibmvfc: Do not call fc_block_scsi_eh() on host reset
fc_fcp: do not call fc_block_scsi_eh() from host reset
fnic: do not call host reset from command abort
visorhba: sanitze private device data allocation
uas: move eh_bus_reset_handler to eh_device_reset_handler
lpfc: drop lpfc_no_handler and lpfc_bus_reset_handler()
libsas: move bus_reset_handler() to target_reset_handler()
bfa: move bus reset to target reset
hptiop: Simplify reset handling
fdomain: move bus reset to host reset
scsi: drop bus reset for wd33c93-compatible boards
rtsx: drop bus reset function
qlogicpti: move bus reset to host reset
acornscsi: move bus reset to host reset
NCR5380: Move bus reset to host reset
qlogicfas: move bus_reset to host_reset
aacraid: split off lun reset function
sym53c8xx_2: split off bus reset from host reset
zfcp: open-code fc_block_scsi_eh() for host reset
scsi: Use Scsi_Host as argument for eh_host_reset_handler
qedf: drop bus 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()
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: remove obsolete bnx2fc_eh_host_reset() definition
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()
scsi: Use scsi_target as argument for eh_target_reset_handler()
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 | 13 +- drivers/infiniband/ulp/srp/ib_srp.c | 14 +- drivers/message/fusion/mptfc.c | 106 +++++++++------ drivers/message/fusion/mptsas.c | 10 +- drivers/message/fusion/mptscsih.c | 113 ++++++++++------ 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 | 51 +++---- drivers/scsi/BusLogic.c | 14 +- drivers/scsi/NCR5380.c | 16 ++- drivers/scsi/NCR53c406a.c | 6 +- drivers/scsi/a100u2w.c | 51 +++---- drivers/scsi/a2091.c | 17 --- drivers/scsi/a3000.c | 17 --- drivers/scsi/aacraid/linit.c | 127 ++++++++++++------ drivers/scsi/advansys.c | 26 ++-- drivers/scsi/aha152x.c | 19 +-- drivers/scsi/aha152x.h | 2 +- drivers/scsi/aha1542.c | 27 ++-- drivers/scsi/aic7xxx/aic79xx_osm.c | 64 ++++----- drivers/scsi/aic7xxx/aic7xxx_osm.c | 96 +++++++------- drivers/scsi/aic94xx/aic94xx_init.c | 2 +- drivers/scsi/arcmsr/arcmsr_hba.c | 9 +- drivers/scsi/arm/acornscsi.c | 11 +- drivers/scsi/arm/cumana_1.c | 2 +- drivers/scsi/arm/fas216.c | 67 +++++----- drivers/scsi/arm/fas216.h | 11 +- drivers/scsi/arm/oak.c | 2 +- drivers/scsi/atari_scsi.c | 6 +- drivers/scsi/be2iscsi/be_main.c | 18 ++- drivers/scsi/bfa/bfad_im.c | 52 ++++---- drivers/scsi/bnx2fc/bnx2fc.h | 6 +- drivers/scsi/bnx2fc/bnx2fc_hwi.c | 14 +- drivers/scsi/bnx2fc/bnx2fc_io.c | 97 +++++++------- drivers/scsi/csiostor/csio_scsi.c | 43 +++--- drivers/scsi/cxlflash/main.c | 28 ++-- drivers/scsi/dc395x.c | 25 ++-- drivers/scsi/dmx3191d.c | 2 +- drivers/scsi/dpt_i2o.c | 43 +++--- drivers/scsi/dpti.h | 6 +- drivers/scsi/eata.c | 19 +-- 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 | 6 +- drivers/scsi/fdomain.h | 2 +- drivers/scsi/fnic/fnic.h | 4 +- drivers/scsi/fnic/fnic_main.c | 2 + drivers/scsi/fnic/fnic_scsi.c | 100 +++++--------- drivers/scsi/g_NCR5380.c | 4 +- drivers/scsi/gdth.c | 16 +-- drivers/scsi/gvp11.c | 18 --- drivers/scsi/hisi_sas/hisi_sas_main.c | 2 +- drivers/scsi/hpsa.c | 14 +- drivers/scsi/hptiop.c | 11 +- drivers/scsi/ibmvscsi/ibmvfc.c | 27 ++-- drivers/scsi/ibmvscsi/ibmvscsi.c | 21 +-- drivers/scsi/imm.c | 7 +- drivers/scsi/initio.c | 11 +- drivers/scsi/ipr.c | 35 ++--- drivers/scsi/ips.c | 40 ++---- drivers/scsi/isci/init.c | 2 +- drivers/scsi/libfc/fc_fcp.c | 20 ++- drivers/scsi/libiscsi.c | 38 +++--- drivers/scsi/libsas/sas_scsi_host.c | 29 ++-- drivers/scsi/lpfc/lpfc_scsi.c | 164 +++++------------------ drivers/scsi/mac53c94.c | 8 +- drivers/scsi/mac_scsi.c | 4 +- drivers/scsi/megaraid.c | 12 +- drivers/scsi/megaraid.h | 2 +- drivers/scsi/megaraid/megaraid_mbox.c | 16 +-- 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/mvme147.c | 16 --- drivers/scsi/mvsas/mv_init.c | 2 +- drivers/scsi/mvumi.c | 7 +- drivers/scsi/ncr53c8xx.c | 4 +- drivers/scsi/nsp32.c | 26 ++-- 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/pm8001/pm8001_init.c | 2 +- drivers/scsi/pmcraid.c | 73 +++++++--- drivers/scsi/ppa.c | 7 +- drivers/scsi/qedf/qedf.h | 5 +- drivers/scsi/qedf/qedf_io.c | 48 +++---- drivers/scsi/qedf/qedf_main.c | 27 ++-- drivers/scsi/qedi/qedi_iscsi.c | 3 +- drivers/scsi/qla1280.c | 54 ++++++-- drivers/scsi/qla2xxx/qla_mbx.c | 1 - drivers/scsi/qla2xxx/qla_os.c | 160 +++++++++++----------- drivers/scsi/qla4xxx/ql4_os.c | 83 ++++++------ drivers/scsi/qlogicfas.c | 2 +- drivers/scsi/qlogicfas408.c | 6 +- drivers/scsi/qlogicfas408.h | 2 +- drivers/scsi/qlogicpti.c | 5 +- drivers/scsi/scsi_debug.c | 86 +++++------- drivers/scsi/scsi_error.c | 150 ++++++++++----------- drivers/scsi/scsi_lib.c | 2 +- drivers/scsi/scsi_transport_fc.c | 7 +- drivers/scsi/scsi_transport_iscsi.c | 6 +- drivers/scsi/sgiwd93.c | 15 --- drivers/scsi/smartpqi/smartpqi_init.c | 6 +- drivers/scsi/snic/snic.h | 5 +- drivers/scsi/snic/snic_main.c | 2 +- drivers/scsi/snic/snic_scsi.c | 99 +++++--------- drivers/scsi/stex.c | 7 +- drivers/scsi/storvsc_drv.c | 4 +- drivers/scsi/sun3_scsi.c | 4 +- drivers/scsi/sym53c416.c | 16 +-- drivers/scsi/sym53c8xx_2/sym_glue.c | 169 ++++++++++++++++-------- 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 | 12 +- drivers/staging/rts5208/rtsx.c | 15 +-- drivers/staging/unisys/visorhba/visorhba_main.c | 133 ++++++++----------- drivers/target/loopback/tcm_loop.c | 17 +-- drivers/usb/image/microtek.c | 4 +- drivers/usb/storage/scsiglue.c | 8 +- drivers/usb/storage/uas.c | 5 +- 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 +- 147 files changed, 1825 insertions(+), 1969 deletions(-)
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 1/35 scsi: fix comment in scsi_device_set_state()
The function returns '0' if successful; with the original comment the function doesn't have a way to indicate success ...
--- drivers/scsi/scsi_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_lib.c +1 -1
@@ -2547,7 +2547,7 @@ void scsi_exit_queue(void)* @sdev: scsi device to change the state of. * @state: state to change to. * -* Returns zero if unsuccessful or an error if the requested +* Returns zero if successful or an error if the requested * transition is illegal. */ int
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 2/35 mptfc: Do not call fc_block_scsi_eh() on host reset
In reply to Hannes ReineckeWhen we're resetting the host any remote port states will be reset anyway, so it's pointless to wait for dev_loss_tmo during host reset.
--- drivers/message/fusion/mptfc.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/message/fusion/mptfc.c +1 -9
@@ -104,7 +104,6 @@static int mptfc_abort (struct scsi_cmnd *SCpnt);static int mptfc_dev_reset (struct scsi_cmnd *SCpnt);static int mptfc_bus_reset (struct scsi_cmnd *SCpnt); -static int mptfc_host_reset (struct scsi_cmnd *SCpnt);static struct scsi_host_template mptfc_driver_template = { .module =THIS_MODULE ,
@@ -123,7 +122,7 @@ .eh_abort_handler = mptfc_abort, .eh_device_reset_handler = mptfc_dev_reset, .eh_bus_reset_handler = mptfc_bus_reset, - .eh_host_reset_handler = mptfc_host_reset, + .eh_host_reset_handler = mptscsih_host_reset, .bios_param = mptscsih_bios_param, .can_queue = MPT_FC_CAN_QUEUE, .this_id = -1,
@@ -254,13 +253,6 @@mptfc_block_error_handler (SCpnt, mptscsih_bus_reset, __func__); } -static int -mptfc_host_reset (struct scsi_cmnd *SCpnt) -{ -return -mptfc_block_error_handler (SCpnt, mptscsih_host_reset, __func__); -} -static void mptfc_set_rport_loss_tmo (struct fc_rport *rport,uint32_t timeout) {
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 3/35 ibmvfc: Do not call fc_block_scsi_eh() on host reset
In reply to Hannes ReineckeWhen we're resetting the host any remote port states will be reset anyway, so it's pointless to wait for dev_loss_tmo during host reset.
--- drivers/scsi/ibmvscsi/ibmvfc.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/scsi/ibmvscsi/ibmvfc.c +0 -4
@@ -2531,13 +2531,9 @@ static int ibmvfc_eh_host_reset_handler(struct scsi_cmnd *cmd)int rc, block_rc;struct ibmvfc_host *vhost =shost_priv (cmd->device->host); - block_rc =fc_block_scsi_eh (cmd);dev_err (vhost->dev,"Resetting connection due to error recovery\n" ); rc =ibmvfc_issue_fc_host_lip (vhost->host); -if (block_rc ==FAST_IO_FAIL ) -return FAST_IO_FAIL ; -return rc ?FAILED :SUCCESS ; }
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 4/35 fc_fcp: do not call fc_block_scsi_eh() from host reset
In reply to Hannes ReineckeWhen calling host reset we're resetting all ports anyway, so there is no point in waiting for the ports to become unblocked.
--- drivers/scsi/libfc/fc_fcp.c | 2 -- 1 file changed, 2 deletions(-)
drivers/scsi/libfc/fc_fcp.c +0 -2
@@ -2222,8 +2222,6 @@ int fc_eh_host_reset(struct scsi_cmnd *sc_cmd)FC_SCSI_DBG (lport,"Resetting host\n" ); -fc_block_scsi_eh (sc_cmd); -fc_lport_reset (lport); wait_tmo = jiffies +FC_HOST_RESET_TIMEOUT ; while (!fc_fcp_lport_queue_ready(lport) && time_before(jiffies,
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 7/35 uas: move eh_bus_reset_handler to eh_device_reset_handler
In reply to Hannes ReineckeThe bus_reset handler is really a device reset, so move it to eh_device_reset_handler().
--- drivers/usb/storage/uas.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/storage/uas.c +2 -2
@@ -737,7 +737,7 @@ static int uas_eh_abort_handler(struct scsi_cmnd *cmnd)return FAILED ; } -static int uas_eh_bus_reset_handler (struct scsi_cmnd *cmnd) +static int uas_eh_device_reset_handler (struct scsi_cmnd *cmnd) {struct scsi_device *sdev = cmnd->device;struct uas_dev_info *devinfo = sdev->hostdata;
@@ -848,7 +848,7 @@ static int uas_slave_configure(struct scsi_device *sdev) .slave_alloc = uas_slave_alloc, .slave_configure = uas_slave_configure, .eh_abort_handler = uas_eh_abort_handler, - .eh_bus_reset_handler = uas_eh_bus_reset_handler, + .eh_device_reset_handler = uas_eh_device_reset_handler, .this_id = -1, .sg_tablesize = SG_NONE, .skip_settle_delay = 1,
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 9/35 libsas: move bus_reset_handler() to target_reset_handler()
In reply to Hannes ReineckeThe bus reset handler is calling I_T Nexus reset, which logically is a target reset as it need to specify both the initiator and the target.
So move it to target reset.
--- drivers/scsi/aic94xx/aic94xx_init.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_main.c | 2 +- drivers/scsi/isci/init.c | 2 +- drivers/scsi/libsas/sas_scsi_host.c | 12 ++++++------ drivers/scsi/mvsas/mv_init.c | 2 +- drivers/scsi/pm8001/pm8001_init.c | 2 +- include/scsi/libsas.h | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-)
drivers/scsi/aic94xx/aic94xx_init.c +1 -1
@@ -70,7 +70,7 @@ .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING, .eh_device_reset_handler = sas_eh_device_reset_handler, - .eh_bus_reset_handler = sas_eh_bus_reset_handler, + .eh_target_reset_handler = sas_eh_target_reset_handler, .target_destroy = sas_target_destroy, .ioctl = sas_ioctl, .track_queue_depth = 1,
drivers/scsi/hisi_sas/hisi_sas_main.c +1 -1
@@ -1371,7 +1371,7 @@ void hisi_sas_rescan_topology(struct hisi_hba *hisi_hba, u32 old_state, .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING, .eh_device_reset_handler = sas_eh_device_reset_handler, - .eh_bus_reset_handler = sas_eh_bus_reset_handler, + .eh_target_reset_handler = sas_eh_target_reset_handler, .target_destroy = sas_target_destroy, .ioctl = sas_ioctl, };
drivers/scsi/isci/init.c +1 -1
@@ -166,7 +166,7 @@ struct device_attribute *isci_host_attrs[] = { .use_clustering = ENABLE_CLUSTERING, .eh_abort_handler = sas_eh_abort_handler, .eh_device_reset_handler = sas_eh_device_reset_handler, - .eh_bus_reset_handler = sas_eh_bus_reset_handler, + .eh_target_reset_handler = sas_eh_target_reset_handler, .target_destroy = sas_target_destroy, .ioctl = sas_ioctl, .shost_attrs = isci_host_attrs,
drivers/scsi/libsas/sas_scsi_host.c +6 -6
@@ -526,7 +526,7 @@ int sas_eh_device_reset_handler(struct scsi_cmnd *cmd)return FAILED ; } -int sas_eh_bus_reset_handler (struct scsi_cmnd *cmd) +int sas_eh_target_reset_handler (struct scsi_cmnd *cmd) {int res;struct Scsi_Host *host = cmd->device->host;
@@ -554,15 +554,15 @@ static int try_to_reset_cmd_device(struct scsi_cmnd *cmd)struct Scsi_Host *shost = cmd->device->host;if (!shost->hostt->eh_device_reset_handler) - goto try_bus_reset; + goto try_target_reset; res = shost->hostt->eh_device_reset_handler (cmd);if (res ==SUCCESS )return res; -try_bus_reset: -if (shost->hostt->eh_bus_reset_handler) -return shost->hostt->eh_bus_reset_handler (cmd); +try_target_reset: +if (shost->hostt->eh_target_reset_handler) +return shost->hostt->eh_target_reset_handler (cmd);return FAILED ; }
@@ -996,6 +996,6 @@ int sas_request_addr(struct Scsi_Host *shost, u8 *addr)EXPORT_SYMBOL_GPL (sas_task_abort);EXPORT_SYMBOL_GPL (sas_phy_reset);EXPORT_SYMBOL_GPL (sas_eh_device_reset_handler); -EXPORT_SYMBOL_GPL (sas_eh_bus_reset_handler); +EXPORT_SYMBOL_GPL (sas_eh_target_reset_handler);EXPORT_SYMBOL_GPL (sas_target_destroy);EXPORT_SYMBOL_GPL (sas_ioctl);
drivers/scsi/mvsas/mv_init.c +1 -1
@@ -61,7 +61,7 @@ .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING, .eh_device_reset_handler = sas_eh_device_reset_handler, - .eh_bus_reset_handler = sas_eh_bus_reset_handler, + .eh_target_reset_handler = sas_eh_target_reset_handler, .target_destroy = sas_target_destroy, .ioctl = sas_ioctl, .shost_attrs = mvst_host_attrs,
drivers/scsi/pm8001/pm8001_init.c +1 -1
@@ -86,7 +86,7 @@ .max_sectors = SCSI_DEFAULT_MAX_SECTORS, .use_clustering = ENABLE_CLUSTERING, .eh_device_reset_handler = sas_eh_device_reset_handler, - .eh_bus_reset_handler = sas_eh_bus_reset_handler, + .eh_target_reset_handler = sas_eh_target_reset_handler, .target_destroy = sas_target_destroy, .ioctl = sas_ioctl, .shost_attrs = pm8001_host_attrs,
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_bus_reset_handler (struct scsi_cmnd *cmd); +int sas_eh_target_reset_handler (struct scsi_cmnd *cmd);extern void sas_target_destroy (struct scsi_target *);extern int sas_slave_alloc (struct scsi_device *);
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 5/35 fnic: do not call host reset from command abort
In reply to Hannes Reineckecommand abort already returns FAILED, which will then be escalated to a host reset. So no need to call host_reset directly.
--- drivers/scsi/fnic/fnic_scsi.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/scsi/fnic/fnic_scsi.c +0 -4
@@ -1977,10 +1977,6 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)FNIC_SCSI_DBG (KERN_DEBUG , fnic->lport->host,"Issuing Host reset due to out of order IO\n" ); -if (fnic_host_reset (sc) ==FAILED ) { -FNIC_SCSI_DBG (KERN_DEBUG , fnic->lport->host, -"fnic_host_reset failed.\n" ); - } ret =FAILED ; goto fnic_abort_cmd_end; }
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 6/35 visorhba: sanitze private device data allocation
In reply to Hannes ReineckeThere's no need to keep the private data for a device in a separate list; better to store it in ->hostdata and do away with the additional list.
--- drivers/staging/unisys/visorhba/visorhba_main.c | 123 ++++++++++-------------- 1 file changed, 53 insertions(+), 70 deletions(-)
drivers/staging/unisys/visorhba/visorhba_main.c +53 -70
@@ -47,8 +47,8 @@MODULE_ALIAS ("visorbus:" SPAR_VHBA_CHANNEL_PROTOCOL_UUID_STR );struct visordisk_info { +struct scsi_device *sdev;u32 valid; -u32 channel, id, lun;/* Disk Path */ atomic_t ios_threshold;atomic_t error_count;struct visordisk_info *next;
@@ -101,12 +101,6 @@ struct visorhba_devices_open {struct visorhba_devdata *devdata; }; -#define for_each_vdisk_match (iter, list, match) \ - for (iter = &list->head; iter->next; iter = iter->next) \ - if ((iter->channel == match->channel) && \ - (iter->id == match->id) && \ - (iter->lun == match->lun)) -/* * visor_thread_start - starts a thread for the device * @threadfn: Function the thread starts
@@ -296,10 +290,9 @@ static void cleanup_scsitaskmgmt_handles(struct idr *idrtable,* Returns whether the command was queued successfully or not. */ static int forward_taskmgmt_command (enum task_mgmt_types tasktype, -struct scsi_cmnd *scsicmd) +struct scsi_device *scsidev) {struct uiscmdrsp *cmdrsp; -struct scsi_device *scsidev = scsicmd->device;struct visorhba_devdata *devdata = (struct visorhba_devdata *)scsidev->host->hostdata;int notifyresult =0xffff ;
@@ -347,12 +340,6 @@ static int forward_taskmgmt_command(enum task_mgmt_types tasktype,dev_dbg (&scsidev->sdev_gendev,"visorhba: taskmgmt type=%d success; result=0x%x\n" , tasktype, notifyresult); -if (tasktype ==TASK_MGMT_ABORT_TASK ) - scsicmd->result =DID_ABORT <<16 ; -else - scsicmd->result =DID_RESET <<16 ; - - scsicmd->scsi_done (scsicmd);cleanup_scsitaskmgmt_handles (&devdata->idr, cmdrsp);return SUCCESS ;
@@ -376,17 +363,20 @@ static int visorhba_abort_handler(struct scsi_cmnd *scsicmd)/* issue TASK_MGMT_ABORT_TASK */ struct scsi_device *scsidev;struct visordisk_info *vdisk; -struct visorhba_devdata *devdata; +int rtn; scsidev = scsicmd->device; - devdata = (struct visorhba_devdata *)scsidev->host->hostdata; -for_each_vdisk_match (vdisk, devdata, scsidev) { -if (atomic_read (&vdisk->error_count) <VISORHBA_ERROR_COUNT ) -atomic_inc (&vdisk->error_count); -else -atomic_set (&vdisk->ios_threshold,IOS_ERROR_THRESHOLD ); + 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_ABORT_TASK , scsidev); +if (rtn ==SUCCESS ) { + scsicmd->result =DID_ABORT <<16 ; + scsicmd->scsi_done (scsicmd); } -return forward_taskmgmt_command (TASK_MGMT_ABORT_TASK , scsicmd); +return rtn; }/*
@@ -400,17 +390,20 @@ static int visorhba_device_reset_handler(struct scsi_cmnd *scsicmd)/* issue TASK_MGMT_LUN_RESET */ struct scsi_device *scsidev;struct visordisk_info *vdisk; -struct visorhba_devdata *devdata; +int rtn; scsidev = scsicmd->device; - devdata = (struct visorhba_devdata *)scsidev->host->hostdata; -for_each_vdisk_match (vdisk, devdata, scsidev) { -if (atomic_read (&vdisk->error_count) <VISORHBA_ERROR_COUNT ) -atomic_inc (&vdisk->error_count); -else -atomic_set (&vdisk->ios_threshold,IOS_ERROR_THRESHOLD ); + 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 forward_taskmgmt_command (TASK_MGMT_LUN_RESET , scsicmd); +return rtn; }/*
@@ -424,17 +417,22 @@ static int visorhba_bus_reset_handler(struct scsi_cmnd *scsicmd) {struct scsi_device *scsidev;struct visordisk_info *vdisk; -struct visorhba_devdata *devdata; +int rtn; scsidev = scsicmd->device; - devdata = (struct visorhba_devdata *)scsidev->host->hostdata; -for_each_vdisk_match (vdisk, devdata, scsidev) { +shost_for_each_device (scsidev, scsidev->host) { + 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 ); } -return forward_taskmgmt_command (TASK_MGMT_BUS_RESET , scsicmd); + rtn =forward_taskmgmt_command (TASK_MGMT_BUS_RESET , scsidev); +if (rtn ==SUCCESS ) { + scsicmd->result =DID_RESET <<16 ; + scsicmd->scsi_done (scsicmd); + } +return rtn; }/*
@@ -569,25 +567,22 @@ static int visorhba_slave_alloc(struct scsi_device *scsidev)* LLD can alloc any struct & do init if needed. */ struct visordisk_info *vdisk; -struct visordisk_info *tmpvdisk;struct visorhba_devdata *devdata;struct Scsi_Host *scsihost = (struct Scsi_Host *)scsidev->host; +if (scsidev->hostdata) +return 0 ;/* already allocated return success */ + devdata = (struct visorhba_devdata *)scsihost->hostdata;if (!devdata)return 0 ;/* even though we errored, treat as success */ -for_each_vdisk_match (vdisk, devdata, scsidev) -return 0 ;/* already allocated return success */ - - tmpvdisk =kzalloc (sizeof (*tmpvdisk),GFP_ATOMIC ); -if (!tmpvdisk) + vdisk =kzalloc (sizeof (*vdisk),GFP_ATOMIC ); +if (!vdisk)return -ENOMEM ; - tmpvdisk->channel = scsidev->channel; - tmpvdisk->id = scsidev->id; - tmpvdisk->lun = scsidev->lun; - vdisk->next = tmpvdisk; + vdisk->sdev = scsidev; + scsidev->hostdata = vdisk;return 0 ; }
@@ -603,17 +598,11 @@ static void visorhba_slave_destroy(struct scsi_device *scsidev)/* midlevel calls this after device has been quiesced and * before it is to be deleted. */ -struct visordisk_info *vdisk, *delvdisk; -struct visorhba_devdata *devdata; -struct Scsi_Host *scsihost = (struct Scsi_Host *)scsidev->host; +struct visordisk_info *vdisk; - devdata = (struct visorhba_devdata *)scsihost->hostdata; -for_each_vdisk_match (vdisk, devdata, scsidev) { - delvdisk = vdisk->next; - vdisk->next = delvdisk->next; -kfree (delvdisk); -return ; - } + vdisk = scsidev->hostdata; + scsidev->hostdata =NULL ; +kfree (vdisk); }static struct scsi_host_template visorhba_driver_template = {
@@ -787,7 +776,6 @@ static int visorhba_serverdown(struct visorhba_devdata *devdata)static void do_scsi_linuxstat (struct uiscmdrsp *cmdrsp,struct scsi_cmnd *scsicmd) { -struct visorhba_devdata *devdata;struct visordisk_info *vdisk;struct scsi_device *scsidev;
@@ -800,12 +788,10 @@ static int visorhba_serverdown(struct visorhba_devdata *devdata) (cmdrsp->scsi.addlstat == ADDL_SEL_TIMEOUT)) return;/* Okay see what our error_count is here.... */ - devdata = (struct visorhba_devdata *)scsidev->host->hostdata; -for_each_vdisk_match (vdisk, devdata, scsidev) { -if (atomic_read (&vdisk->error_count) <VISORHBA_ERROR_COUNT ) { -atomic_inc (&vdisk->error_count); -atomic_set (&vdisk->ios_threshold,IOS_ERROR_THRESHOLD ); - } + vdisk = scsidev->hostdata; +if (atomic_read (&vdisk->error_count) <VISORHBA_ERROR_COUNT ) { +atomic_inc (&vdisk->error_count); +atomic_set (&vdisk->ios_threshold,IOS_ERROR_THRESHOLD ); } }
@@ -846,7 +832,6 @@ static int set_no_disk_inquiry_result(unsigned char *buf,char *this_page_orig;int bufind =0 ;struct visordisk_info *vdisk; -struct visorhba_devdata *devdata; scsidev = scsicmd->device; if ((cmdrsp->scsi.cmnd[0] == INQUIRY) &&
@@ -883,13 +868,11 @@ static int set_no_disk_inquiry_result(unsigned char *buf, }kfree (buf); }else { - devdata = (struct visorhba_devdata *)scsidev->host->hostdata; -for_each_vdisk_match (vdisk, devdata, scsidev) { -if (atomic_read (&vdisk->ios_threshold) >0 ) { -atomic_dec (&vdisk->ios_threshold); -if (atomic_read (&vdisk->ios_threshold) ==0 ) -atomic_set (&vdisk->error_count,0 ); - } + vdisk = scsidev->hostdata; +if (atomic_read (&vdisk->ios_threshold) >0 ) { +atomic_dec (&vdisk->ios_threshold); +if (atomic_read (&vdisk->ios_threshold) ==0 ) +atomic_set (&vdisk->error_count,0 ); } } }
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 8/35 lpfc: drop lpfc_no_handler and lpfc_bus_reset_handler()
In reply to Hannes Reineckelpfc_bus_reset_handler() is really just a loop calling lpfc_target_reset_handler() over all targets, which is what the error handler will be doing anyway.
And lpfc_no_handler() will return FAILED, just like SCSI EH does if no handler is present.
So drop both.
--- drivers/scsi/lpfc/lpfc_scsi.c | 99 ------------------------------------------- 1 file changed, 99 deletions(-)
drivers/scsi/lpfc/lpfc_scsi.c +0 -99
@@ -5294,93 +5294,6 @@ void lpfc_poll_timeout(unsigned long ptr) }/** -* lpfc_bus_reset_handler - scsi_host_template eh_bus_reset_handler entry point -* @cmnd: Pointer to scsi_cmnd data structure. -* -* This routine does target reset to all targets on @cmnd->device->host. -* This emulates Parallel SCSI Bus Reset Semantics. -* -* Return code : -* 0x2003 - Error -* 0x2002 - Success -**/ -static int -lpfc_bus_reset_handler (struct scsi_cmnd *cmnd) -{ -struct Scsi_Host *shost = cmnd->device->host; -struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; -struct lpfc_nodelist *ndlp =NULL ; -struct lpfc_scsi_event_header scsi_event; -int match; -int ret =SUCCESS , status, i; - - scsi_event.event_type =FC_REG_SCSI_EVENT ; - scsi_event.subcategory =LPFC_EVENT_BUSRESET ; - scsi_event.lun =0 ; -memcpy (scsi_event.wwpn, &vport->fc_portname,sizeof (struct lpfc_name )); -memcpy (scsi_event.wwnn, &vport->fc_nodename,sizeof (struct lpfc_name )); - -fc_host_post_vendor_event (shost,fc_get_event_number (), -sizeof (scsi_event), (char *)&scsi_event,LPFC_NL_VENDOR_ID ); - - status =fc_block_scsi_eh (cmnd); -if (status !=0 && status !=SUCCESS ) -return status; - -/* -* Since the driver manages a single bus device, reset all -* targets known to the driver. Should any target reset -* fail, this routine returns failure to the midlayer. -*/ -for (i =0 ; i <LPFC_MAX_TARGET ; i++) { -/* Search for mapped node by target ID */ - match =0 ; -spin_lock_irq (shost->host_lock); -list_for_each_entry (ndlp, &vport->fc_nodes, nlp_listp) { -if (!NLP_CHK_NODE_ACT (ndlp)) -continue ; -if (vport->phba->cfg_fcp2_no_tgt_reset && - (ndlp->nlp_fcp_info &NLP_FCP_2_DEVICE )) -continue ; -if (ndlp->nlp_state ==NLP_STE_MAPPED_NODE && - ndlp->nlp_sid == i && - ndlp->rport && - ndlp->nlp_type &NLP_FCP_TARGET ) { - match =1 ; -break ; - } - } -spin_unlock_irq (shost->host_lock); -if (!match) -continue ; - - status =lpfc_send_taskmgmt (vport, cmnd, - i,0 ,FCP_TARGET_RESET ); - -if (status !=SUCCESS ) { -lpfc_printf_vlog (vport,KERN_ERR ,LOG_FCP , -"0700 Bus Reset on target %d failed\n" , - i); - ret =FAILED ; - } - } -/* -* We have to clean up i/o as : they may be orphaned by the TMFs -* above; or if any of the TMFs failed, they may be in an -* indeterminate state. -* We will report success if all the i/o aborts successfully. -*/ - - status =lpfc_reset_flush_io_context (vport,0 ,0 ,LPFC_CTX_HOST ); -if (status !=SUCCESS ) - ret =FAILED ; - -lpfc_printf_vlog (vport,KERN_ERR ,LOG_FCP , -"0714 SCSI layer issued Bus Reset Data: x%x\n" , ret); -return ret; -} - -/** * lpfc_host_reset_handler - scsi_host_template eh_host_reset_handler entry pt * @cmnd: Pointer to scsi_cmnd data structure. *
@@ -5926,11 +5839,6 @@ struct lpfc_device_data*return SCSI_MLQUEUE_HOST_BUSY ; } -static int -lpfc_no_handler (struct scsi_cmnd *cmnd) -{ -return FAILED ; -}static int lpfc_no_slave (struct scsi_device *sdev)
@@ -5944,11 +5852,6 @@ struct scsi_host_template lpfc_template_nvme = { .proc_name = LPFC_DRIVER_NAME, .info = lpfc_info, .queuecommand = lpfc_no_command, - .eh_abort_handler = lpfc_no_handler, - .eh_device_reset_handler = lpfc_no_handler, - .eh_target_reset_handler = lpfc_no_handler, - .eh_bus_reset_handler = lpfc_no_handler, - .eh_host_reset_handler = lpfc_no_handler, .slave_alloc = lpfc_no_slave, .slave_configure = lpfc_no_slave, .scan_finished = lpfc_scan_finished,
@@ -5972,7 +5875,6 @@ struct scsi_host_template lpfc_template_no_hr = { .eh_abort_handler = lpfc_abort_handler, .eh_device_reset_handler = lpfc_device_reset_handler, .eh_target_reset_handler = lpfc_target_reset_handler, - .eh_bus_reset_handler = lpfc_bus_reset_handler, .slave_alloc = lpfc_slave_alloc, .slave_configure = lpfc_slave_configure, .slave_destroy = lpfc_slave_destroy,
@@ -5998,7 +5900,6 @@ struct scsi_host_template lpfc_template = { .eh_abort_handler = lpfc_abort_handler, .eh_device_reset_handler = lpfc_device_reset_handler, .eh_target_reset_handler = lpfc_target_reset_handler, - .eh_bus_reset_handler = lpfc_bus_reset_handler, .eh_host_reset_handler = lpfc_host_reset_handler, .slave_alloc = lpfc_slave_alloc, .slave_configure = lpfc_slave_configure,
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 11/35 hptiop: Simplify reset handling
In reply to Hannes ReineckeThe Highpoint driver only has one reset function, and that is a host reset. So stop pretending we're doing anything else.
--- drivers/scsi/hptiop.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/scsi/hptiop.c +4 -7
@@ -1106,12 +1106,10 @@ static int hptiop_reset_hba(struct hptiop_hba *hba)static int hptiop_reset (struct scsi_cmnd *scp) { -struct Scsi_Host * host = scp->device->host; -struct hptiop_hba * hba = (struct hptiop_hba *)host->hostdata; +struct hptiop_hba * hba = (struct hptiop_hba *)scp->device->host->hostdata; -printk (KERN_WARNING "hptiop_reset(%d/%d/%d) scp=%p\n" , - scp->device->host->host_no, scp->device->channel, - scp->device->id, scp); +printk (KERN_WARNING "hptiop_reset(%d/%d/%d)\n" , + scp->device->host->host_no,-1 ,-1 );return hptiop_reset_hba (hba)?FAILED :SUCCESS ; }
@@ -1179,8 +1177,7 @@ static int hptiop_slave_config(struct scsi_device *sdev) .module = THIS_MODULE, .name = driver_name, .queuecommand = hptiop_queuecommand, - .eh_device_reset_handler = hptiop_reset, - .eh_bus_reset_handler = hptiop_reset, + .eh_host_reset_handler = hptiop_reset, .info = hptiop_info, .emulated = 0, .use_clustering = ENABLE_CLUSTERING,
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 10/35 bfa: move bus reset to target reset
In reply to Hannes ReineckeThe bus reset handler is just calling target reset on all targets, which is exactly what SCSI EH will be doing anyway.
So move the bus reset function to target reset and drop the loop.
--- drivers/scsi/bfa/bfad_im.c | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-)
drivers/scsi/bfa/bfad_im.c +15 -22
@@ -373,32 +373,28 @@ static void bfad_im_fc_rport_add(struct bfad_im_port_s *im_port, }/* -* Scsi_Host template entry, resets the bus and abort all commands. +* Scsi_Host template entry, resets the target and abort all commands. */ static int -bfad_im_reset_bus_handler (struct scsi_cmnd *cmnd) +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 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 i, rc, err_cnt =0 ; +u32 rc, rtn =FAILED ;DECLARE_WAIT_QUEUE_HEAD_ONSTACK (wq);enum bfi_tskim_status task_status;spin_lock_irqsave (&bfad->bfad_lock, flags); -for (i =0 ; i <MAX_FCP_TARGET ; i++) { - itnim =bfad_get_itnim (im_port, i); -if (itnim) { - cmnd->SCp.ptr = (char *)&wq; - rc =bfad_im_target_reset_send (bfad, cmnd, itnim); -if (rc !=BFA_STATUS_OK ) { - err_cnt++; -continue ; - } - + 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,
@@ -406,20 +402,17 @@ static void bfad_im_fc_rport_add(struct bfad_im_port_s *im_port,spin_lock_irqsave (&bfad->bfad_lock, flags); task_status = cmnd->SCp.Status >>1 ; -if (task_status !=BFI_TSKIM_STS_OK ) { +if (task_status !=BFI_TSKIM_STS_OK )BFA_LOG (KERN_ERR , bfad, bfa_log_level,"target reset failure," " status: %d\n" , task_status); - err_cnt++; - } +else + rtn =SUCCESS ; } }spin_unlock_irqrestore (&bfad->bfad_lock, flags); -if (err_cnt) -return FAILED ; - -return SUCCESS ; +return rtn; }/*
@@ -816,7 +809,7 @@ struct scsi_host_template bfad_im_scsi_host_template = { .eh_timed_out = fc_eh_timed_out, .eh_abort_handler = bfad_im_abort_handler, .eh_device_reset_handler = bfad_im_reset_lun_handler, - .eh_bus_reset_handler = bfad_im_reset_bus_handler, + .eh_target_reset_handler = bfad_im_reset_target_handler, .slave_alloc = bfad_im_slave_alloc, .slave_configure = bfad_im_slave_configure,
@@ -839,7 +832,7 @@ struct scsi_host_template bfad_im_vport_template = { .eh_timed_out = fc_eh_timed_out, .eh_abort_handler = bfad_im_abort_handler, .eh_device_reset_handler = bfad_im_reset_lun_handler, - .eh_bus_reset_handler = bfad_im_reset_bus_handler, + .eh_target_reset_handler = bfad_im_reset_target_handler, .slave_alloc = bfad_im_slave_alloc, .slave_configure = bfad_im_slave_configure,
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 12/35 fdomain: move bus reset to host reset
In reply to Hannes ReineckeThe bus reset function really is a host reset, so move it to eh_host_reset_handler().
--- drivers/scsi/fdomain.c | 6 +++--- drivers/scsi/fdomain.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/fdomain.c +3 -3
@@ -933,7 +933,7 @@ struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt ) } } -fdomain_16x0_bus_reset (NULL ); +fdomain_16x0_host_reset (NULL );if (fdomain_test_loopback ()) {printk (KERN_ERR "scsi: <fdomain> Detection failed (loopback test failed at port base 0x%x)\n" , port_base);
@@ -1568,7 +1568,7 @@ static int fdomain_16x0_abort(struct scsi_cmnd *SCpnt)return SUCCESS ; } -int fdomain_16x0_bus_reset (struct scsi_cmnd *SCpnt) +int fdomain_16x0_host_reset (struct scsi_cmnd *SCpnt) {unsigned long flags;
@@ -1758,7 +1758,7 @@ struct scsi_host_template fdomain_driver_template = { .info = fdomain_16x0_info, .queuecommand = fdomain_16x0_queue, .eh_abort_handler = fdomain_16x0_abort, - .eh_bus_reset_handler = fdomain_16x0_bus_reset, + .eh_host_reset_handler = fdomain_16x0_host_reset, .bios_param = fdomain_16x0_biosparam, .release = fdomain_16x0_release, .can_queue = 1,
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_bus_reset (struct scsi_cmnd *SCpnt); +extern int fdomain_16x0_host_reset (struct scsi_cmnd *SCpnt);
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 13/35 scsi: drop bus reset for wd33c93-compatible boards
In reply to Hannes ReineckeThe bus reset function is just a wrapper around host reset, so drop it.
--- drivers/scsi/a2091.c | 17 ----------------- drivers/scsi/a3000.c | 17 ----------------- drivers/scsi/gvp11.c | 18 ------------------ drivers/scsi/mvme147.c | 16 ---------------- drivers/scsi/sgiwd93.c | 15 --------------- 5 files changed, 83 deletions(-)
drivers/scsi/a2091.c +0 -17
@@ -147,22 +147,6 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, } } -static int a2091_bus_reset (struct scsi_cmnd *cmd) -{ -struct Scsi_Host *instance = cmd->device->host; - -/* FIXME perform bus-specific reset */ - -/* FIXME 2: kill this function, and let midlayer fall back -to the same action, calling wd33c93_host_reset() */ - -spin_lock_irq (instance->host_lock); -wd33c93_host_reset (cmd); -spin_unlock_irq (instance->host_lock); - -return SUCCESS ; -} -static struct scsi_host_template a2091_scsi_template = { .module =THIS_MODULE , .name ="Commodore A2091/A590 SCSI" ,
@@ -171,7 +155,6 @@ static int a2091_bus_reset(struct scsi_cmnd *cmd) .proc_name = "A2901", .queuecommand = wd33c93_queuecommand, .eh_abort_handler = wd33c93_abort, - .eh_bus_reset_handler = a2091_bus_reset, .eh_host_reset_handler = wd33c93_host_reset, .can_queue = CAN_QUEUE, .this_id = 7,
drivers/scsi/a3000.c +0 -17
@@ -162,22 +162,6 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, } } -static int a3000_bus_reset (struct scsi_cmnd *cmd) -{ -struct Scsi_Host *instance = cmd->device->host; - -/* FIXME perform bus-specific reset */ - -/* FIXME 2: kill this entire function, which should -cause mid-layer to call wd33c93_host_reset anyway? */ - -spin_lock_irq (instance->host_lock); -wd33c93_host_reset (cmd); -spin_unlock_irq (instance->host_lock); - -return SUCCESS ; -} -static struct scsi_host_template amiga_a3000_scsi_template = { .module =THIS_MODULE , .name ="Amiga 3000 built-in SCSI" ,
@@ -186,7 +170,6 @@ static int a3000_bus_reset(struct scsi_cmnd *cmd) .proc_name = "A3000", .queuecommand = wd33c93_queuecommand, .eh_abort_handler = wd33c93_abort, - .eh_bus_reset_handler = a3000_bus_reset, .eh_host_reset_handler = wd33c93_host_reset, .can_queue = CAN_QUEUE, .this_id = 7,
drivers/scsi/gvp11.c +0 -18
@@ -171,23 +171,6 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, } } -static int gvp11_bus_reset (struct scsi_cmnd *cmd) -{ -struct Scsi_Host *instance = cmd->device->host; - -/* FIXME perform bus-specific reset */ - -/* FIXME 2: shouldn't we no-op this function (return -FAILED), and fall back to host reset function, -wd33c93_host_reset ? */ - -spin_lock_irq (instance->host_lock); -wd33c93_host_reset (cmd); -spin_unlock_irq (instance->host_lock); - -return SUCCESS ; -} -static struct scsi_host_template gvp11_scsi_template = { .module =THIS_MODULE , .name ="GVP Series II SCSI" ,
@@ -196,7 +179,6 @@ static int gvp11_bus_reset(struct scsi_cmnd *cmd) .proc_name = "GVP11", .queuecommand = wd33c93_queuecommand, .eh_abort_handler = wd33c93_abort, - .eh_bus_reset_handler = gvp11_bus_reset, .eh_host_reset_handler = wd33c93_host_reset, .can_queue = CAN_QUEUE, .this_id = 7,
drivers/scsi/mvme147.c +0 -16
@@ -121,21 +121,6 @@ int mvme147_detect(struct scsi_host_template *tpnt)return 0 ; } -static int mvme147_bus_reset (struct scsi_cmnd *cmd) -{ -/* FIXME perform bus-specific reset */ - -/* FIXME 2: kill this function, and let midlayer fallback to -the same result, calling wd33c93_host_reset() */ - -spin_lock_irq (cmd->device->host->host_lock); -wd33c93_host_reset (cmd); -spin_unlock_irq (cmd->device->host->host_lock); - -return SUCCESS ; -} - -static struct scsi_host_template driver_template = { .proc_name ="MVME147" , .name ="MVME147 built-in SCSI" ,
@@ -143,7 +128,6 @@ static int mvme147_bus_reset(struct scsi_cmnd *cmd) .release = mvme147_release, .queuecommand = wd33c93_queuecommand, .eh_abort_handler = wd33c93_abort, - .eh_bus_reset_handler = mvme147_bus_reset, .eh_host_reset_handler = wd33c93_host_reset, .can_queue = CAN_QUEUE, .this_id = 7,
drivers/scsi/sgiwd93.c +0 -15
@@ -192,20 +192,6 @@ static inline void init_hpc_chain(struct ip22_hostdata *hdata) hcp->desc.pnext = hdata->dma; } -static int sgiwd93_bus_reset (struct scsi_cmnd *cmd) -{ -/* FIXME perform bus-specific reset */ - -/* FIXME 2: kill this function, and let midlayer fallback -to the same result, calling wd33c93_host_reset() */ - -spin_lock_irq (cmd->device->host->host_lock); -wd33c93_host_reset (cmd); -spin_unlock_irq (cmd->device->host->host_lock); - -return SUCCESS ; -} -/* * Kludge alert - the SCSI code calls the abort and reset method with int * arguments not with pointers. So this is going to blow up beautyfully
@@ -217,7 +203,6 @@ static int sgiwd93_bus_reset(struct scsi_cmnd *cmd) .name = "SGI WD93", .queuecommand = wd33c93_queuecommand, .eh_abort_handler = wd33c93_abort, - .eh_bus_reset_handler = sgiwd93_bus_reset, .eh_host_reset_handler = wd33c93_host_reset, .can_queue = 16, .this_id = 7,
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 14/35 rtsx: drop bus reset function
In reply to Hannes ReineckeFunction is a stub, so can as well be dropped.
--- drivers/staging/rts5208/rtsx.c | 11 ----------- 1 file changed, 11 deletions(-)
drivers/staging/rts5208/rtsx.c +0 -11
@@ -205,16 +205,6 @@ static int device_reset(struct scsi_cmnd *srb)return SUCCESS ; } -/* Simulate a SCSI bus reset by resetting the device's USB port. */ -static int bus_reset (struct scsi_cmnd *srb) -{ -struct rtsx_dev *dev =host_to_rtsx (srb->device->host); - -dev_info (&dev->pci->dev,"%s called\n" , __func__); - -return SUCCESS ; -} -/* * this defines our host template, with which we'll allocate hosts */
@@ -231,7 +221,6 @@ static int bus_reset(struct scsi_cmnd *srb)/* error and abort handlers */ .eh_abort_handler = command_abort, .eh_device_reset_handler = device_reset, - .eh_bus_reset_handler = bus_reset,/* queue commands only, only one command per LUN */ .can_queue = 1,
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 16/35 acornscsi: move bus reset to host reset
In reply to Hannes ReineckeThe bus reset function is really a host reset, so move it to eh_host_reset_handler.
--- drivers/scsi/arm/acornscsi.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/scsi/arm/acornscsi.c +6 -5
@@ -2725,23 +2725,24 @@ int acornscsi_abort(struct scsi_cmnd *SCpnt)* Params : SCpnt - command causing reset * Returns : one of SCSI_RESET_ macros */ -int acornscsi_bus_reset (struct scsi_cmnd *SCpnt) +int acornscsi_host_reset (struct Scsi_Host *shpnt) { -AS_Host *host = (AS_Host *)SCpnt->device->host->hostdata; +AS_Host *host = (AS_Host *)shpnt->hostdata;struct scsi_cmnd *SCptr; host->stats.resets +=1 ;#if (DEBUG &DEBUG_RESET ) { -int asr, ssr; +int asr, ssr, devidx; asr =sbic_arm_read (host,SBIC_ASR ); ssr =sbic_arm_read (host,SBIC_SSR );printk (KERN_WARNING "acornscsi_reset: " );print_sbic_status (asr, ssr, host->scsi.phase); -acornscsi_dumplog (host, SCpnt->device->id); +for (devidx =0 ; devidx <9 ; devidx ++) { +acornscsi_dumplog (host, devidx); }#endif
@@ -2884,7 +2885,7 @@ static int acornscsi_show_info(struct seq_file *m, struct Scsi_Host *instance) .info = acornscsi_info, .queuecommand = acornscsi_queuecmd, .eh_abort_handler = acornscsi_abort, - .eh_bus_reset_handler = acornscsi_bus_reset, + .eh_host_reset_handler = acornscsi_host_reset, .can_queue = 16, .this_id = 7, .sg_tablesize = SG_ALL,
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 17/35 NCR5380: Move bus reset to host reset
In reply to Hannes ReineckeThe bus reset handler really is a host reset, so move it to eh_bus_reset_handler.
--- drivers/scsi/NCR5380.c | 13 ++++++++----- drivers/scsi/arm/cumana_1.c | 2 +- drivers/scsi/arm/oak.c | 2 +- drivers/scsi/atari_scsi.c | 6 +++--- drivers/scsi/dmx3191d.c | 2 +- drivers/scsi/g_NCR5380.c | 4 ++-- drivers/scsi/mac_scsi.c | 4 ++-- drivers/scsi/sun3_scsi.c | 4 ++-- 8 files changed, 20 insertions(+), 17 deletions(-)
drivers/scsi/NCR5380.c +8 -5
@@ -2296,24 +2296,24 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)/** -* NCR5380_bus_reset - reset the SCSI bus +* NCR5380_host_reset - reset the SCSI host * @cmd: SCSI command undergoing EH * * Returns SUCCESS */ -static int NCR5380_bus_reset (struct scsi_cmnd *cmd) +static int NCR5380_host_reset (struct scsi_cmnd *cmd) {struct Scsi_Host *instance = cmd->device->host;struct NCR5380_hostdata *hostdata =shost_priv (instance);int i;unsigned long flags; -struct NCR5380_cmd *ncmd; +struct NCR5380_cmd *ncmd, *tmp;spin_lock_irqsave (&hostdata->lock, flags);#if (NDEBUG &NDEBUG_ANY ) -scmd_printk (KERN_INFO , cmd, __func__); +shost_printk (KERN_INFO , instance, __func__);#endif NCR5380_dprint (NDEBUG_ANY , instance);NCR5380_dprint_phase (NDEBUG_ANY , instance);
@@ -2331,7 +2331,10 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd)* commands! */ -if (list_del_cmd (&hostdata->unissued, cmd)) { +list_for_each_entry_safe (ncmd, tmp, &hostdata->unissued, list) { +struct scsi_cmnd *cmd =NCR5380_to_scmd (ncmd); + +list_del_init (&ncmd->list); cmd->result =DID_RESET <<16 ; cmd->scsi_done (cmd); }
drivers/scsi/arm/cumana_1.c +1 -1
@@ -216,7 +216,7 @@ static void cumanascsi_write(struct NCR5380_hostdata *hostdata, .info = cumanascsi_info, .queuecommand = cumanascsi_queue_command, .eh_abort_handler = NCR5380_abort, - .eh_bus_reset_handler = NCR5380_bus_reset, + .eh_host_reset_handler = NCR5380_host_reset, .can_queue = 16, .this_id = 7, .sg_tablesize = SG_ALL,
drivers/scsi/arm/oak.c +1 -1
@@ -105,7 +105,7 @@ static inline int oakscsi_pread(struct NCR5380_hostdata *hostdata, .info = oakscsi_info, .queuecommand = oakscsi_queue_command, .eh_abort_handler = NCR5380_abort, - .eh_bus_reset_handler = NCR5380_bus_reset, + .eh_host_reset_handler = NCR5380_host_reset, .can_queue = 16, .this_id = 7, .sg_tablesize = SG_ALL,
drivers/scsi/atari_scsi.c +3 -3
@@ -671,7 +671,7 @@ static void atari_scsi_falcon_reg_write(unsigned int reg, u8 value)#include "NCR5380.c" -static int atari_scsi_bus_reset (struct scsi_cmnd *cmd) +static int atari_scsi_host_reset (struct scsi_cmnd *cmd) {int rv;unsigned long flags;
@@ -688,7 +688,7 @@ static int atari_scsi_bus_reset(struct scsi_cmnd *cmd) atari_dma_orig_addr =NULL ; } - rv =NCR5380_bus_reset (cmd); + rv =NCR5380_host_reset (cmd);/* 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
@@ -711,7 +711,7 @@ static int atari_scsi_bus_reset(struct scsi_cmnd *cmd) .info = atari_scsi_info, .queuecommand = atari_scsi_queue_command, .eh_abort_handler = atari_scsi_abort, - .eh_bus_reset_handler = atari_scsi_bus_reset, + .eh_host_reset_handler = atari_scsi_host_reset, .this_id = 7, .cmd_per_lun = 2, .use_clustering = DISABLE_CLUSTERING,
drivers/scsi/dmx3191d.c +1 -1
@@ -58,7 +58,7 @@ .info = NCR5380_info, .queuecommand = NCR5380_queue_command, .eh_abort_handler = NCR5380_abort, - .eh_bus_reset_handler = NCR5380_bus_reset, + .eh_host_reset_handler = NCR5380_host_reset, .can_queue = 32, .this_id = 7, .sg_tablesize = SG_ALL,
drivers/scsi/g_NCR5380.c +2 -2
@@ -54,7 +54,7 @@#define NCR5380_intr generic_NCR5380_intr#define NCR5380_queue_command generic_NCR5380_queue_command#define NCR5380_abort generic_NCR5380_abort -#define NCR5380_bus_reset generic_NCR5380_bus_reset +#define NCR5380_host_reset generic_NCR5380_host_reset#define NCR5380_info generic_NCR5380_info#define NCR5380_io_delay (x) udelay(x)
@@ -661,7 +661,7 @@ static int generic_NCR5380_dma_xfer_len(struct NCR5380_hostdata *hostdata, .info = generic_NCR5380_info, .queuecommand = generic_NCR5380_queue_command, .eh_abort_handler = generic_NCR5380_abort, - .eh_bus_reset_handler = generic_NCR5380_bus_reset, + .eh_host_reset_handler = generic_NCR5380_host_reset, .can_queue = 16, .this_id = 7, .sg_tablesize = SG_ALL,
drivers/scsi/mac_scsi.c +2 -2
@@ -41,7 +41,7 @@#define NCR5380_intr macscsi_intr#define NCR5380_queue_command macscsi_queue_command#define NCR5380_abort macscsi_abort -#define NCR5380_bus_reset macscsi_bus_reset +#define NCR5380_host_reset macscsi_host_reset#define NCR5380_info macscsi_info#include "NCR5380.h"
@@ -328,7 +328,7 @@ static int macscsi_dma_residual(struct NCR5380_hostdata *hostdata) .info = macscsi_info, .queuecommand = macscsi_queue_command, .eh_abort_handler = macscsi_abort, - .eh_bus_reset_handler = macscsi_bus_reset, + .eh_host_reset_handler = macscsi_host_reset, .can_queue = 16, .this_id = 7, .sg_tablesize = 1,
drivers/scsi/sun3_scsi.c +2 -2
@@ -46,7 +46,7 @@#define NCR5380_write (reg, value) out_8(hostdata->io + (reg), value)#define NCR5380_queue_command sun3scsi_queue_command -#define NCR5380_bus_reset sun3scsi_bus_reset +#define NCR5380_host_reset sun3scsi_host_reset#define NCR5380_abort sun3scsi_abort#define NCR5380_info sun3scsi_info
@@ -495,7 +495,7 @@ static int sun3scsi_dma_finish(int write_flag) .info = sun3scsi_info, .queuecommand = sun3scsi_queue_command, .eh_abort_handler = sun3scsi_abort, - .eh_bus_reset_handler = sun3scsi_bus_reset, + .eh_host_reset_handler = sun3scsi_host_reset, .can_queue = 16, .this_id = 7, .sg_tablesize = SG_NONE,
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 19/35 aacraid: split off lun reset function
In reply to Hannes ReineckeThe current host reset function does both, a LUN reset over all LUNs followed by a host reset.
So split them off into individual functions.
--- drivers/scsi/aacraid/linit.c | 70 ++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 29 deletions(-)
drivers/scsi/aacraid/linit.c +41 -29
@@ -815,11 +815,11 @@ static int aac_eh_abort(struct scsi_cmnd* cmd) }/* -* aac_eh_reset - Reset command handling +* aac_eh_lun_reset - LUN reset handling * @scsi_cmd: SCSI command block causing the reset * */ -static int aac_eh_reset (struct scsi_cmnd * cmd) +static int aac_eh_lun_reset (struct scsi_cmnd * cmd) {struct scsi_device * dev = cmd->device;struct Scsi_Host * host = dev->host;
@@ -827,12 +827,6 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)int count;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)); cid =scmd_id (cmd);
@@ -904,26 +898,44 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) }msleep (1000 ); } +return ret; + } -if (ret ==SUCCESS ) - goto out; - - }else { - -/* 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)) { - fib->flags |=FIB_CONTEXT_FLAG_TIMED_OUT ; - cmd->SCp.phase =AAC_OWNER_ERROR_HANDLER ; - } +/* 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) { + fib->flags |=FIB_CONTEXT_FLAG_TIMED_OUT ; + cmd = fib->callback_data; + cmd->SCp.phase =AAC_OWNER_ERROR_HANDLER ; + ret =SUCCESS ; } } +return ret; +} + +/* +* aac_eh_reset - Reset command handling +* @scsi_cmd: SCSI command block causing the reset +* +*/ +static int aac_eh_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 status =0 ; +int count; +__le32 supported_options2 =0 ; +bool is_mu_reset; +bool is_ignore_reset; +bool is_doorbell_reset; +int ret =FAILED ; +pr_err ("%s: Host adapter reset request. SCSI hang ?\n" ,AAC_DRIVERNAME );
@@ -954,11 +966,9 @@ static int aac_eh_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 ); +if (aac_reset_adapter (aac,2 ,IOP_HWSOFT_RESET ) ==0 ) + ret =SUCCESS ; } - ret =SUCCESS ; - -out:return ret; }
@@ -1382,6 +1392,7 @@ 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_device_reset_handler = aac_eh_lun_reset, .eh_host_reset_handler = aac_eh_reset, .can_queue = AAC_NUM_IO_FIB, .this_id = MAXIMUM_NUM_CONTAINERS,
@@ -1807,6 +1818,7 @@ static void aac_flush_ios(struct aac_dev *aac)for (i =0 ; i < aac->scsi_host_ptr->can_queue; i++) { cmd = (struct scsi_cmnd *)aac->fibs[i].callback_data;if (cmd && (cmd->SCp.phase ==AAC_OWNER_FIRMWARE )) { + aac->fibs[i].callback_data =NULL ;scsi_dma_unmap (cmd);if (aac->handle_pci_error)
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 15/35 qlogicpti: move bus reset to host reset
In reply to Hannes ReineckeThe bus reset function really is a host reset, so move it to eh_host_reset_handler().
--- drivers/scsi/qlogicpti.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/qlogicpti.c +2 -3
@@ -1250,10 +1250,9 @@ static int qlogicpti_abort(struct scsi_cmnd *Cmnd)return return_status; } -static int qlogicpti_reset (struct scsi_cmnd *Cmnd) +static int qlogicpti_reset (struct Scsi_Host *host) {u_short param[6 ]; -struct Scsi_Host *host = Cmnd->device->host;struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata;int return_status =SUCCESS ;
@@ -1283,7 +1282,7 @@ static int qlogicpti_reset(struct scsi_cmnd *Cmnd) .queuecommand = qlogicpti_queuecommand, .slave_configure = qlogicpti_slave_configure, .eh_abort_handler = qlogicpti_abort, - .eh_bus_reset_handler = qlogicpti_reset, + .eh_host_reset_handler = qlogicpti_reset, .can_queue = QLOGICPTI_REQ_QUEUE_LEN, .this_id = 7, .sg_tablesize = QLOGICPTI_MAX_SG(QLOGICPTI_REQ_QUEUE_LEN),
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 20/35 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 | 106 ++++++++++++++++++++++-------------- 1 file changed, 65 insertions(+), 41 deletions(-)
drivers/scsi/sym53c8xx_2/sym_glue.c +65 -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,71 @@ 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 sym_data *sym_data =shost_priv (cmd->device->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 25/35 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 | 77 ++++++++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 29 deletions(-)
drivers/message/fusion/mptfc.c +48 -29
@@ -184,73 +184,92 @@ };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 fc_rport *rport =starget_to_rport (scsi_target (SCpnt->device)); +int rtn; + + rtn =mptfc_block_error_handler (rport); +if (rtn ==SUCCESS ) { +dfcprintk (ioc,printk (MYIOC_s_DEBUG_FMT +"%s.%d: %d:%llu, executing recovery.\n" , __func__, + ioc->name, ioc->sh->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 fc_rport *rport =starget_to_rport (scsi_target (SCpnt->device)); +int rtn; + + rtn =mptfc_block_error_handler (rport); +if (rtn ==SUCCESS ) { +dfcprintk (ioc,printk (MYIOC_s_DEBUG_FMT +"%s.%d: %d:%llu, executing recovery.\n" , __func__, + ioc->name, ioc->sh->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 fc_rport *rport =starget_to_rport (scsi_target (SCpnt->device)); +int rtn; + + rtn =mptfc_block_error_handler (rport); +if (rtn ==SUCCESS ) { +dfcprintk (ioc,printk (MYIOC_s_DEBUG_FMT +"%s.%d: %d:%llu, executing recovery.\n" , __func__, + ioc->name, ioc->sh->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 29/35 bnx2fc: remove obsolete bnx2fc_eh_host_reset() definition
In reply to Hannes ReineckeNever used anywhere.
--- drivers/scsi/bnx2fc/bnx2fc.h | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/bnx2fc/bnx2fc.h +0 -1
@@ -538,7 +538,6 @@ 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_host_reset (struct scsi_cmnd *sc_cmd);int bnx2fc_eh_target_reset (struct scsi_cmnd *sc_cmd);int bnx2fc_eh_device_reset (struct scsi_cmnd *sc_cmd); void bnx2fc_rport_event_handler(struct fc_lport *lport,
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 18/35 qlogicfas: move bus_reset to host_reset
In reply to Hannes ReineckeFrom: Hannes Reinecke <[email protected]>
The bus reset handler is really a host reset.
--- drivers/scsi/pcmcia/qlogic_stub.c | 4 ++-- drivers/scsi/qlogicfas.c | 2 +- drivers/scsi/qlogicfas408.c | 2 +- drivers/scsi/qlogicfas408.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
drivers/scsi/pcmcia/qlogic_stub.c +2 -2
@@ -67,7 +67,7 @@ .info = qlogicfas408_info, .queuecommand = qlogicfas408_queuecommand, .eh_abort_handler = qlogicfas408_abort, - .eh_bus_reset_handler = qlogicfas408_bus_reset, + .eh_host_reset_handler = qlogicfas408_host_reset, .bios_param = qlogicfas408_biosparam, .can_queue = 1, .this_id = -1,
@@ -264,7 +264,7 @@ static int qlogic_resume(struct pcmcia_device *link)outb (0x04 , link->resource[0 ]->start +0xd ); }/* Ugggglllyyyy!!! */ -qlogicfas408_bus_reset (NULL ); +qlogicfas408_host_reset (NULL );return 0 ; }
drivers/scsi/qlogicfas.c +1 -1
@@ -188,7 +188,7 @@ static int qlogicfas_release(struct Scsi_Host *shost) .info = qlogicfas408_info, .queuecommand = qlogicfas408_queuecommand, .eh_abort_handler = qlogicfas408_abort, - .eh_bus_reset_handler = qlogicfas408_bus_reset, + .eh_host_reset_handler = qlogicfas408_host_reset, .bios_param = qlogicfas408_biosparam, .can_queue = 1, .this_id = -1,
drivers/scsi/qlogicfas408.c +1 -1
@@ -607,7 +607,7 @@ static void __exit qlogicfas408_exit(void)EXPORT_SYMBOL (qlogicfas408_info);EXPORT_SYMBOL (qlogicfas408_queuecommand);EXPORT_SYMBOL (qlogicfas408_abort); -EXPORT_SYMBOL (qlogicfas408_bus_reset); +EXPORT_SYMBOL (qlogicfas408_host_reset);EXPORT_SYMBOL (qlogicfas408_biosparam);EXPORT_SYMBOL (qlogicfas408_ihandl);EXPORT_SYMBOL (qlogicfas408_get_chip_type);
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); -int qlogicfas408_bus_reset (struct scsi_cmnd * cmd); +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);
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 21/35 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 32/35 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 35/35 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 | 112 +++++++++++++++++----------------------------- 1 file changed, 42 insertions(+), 70 deletions(-)
drivers/scsi/scsi_error.c +42 -70
@@ -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,void *data) +{ + 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,NULL );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,12 @@ static void __scsi_report_device_reset(struct scsi_device *sdev, void *data)* timer on it, and set the host back to a consistent state prior to * returning. */ -static 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_host_template *hostt = host->hostt; -struct scsi_target *starget =scsi_target (scmd->device);if (!hostt->eh_target_reset_handler)return FAILED ;
@@ -836,17 +837,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,NULL );return rtn; }
@@ -878,11 +879,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 +1435,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 +1500,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 +1575,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 +1613,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 ) {
@@ -2260,11 +2262,6 @@ void scsi_report_device_reset(struct Scsi_Host *shost, int channel, int target) }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 +2270,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 +2285,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 +2294,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 +2334,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 23/35 qedf: drop bus reset handler
In reply to Hannes Reineckeqedf has a host reset handler, but as the bus reset handler is a stub always returning SUCCESS the host reset is never invoked. So drop the bus reset handler.
--- drivers/scsi/qedf/qedf_main.c | 11 ----------- 1 file changed, 11 deletions(-)
drivers/scsi/qedf/qedf_main.c +0 -11
@@ -629,16 +629,6 @@ static int qedf_eh_device_reset(struct scsi_cmnd *sc_cmd)return qedf_initiate_tmf (sc_cmd,FCP_TMF_LUN_RESET ); } -static int qedf_eh_bus_reset (struct scsi_cmnd *sc_cmd) -{ -QEDF_ERR (NULL ,"BUS RESET Issued...\n" ); -/* -* Essentially a no-op but return SUCCESS to prevent -* unnecessary escalation to the host reset handler. -*/ -return SUCCESS ; -} -void qedf_wait_for_upload (struct qedf_ctx *qedf) {while (1 ) {
@@ -716,7 +706,6 @@ static int qedf_slave_configure(struct scsi_device *sdev) .eh_abort_handler = qedf_eh_abort, .eh_device_reset_handler = qedf_eh_device_reset, /* lun reset */ .eh_target_reset_handler = qedf_eh_target_reset, /* target reset */ - .eh_bus_reset_handler = qedf_eh_bus_reset, .eh_host_reset_handler = qedf_eh_host_reset, .slave_configure = qedf_slave_configure, .dma_boundary = QED_HW_DMA_BOUNDARY,
Signature · 1 line
1.8.5.6
Hannes Reinecke
maintainerPATCH 26/35 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.
And sets the pointer corectly.
--- 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 31/35 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 22/35 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 | 17 ++++---- drivers/message/fusion/mptscsih.h | 2 +- drivers/s390/scsi/zfcp_scsi.c | 3 +- drivers/scsi/3w-9xxx.c | 11 ++--- drivers/scsi/3w-sas.c | 11 ++--- drivers/scsi/3w-xxxx.c | 11 +++-- drivers/scsi/53c700.c | 15 +++---- drivers/scsi/BusLogic.c | 14 ++---- drivers/scsi/NCR5380.c | 5 +-- drivers/scsi/NCR53c406a.c | 6 +-- drivers/scsi/aacraid/linit.c | 4 +- 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 | 19 ++------- drivers/scsi/eata_pio.c | 29 ++++++------- drivers/scsi/esas2r/esas2r.h | 2 +- drivers/scsi/esas2r/esas2r_main.c | 16 ++++--- drivers/scsi/esp_scsi.c | 4 +- drivers/scsi/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 | 7 ++- drivers/scsi/ipr.c | 4 +- drivers/scsi/ips.c | 40 ++++------------- drivers/scsi/libfc/fc_fcp.c | 5 +-- drivers/scsi/lpfc/lpfc_scsi.c | 3 +- drivers/scsi/mac53c94.c | 8 ++-- drivers/scsi/megaraid.c | 12 +++--- drivers/scsi/megaraid.h | 2 +- drivers/scsi/megaraid/megaraid_mbox.c | 16 ++----- 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 | 14 +++--- drivers/scsi/pcmcia/aha152x_stub.c | 2 +- drivers/scsi/pcmcia/nsp_cs.c | 4 +- drivers/scsi/pcmcia/sym53c500_cs.c | 8 ++-- drivers/scsi/pmcraid.c | 4 +- drivers/scsi/ppa.c | 7 ++- drivers/scsi/qedf/qedf_main.c | 4 +- drivers/scsi/qedi/qedi_iscsi.c | 3 +- drivers/scsi/qla1280.c | 23 ++++++++-- drivers/scsi/qla2xxx/qla_os.c | 17 +++----- drivers/scsi/qla4xxx/ql4_os.c | 16 +++---- drivers/scsi/scsi_debug.c | 16 +++---- drivers/scsi/scsi_error.c | 2 +- drivers/scsi/snic/snic.h | 3 +- drivers/scsi/snic/snic_main.c | 2 +- drivers/scsi/snic/snic_scsi.c | 57 ++++++++----------------- drivers/scsi/stex.c | 7 ++- drivers/scsi/storvsc_drv.c | 4 +- drivers/scsi/sym53c416.c | 16 +++---- drivers/scsi/sym53c8xx_2/sym_glue.c | 4 +- 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 +- 79 files changed, 298 insertions(+), 410 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 +8 -9
@@ -1910,7 +1910,7 @@ int mptscsih_show_info(struct seq_file *m, struct Scsi_Host *host)* 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 +7 -8
@@ -169,7 +169,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_bus_reset(struct scsi_cmnd * SCpnt); -STATIC int NCR_700_host_reset(struct scsi_cmnd * SCpnt); +STATIC int NCR_700_host_reset(struct Scsi_Host *host); STATIC void NCR_700_chip_setup(struct Scsi_Host *host); STATIC void NCR_700_chip_reset(struct Scsi_Host *host); STATIC int NCR_700_slave_alloc(struct scsi_device *SDpnt);
@@ -1975,17 +1975,16 @@ 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) { -scmd_printk (KERN_INFO , SCp,"New error handler wants HOST reset\n\t" ); -scsi_print_command (SCp); +shost_printk (KERN_INFO , shost,"SCSI EH wants HOST reset\n\t" ); -spin_lock_irq (SCp->device->host->host_lock); +spin_lock_irq (host->host_lock); -NCR_700_internal_bus_reset (SCp->device->host); -NCR_700_chip_reset (SCp->device->host); +NCR_700_internal_bus_reset (host); +NCR_700_chip_reset (host); -spin_unlock_irq (SCp->device->host->host_lock); +spin_unlock_irq (host->host_lock);return SUCCESS ; }
drivers/scsi/BusLogic.c +4 -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 +1 -3
@@ -923,10 +923,8 @@ static int aac_eh_lun_reset(struct scsi_cmnd * cmd)* @scsi_cmd: SCSI command block causing the reset * */ -static int aac_eh_reset (struct scsi_cmnd * cmd) +static int aac_eh_reset (struct Scsi_Host * host) { -struct scsi_device * dev = cmd->device; -struct Scsi_Host * host = dev->host;struct aac_dev * aac = (struct aac_dev *)host->hostdata;int status =0 ;int count;
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
@@ -1214,7 +1214,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);
@@ -1223,15 +1223,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
@@ -2165,7 +2165,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
@@ -2176,21 +2176,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" , 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 +4 -15
@@ -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,21 +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 ; -int arg_done =0 ;struct scsi_cmnd *SCpnt; -struct Scsi_Host *shost = SCarg->device->host;struct hostdata *ha = (struct hostdata *)shost->hostdata; -scmd_printk (KERN_INFO , SCarg,"reset, enter.\n" ); +shost_printk (KERN_INFO , shost,"reset, enter.\n" );spin_lock_irq (shost->host_lock); -if (SCarg->host_scribble ==NULL ) -printk ("%s: reset, inactive.\n" , ha->board_name); -if (ha->in_reset) {printk ("%s: reset, exit, already in reset.\n" , ha->board_name);spin_unlock_irq (shost->host_lock);
@@ -1967,9 +1962,6 @@ static int eata2x_eh_host_reset(struct scsi_cmnd *SCarg)if (SCpnt->scsi_done ==NULL )panic ("%s: reset, mbox %d, SCpnt->scsi_done == NULL.\n" , ha->board_name, i); - -if (SCpnt == SCarg) - arg_done =1 ; }if (do_dma (shost->io_port,0 ,RESET_PIO )) {
@@ -2037,10 +2029,7 @@ static int eata2x_eh_host_reset(struct scsi_cmnd *SCarg) ha->in_reset =0 ; do_trace =0 ; -if (arg_done) -printk ("%s: reset, exit, done.\n" , ha->board_name); -else -printk ("%s: reset, exit.\n" , ha->board_name); +printk ("%s: reset, exit.\n" , ha->board_name);spin_unlock_irq (shost->host_lock);return SUCCESS ;
drivers/scsi/eata_pio.c +14 -15
@@ -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
@@ -2616,11 +2616,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, block_rc; -struct ibmvfc_host *vhost =shost_priv (cmd->device->host); +struct ibmvfc_host *vhost =shost_priv (shost);dev_err (vhost->dev,"Resetting connection due to error recovery\n" ); rc =ibmvfc_issue_fc_host_lip (vhost->host);
drivers/scsi/ibmvscsi/ibmvscsi.c +2 -2
@@ -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 -4
@@ -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 */
@@ -1106,7 +1106,6 @@ static int imm_adjust_queue(struct scsi_device *device) .name = "Iomega VPI2 (imm) interface", .queuecommand = imm_queuecommand, .eh_abort_handler = imm_abort, - .eh_bus_reset_handler = imm_reset, .eh_host_reset_handler = imm_reset, .bios_param = imm_biosparam, .this_id = 7,
drivers/scsi/ipr.c +2 -2
@@ -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 -32
@@ -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" );
@@ -865,23 +858,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 */
@@ -1020,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; }
@@ -1105,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 +5 -7
@@ -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 ;
@@ -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;
@@ -1977,7 +1977,7 @@ static DEF_SCSI_QCMD(megaraid_queue)"%s-[%x], driver owner\n" , (aor==SCB_ABORT ) ?"ABORTING" :"RESET" , scb->idx); - + cmd = scb->cmd;mega_free_scb (adapter, scb);if ( aor ==SCB_ABORT ) {
@@ -4180,8 +4180,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, };
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 -12
@@ -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 []);
@@ -341,8 +341,6 @@ static void megaraid_mbox_prepare_epthru(adapter_t *, scb_t *, .proc_name = "megaraid", .queuecommand = megaraid_queue_command, .eh_abort_handler = megaraid_abort_handler, - .eh_device_reset_handler = megaraid_reset_handler, - .eh_bus_reset_handler = megaraid_reset_handler, .eh_host_reset_handler = megaraid_reset_handler, .change_queue_depth = scsi_change_queue_depth, .use_clustering = ENABLE_CLUSTERING,
@@ -2569,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;
@@ -2583,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
@@ -2615,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 ((atomic_t *)&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 +6 -8
@@ -202,7 +202,7 @@/* SCSI error handler */ static int nsp32_eh_abort (struct scsi_cmnd *);static int nsp32_eh_bus_reset (struct scsi_cmnd *); -static int nsp32_eh_host_reset (struct scsi_cmnd *); +static int nsp32_eh_host_reset (struct Scsi_Host *);/* generate SCSI message */ static void nsp32_build_identify (struct scsi_cmnd *);
@@ -2905,23 +2905,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/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 +2 -2
@@ -3096,12 +3096,12 @@ static int pmcraid_eh_target_reset_handler(struct scsi_cmnd *scmd)* Return value * SUCCESS or FAILED */ -static int pmcraid_eh_host_reset_handler (struct scsi_cmnd *scmd) +static int pmcraid_eh_host_reset_handler (struct Scsi_Host *shost) {unsigned long interval =10000 ;/* 10 seconds interval */ int waits =jiffies_to_msecs (PMCRAID_RESET_HOST_TIMEOUT ) / interval;struct pmcraid_instance *pinstance = - (struct pmcraid_instance *)(scmd->device->host->hostdata); + (struct pmcraid_instance *)(shost->hostdata);/* wait for an additional 150 seconds just in case firmware could come
drivers/scsi/ppa.c +3 -4
@@ -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 */
@@ -970,7 +970,6 @@ static int ppa_adjust_queue(struct scsi_device *device) .name = "Iomega VPI0 (ppa) interface", .queuecommand = ppa_queuecommand, .eh_abort_handler = ppa_abort, - .eh_bus_reset_handler = ppa_reset, .eh_host_reset_handler = ppa_reset, .bios_param = ppa_biosparam, .this_id = -1,
drivers/scsi/qedf/qedf_main.c +2 -2
@@ -676,12 +676,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 +19 -4
@@ -1047,13 +1047,28 @@ 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_qla_host *ha = (struct scsi_qla_host *)shost->hostdata; -spin_lock_irq (cmd->device->host->host_lock); - rc =qla1280_error_action (cmd,ADAPTER_RESET ); -spin_unlock_irq (cmd->device->host->host_lock); +spin_lock_irq (shost->host_lock); +if (qla1280_verbose) { +printk (KERN_INFO +"scsi(%ld): Issued ADAPTER RESET\n" , + ha->host_no); +printk (KERN_INFO "scsi(%ld): I/O processing will " +"continue automatically\n" , ha->host_no); + } + ha->flags.reset_active =1 ; + +if (qla1280_abort_isp (ha) !=0 ) {/* it's dead */ + rc =FAILED ; + } + + ha->flags.reset_active =0 ; + +spin_unlock_irq (shost->host_lock);return rc; }
drivers/scsi/qla2xxx/qla_os.c +6 -11
@@ -261,7 +261,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 *);
@@ -1509,13 +1509,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)) {
@@ -1525,11 +1523,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
@@ -1575,8 +1570,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 +7 -9
@@ -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);
@@ -9372,12 +9372,12 @@ static int qla4xxx_is_eh_active(struct Scsi_Host *shost)* This routine is invoked by the Linux kernel to perform fatal error * recovery on the specified adapter. **/ -static int qla4xxx_eh_host_reset (struct scsi_cmnd *cmd) +static int qla4xxx_eh_host_reset (struct Scsi_Host *host) {int return_status =FAILED ;struct scsi_qla_host *ha; - ha =to_qla_host (cmd->device->host); + ha =to_qla_host (host);if ((is_qla8032 (ha) ||is_qla8042 (ha)) && ql4xdontresethba)qla4_83xx_set_idc_dontreset (ha);
@@ -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/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
@@ -379,8 +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_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 +1 -1
@@ -120,7 +120,7 @@ .queuecommand = snic_queuecommand, .eh_abort_handler = snic_abort_cmd, .eh_device_reset_handler = snic_device_reset, - .eh_host_reset_handler = snic_host_reset, + .eh_host_reset_handler = snic_reset, .slave_alloc = snic_slave_alloc, .slave_configure = snic_slave_configure, .change_queue_depth = snic_change_queue_depth,
drivers/scsi/snic/snic_scsi.c +17 -40
108 lines not on this page · raw message
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 +2 -2
@@ -687,9 +687,9 @@ 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 sym_data *sym_data =shost_priv (cmd->device->shost); +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;
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; hostdata = (struct WD33C93_hostdata *) instance->hostdata;printk ("scsi%d: reset. " , instance->host_no);
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 24/35 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
@@ -690,7 +690,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;
@@ -1118,7 +1118,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
@@ -1805,7 +1805,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;
@@ -1817,8 +1817,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);
@@ -1827,7 +1831,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,
@@ -2323,7 +2326,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 ;
@@ -2336,8 +2339,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);
@@ -2347,7 +2354,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
@@ -1197,6 +1197,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;
@@ -1213,7 +1214,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 ;
@@ -1344,9 +1345,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,
@@ -1457,10 +1460,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
@@ -808,7 +808,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 30/35 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
@@ -385,6 +385,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
@@ -1690,7 +1690,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;
@@ -1759,16 +1760,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 34/35 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 | 13 ++-- drivers/infiniband/ulp/srp/ib_srp.c | 8 +-- drivers/message/fusion/mptfc.c | 10 +-- drivers/message/fusion/mptscsih.c | 19 +++--- drivers/message/fusion/mptscsih.h | 2 +- drivers/s390/scsi/zfcp_scsi.c | 4 +- drivers/scsi/a100u2w.c | 47 ++++--------- drivers/scsi/aacraid/linit.c | 61 ++++++++++++----- drivers/scsi/aha152x.c | 4 +- drivers/scsi/aha1542.c | 8 +-- drivers/scsi/aic7xxx/aic79xx_osm.c | 54 ++++++++------- drivers/scsi/aic7xxx/aic7xxx_osm.c | 90 +++++++++++++------------ drivers/scsi/arm/fas216.c | 54 +++++++-------- drivers/scsi/be2iscsi/be_main.c | 8 +-- drivers/scsi/bfa/bfad_im.c | 9 ++- drivers/scsi/bnx2fc/bnx2fc.h | 2 +- drivers/scsi/bnx2fc/bnx2fc_io.c | 6 +- drivers/scsi/csiostor/csio_scsi.c | 39 ++++++----- 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_main.c | 2 + drivers/scsi/fnic/fnic_scsi.c | 77 +++++++-------------- drivers/scsi/hpsa.c | 14 ++-- drivers/scsi/ibmvscsi/ibmvfc.c | 5 +- drivers/scsi/ibmvscsi/ibmvscsi.c | 17 ++--- 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 | 61 +++++++---------- 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 | 42 +++++------- drivers/scsi/sym53c8xx_2/sym_glue.c | 60 ++++++++++++----- 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 | 12 +++- 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 +- 62 files changed, 545 insertions(+), 549 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 +5 -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,20 @@ 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, sdev->channel, sdev->id, sdev->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 +5 -5
@@ -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 = {
@@ -239,9 +239,9 @@ }static int -mptfc_dev_reset (struct scsi_cmnd *SCpnt) +mptfc_dev_reset (struct scsi_device *sdev) { -struct fc_rport *rport =starget_to_rport (scsi_target (SCpnt->device)); +struct fc_rport *rport =starget_to_rport (scsi_target (sdev));int rtn; rtn =mptfc_block_error_handler (rport);
@@ -249,8 +249,8 @@dfcprintk (ioc,printk (MYIOC_s_DEBUG_FMT"%s.%d: %d:%llu, executing recovery.\n" , __func__, ioc->name, ioc->sh->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 +13 -34
102 lines not on this page · raw message
drivers/scsi/aacraid/linit.c +45 -16
127 lines not on this page · raw message
drivers/scsi/aha152x.c +2 -2
@@ -1052,9 +1052,9 @@ 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_Host *shpnt = sdev->host;DECLARE_COMPLETION (done);int ret, issued, disconnected;unsigned char old_cmd_len = SCpnt->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 +29 -25
125 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_osm.c +47 -43
216 lines not on this page · raw message
drivers/scsi/arm/fas216.c +26 -28
126 lines not on this page · raw message
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 +6 -3
@@ -299,12 +299,12 @@ 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_Host *shost = cmnd->device->host; +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;
@@ -314,6 +314,7 @@ static void bfad_im_fc_rport_add(struct bfad_im_port_s *im_port,unsigned long flags;enum bfi_tskim_status task_status;struct scsi_lun scsilun; +struct scsi_cmnd tmf_cmnd, *cmnd = &tmf_cmnd;spin_lock_irqsave (&bfad->bfad_lock, flags); itnim = itnim_data->itnim;
@@ -339,6 +340,8 @@ static void bfad_im_fc_rport_add(struct bfad_im_port_s *im_port, cmnd->host_scribble =NULL ; cmnd->SCp.ptr = (char *)&wq; cmnd->SCp.Status =0 ; + cmnd->device = sdev; + cmnd->request =NULL ; bfa_itnim =bfa_fcs_itnim_get_halitn (&itnim->fcs_itnim);/* * bfa_itnim can be NULL if the port gets disconnected and the bfa
drivers/scsi/bnx2fc/bnx2fc.h +1 -1
@@ -540,7 +540,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
@@ -1073,12 +1073,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 +21 -18
@@ -2058,14 +2058,15 @@ 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 csio_lnode *ln =shost_priv (cmnd->device->host); +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); -struct csio_rnode *rn = (struct csio_rnode *)(cmnd->device->hostdata); +struct csio_rnode *rn = (struct csio_rnode *)(sdev->hostdata);struct csio_ioreq *ioreq =NULL ;struct csio_scsi_qset *sqset; +struct scsi_cmnd tmf_cmnd;unsigned long flags;int retval;int count, ret;
@@ -2076,13 +2077,13 @@ static DEVICE_ATTR(dbg_level, S_IRUGO | S_IWUSR, csio_show_dbg_level, goto fail;csio_dbg (hw,"Request to reset LUN:%llu (ssni:0x%x tgtid:%d)\n" , - cmnd->device->lun, rn->flowid, rn->scsi_id); + sdev->lun, rn->flowid, rn->scsi_id);if (!csio_is_lnode_ready (ln)) {csio_err (hw,"LUN reset cannot be issued on non-ready" " local node vnpi:0x%x (LUN:%llu)\n" , - ln->vnp_flowid, cmnd->device->lun); + ln->vnp_flowid, sdev->lun); goto fail; }
@@ -2102,7 +2103,7 @@ static DEVICE_ATTR(dbg_level, S_IRUGO | S_IWUSR, csio_show_dbg_level,csio_err (hw,"LUN reset cannot be issued on non-ready" " remote node ssni:0x%x (LUN:%llu)\n" , - rn->flowid, cmnd->device->lun); + rn->flowid, sdev->lun); goto fail; }
@@ -2122,11 +2123,13 @@ static DEVICE_ATTR(dbg_level, S_IRUGO | S_IWUSR, csio_show_dbg_level, ioreq->iq_idx = sqset->iq_idx; ioreq->eq_idx = sqset->eq_idx; -csio_scsi_cmnd (ioreq) = cmnd; - cmnd->host_scribble = (unsigned char *)ioreq; - cmnd->SCp.Status =0 ; +csio_scsi_cmnd (ioreq) = &tmf_cmnd; + tmf_cmnd.host_scribble = (unsigned char *)ioreq; + tmf_cmnd.SCp.Status =0 ; + tmf_cmnd.device = sdev; + tmf_cmnd.request =NULL ; - cmnd->SCp.Message =FCP_TMF_LUN_RESET ; + tmf_cmnd.SCp.Message =FCP_TMF_LUN_RESET ; ioreq->tmo =CSIO_SCSI_LUNRST_TMO_MS /1000 ;/*
@@ -2143,7 +2146,7 @@ static DEVICE_ATTR(dbg_level, S_IRUGO | S_IWUSR, csio_show_dbg_level, sld.level =CSIO_LEV_LUN ; sld.lnode = ioreq->lnode; sld.rnode = ioreq->rnode; - sld.oslun = cmnd->device->lun; + sld.oslun = sdev->lun;spin_lock_irqsave (&hw->lock, flags);/* Kick off TM SM on the ioreq */
@@ -2159,14 +2162,14 @@ 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" , - cmnd->device->id, cmnd->device->lun); + sdev->id, sdev->lun);spin_lock_irq (&hw->lock);csio_scsi_drvcleanup (ioreq);
@@ -2177,9 +2180,9 @@ static DEVICE_ATTR(dbg_level, S_IRUGO | S_IWUSR, csio_show_dbg_level, }/* LUN reset returned, check cached status */ -if (cmnd->SCp.Status !=FW_SUCCESS ) { +if (tmf_cmnd.SCp.Status !=FW_SUCCESS ) {csio_err (hw,"LUN reset failed (%d:%llu), status: %d\n" , - cmnd->device->id, cmnd->device->lun, cmnd->SCp.Status); + sdev->id, sdev->lun, tmf_cmnd.SCp.Status); goto fail; }
@@ -2199,7 +2202,7 @@ static DEVICE_ATTR(dbg_level, S_IRUGO | S_IWUSR, csio_show_dbg_level,if (retval !=0 ) {csio_err (hw,"Attempt to abort I/Os during LUN reset of %llu" -" returned %d\n" , cmnd->device->lun, retval); +" returned %d\n" , sdev->lun, retval);/* Return I/Os back to active_q */ spin_lock_irq (&hw->lock);list_splice_tail_init (&local_q, &scsim->active_q);
@@ -2210,7 +2213,7 @@ static DEVICE_ATTR(dbg_level, S_IRUGO | S_IWUSR, csio_show_dbg_level,CSIO_INC_STATS (rn, n_lun_rst);csio_info (hw,"LUN reset occurred (%d:%llu)\n" , - cmnd->device->id, cmnd->device->lun); + sdev->id, sdev->lun);return SUCCESS ;
drivers/scsi/cxlflash/main.c +5 -10
@@ -2121,28 +2121,23 @@ static void drain_ioctls(struct cxlflash_cfg *cfg)/** * 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_main.c +2 -0
@@ -696,6 +696,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 +23 -54
139 lines not on this page · raw message
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 +9 -8
@@ -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 ;
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
@@ -1015,13 +1015,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 +25 -36
106 lines not on this page · raw message
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
@@ -378,7 +378,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_reset (struct Scsi_Host *);void snic_shutdown_scsi_cleanup (struct snic *);
drivers/scsi/snic/snic_scsi.c +16 -26
69 lines not on this page · raw message
drivers/scsi/sym53c8xx_2/sym_glue.c +45 -15
73 lines not on this page · raw message
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 +9 -3
@@ -212,7 +212,8 @@ static int scsifront_do_request(struct vscsifrnt_info *info,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->timeout_per_command = + sc->request ? sc->request->timeout /HZ :30 *HZ ;for (i =0 ; i < (shadow->nr_segments & ~VSCSIIF_SG_GRANT ); i++) ring_req->seg[i] = shadow->seg[i];
@@ -645,10 +646,15 @@ static int scsifront_eh_abort_handler(struct scsi_cmnd *sc)return scsifront_action_handler (sc,VSCSIIF_ACT_SCSI_ABORT ); } -static int scsifront_dev_reset_handler (struct scsi_cmnd *sc) +static int scsifront_dev_reset_handler (struct scsi_device *sdev) { +struct scsi_cmnd sc; +pr_debug ("%s\n" , __func__); -return scsifront_action_handler (sc,VSCSIIF_ACT_SCSI_RESET ); +memset (&sc,0 ,sizeof (sc)); + sc->device = sdev; + sc->cmd_len =6 ; +return scsifront_action_handler (&sc,VSCSIIF_ACT_SCSI_RESET ); }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
Hannes Reinecke
maintainerPATCH 33/35 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/be2iscsi/be_main.c | 4 +-- drivers/scsi/bfa/bfad_im.c | 16 +++++---- 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 | 7 ++-- drivers/scsi/libiscsi.c | 4 +-- drivers/scsi/libsas/sas_scsi_host.c | 9 +++--- drivers/scsi/lpfc/lpfc_scsi.c | 44 ++++++++++++------------- 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.h | 5 +-- drivers/scsi/qedf/qedf_io.c | 48 ++++++++++++--------------- drivers/scsi/qedf/qedf_main.c | 10 ++++-- drivers/scsi/qla2xxx/qla_mbx.c | 1 - drivers/scsi/qla2xxx/qla_os.c | 50 ++++++++++++++++++++++++++--- 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/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 +- 34 files changed, 301 insertions(+), 219 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/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 +10 -6
@@ -376,22 +376,26 @@ 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_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; +struct scsi_cmnd tmf_cmnd, *cmnd = &tmf_cmnd;spin_lock_irqsave (&bfad->bfad_lock, flags); - itnim =bfad_get_itnim (im_port, starget->id); -if (itnim) { +if (rport->dd_data) { + itnim_data = rport->dd_data; + itnim = itnim_data->itnim; + cmnd->SCp.ptr = (char *)&wq; rc =bfad_im_target_reset_send (bfad, cmnd, itnim);if (rc ==BFA_STATUS_OK ) {
drivers/scsi/bnx2fc/bnx2fc.h +1 -1
@@ -539,7 +539,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
@@ -1057,9 +1057,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 +3 -4
@@ -2494,12 +2494,11 @@ static void ibmvfc_dev_cancel_all_reset(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_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); +struct Scsi_Host *shost =rport_to_shost (rport); +struct ibmvfc_host *vhost =shost_priv (sdev->host);int block_rc;int reset_rc =0 ;int rc =FAILED ;
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 +20 -24
121 lines not on this page · raw message
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.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 -3
@@ -617,16 +617,20 @@ 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 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)
drivers/scsi/qla2xxx/qla_mbx.c +0 -1
@@ -1337,7 +1337,6 @@ static int is_rom_cmd(uint16_t cmd)struct req_que *req;struct rsp_que *rsp; - l = l; vha = fcport->vha; ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x103e,
drivers/scsi/qla2xxx/qla_os.c +45 -5
70 lines not on this page · raw message
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/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 27/35 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 | 31 +++++++++++----- drivers/message/fusion/mptscsih.c | 21 +++++------ drivers/message/fusion/mptscsih.h | 2 +- drivers/scsi/53c700.c | 36 ++++++++++--------- drivers/scsi/a100u2w.c | 4 +-- drivers/scsi/aha152x.c | 4 +-- drivers/scsi/aha1542.c | 4 +-- drivers/scsi/aic7xxx/aic79xx_osm.c | 10 +++--- drivers/scsi/aic7xxx/aic7xxx_osm.c | 6 ++-- drivers/scsi/arcmsr/arcmsr_hba.c | 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/nsp32.c | 12 +++---- drivers/scsi/pcmcia/nsp_cs.c | 6 ++-- drivers/scsi/pmcraid.c | 47 ++++++++++++++++++++----- drivers/scsi/qla1280.c | 10 +++--- drivers/scsi/qla2xxx/qla_os.c | 29 ++++----------- drivers/scsi/qlogicfas408.c | 4 +-- 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 +- 37 files changed, 215 insertions(+), 204 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 +22 -9
@@ -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 ,
@@ -256,18 +256,31 @@ }static int -mptfc_bus_reset (struct scsi_cmnd *SCpnt) +mptfc_bus_reset (struct Scsi_Host *shost,int channel) { -struct fc_rport *rport =starget_to_rport (scsi_target (SCpnt->device)); +MPT_SCSI_HOST *hd; +MPT_ADAPTER *ioc; +struct mptfc_rport_info *ri;int rtn; - rtn =mptfc_block_error_handler (rport); -if (rtn ==SUCCESS ) { + hd =shost_priv (shost); + ioc = hd->ioc; +list_for_each_entry (ri, &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 (ioc,printk (MYIOC_s_DEBUG_FMT -"%s.%d: %d:%llu, executing recovery.\n" , __func__, - ioc->name, ioc->sh->host_no, - SCpnt->device->id, SCpnt->device->lun)); - rtn =mptscsih_bus_reset (SCpnt); +"%s.%d: executing recovery.\n" , __func__, + ioc->name, ioc->sh->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/53c700.c +19 -17
@@ -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_bus_reset(struct scsi_cmnd * SCpnt); +STATIC int NCR_700_bus_reset(struct Scsi_Host *host, int channel); 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);
@@ -1938,39 +1938,41 @@ STATIC DEF_SCSI_QCMD(NCR_700_queuecommand) } STATIC int -NCR_700_bus_reset (struct scsi_cmnd * SCp) +NCR_700_bus_reset (struct Scsi_Host *shost,int channel) {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 *)shost->hostdata[0 ]; +struct scsi_device *sdev; -scmd_printk (KERN_INFO , SCp, -"New error handler wants BUS reset, cmd %p\n\t" , SCp); -scsi_print_command (SCp); +shost_printk (KERN_INFO , shost, +"New error handler wants BUS 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 (shost->host_lock);while (hostdata->eh_complete !=NULL ) { -spin_unlock_irq (SCp->device->host->host_lock); +spin_unlock_irq (shost->host_lock);msleep_interruptible (100 ); -spin_lock_irq (SCp->device->host->host_lock); +spin_lock_irq (shost->host_lock); } hostdata->eh_complete = &complete; -NCR_700_internal_bus_reset (SCp->device->host); +NCR_700_internal_bus_reset (shost); -spin_unlock_irq (SCp->device->host->host_lock); +spin_unlock_irq (shost->host_lock);wait_for_completion (&complete); -spin_lock_irq (SCp->device->host->host_lock); +spin_lock_irq (shost->host_lock); hostdata->eh_complete =NULL ; -/* Revalidate the transport parameters of the failing device */ -if (hostdata->fast) -spi_schedule_dv_device (SCp->device); +/* Revalidate the transport parameters of the attached devices */ +if (hostdata->fast) { +shost_for_each_device (sdev, shost) +spi_schedule_dv_device (sdev); + } -spin_unlock_irq (SCp->device->host->host_lock); +spin_unlock_irq (shost->host_lock);return SUCCESS ; }
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/aha152x.c +2 -2
@@ -1168,9 +1168,9 @@ static int aha152x_bus_reset_host(struct Scsi_Host *shpnt)* Reset the bus * */ -static int aha152x_bus_reset (Scsi_Cmnd *SCpnt) +static int aha152x_bus_reset (struct Scsi_Host *shpnt,int channel) { -return aha152x_bus_reset_host (SCpnt->device->host); +return aha152x_bus_reset_host (shpnt, channel); }/*
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/nsp32.c +6 -6
@@ -2845,21 +2845,21 @@ static int nsp32_eh_abort(struct scsi_cmnd *SCpnt)return SUCCESS ; } -static int nsp32_eh_bus_reset (struct scsi_cmnd *SCpnt) +static int nsp32_eh_bus_reset (struct Scsi_Host *host,int channel) { -nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata; -unsigned int base = SCpnt->device->host->io_port; +nsp32_hw_data *data = (nsp32_hw_data *)host->hostdata; +unsigned int base = host->io_port; -spin_lock_irq (SCpnt->device->host->host_lock); +spin_lock_irq (host->host_lock); -nsp32_msg (KERN_INFO ,"Bus Reset" ); +nsp32_msg (KERN_INFO ,"Bus Reset" );nsp32_dbg (NSP32_DEBUG_BUSRESET ,"SCpnt=0x%x" , SCpnt);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 ;/* SCSI bus reset is succeeded at any time. */ }
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 +38 -9
79 lines not on this page · raw message
drivers/scsi/qla1280.c +6 -4
@@ -1031,13 +1031,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
@@ -260,7 +260,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 *);
@@ -1438,13 +1438,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)) {
@@ -1453,22 +1450,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,
@@ -1492,8 +1475,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/qlogicfas408.c +2 -2
@@ -502,9 +502,9 @@ int qlogicfas408_abort(struct scsi_cmnd *cmd)* the PCMCIA qlogic_stub code. This wants fixing */ -int qlogicfas408_bus_reset (struct scsi_cmnd *cmd) +int qlogicfas408_host_reset (struct Scsi_Host *shost) { -struct qlogicfas408_priv *priv =get_priv_by_cmd (cmd); +struct qlogicfas408_priv *priv =get_priv_by_host (shost);unsigned long flags; priv->qabort =2 ;
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 28/35 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
Re: [PATCH 01/35] scsi: fix comment in scsi_device_set_state()
In reply to Hannes ReineckeQuoted 2 lines · Hannes Reinecke
The function returns '0' if successful; with the original comment the function doesn't have a way to indicate success ...
Re: [PATCH 22/35] scsi: Use Scsi_Host as argument for eh_host_reset_handler
In reply to Hannes ReineckeQuoted 38 lines · Hannes Reinecke
drivers/scsi/eata.c +3
-8@@ -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,21 +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 ; -int arg_done =0 ;struct scsi_cmnd *SCpnt; -struct Scsi_Host *shost = SCarg->device->host;struct hostdata *ha = (struct hostdata *)shost->hostdata; -scmd_printk (KERN_INFO , SCarg,"reset, enter.\n" ); +shost_printk (KERN_INFO , shost,"reset, enter.\n" );spin_lock_irq (shost->host_lock); -if (SCarg->host_scribble ==NULL ) -printk ("%s: reset, inactive.\n" , ha->board_name); -if (ha->in_reset) {printk ("%s: reset, exit, already in reset.\n" , ha->board_name);spin_unlock_irq (shost->host_lock);
drivers/scsi/eata.c static int eata2x_eh_host_reset(struct scsi_cmnd *SCarg) · line 1967
Quoted 9 lines
drivers/scsi/eata.c +0
-3@@ -1967,9 +1962,6 @@ static int eata2x_eh_host_reset(struct scsi_cmnd *SCarg)if (SCpnt->scsi_done ==NULL )panic ("%s: reset, mbox %d, SCpnt->scsi_done == NULL.\n" , ha->board_name, i); - -if (SCpnt == SCarg) - arg_done =1 ; }if (do_dma (shost->io_port,0 ,RESET_PIO )) {
Please isolate the "arg_done" removal into a separate patch.
Quoted 14 lines
drivers/scsi/eata.c +0
-10@@ -865,23 +858,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 ); - }
drivers/scsi/eata.c static int __ips_eh_reset(struct scsi_cmnd *SC) · line 863
Quoted 10 lines
drivers/scsi/eata.c +0
-7- -/* 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 */
Shouldn't this change be isolated into a separate patch too?
Quoted 39 lines
drivers/scsi/megaraid.c +4
-4@@ -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 ;@@ -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;
drivers/scsi/megaraid.c static DEF_SCSI_QCMD(megaraid_queue) · line 1981
Quoted 6 lines
drivers/scsi/megaraid.c +1
-1@@ -1977,7 +1977,7 @@ static DEF_SCSI_QCMD(megaraid_queue)"%s-[%x], driver owner\n" , (aor==SCB_ABORT ) ?"ABORTING" :"RESET" , scb->idx); - + cmd = scb->cmd;mega_free_scb (adapter, scb);
This looks weird. Assigning scb->cmd to cmd will cause megaraid_abort_and_reset() to abort or reset the first command on pending_list if the cmd argument is NULL. If the cmd argument is NULL, shouldn't all commands on pending_list be aborted or reset?
Quoted 10 lines
drivers/scsi/megaraid.c +1
-1-static int megasas_reset_bus_host (struct scsi_cmnd *scmd) +static int megasas_reset_bus_host (struct Scsi_Host *shost) {drivers/scsi/megaraid.c +1
-2int ret;struct megasas_instance *instance; - instance = (struct megasas_instance *)scmd->device->host->hostdata; + instance = (struct megasas_instance *)shost->hostdata; - scmd_printk(KERN_INFO, scmd,
drivers/scsi/megaraid.c
Quoted 10 lines
drivers/scsi/megaraid.c +4
-3+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 ((atomic_t *)&shost->host_busy),atomic_read (&instance->fw_outstanding));
Since host_busy already has type atomic_t and since you have to touch this code anyway, how about leaving out the (atomic_t *) cast?
Quoted 25 lines
drivers/scsi/qla1280.c +12
-4@@ -1047,13 +1047,28 @@ 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_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 ; +
drivers/scsi/qla1280.c static void qla1280_mailbox_timeout(unsigned long __data) · line 1074
Quoted 10 lines
drivers/scsi/qla1280.c +7
-0+if (qla1280_abort_isp (ha) !=0 ) {/* it's dead */ + rc =FAILED ; + } + + ha->flags.reset_active =0 ; + +spin_unlock_irq (shost->host_lock);return rc; }
This change introduces some code duplication. Have you considered to isolate the ADAPTER_RESET code from qla1280_error_action() into a new function in a separate patch such that that new function can be called here instead of duplicating the ADAPTER_RESET code?
Bart.
RE: [PATCH 19/35] aacraid: split off lun reset function
In reply to Hannes Reinecke-----Original Message-----
Quoted 9 lines
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Hannes Reinecke
Sent: Friday, June 23, 2017 7:03 AM
To: Martin K. Petersen <[email protected]>
Cc: Christoph Hellwig <[email protected]>; James Bottomley <[email protected]>; [email protected]; Hannes Reinecke <[email protected]>; Hannes Reinecke <[email protected]>
Subject: [PATCH 19/35] aacraid: split off lun reset function
Quoted 3 lines
The current host reset function does both, a LUN reset over all LUNs followed by a host reset.
So split them off into individual functions.
Hi Hannes,
I don't have a problem with breaking out the two functions, however the LUN reset only affects the current scmd, while your change will affect anything that has callback data, which may or may not be an scmd. In addition it is impacting the whole controller, not just the device affected by the input scmd ...
Thanks, -Dave
Quoted 34 lines
Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/aacraid/linit.c | 70 ++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 29 deletions(-)drivers/scsi/aacraid/linit.c index renamed from drivers/scsi/aacraid/linit.c +0
-00f277df..bbacbf2 100644
drivers/scsi/aacraid/linit.c +14
-6@@ -815,11 +815,11 @@ static int aac_eh_abort(struct scsi_cmnd* cmd) } -if (fib->hw_fib_va->header.XferState && - (fib->flags &FIB_CONTEXT_FLAG ) && - (fib->callback_data == cmd)) { << only affects one scmd - fib->flags |=FIB_CONTEXT_FLAG_TIMED_OUT ; - cmd->SCp.phase =AAC_OWNER_ERROR_HANDLER ; - } +/* 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) { << affects anything with callback data + fib->flags |= FIB_CONTEXT_FLAG_TIMED_OUT; + cmd = fib->callback_data; + cmd->SCp.phase =AAC_OWNER_ERROR_HANDLER ; + ret =SUCCESS ; } } +return ret; +}
Re: [PATCH 32/35] zfcp: use scsi device as argument for zfcp_task_mgmt_function()
In reply to Hannes ReineckeQuoted 3 lines · Hannes Reinecke
zfcp_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.
There are multiple changes in this patch which makes this patch harder to review than necessary. Please split this patch, e.g. as follows:
* one patch that removes the "tm_flags" argument from zfcp_fc_scsi_to_fcp() and inlines the tm_flags != 0 case.
* another patch that adds the struct scsi_device * argument to zfcp_fsf_fcp_handler_common().
* a third patch that changes the first argument of zfcp_task_mgmt_function() from struct scsi_cmnd * into struct scsi_device *.
Thanks,
Bart.
Re: [PATCH 35/35] scsi: Do not allocate scsi command in scsi_ioctl_reset()
In reply to Hannes ReineckeQuoted 3 lines · Hannes Reinecke
As we now have moved the error handler functions to not rely on a scsi command we can drop the out-of-band scsi command allocation from
scsi_ioctl_reset().
I'm glad that that command allocation is gone :-)
Re: [PATCH 33/35] scsi: Use scsi_target as argument for eh_target_reset_handler()
In reply to Hannes Reineckedrivers/s390/scsi/zfcp_scsi.c static int zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt) · line 316
Quoted 6 lines · Hannes Reinecke
drivers/s390/scsi/zfcp_scsi.c +5
-1-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)
A minor comment: I assume that "supports" should have been "support"?
Quoted 13 lines
drivers/scsi/pmcraid.c +10
-2-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 ; + }
drivers/scsi/pmcraid.c static int pmcraid_eh_bus_reset_handler(struct Scsi_Host *host, int channel) · line 3128
Quoted 10 lines
drivers/scsi/pmcraid.c +5
-1+ } +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 ); }
Is this sdev_printk() statement really useful? If any kernel messages are reported due to a reset, shouldn't that be done by the SCSI core instead of by a SCSI LLD?
drivers/scsi/qla2xxx/qla_mbx.c static int is_rom_cmd(uint16_t cmd) · line 1342
Quoted 13 lines
void
qedf_wait_for_upload(struct qedf_ctx *qedf)drivers/scsi/qla2xxx/qla_mbx.c +0
-1@@ -1337,7 +1337,6 @@ static int is_rom_cmd(uint16_t cmd)struct req_que *req;struct rsp_que *rsp; - l = l; vha = fcport->vha; ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x103e,
That's a real gem ...
Although I'm not familiar enough with all the drivers that are modified by this patch to do an in-depth review, as far as I can see the changes in this patch look fine to me. Hence:
Re: [PATCH 34/35] scsi: Move eh_device_reset_handler() to use scsi_device as argument
In reply to Hannes ReineckeQuoted 3 lines · Hannes Reinecke
When resetting a device we shouldn't depend on an existing SCSI device, so use 'struct
scsi_device' as argument foreh_device_reset_handler().
Did you perhaps mean "existing SCSI command"?
Also for this patch, I'm not familiar enough with all the SCSI LLDs that have been modified to do an in-depth review. But since I agree with the direction of this patch:
kbuild test robot
build botRe: [PATCH 12/35] fdomain: move bus reset to host reset
In reply to Hannes Reineckereproduce:
Hi Hannes,
[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on v4.12-rc6 next-20170623]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Hannes-Reinecke/SCSI-EH-argument-reshuffling/20170624-071433 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next config: i386-randconfig-x072-06180431 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386
All errors (new ones prefixed by >>):
drivers/scsi/pcmcia/fdomain_stub.c: In function 'fdomain_resume':
>> drivers/scsi/pcmcia/fdomain_stub.c:176:2: error: implicit declaration of function 'fdomain_16x0_bus_reset' [-Werror=implicit-function-declaration]
fdomain_16x0_bus_reset(NULL);
^~~~~~~~~~~~~~~~~~~~~~cc1: some warnings being treated as errors
vim +/fdomain_16x0_bus_reset +176 drivers/scsi/pcmcia/fdomain_stub.c
^1da177e Linus Torvalds 2005-04-16 170 }
^1da177e Linus Torvalds 2005-04-16 171
^1da177e Linus Torvalds 2005-04-16 172 /*====================================================================*/
^1da177e Linus Torvalds 2005-04-16 173
fba395ee Dominik Brodowski 2006-03-31 174 static int fdomain_resume(struct pcmcia_device *link)
98e4c28b Dominik Brodowski 2005-11-14 175 {
98e4c28b Dominik Brodowski 2005-11-14 @176 fdomain_16x0_bus_reset(NULL);
98e4c28b Dominik Brodowski 2005-11-14 177
98e4c28b Dominik Brodowski 2005-11-14 178 return 0;
98e4c28b Dominik Brodowski 2005-11-14 179 }:::::: The code at line 176 was first introduced by commit
:::::: 98e4c28b7ec390c2dad6a4c69d69629c0f7e8b10 [PATCH] pcmcia: new suspend core
:::::: TO: Dominik Brodowski <[email protected]> :::::: CC: Dominik Brodowski <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botRe: [PATCH 22/35] scsi: Use Scsi_Host as argument for eh_host_reset_handler
In reply to Hannes Reineckereproduce:
Hi Hannes,
[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on next-20170623]
[cannot apply to v4.12-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Hannes-Reinecke/SCSI-EH-argument-reshuffling/20170624-071433 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next config: i386-randconfig-x004-201725 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386
All errors (new ones prefixed by >>):
In file included from drivers/scsi/53c700.c:140:0:
drivers/scsi/53c700.c: In function 'NCR_700_host_reset':
>> drivers/scsi/53c700.c:1980:26: error: 'shost' undeclared (first use in this function)
shost_printk(KERN_INFO, shost, "SCSI EH wants HOST reset\n\t");
^
include/scsi/scsi_host.h:747:23: note: in definition of macro 'shost_printk'
dev_printk(prefix, &(shost)->shost_gendev, fmt, ##a)
^~~~~
drivers/scsi/53c700.c:1980:26: note: each undeclared identifier is reported only once for each function it appears in
shost_printk(KERN_INFO, shost, "SCSI EH wants HOST reset\n\t");
^
include/scsi/scsi_host.h:747:23: note: in definition of macro 'shost_printk'
dev_printk(prefix, &(shost)->shost_gendev, fmt, ##a)
^~~~~
--
drivers/scsi/sym53c416.c: In function 'sym53c416_info':
drivers/scsi/sym53c416.c:723:6: warning: unused variable 'i' [-Wunused-variable]
int i;
^
drivers/scsi/sym53c416.c: At top level:
>> drivers/scsi/sym53c416.c:762:12: error: conflicting types for 'sym53c416_host_reset'
static int sym53c416_host_reset(struct Scsi_Host *SChost)
^~~~~~~~~~~~~~~~~~~~
In file included from drivers/scsi/sym53c416.c:45:0:
drivers/scsi/sym53c416.h:29:12: note: previous declaration of 'sym53c416_host_reset' was here
static int sym53c416_host_reset(Scsi_Cmnd *);
^~~~~~~~~~~~~~~~~~~~
drivers/scsi/sym53c416.c: In function 'sym53c416_host_reset':
drivers/scsi/sym53c416.c:766:6: warning: unused variable 'i' [-Wunused-variable]
int i;
^vim +/shost +1980 drivers/scsi/53c700.c
1974 return SUCCESS;
1975 }
1976
1977 STATIC int
1978 NCR_700_host_reset(struct Scsi_Host * host)
1979 {
> 1980 shost_printk(KERN_INFO, shost, "SCSI EH wants HOST reset\n\t");
1981
1982 spin_lock_irq(host->host_lock);
1983
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botRe: [PATCH 27/35] scsi: Use Scsi_Host and channel number as argument for eh_bus_reset_handler()
In reply to Hannes Reineckereproduce:
Hi Hannes,
[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on next-20170623]
[cannot apply to v4.12-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Hannes-Reinecke/SCSI-EH-argument-reshuffling/20170624-071433 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next config: i386-randconfig-x070-06180431 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386
All error/warnings (new ones prefixed by >>):
In file included from include/linux/seqlock.h:35:0,
from include/linux/time.h:5,
from include/linux/stat.h:18,
from include/linux/module.h:10,
from drivers/scsi/qlogicfas408.c:42:
drivers/scsi/qlogicfas408.c: In function 'qlogicfas408_host_reset':
>> drivers/scsi/qlogicfas408.c:512:20: error: 'cmd' undeclared (first use in this function)
spin_lock_irqsave(cmd->device->host->host_lock, flags);
^
include/linux/spinlock.h:205:34: note: in definition of macro 'raw_spin_lock_irqsave'
flags = _raw_spin_lock_irqsave(lock); \
^~~~
>> drivers/scsi/qlogicfas408.c:512:2: note: in expansion of macro 'spin_lock_irqsave'
spin_lock_irqsave(cmd->device->host->host_lock, flags);
^~~~~~~~~~~~~~~~~
drivers/scsi/qlogicfas408.c:512:20: note: each undeclared identifier is reported only once for each function it appears in
spin_lock_irqsave(cmd->device->host->host_lock, flags);
^
include/linux/spinlock.h:205:34: note: in definition of macro 'raw_spin_lock_irqsave'
flags = _raw_spin_lock_irqsave(lock); \
^~~~
>> drivers/scsi/qlogicfas408.c:512:2: note: in expansion of macro 'spin_lock_irqsave'
spin_lock_irqsave(cmd->device->host->host_lock, flags);
^~~~~~~~~~~~~~~~~vim +/cmd +512 drivers/scsi/qlogicfas408.c
^1da177e Linus Torvalds 2005-04-16 506 {
2a03ede9 Hannes Reinecke 2017-06-23 507 struct qlogicfas408_priv *priv = get_priv_by_host(shost);
68b3aa7c Jeff Garzik 2005-05-28 508 unsigned long flags;
68b3aa7c Jeff Garzik 2005-05-28 509
^1da177e Linus Torvalds 2005-04-16 510 priv->qabort = 2;
68b3aa7c Jeff Garzik 2005-05-28 511
68b3aa7c Jeff Garzik 2005-05-28 @512 spin_lock_irqsave(cmd->device->host->host_lock, flags);
^1da177e Linus Torvalds 2005-04-16 513 ql_zap(priv);
68b3aa7c Jeff Garzik 2005-05-28 514 spin_unlock_irqrestore(cmd->device->host->host_lock, flags);
68b3aa7c Jeff Garzik 2005-05-28 515 :::::: The code at line 512 was first introduced by commit
:::::: 68b3aa7c9805aee9005a8ca53c5e99177961fbb9 [SCSI] allow sleeping in ->eh_bus_reset_handler()
:::::: TO: Jeff Garzik <[email protected]>
:::::: CC: Jeff Garzik <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botRe: [PATCH 27/35] scsi: Use Scsi_Host and channel number as argument for eh_bus_reset_handler()
In reply to Hannes Reineckereproduce:
Hi Hannes,
[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on next-20170623]
[cannot apply to v4.12-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Hannes-Reinecke/SCSI-EH-argument-reshuffling/20170624-071433 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next config: i386-randconfig-x078-06180431 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386
All error/warnings (new ones prefixed by >>):
>> drivers/scsi/nsp32.c:280:27: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.eh_bus_reset_handler = nsp32_eh_bus_reset,
^~~~~~~~~~~~~~~~~~
drivers/scsi/nsp32.c:280:27: note: (near initialization for 'nsp32_template.eh_bus_reset_handler')
>> drivers/scsi/nsp32.c:2848:12: error: conflicting types for 'nsp32_eh_bus_reset'
static int nsp32_eh_bus_reset(struct Scsi_Host *host, int channel)
^~~~~~~~~~~~~~~~~~
drivers/scsi/nsp32.c:204:20: note: previous declaration of 'nsp32_eh_bus_reset' was here
static int nsp32_eh_bus_reset (struct scsi_cmnd *);
^~~~~~~~~~~~~~~~~~
>> drivers/scsi/nsp32.c:204:20: warning: 'nsp32_eh_bus_reset' used but never defined drivers/scsi/nsp32.c:2848:12: warning: 'nsp32_eh_bus_reset' defined but not used [-Wunused-function]
static int nsp32_eh_bus_reset(struct Scsi_Host *host, int channel)
^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +280 drivers/scsi/nsp32.c
f281233d Jeff Garzik 2010-11-16 198 static int nsp32_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
^1da177e Linus Torvalds 2005-04-16 199 static const char *nsp32_info (struct Scsi_Host *);
^1da177e Linus Torvalds 2005-04-16 200 static int nsp32_release (struct Scsi_Host *);
^1da177e Linus Torvalds 2005-04-16 201
^1da177e Linus Torvalds 2005-04-16 202 /* SCSI error handler */
^1da177e Linus Torvalds 2005-04-16 203 static int nsp32_eh_abort (struct scsi_cmnd *);
^1da177e Linus Torvalds 2005-04-16 @204 static int nsp32_eh_bus_reset (struct scsi_cmnd *);
33f80ca2 Hannes Reinecke 2017-06-23 205 static int nsp32_eh_host_reset(struct Scsi_Host *);
^1da177e Linus Torvalds 2005-04-16 206
^1da177e Linus Torvalds 2005-04-16 207 /* generate SCSI message */
^1da177e Linus Torvalds 2005-04-16 208 static void nsp32_build_identify(struct scsi_cmnd *);
^1da177e Linus Torvalds 2005-04-16 209 static void nsp32_build_nop (struct scsi_cmnd *);
^1da177e Linus Torvalds 2005-04-16 210 static void nsp32_build_reject (struct scsi_cmnd *);
^1da177e Linus Torvalds 2005-04-16 211 static void nsp32_build_sdtr (struct scsi_cmnd *, unsigned char, unsigned char);
^1da177e Linus Torvalds 2005-04-16 212
^1da177e Linus Torvalds 2005-04-16 213 /* SCSI message handler */
^1da177e Linus Torvalds 2005-04-16 214 static int nsp32_busfree_occur(struct scsi_cmnd *, unsigned short);
^1da177e Linus Torvalds 2005-04-16 215 static void nsp32_msgout_occur (struct scsi_cmnd *);
^1da177e Linus Torvalds 2005-04-16 216 static void nsp32_msgin_occur (struct scsi_cmnd *, unsigned long, unsigned short);
^1da177e Linus Torvalds 2005-04-16 217
^1da177e Linus Torvalds 2005-04-16 218 static int nsp32_setup_sg_table (struct scsi_cmnd *);
^1da177e Linus Torvalds 2005-04-16 219 static int nsp32_selection_autopara(struct scsi_cmnd *);
^1da177e Linus Torvalds 2005-04-16 220 static int nsp32_selection_autoscsi(struct scsi_cmnd *);
^1da177e Linus Torvalds 2005-04-16 221 static void nsp32_scsi_done (struct scsi_cmnd *);
^1da177e Linus Torvalds 2005-04-16 222 static int nsp32_arbitration (struct scsi_cmnd *, unsigned int);
^1da177e Linus Torvalds 2005-04-16 223 static int nsp32_reselection (struct scsi_cmnd *, unsigned char);
^1da177e Linus Torvalds 2005-04-16 224 static void nsp32_adjust_busfree (struct scsi_cmnd *, unsigned int);
^1da177e Linus Torvalds 2005-04-16 225 static void nsp32_restart_autoscsi (struct scsi_cmnd *, unsigned short);
^1da177e Linus Torvalds 2005-04-16 226
^1da177e Linus Torvalds 2005-04-16 227 /* SCSI SDTR */
^1da177e Linus Torvalds 2005-04-16 228 static void nsp32_analyze_sdtr (struct scsi_cmnd *);
^1da177e Linus Torvalds 2005-04-16 229 static int nsp32_search_period_entry(nsp32_hw_data *, nsp32_target *, unsigned char);
^1da177e Linus Torvalds 2005-04-16 230 static void nsp32_set_async (nsp32_hw_data *, nsp32_target *);
^1da177e Linus Torvalds 2005-04-16 231 static void nsp32_set_max_sync (nsp32_hw_data *, nsp32_target *, unsigned char *, unsigned char *);
^1da177e Linus Torvalds 2005-04-16 232 static void nsp32_set_sync_entry (nsp32_hw_data *, nsp32_target *, int, unsigned char);
^1da177e Linus Torvalds 2005-04-16 233
^1da177e Linus Torvalds 2005-04-16 234 /* SCSI bus status handler */
^1da177e Linus Torvalds 2005-04-16 235 static void nsp32_wait_req (nsp32_hw_data *, int);
^1da177e Linus Torvalds 2005-04-16 236 static void nsp32_wait_sack (nsp32_hw_data *, int);
^1da177e Linus Torvalds 2005-04-16 237 static void nsp32_sack_assert (nsp32_hw_data *);
^1da177e Linus Torvalds 2005-04-16 238 static void nsp32_sack_negate (nsp32_hw_data *);
^1da177e Linus Torvalds 2005-04-16 239 static void nsp32_do_bus_reset(nsp32_hw_data *);
^1da177e Linus Torvalds 2005-04-16 240
^1da177e Linus Torvalds 2005-04-16 241 /* hardware interrupt handler */
7d12e780 David Howells 2006-10-05 242 static irqreturn_t do_nsp32_isr(int, void *);
^1da177e Linus Torvalds 2005-04-16 243
^1da177e Linus Torvalds 2005-04-16 244 /* initialize hardware */
^1da177e Linus Torvalds 2005-04-16 245 static int nsp32hw_init(nsp32_hw_data *);
^1da177e Linus Torvalds 2005-04-16 246
^1da177e Linus Torvalds 2005-04-16 247 /* EEPROM handler */
^1da177e Linus Torvalds 2005-04-16 248 static int nsp32_getprom_param (nsp32_hw_data *);
^1da177e Linus Torvalds 2005-04-16 249 static int nsp32_getprom_at24 (nsp32_hw_data *);
^1da177e Linus Torvalds 2005-04-16 250 static int nsp32_getprom_c16 (nsp32_hw_data *);
^1da177e Linus Torvalds 2005-04-16 251 static void nsp32_prom_start (nsp32_hw_data *);
^1da177e Linus Torvalds 2005-04-16 252 static void nsp32_prom_stop (nsp32_hw_data *);
^1da177e Linus Torvalds 2005-04-16 253 static int nsp32_prom_read (nsp32_hw_data *, int);
^1da177e Linus Torvalds 2005-04-16 254 static int nsp32_prom_read_bit (nsp32_hw_data *);
^1da177e Linus Torvalds 2005-04-16 255 static void nsp32_prom_write_bit(nsp32_hw_data *, int);
^1da177e Linus Torvalds 2005-04-16 256 static void nsp32_prom_set (nsp32_hw_data *, int, int);
^1da177e Linus Torvalds 2005-04-16 257 static int nsp32_prom_get (nsp32_hw_data *, int);
^1da177e Linus Torvalds 2005-04-16 258
^1da177e Linus Torvalds 2005-04-16 259 /* debug/warning/info message */
^1da177e Linus Torvalds 2005-04-16 260 static void nsp32_message (const char *, int, char *, char *, ...);
^1da177e Linus Torvalds 2005-04-16 261 #ifdef NSP32_DEBUG
^1da177e Linus Torvalds 2005-04-16 262 static void nsp32_dmessage(const char *, int, int, char *, ...);
^1da177e Linus Torvalds 2005-04-16 263 #endif
^1da177e Linus Torvalds 2005-04-16 264
^1da177e Linus Torvalds 2005-04-16 265 /*
^1da177e Linus Torvalds 2005-04-16 266 * max_sectors is currently limited up to 128.
^1da177e Linus Torvalds 2005-04-16 267 */
^1da177e Linus Torvalds 2005-04-16 268 static struct scsi_host_template nsp32_template = {
^1da177e Linus Torvalds 2005-04-16 269 .proc_name = "nsp32",
^1da177e Linus Torvalds 2005-04-16 270 .name = "Workbit NinjaSCSI-32Bi/UDE",
35c6e0e5 Al Viro 2013-03-31 271 .show_info = nsp32_show_info,
^1da177e Linus Torvalds 2005-04-16 272 .info = nsp32_info,
^1da177e Linus Torvalds 2005-04-16 273 .queuecommand = nsp32_queuecommand,
^1da177e Linus Torvalds 2005-04-16 274 .can_queue = 1,
^1da177e Linus Torvalds 2005-04-16 275 .sg_tablesize = NSP32_SG_SIZE,
^1da177e Linus Torvalds 2005-04-16 276 .max_sectors = 128,
^1da177e Linus Torvalds 2005-04-16 277 .this_id = NSP32_HOST_SCSIID,
^1da177e Linus Torvalds 2005-04-16 278 .use_clustering = DISABLE_CLUSTERING,
^1da177e Linus Torvalds 2005-04-16 279 .eh_abort_handler = nsp32_eh_abort,
^1da177e Linus Torvalds 2005-04-16 @280 .eh_bus_reset_handler = nsp32_eh_bus_reset,
^1da177e Linus Torvalds 2005-04-16 281 .eh_host_reset_handler = nsp32_eh_host_reset,
^1da177e Linus Torvalds 2005-04-16 282 /* .highmem_io = 1, */
^1da177e Linus Torvalds 2005-04-16 283 };:::::: The code at line 280 was first introduced by commit :::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <[email protected]> :::::: CC: Linus Torvalds <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botRe: [PATCH 22/35] scsi: Use Scsi_Host as argument for eh_host_reset_handler
In reply to Hannes Reineckereproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross…
Hi Hannes,
[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on next-20170623]
[cannot apply to v4.12-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Hannes-Reinecke/SCSI-EH-argument-reshuffling/20170624-071433 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next config: powerpc-allmodconfig (attached as .config) compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc
All warnings (new ones prefixed by >>):
In file included from include/linux/printk.h:329:0,
from include/linux/kernel.h:13,
from include/linux/delay.h:21,
from drivers/scsi/cxlflash/main.c:15:
drivers/scsi/cxlflash/main.c: In function 'cxlflash_eh_host_reset_handler':
>> drivers/scsi/cxlflash/main.c:2186:15: warning: format '%s' expects argument of type 'char *', but argument 4 has type 'unsigned int' [-Wformat=]
dev_dbg(dev, "%s: %d/-1/-1/-1\n", host->host_no);
^
include/linux/dynamic_debug.h:134:39: note: in definition of macro 'dynamic_dev_dbg'
__dynamic_dev_dbg(&descriptor, dev, fmt, \
^~~
>> drivers/scsi/cxlflash/main.c:2186:2: note: in expansion of macro 'dev_dbg'
dev_dbg(dev, "%s: %d/-1/-1/-1\n", host->host_no);
^~~~~~~
>> drivers/scsi/cxlflash/main.c:2186:15: warning: format '%d' expects a matching 'int' argument [-Wformat=]
dev_dbg(dev, "%s: %d/-1/-1/-1\n", host->host_no);
^
include/linux/dynamic_debug.h:134:39: note: in definition of macro 'dynamic_dev_dbg'
__dynamic_dev_dbg(&descriptor, dev, fmt, \
^~~
>> drivers/scsi/cxlflash/main.c:2186:2: note: in expansion of macro 'dev_dbg'
dev_dbg(dev, "%s: %d/-1/-1/-1\n", host->host_no);
^~~~~~~vim +2186 drivers/scsi/cxlflash/main.c
2170 * Following a reset, the state is evaluated again in case an EEH occurred
2171 * during the reset. In such a scenario, the host reset will either yield
2172 * until the EEH recovery is complete or return success or failure based
2173 * upon the current device state.
2174 *
2175 * Return:
2176 * SUCCESS as defined in scsi/scsi.h
2177 * FAILED as defined in scsi/scsi.h
2178 */
2179 static int cxlflash_eh_host_reset_handler(struct Scsi_Host *host)
2180 {
2181 int rc = SUCCESS;
2182 int rcr = 0;
2183 struct cxlflash_cfg *cfg = shost_priv(host);
2184 struct device *dev = &cfg->dev->dev;
2185
> 2186 dev_dbg(dev, "%s: %d/-1/-1/-1\n", host->host_no);
2187
2188 switch (cfg->state) {
2189 case STATE_NORMAL:
2190 cfg->state = STATE_RESET;
2191 drain_ioctls(cfg);
2192 cxlflash_mark_contexts_error(cfg);
2193 rcr = afu_reset(cfg);
2194 if (rcr) {
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botRe: [PATCH 34/35] scsi: Move eh_device_reset_handler() to use scsi_device as argument
In reply to Hannes Reineckereproduce:
Hi Hannes,
[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on next-20170623]
[cannot apply to v4.12-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Hannes-Reinecke/SCSI-EH-argument-reshuffling/20170624-071433 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next config: x86_64-randconfig-x005-201725 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64
All errors (new ones prefixed by >>):
In file included from drivers/block/cciss.c:374:0:
drivers/block/cciss_scsi.c: In function 'cciss_eh_device_reset_handler':
>> drivers/block/cciss_scsi.c:1605:27: error: 'sdev' undeclared (first use in this function)
rc = lookup_scsi3addr(h, sdev->channel, sdev->id, sdev->lun, lunaddr);
^~~~ drivers/block/cciss_scsi.c:1605:27: note: each undeclared identifier is reported only once for each function it appears in
vim +/sdev +1605 drivers/block/cciss_scsi.c
1599
1600 /* find the controller to which the command to be aborted was sent */
1601 h = (ctlr_info_t *) scsidev->host->hostdata[0];
1602 if (h == NULL) /* paranoia */
1603 return FAILED;
1604 dev_warn(&h->pdev->dev, "resetting tape drive or medium changer.\n");
> 1605 rc = lookup_scsi3addr(h, sdev->channel, sdev->id, sdev->lun, lunaddr);
1606 if (rc != 0)
1607 return FAILED;
1608 /* send a reset to the SCSI LUN which the command was sent to */
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botRe: [PATCH 33/35] scsi: Use scsi_target as argument for eh_target_reset_handler()
In reply to Hannes Reineckereproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross…
Hi Hannes,
[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on next-20170623]
[cannot apply to v4.12-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Hannes-Reinecke/SCSI-EH-argument-reshuffling/20170624-071433 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next config: powerpc-allmodconfig (attached as .config) compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc
All errors (new ones prefixed by >>):
drivers/scsi/ibmvscsi/ibmvfc.c: In function 'ibmvfc_eh_target_reset_handler':
>> drivers/scsi/ibmvscsi/ibmvfc.c:2501:41: error: 'sdev' undeclared (first use in this function)
struct ibmvfc_host *vhost = shost_priv(sdev->host);
^~~~
drivers/scsi/ibmvscsi/ibmvfc.c:2501:41: note: each undeclared identifier is reported only once for each function it appears in
drivers/scsi/ibmvscsi/ibmvfc.c:2500:20: warning: unused variable 'shost' [-Wunused-variable]
struct Scsi_Host *shost = rport_to_shost(rport);
^~~~~
drivers/scsi/ibmvscsi/ibmvfc.c: In function 'ibmvfc_eh_host_reset_handler':
drivers/scsi/ibmvscsi/ibmvfc.c:2533:10: warning: unused variable 'block_rc' [-Wunused-variable]
int rc, block_rc;
^~~~~~~~vim +/sdev +2501 drivers/scsi/ibmvscsi/ibmvfc.c
2495 * SUCCESS / FAST_IO_FAIL / FAILED
2496 **/
2497 static int ibmvfc_eh_target_reset_handler(struct scsi_target *starget)
2498 {
2499 struct fc_rport *rport = starget_to_rport(starget);
2500 struct Scsi_Host *shost = rport_to_shost(rport);
> 2501 struct ibmvfc_host *vhost = shost_priv(sdev->host);
2502 int block_rc;
2503 int reset_rc = 0;
2504 int rc = FAILED;
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botRe: [PATCH 34/35] scsi: Move eh_device_reset_handler() to use scsi_device as argument
In reply to Hannes Reineckereproduce:
Hi Hannes,
[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on next-20170623]
[cannot apply to v4.12-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Hannes-Reinecke/SCSI-EH-argument-reshuffling/20170624-071433 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next config: i386-randconfig-x004-201725 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386
All errors (new ones prefixed by >>):
drivers/scsi/aha152x.c: In function 'aha152x_device_reset':
>> drivers/scsi/aha152x.c:1060:30: error: 'SCpnt' undeclared (first use in this function)
unsigned char old_cmd_len = SCpnt->cmd_len;
^~~~~
drivers/scsi/aha152x.c:1060:30: note: each undeclared identifier is reported only once for each function it appears in
drivers/scsi/aha152x.c: In function 'aha152x_bus_reset':
drivers/scsi/aha152x.c:1173:9: error: too many arguments to function 'aha152x_bus_reset_host'
return aha152x_bus_reset_host(shpnt, channel);
^~~~~~~~~~~~~~~~~~~~~~ drivers/scsi/aha152x.c:1144:12: note: declared here
static int aha152x_bus_reset_host(struct Scsi_Host *shpnt)
^~~~~~~~~~~~~~~~~~~~~~
vim +/SCpnt +1060 drivers/scsi/aha152x.c
^1da177e Linus Torvalds 2005-04-16 1054 */
fb100e8d Hannes Reinecke 2017-06-23 1055 static int aha152x_device_reset(struct scsi_device * sdev)
^1da177e Linus Torvalds 2005-04-16 1056 {
fb100e8d Hannes Reinecke 2017-06-23 1057 struct Scsi_Host *shpnt = sdev->host;
0f06bb34 Christoph Hellwig 2007-05-13 1058 DECLARE_COMPLETION(done);
^1da177e Linus Torvalds 2005-04-16 1059 int ret, issued, disconnected;
631c228c Christoph Hellwig 2006-07-08 @1060 unsigned char old_cmd_len = SCpnt->cmd_len;
^1da177e Linus Torvalds 2005-04-16 1061 unsigned long flags;
0f06bb34 Christoph Hellwig 2007-05-13 1062 unsigned long timeleft;^1da177e Linus Torvalds 2005-04-16 1063
:::::: The code at line 1060 was first introduced by commit
:::::: 631c228cd09bd5b93090fa60bd9803ec14aa0586 [SCSI] hide EH backup data outside the scsi_cmnd
:::::: TO: Christoph Hellwig <[email protected]>
:::::: CC: James Bottomley <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH 34/35] scsi: Move eh_device_reset_handler() to use scsi_device as argument
In reply to Hannes ReineckePlease factor out any non-trivial changes to separate patches.
E.g. the fnic tag reserved tag is something that should have patch on it's own with a proper description (and I like that change a lot btw!)
Re: [PATCH 35/35] scsi: Do not allocate scsi command in scsi_ioctl_reset()
In reply to Hannes ReineckeQuoted 14 lines · Hannes Reinecke
As we now have moved the error handler functions to not rely on a scsi command we can drop the out-of-band scsi command allocation from
scsi_ioctl_reset().Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/scsi_error.c | 112 +++++++++++++++++----------------------------- 1 file changed, 42 insertions(+), 70 deletions(-)drivers/scsi/scsi_error.c +0
-0
drivers/scsi/scsi_error.c static void scsi_eh_done(struct scsi_cmnd *scmd) · line 735
Quoted 8 lines
drivers/scsi/scsi_error.c +5
-0@@ -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,void *data) +{ + sdev->was_reset =1 ; + sdev->expecting_cc_ua =1 ; +}
Please have aversion without the data argument, which is only needed for the target iterator.
Re: [PATCH 17/35] NCR5380: Move bus reset to host reset
In reply to Hannes ReineckeQuoted 30 lines · Hannes Reinecke
The bus reset handler really is a host reset, so move it to
eh_bus_reset_handler.Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/NCR5380.c | 13 ++++++++----- drivers/scsi/arm/cumana_1.c | 2 +- drivers/scsi/arm/oak.c | 2 +- drivers/scsi/atari_scsi.c | 6 +++--- drivers/scsi/dmx3191d.c | 2 +- drivers/scsi/g_NCR5380.c | 4 ++-- drivers/scsi/mac_scsi.c | 4 ++-- drivers/scsi/sun3_scsi.c | 4 ++-- 8 files changed, 20 insertions(+), 17 deletions(-)drivers/scsi/NCR5380.c +1
-1@@ -2296,24 +2296,24 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)/** -* NCR5380_bus_reset - reset the SCSI bus +* NCR5380_host_reset - reset the SCSI host * @cmd: SCSI command undergoing EH * * Returns SUCCESS */
drivers/scsi/NCR5380.c static int NCR5380_abort(struct scsi_cmnd *cmd) · line 2312
Quoted 10 lines
drivers/scsi/NCR5380.c +2
-2-static int NCR5380_bus_reset (struct scsi_cmnd *cmd) +static int NCR5380_host_reset (struct scsi_cmnd *cmd) {struct Scsi_Host *instance = cmd->device->host;struct NCR5380_hostdata *hostdata =shost_priv (instance);int i;unsigned long flags; -struct NCR5380_cmd *ncmd; +struct NCR5380_cmd *ncmd, *tmp;
Do you need to introduce another temporary command pointer for this?
Quoted 10 lines
drivers/scsi/NCR5380.c +1
-1spin_lock_irqsave (&hostdata->lock, flags);#if (NDEBUG &NDEBUG_ANY ) -scmd_printk (KERN_INFO , cmd, __func__); +shost_printk (KERN_INFO , instance, __func__);#endif NCR5380_dprint (NDEBUG_ANY , instance);NCR5380_dprint_phase (NDEBUG_ANY , instance);@@ -2331,7 +2331,10 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd)* commands!
drivers/scsi/NCR5380.c static int NCR5380_bus_reset(struct scsi_cmnd *cmd) · line 2340
Quoted 10 lines
drivers/scsi/NCR5380.c +4
-1*/ -if (list_del_cmd (&hostdata->unissued, cmd)) { +list_for_each_entry_safe (ncmd, tmp, &hostdata->unissued, list) { +struct scsi_cmnd *cmd =NCR5380_to_scmd (ncmd); + +list_del_init (&ncmd->list); cmd->result =DID_RESET <<16 ; cmd->scsi_done (cmd); }
For the sake of consistency, why didn't you use the same style that is used later in this routine? I.e.
list_for_each_entry(ncmd, &hostdata->unissued, list) {
struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd);
cmd->result = DID_RESET << 16;
cmd->scsi_done(cmd);
}
INIT_LIST_HEAD(&hostdata->unissued);Either way,
Thanks.
Quoted 137 lines
drivers/scsi/arm/cumana_1.c +1
-1@@ -216,7 +216,7 @@ static void cumanascsi_write(struct NCR5380_hostdata *hostdata, .info = cumanascsi_info, .queuecommand = cumanascsi_queue_command, .eh_abort_handler = NCR5380_abort, - .eh_bus_reset_handler = NCR5380_bus_reset, + .eh_host_reset_handler = NCR5380_host_reset, .can_queue = 16, .this_id = 7, .sg_tablesize = SG_ALL,drivers/scsi/arm/oak.c +1
-1@@ -105,7 +105,7 @@ static inline int oakscsi_pread(struct NCR5380_hostdata *hostdata, .info = oakscsi_info, .queuecommand = oakscsi_queue_command, .eh_abort_handler = NCR5380_abort, - .eh_bus_reset_handler = NCR5380_bus_reset, + .eh_host_reset_handler = NCR5380_host_reset, .can_queue = 16, .this_id = 7, .sg_tablesize = SG_ALL,drivers/scsi/atari_scsi.c +3
-3@@ -671,7 +671,7 @@ static void atari_scsi_falcon_reg_write(unsigned int reg, u8 value)#include "NCR5380.c" -static int atari_scsi_bus_reset (struct scsi_cmnd *cmd) +static int atari_scsi_host_reset (struct scsi_cmnd *cmd) {int rv;unsigned long flags;@@ -688,7 +688,7 @@ static int atari_scsi_bus_reset(struct scsi_cmnd *cmd) atari_dma_orig_addr =NULL ; } - rv =NCR5380_bus_reset (cmd); + rv =NCR5380_host_reset (cmd);/* 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 @@ -711,7 +711,7 @@ static int atari_scsi_bus_reset(struct scsi_cmnd *cmd) .info = atari_scsi_info, .queuecommand = atari_scsi_queue_command, .eh_abort_handler = atari_scsi_abort, - .eh_bus_reset_handler = atari_scsi_bus_reset, + .eh_host_reset_handler = atari_scsi_host_reset, .this_id = 7, .cmd_per_lun = 2, .use_clustering = DISABLE_CLUSTERING,drivers/scsi/dmx3191d.c +1
-1@@ -58,7 +58,7 @@ .info = NCR5380_info, .queuecommand = NCR5380_queue_command, .eh_abort_handler = NCR5380_abort, - .eh_bus_reset_handler = NCR5380_bus_reset, + .eh_host_reset_handler = NCR5380_host_reset, .can_queue = 32, .this_id = 7, .sg_tablesize = SG_ALL,drivers/scsi/g_NCR5380.c +2
-2@@ -54,7 +54,7 @@#define NCR5380_intr generic_NCR5380_intr#define NCR5380_queue_command generic_NCR5380_queue_command#define NCR5380_abort generic_NCR5380_abort -#define NCR5380_bus_reset generic_NCR5380_bus_reset +#define NCR5380_host_reset generic_NCR5380_host_reset#define NCR5380_info generic_NCR5380_info#define NCR5380_io_delay (x) udelay(x)@@ -661,7 +661,7 @@ static int generic_NCR5380_dma_xfer_len(struct NCR5380_hostdata *hostdata, .info = generic_NCR5380_info, .queuecommand = generic_NCR5380_queue_command, .eh_abort_handler = generic_NCR5380_abort, - .eh_bus_reset_handler = generic_NCR5380_bus_reset, + .eh_host_reset_handler = generic_NCR5380_host_reset, .can_queue = 16, .this_id = 7, .sg_tablesize = SG_ALL,drivers/scsi/mac_scsi.c +2
-2@@ -41,7 +41,7 @@#define NCR5380_intr macscsi_intr#define NCR5380_queue_command macscsi_queue_command#define NCR5380_abort macscsi_abort -#define NCR5380_bus_reset macscsi_bus_reset +#define NCR5380_host_reset macscsi_host_reset#define NCR5380_info macscsi_info#include "NCR5380.h" @@ -328,7 +328,7 @@ static int macscsi_dma_residual(struct NCR5380_hostdata *hostdata) .info = macscsi_info, .queuecommand = macscsi_queue_command, .eh_abort_handler = macscsi_abort, - .eh_bus_reset_handler = macscsi_bus_reset, + .eh_host_reset_handler = macscsi_host_reset, .can_queue = 16, .this_id = 7, .sg_tablesize = 1,drivers/scsi/sun3_scsi.c +2
-2@@ -46,7 +46,7 @@#define NCR5380_write (reg, value) out_8(hostdata->io + (reg), value)#define NCR5380_queue_command sun3scsi_queue_command -#define NCR5380_bus_reset sun3scsi_bus_reset +#define NCR5380_host_reset sun3scsi_host_reset#define NCR5380_abort sun3scsi_abort#define NCR5380_info sun3scsi_info@@ -495,7 +495,7 @@ static int sun3scsi_dma_finish(int write_flag) .info = sun3scsi_info, .queuecommand = sun3scsi_queue_command, .eh_abort_handler = sun3scsi_abort, - .eh_bus_reset_handler = sun3scsi_bus_reset, + .eh_host_reset_handler = sun3scsi_host_reset, .can_queue = 16, .this_id = 7, .sg_tablesize = SG_NONE,
Hannes Reinecke
maintainerRe: [PATCH 17/35] NCR5380: Move bus reset to host reset
Quoted 77 lines · Finn Thain
Quoted 30 lines · Hannes Reinecke
The bus reset handler really is a host reset, so move it to
eh_bus_reset_handler.Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/NCR5380.c | 13 ++++++++----- drivers/scsi/arm/cumana_1.c | 2 +- drivers/scsi/arm/oak.c | 2 +- drivers/scsi/atari_scsi.c | 6 +++--- drivers/scsi/dmx3191d.c | 2 +- drivers/scsi/g_NCR5380.c | 4 ++-- drivers/scsi/mac_scsi.c | 4 ++-- drivers/scsi/sun3_scsi.c | 4 ++-- 8 files changed, 20 insertions(+), 17 deletions(-)drivers/scsi/NCR5380.c +1
-1@@ -2296,24 +2296,24 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)/** -* NCR5380_bus_reset - reset the SCSI bus +* NCR5380_host_reset - reset the SCSI host * @cmd: SCSI command undergoing EH * * Returns SUCCESS */ drivers/scsi/NCR5380.c static int NCR5380_abort(struct scsi_cmnd *cmd) · line 2312
Quoted 10 lines
drivers/scsi/NCR5380.c +2
-2-static int NCR5380_bus_reset (struct scsi_cmnd *cmd) +static int NCR5380_host_reset (struct scsi_cmnd *cmd) {struct Scsi_Host *instance = cmd->device->host;struct NCR5380_hostdata *hostdata =shost_priv (instance);int i;unsigned long flags; -struct NCR5380_cmd *ncmd; +struct NCR5380_cmd *ncmd, *tmp;Do you need to introduce another temporary command pointer for this?
Quoted 10 lines
drivers/scsi/NCR5380.c +1
-1spin_lock_irqsave (&hostdata->lock, flags);#if (NDEBUG &NDEBUG_ANY ) -scmd_printk (KERN_INFO , cmd, __func__); +shost_printk (KERN_INFO , instance, __func__);#endif NCR5380_dprint (NDEBUG_ANY , instance);NCR5380_dprint_phase (NDEBUG_ANY , instance);@@ -2331,7 +2331,10 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd)* commands! drivers/scsi/NCR5380.c static int NCR5380_bus_reset(struct scsi_cmnd *cmd) · line 2340
Quoted 10 lines
drivers/scsi/NCR5380.c +4
-1*/ -if (list_del_cmd (&hostdata->unissued, cmd)) { +list_for_each_entry_safe (ncmd, tmp, &hostdata->unissued, list) { +struct scsi_cmnd *cmd =NCR5380_to_scmd (ncmd); + +list_del_init (&ncmd->list); cmd->result =DID_RESET <<16 ; cmd->scsi_done (cmd); }For the sake of consistency, why didn't you use the same style that is used later in this routine? I.e.
list_for_each_entry(ncmd, &hostdata->unissued, list) { struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd); cmd->result = DID_RESET << 16; cmd->scsi_done(cmd); } INIT_LIST_HEAD(&hostdata->unissued);
Quoted 6 lines
Either way,
Acked-by Finn Thain <[email protected]>Thanks.
As the driver was switch to using embedded private data area we need to ensure that we're not touching the data area anymore once we call ->done(); the command might be reused after that.
Once the command is reused the 'list' structure in the embedded data area will be reset, resulting in a list corruption for the 'unissued' list.
But as we're running under EH here where we don't have asynchronous I/O submissions I guess we should be fine with your suggestion. Will be updating the patch.
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)
Can you send a series with just the prep patches in the beginning? I think some of this could be 4.13 material still, leaving the actual prototype changes for 4.14.
Re: [PATCH 01/35] scsi: fix comment in scsi_device_set_state()
In reply to Hannes ReineckeLooks fine,
Re: [PATCH 02/35] mptfc: Do not call fc_block_scsi_eh() on host reset
In reply to Hannes ReineckeLooks fine,
Re: [PATCH 03/35] ibmvfc: Do not call fc_block_scsi_eh() on host reset
In reply to Hannes ReineckeLooks fine,
Re: [PATCH 04/35] fc_fcp: do not call fc_block_scsi_eh() from host reset
In reply to Hannes ReineckeLoks fine,
Re: [PATCH 05/35] fnic: do not call host reset from command abort
In reply to Hannes ReineckeLooks fine,
Re: [PATCH 06/35] visorhba: sanitze private device data allocation
In reply to Hannes ReineckeQuoted 3 lines · Hannes Reinecke
There's no need to keep the private data for a device in a separate list; better to store it in ->hostdata and do away with the additional list.
Nice improvement, although that driver is a complete mess.. And I guess you need to send this to Greg separately.
Re: [PATCH 07/35] uas: move eh_bus_reset_handler to eh_device_reset_handler
In reply to Hannes ReineckeLooks good,
Re: [PATCH 08/35] lpfc: drop lpfc_no_handler and lpfc_bus_reset_handler()
In reply to Hannes ReineckeQuoted 5 lines · Hannes Reinecke
lpfc_bus_reset_handler()is really just a loop callinglpfc_target_reset_handler()over all targets, which is what the error handler will be doing anyway.
Andlpfc_no_handler()will return FAILED, just like SCSI EH does if no handler is present.
Looks sensible, but I'd really like to see James looking over this..
Quoted 148 lines
So drop both.
Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/lpfc/lpfc_scsi.c | 99 ------------------------------------------- 1 file changed, 99 deletions(-)drivers/scsi/lpfc/lpfc_scsi.c +0
-99@@ -5294,93 +5294,6 @@ void lpfc_poll_timeout(unsigned long ptr) }/** -* lpfc_bus_reset_handler - scsi_host_template eh_bus_reset_handler entry point -* @cmnd: Pointer to scsi_cmnd data structure. -* -* This routine does target reset to all targets on @cmnd->device->host. -* This emulates Parallel SCSI Bus Reset Semantics. -* -* Return code : -* 0x2003 - Error -* 0x2002 - Success -**/ -static int -lpfc_bus_reset_handler (struct scsi_cmnd *cmnd) -{ -struct Scsi_Host *shost = cmnd->device->host; -struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; -struct lpfc_nodelist *ndlp =NULL ; -struct lpfc_scsi_event_header scsi_event; -int match; -int ret =SUCCESS , status, i; - - scsi_event.event_type =FC_REG_SCSI_EVENT ; - scsi_event.subcategory =LPFC_EVENT_BUSRESET ; - scsi_event.lun =0 ; -memcpy (scsi_event.wwpn, &vport->fc_portname,sizeof (struct lpfc_name )); -memcpy (scsi_event.wwnn, &vport->fc_nodename,sizeof (struct lpfc_name )); - -fc_host_post_vendor_event (shost,fc_get_event_number (), -sizeof (scsi_event), (char *)&scsi_event,LPFC_NL_VENDOR_ID ); - - status =fc_block_scsi_eh (cmnd); -if (status !=0 && status !=SUCCESS ) -return status; - -/* -* Since the driver manages a single bus device, reset all -* targets known to the driver. Should any target reset -* fail, this routine returns failure to the midlayer. -*/ -for (i =0 ; i <LPFC_MAX_TARGET ; i++) { -/* Search for mapped node by target ID */ - match =0 ; -spin_lock_irq (shost->host_lock); -list_for_each_entry (ndlp, &vport->fc_nodes, nlp_listp) { -if (!NLP_CHK_NODE_ACT (ndlp)) -continue ; -if (vport->phba->cfg_fcp2_no_tgt_reset && - (ndlp->nlp_fcp_info &NLP_FCP_2_DEVICE )) -continue ; -if (ndlp->nlp_state ==NLP_STE_MAPPED_NODE && - ndlp->nlp_sid == i && - ndlp->rport && - ndlp->nlp_type &NLP_FCP_TARGET ) { - match =1 ; -break ; - } - } -spin_unlock_irq (shost->host_lock); -if (!match) -continue ; - - status =lpfc_send_taskmgmt (vport, cmnd, - i,0 ,FCP_TARGET_RESET ); - -if (status !=SUCCESS ) { -lpfc_printf_vlog (vport,KERN_ERR ,LOG_FCP , -"0700 Bus Reset on target %d failed\n" , - i); - ret =FAILED ; - } - } -/* -* We have to clean up i/o as : they may be orphaned by the TMFs -* above; or if any of the TMFs failed, they may be in an -* indeterminate state. -* We will report success if all the i/o aborts successfully. -*/ - - status =lpfc_reset_flush_io_context (vport,0 ,0 ,LPFC_CTX_HOST ); -if (status !=SUCCESS ) - ret =FAILED ; - -lpfc_printf_vlog (vport,KERN_ERR ,LOG_FCP , -"0714 SCSI layer issued Bus Reset Data: x%x\n" , ret); -return ret; -} - -/** * lpfc_host_reset_handler - scsi_host_template eh_host_reset_handler entry pt * @cmnd: Pointer to scsi_cmnd data structure. * @@ -5926,11 +5839,6 @@ struct lpfc_device_data*return SCSI_MLQUEUE_HOST_BUSY ; } -static int -lpfc_no_handler (struct scsi_cmnd *cmnd) -{ -return FAILED ; -}static int lpfc_no_slave (struct scsi_device *sdev)@@ -5944,11 +5852,6 @@ struct scsi_host_template lpfc_template_nvme = { .proc_name = LPFC_DRIVER_NAME, .info = lpfc_info, .queuecommand = lpfc_no_command, - .eh_abort_handler = lpfc_no_handler, - .eh_device_reset_handler = lpfc_no_handler, - .eh_target_reset_handler = lpfc_no_handler, - .eh_bus_reset_handler = lpfc_no_handler, - .eh_host_reset_handler = lpfc_no_handler, .slave_alloc = lpfc_no_slave, .slave_configure = lpfc_no_slave, .scan_finished = lpfc_scan_finished,@@ -5972,7 +5875,6 @@ struct scsi_host_template lpfc_template_no_hr = { .eh_abort_handler = lpfc_abort_handler, .eh_device_reset_handler = lpfc_device_reset_handler, .eh_target_reset_handler = lpfc_target_reset_handler, - .eh_bus_reset_handler = lpfc_bus_reset_handler, .slave_alloc = lpfc_slave_alloc, .slave_configure = lpfc_slave_configure, .slave_destroy = lpfc_slave_destroy,@@ -5998,7 +5900,6 @@ struct scsi_host_template lpfc_template = { .eh_abort_handler = lpfc_abort_handler, .eh_device_reset_handler = lpfc_device_reset_handler, .eh_target_reset_handler = lpfc_target_reset_handler, - .eh_bus_reset_handler = lpfc_bus_reset_handler, .eh_host_reset_handler = lpfc_host_reset_handler, .slave_alloc = lpfc_slave_alloc, .slave_configure = lpfc_slave_configure,Signature · 1 line
1.8.5.6
---end quoted text---
Re: [PATCH 09/35] libsas: move bus_reset_handler() to target_reset_handler()
In reply to Hannes ReineckeLooks good,
Re: [PATCH 10/35] bfa: move bus reset to target reset
In reply to Hannes ReineckeLooks good,
Re: [PATCH 11/35] hptiop: Simplify reset handling
In reply to Hannes ReineckeLooks fine,
Re: [PATCH 13/35] scsi: drop bus reset for wd33c93-compatible boards
In reply to Hannes ReineckeQuoted 1 line · Hannes Reinecke
The bus reset function is just a wrapper around host reset, so drop it.
It also takes the host_lock, which the direct host_reset invokation doesn't. Given that before we'd always get the bus reset first that probably was the actually tested path, so we should move the lock into wd33c93_host_reset.
Re: [PATCH 14/35] rtsx: drop bus reset function
In reply to Hannes ReineckeLooks good,
Re: [PATCH 15/35] qlogicpti: move bus reset to host reset
In reply to Hannes ReineckeLooks good,
Re: [PATCH 16/35] acornscsi: move bus reset to host reset
In reply to Hannes ReineckeLooks good,
Re: [PATCH 18/35] qlogicfas: move bus_reset to host_reset
In reply to Hannes ReineckeLooks good,
Re: [PATCH 23/35] qedf: drop bus reset handler
In reply to Hannes ReineckeThis is a clear change of behavior, so we should run it past the maintainer. The old behavior looks wrong, but it's probably papering over something else..
Re: [PATCH 29/35] bnx2fc: remove obsolete bnx2fc_eh_host_reset() definition
In reply to Hannes ReineckeLooks good,