aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-05-28 07:55:48 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-06-17 13:05:03 -0400
commit94d0e7b805961c44e4dc486ffc21075084bb7175 (patch)
tree1609752ea7a9adb28583147f0bea33a9f10877d7
parent8fa728a26886f56a9ee10a44fea0ddda301d21c3 (diff)
[SCSI] allow sleeping in ->eh_device_reset_handler()
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--Documentation/scsi/scsi_mid_low_api.txt3
-rw-r--r--drivers/ieee1394/sbp2.c14
-rw-r--r--drivers/message/fusion/mptscsih.c6
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c3
-rw-r--r--drivers/scsi/aha152x.c2
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c8
-rw-r--r--drivers/scsi/aic7xxx_old.c14
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c2
-rw-r--r--drivers/scsi/ipr.c13
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c12
-rw-r--r--drivers/scsi/megaraid.c14
-rw-r--r--drivers/scsi/megaraid/megaraid_mbox.c14
-rw-r--r--drivers/scsi/qla1280.c8
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c8
-rw-r--r--drivers/scsi/scsi_error.c7
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c8
-rw-r--r--drivers/usb/storage/scsiglue.c4
17 files changed, 98 insertions, 42 deletions
diff --git a/Documentation/scsi/scsi_mid_low_api.txt b/Documentation/scsi/scsi_mid_low_api.txt
index f4a37ee670f2..62f7f76f5de8 100644
--- a/Documentation/scsi/scsi_mid_low_api.txt
+++ b/Documentation/scsi/scsi_mid_low_api.txt
@@ -973,8 +973,7 @@ Details:
973 * 973 *
974 * Returns SUCCESS if command aborted else FAILED 974 * Returns SUCCESS if command aborted else FAILED
975 * 975 *
976 * Locks: struct Scsi_Host::host_lock held (with irqsave) on entry 976 * Locks: None held
977 * and assumed to be held on return.
978 * 977 *
979 * Calling context: kernel thread 978 * Calling context: kernel thread
980 * 979 *
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index de552486b1c9..fcfddcc8e7ba 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -2615,7 +2615,7 @@ static int sbp2scsi_abort(struct scsi_cmnd *SCpnt)
2615/* 2615/*
2616 * Called by scsi stack when something has really gone wrong. 2616 * Called by scsi stack when something has really gone wrong.
2617 */ 2617 */
2618static int sbp2scsi_reset(struct scsi_cmnd *SCpnt) 2618static int __sbp2scsi_reset(struct scsi_cmnd *SCpnt)
2619{ 2619{
2620 struct scsi_id_instance_data *scsi_id = 2620 struct scsi_id_instance_data *scsi_id =
2621 (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0]; 2621 (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0];
@@ -2630,6 +2630,18 @@ static int sbp2scsi_reset(struct scsi_cmnd *SCpnt)
2630 return(SUCCESS); 2630 return(SUCCESS);
2631} 2631}
2632 2632
2633static int sbp2scsi_reset(struct scsi_cmnd *SCpnt)
2634{
2635 unsigned long flags;
2636 int rc;
2637
2638 spin_lock_irqsave(SCpnt->device->host->host_lock, flags);
2639 rc = __sbp2scsi_reset(SCpnt);
2640 spin_unlock_irqrestore(SCpnt->device->host->host_lock, flags);
2641
2642 return rc;
2643}
2644
2633static const char *sbp2scsi_info (struct Scsi_Host *host) 2645static const char *sbp2scsi_info (struct Scsi_Host *host)
2634{ 2646{
2635 return "SCSI emulation for IEEE-1394 SBP-2 Devices"; 2647 return "SCSI emulation for IEEE-1394 SBP-2 Devices";
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 6a5851c51a21..82cd9bc3b024 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -1801,7 +1801,6 @@ int
1801mptscsih_dev_reset(struct scsi_cmnd * SCpnt) 1801mptscsih_dev_reset(struct scsi_cmnd * SCpnt)
1802{ 1802{
1803 MPT_SCSI_HOST *hd; 1803 MPT_SCSI_HOST *hd;
1804 spinlock_t *host_lock = SCpnt->device->host->host_lock;
1805 1804
1806 /* If we can't locate our host adapter structure, return FAILED status. 1805 /* If we can't locate our host adapter structure, return FAILED status.
1807 */ 1806 */
@@ -1818,7 +1817,6 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt)
1818 printk(KERN_WARNING MYNAM ": %s: >> Attempting target reset! (sc=%p)\n", 1817 printk(KERN_WARNING MYNAM ": %s: >> Attempting target reset! (sc=%p)\n",
1819 hd->ioc->name, SCpnt); 1818 hd->ioc->name, SCpnt);
1820 1819
1821 spin_unlock_irq(host_lock);
1822 if (mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET, 1820 if (mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET,
1823 SCpnt->device->channel, SCpnt->device->id, 1821 SCpnt->device->channel, SCpnt->device->id,
1824 0, 0, 5 /* 5 second timeout */) 1822 0, 0, 5 /* 5 second timeout */)
@@ -1830,12 +1828,10 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt)
1830 hd->ioc->name, SCpnt); 1828 hd->ioc->name, SCpnt);
1831 hd->tmPending = 0; 1829 hd->tmPending = 0;
1832 hd->tmState = TM_STATE_NONE; 1830 hd->tmState = TM_STATE_NONE;
1833 spin_lock_irq(host_lock);
1834 return FAILED; 1831 return FAILED;
1835 } 1832 }
1836 spin_lock_irq(host_lock);
1837 return SUCCESS;
1838 1833
1834 return SUCCESS;
1839} 1835}
1840 1836
1841/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1837/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 6e4447598495..be7c91d4ae8c 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -636,8 +636,6 @@ zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt)
636 struct zfcp_unit *unit = (struct zfcp_unit *) scpnt->device->hostdata; 636 struct zfcp_unit *unit = (struct zfcp_unit *) scpnt->device->hostdata;
637 struct Scsi_Host *scsi_host = scpnt->device->host; 637 struct Scsi_Host *scsi_host = scpnt->device->host;
638 638
639 spin_unlock_irq(scsi_host->host_lock);
640
641 if (!unit) { 639 if (!unit) {
642 ZFCP_LOG_NORMAL("bug: Tried reset for nonexistent unit\n"); 640 ZFCP_LOG_NORMAL("bug: Tried reset for nonexistent unit\n");
643 retval = SUCCESS; 641 retval = SUCCESS;
@@ -680,7 +678,6 @@ zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt)
680 retval = SUCCESS; 678 retval = SUCCESS;
681 } 679 }
682 out: 680 out:
683 spin_lock_irq(scsi_host->host_lock);
684 return retval; 681 return retval;
685} 682}
686 683
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index 88d119f4b970..630b11575230 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -1225,8 +1225,6 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt)
1225 } 1225 }
1226 1226
1227 DO_UNLOCK(flags); 1227 DO_UNLOCK(flags);
1228
1229 spin_lock_irq(shpnt->host_lock);
1230 return ret; 1228 return ret;
1231} 1229}
1232 1230
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 7fc6c76e519b..31db0edc7cf9 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -1511,17 +1511,17 @@ ahd_linux_dev_reset(Scsi_Cmnd *cmd)
1511 ahd_name(ahd), cmd->device->channel, cmd->device->id, 1511 ahd_name(ahd), cmd->device->channel, cmd->device->id,
1512 cmd->device->lun, cmd); 1512 cmd->device->lun, cmd);
1513#endif 1513#endif
1514 ahd_midlayer_entrypoint_lock(ahd, &s); 1514 ahd_lock(ahd, &s);
1515 1515
1516 dev = ahd_linux_get_device(ahd, cmd->device->channel, cmd->device->id, 1516 dev = ahd_linux_get_device(ahd, cmd->device->channel, cmd->device->id,
1517 cmd->device->lun, /*alloc*/FALSE); 1517 cmd->device->lun, /*alloc*/FALSE);
1518 if (dev == NULL) { 1518 if (dev == NULL) {
1519 ahd_midlayer_entrypoint_unlock(ahd, &s); 1519 ahd_unlock(ahd, &s);
1520 kfree(recovery_cmd); 1520 kfree(recovery_cmd);
1521 return (FAILED); 1521 return (FAILED);
1522 } 1522 }
1523 if ((scb = ahd_get_scb(ahd, AHD_NEVER_COL_IDX)) == NULL) { 1523 if ((scb = ahd_get_scb(ahd, AHD_NEVER_COL_IDX)) == NULL) {
1524 ahd_midlayer_entrypoint_unlock(ahd, &s); 1524 ahd_unlock(ahd, &s);
1525 kfree(recovery_cmd); 1525 kfree(recovery_cmd);
1526 return (FAILED); 1526 return (FAILED);
1527 } 1527 }
@@ -1570,7 +1570,7 @@ ahd_linux_dev_reset(Scsi_Cmnd *cmd)
1570 spin_lock_irq(&ahd->platform_data->spin_lock); 1570 spin_lock_irq(&ahd->platform_data->spin_lock);
1571 ahd_schedule_runq(ahd); 1571 ahd_schedule_runq(ahd);
1572 ahd_linux_run_complete_queue(ahd); 1572 ahd_linux_run_complete_queue(ahd);
1573 ahd_midlayer_entrypoint_unlock(ahd, &s); 1573 ahd_unlock(ahd, &s);
1574 printf("%s: Device reset returning 0x%x\n", ahd_name(ahd), retval); 1574 printf("%s: Device reset returning 0x%x\n", ahd_name(ahd), retval);
1575 return (retval); 1575 return (retval);
1576} 1576}
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c
index ee127e8aea55..1e83096bb911 100644
--- a/drivers/scsi/aic7xxx_old.c
+++ b/drivers/scsi/aic7xxx_old.c
@@ -10358,7 +10358,7 @@ aic7xxx_queue(Scsi_Cmnd *cmd, void (*fn)(Scsi_Cmnd *))
10358 * Returns an enumerated type that indicates the status of the operation. 10358 * Returns an enumerated type that indicates the status of the operation.
10359 *-F*************************************************************************/ 10359 *-F*************************************************************************/
10360static int 10360static int
10361aic7xxx_bus_device_reset(Scsi_Cmnd *cmd) 10361__aic7xxx_bus_device_reset(Scsi_Cmnd *cmd)
10362{ 10362{
10363 struct aic7xxx_host *p; 10363 struct aic7xxx_host *p;
10364 struct aic7xxx_scb *scb; 10364 struct aic7xxx_scb *scb;
@@ -10551,6 +10551,18 @@ aic7xxx_bus_device_reset(Scsi_Cmnd *cmd)
10551 return SUCCESS; 10551 return SUCCESS;
10552} 10552}
10553 10553
10554static int
10555aic7xxx_bus_device_reset(Scsi_Cmnd *cmd)
10556{
10557 int rc;
10558
10559 spin_lock_irq(cmd->device->host->host_lock);
10560 rc = __aic7xxx_bus_device_reset(cmd);
10561 spin_unlock_irq(cmd->device->host->host_lock);
10562
10563 return rc;
10564}
10565
10554 10566
10555/*+F************************************************************************* 10567/*+F*************************************************************************
10556 * Function: 10568 * Function:
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index d857842bc45b..d89b8eb3cdf3 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -976,9 +976,7 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)
976 return FAILED; 976 return FAILED;
977 } 977 }
978 978
979 spin_unlock_irq(hostdata->host->host_lock);
980 wait_for_completion(&evt->comp); 979 wait_for_completion(&evt->comp);
981 spin_lock_irq(hostdata->host->host_lock);
982 980
983 /* make sure we got a good response */ 981 /* make sure we got a good response */
984 if (unlikely(srp_rsp.srp.generic.type != SRP_RSP_TYPE)) { 982 if (unlikely(srp_rsp.srp.generic.type != SRP_RSP_TYPE)) {
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index f9c01a13abef..fd8af643feac 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -2916,7 +2916,7 @@ static int ipr_eh_host_reset(struct scsi_cmnd * scsi_cmd)
2916 * Return value: 2916 * Return value:
2917 * SUCCESS / FAILED 2917 * SUCCESS / FAILED
2918 **/ 2918 **/
2919static int ipr_eh_dev_reset(struct scsi_cmnd * scsi_cmd) 2919static int __ipr_eh_dev_reset(struct scsi_cmnd * scsi_cmd)
2920{ 2920{
2921 struct ipr_cmnd *ipr_cmd; 2921 struct ipr_cmnd *ipr_cmd;
2922 struct ipr_ioa_cfg *ioa_cfg; 2922 struct ipr_ioa_cfg *ioa_cfg;
@@ -2970,6 +2970,17 @@ static int ipr_eh_dev_reset(struct scsi_cmnd * scsi_cmd)
2970 return (IPR_IOASC_SENSE_KEY(ioasc) ? FAILED : SUCCESS); 2970 return (IPR_IOASC_SENSE_KEY(ioasc) ? FAILED : SUCCESS);
2971} 2971}
2972 2972
2973static int ipr_eh_dev_reset(struct scsi_cmnd * cmd)
2974{
2975 int rc;
2976
2977 spin_lock_irq(cmd->device->host->host_lock);
2978 rc = __ipr_eh_dev_reset(cmd);
2979 spin_unlock_irq(cmd->device->host->host_lock);
2980
2981 return rc;
2982}
2983
2973/** 2984/**
2974 * ipr_bus_reset_done - Op done function for bus reset. 2985 * ipr_bus_reset_done - Op done function for bus reset.
2975 * @ipr_cmd: ipr command struct 2986 * @ipr_cmd: ipr command struct
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index e9b84f9d8e81..13da26883da3 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -928,7 +928,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd)
928} 928}
929 929
930static int 930static int
931lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) 931__lpfc_reset_lun_handler(struct scsi_cmnd *cmnd)
932{ 932{
933 struct Scsi_Host *shost = cmnd->device->host; 933 struct Scsi_Host *shost = cmnd->device->host;
934 struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata[0]; 934 struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata[0];
@@ -1040,6 +1040,16 @@ out:
1040 return ret; 1040 return ret;
1041} 1041}
1042 1042
1043static int
1044lpfc_reset_lun_handler(struct scsi_cmnd *cmnd)
1045{
1046 int rc;
1047 spin_lock_irq(cmnd->device->host->host_lock);
1048 rc = __lpfc_reset_lun_handler(cmnd);
1049 spin_unlock_irq(cmnd->device->host->host_lock);
1050 return rc;
1051}
1052
1043/* 1053/*
1044 * Note: midlayer calls this function with the host_lock held 1054 * Note: midlayer calls this function with the host_lock held
1045 */ 1055 */
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 8d707b29027d..80b0c40c522b 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -1938,7 +1938,7 @@ megaraid_abort(Scsi_Cmnd *cmd)
1938 1938
1939 1939
1940static int 1940static int
1941megaraid_reset(Scsi_Cmnd *cmd) 1941__megaraid_reset(Scsi_Cmnd *cmd)
1942{ 1942{
1943 adapter_t *adapter; 1943 adapter_t *adapter;
1944 megacmd_t mc; 1944 megacmd_t mc;
@@ -1972,6 +1972,18 @@ megaraid_reset(Scsi_Cmnd *cmd)
1972 return rval; 1972 return rval;
1973} 1973}
1974 1974
1975static int
1976megaraid_reset(Scsi_Cmnd *cmd)
1977{
1978 adapter = (adapter_t *)cmd->device->host->hostdata;
1979 int rc;
1980
1981 spin_lock_irq(&adapter->lock);
1982 rc = __megaraid_reset(cmd);
1983 spin_unlock_irq(&adapter->lock);
1984
1985 return rc;
1986}
1975 1987
1976 1988
1977/** 1989/**
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index bec4406011aa..057ed45b54b2 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -2726,7 +2726,7 @@ megaraid_abort_handler(struct scsi_cmnd *scp)
2726 * host 2726 * host
2727 **/ 2727 **/
2728static int 2728static int
2729megaraid_reset_handler(struct scsi_cmnd *scp) 2729__megaraid_reset_handler(struct scsi_cmnd *scp)
2730{ 2730{
2731 adapter_t *adapter; 2731 adapter_t *adapter;
2732 scb_t *scb; 2732 scb_t *scb;
@@ -2847,6 +2847,18 @@ megaraid_reset_handler(struct scsi_cmnd *scp)
2847 return rval; 2847 return rval;
2848} 2848}
2849 2849
2850static int
2851megaraid_reset_handler(struct scsi_cmnd *cmd)
2852{
2853 int rc;
2854
2855 spin_lock_irq(cmd->device->host->host_lock);
2856 rc = __megaraid_reset_handler(cmd);
2857 spin_unlock_irq(cmd->device->host->host_lock);
2858
2859 return rc;
2860}
2861
2850 2862
2851/* 2863/*
2852 * START: internal commands library 2864 * START: internal commands library
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 638be81c4509..907a1e8cc880 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -1114,7 +1114,13 @@ qla1280_eh_abort(struct scsi_cmnd * cmd)
1114static int 1114static int
1115qla1280_eh_device_reset(struct scsi_cmnd *cmd) 1115qla1280_eh_device_reset(struct scsi_cmnd *cmd)
1116{ 1116{
1117 return qla1280_error_action(cmd, DEVICE_RESET); 1117 int rc;
1118
1119 spin_lock_irq(cmd->device->host->host_lock);
1120 rc = qla1280_error_action(cmd, DEVICE_RESET);
1121 spin_unlock_irq(cmd->device->host->host_lock);
1122
1123 return rc;
1118} 1124}
1119 1125
1120/************************************************************************** 1126/**************************************************************************
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 1693998aa727..360974eb2b26 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -613,12 +613,8 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
613 qla_printk(KERN_INFO, ha, 613 qla_printk(KERN_INFO, ha,
614 "scsi(%ld:%d:%d): DEVICE RESET ISSUED.\n", ha->host_no, id, lun); 614 "scsi(%ld:%d:%d): DEVICE RESET ISSUED.\n", ha->host_no, id, lun);
615 615
616 spin_unlock_irq(ha->host->host_lock); 616 if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS)
617
618 if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) {
619 spin_lock_irq(ha->host->host_lock);
620 goto eh_dev_reset_done; 617 goto eh_dev_reset_done;
621 }
622 618
623 if (qla2x00_wait_for_loop_ready(ha) == QLA_SUCCESS) { 619 if (qla2x00_wait_for_loop_ready(ha) == QLA_SUCCESS) {
624 if (qla2x00_device_reset(ha, fcport) == 0) 620 if (qla2x00_device_reset(ha, fcport) == 0)
@@ -669,8 +665,6 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
669 "scsi(%ld:%d:%d): DEVICE RESET SUCCEEDED.\n", ha->host_no, id, lun); 665 "scsi(%ld:%d:%d): DEVICE RESET SUCCEEDED.\n", ha->host_no, id, lun);
670 666
671eh_dev_reset_done: 667eh_dev_reset_done:
672 spin_lock_irq(ha->host->host_lock);
673
674 return ret; 668 return ret;
675} 669}
676 670
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 3877a78f5e50..87d925055b47 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -857,17 +857,14 @@ static int scsi_eh_abort_cmds(struct list_head *work_q,
857 **/ 857 **/
858static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd) 858static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd)
859{ 859{
860 unsigned long flags; 860 int rtn;
861 int rtn = FAILED;
862 861
863 if (!scmd->device->host->hostt->eh_device_reset_handler) 862 if (!scmd->device->host->hostt->eh_device_reset_handler)
864 return rtn; 863 return FAILED;
865 864
866 scmd->owner = SCSI_OWNER_LOWLEVEL; 865 scmd->owner = SCSI_OWNER_LOWLEVEL;
867 866
868 spin_lock_irqsave(scmd->device->host->host_lock, flags);
869 rtn = scmd->device->host->hostt->eh_device_reset_handler(scmd); 867 rtn = scmd->device->host->hostt->eh_device_reset_handler(scmd);
870 spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
871 868
872 if (rtn == SUCCESS) { 869 if (rtn == SUCCESS) {
873 scmd->device->was_reset = 1; 870 scmd->device->was_reset = 1;
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index e2d055ed5b6f..5ea62552d47d 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -867,7 +867,13 @@ static int sym53c8xx_eh_abort_handler(struct scsi_cmnd *cmd)
867 867
868static int sym53c8xx_eh_device_reset_handler(struct scsi_cmnd *cmd) 868static int sym53c8xx_eh_device_reset_handler(struct scsi_cmnd *cmd)
869{ 869{
870 return sym_eh_handler(SYM_EH_DEVICE_RESET, "DEVICE RESET", cmd); 870 int rc;
871
872 spin_lock_irq(cmd->device->host->host_lock);
873 rc = sym_eh_handler(SYM_EH_DEVICE_RESET, "DEVICE RESET", cmd);
874 spin_unlock_irq(cmd->device->host->host_lock);
875
876 return rc;
871} 877}
872 878
873static int sym53c8xx_eh_bus_reset_handler(struct scsi_cmnd *cmd) 879static int sym53c8xx_eh_bus_reset_handler(struct scsi_cmnd *cmd)
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 7dce9c01c357..739a9143477d 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -253,8 +253,6 @@ static int device_reset(struct scsi_cmnd *srb)
253 253
254 US_DEBUGP("%s called\n", __FUNCTION__); 254 US_DEBUGP("%s called\n", __FUNCTION__);
255 255
256 scsi_unlock(us_to_host(us));
257
258 /* lock the device pointers and do the reset */ 256 /* lock the device pointers and do the reset */
259 down(&(us->dev_semaphore)); 257 down(&(us->dev_semaphore));
260 if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { 258 if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) {
@@ -264,8 +262,6 @@ static int device_reset(struct scsi_cmnd *srb)
264 result = us->transport_reset(us); 262 result = us->transport_reset(us);
265 up(&(us->dev_semaphore)); 263 up(&(us->dev_semaphore));
266 264
267 /* lock the host for the return */
268 scsi_lock(us_to_host(us));
269 return result; 265 return result;
270} 266}
271 267