Skip to content

Commit df0ae24

Browse files
committed
[SCSI] allow sleeping in ->eh_host_reset_handler()
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1 parent 68b3aa7 commit df0ae24

38 files changed

Lines changed: 177 additions & 44 deletions

‎Documentation/scsi/scsi_mid_low_api.txt‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -990,8 +990,7 @@ Details:
990990
*
991991
* Returns SUCCESS if command aborted else FAILED
992992
*
993-
* Locks: struct Scsi_Host::host_lock held (with irqsave) on entry
994-
* and assumed to be held on return.
993+
* Locks: None held
995994
*
996995
* Calling context: kernel thread
997996
*

‎drivers/fc4/fc.c‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,13 +1005,7 @@ int fcp_scsi_dev_reset(Scsi_Cmnd *SCpnt)
10051005
return SUCCESS;
10061006
}
10071007

1008-
int fcp_scsi_bus_reset(Scsi_Cmnd *SCpnt)
1009-
{
1010-
printk ("FC: bus reset!\n");
1011-
return FAILED;
1012-
}
1013-
1014-
int fcp_scsi_host_reset(Scsi_Cmnd *SCpnt)
1008+
static int __fcp_scsi_host_reset(Scsi_Cmnd *SCpnt)
10151009
{
10161010
fc_channel *fc = FC_SCMND(SCpnt);
10171011
fcp_cmnd *fcmd = FCP_CMND(SCpnt);
@@ -1032,6 +1026,17 @@ int fcp_scsi_host_reset(Scsi_Cmnd *SCpnt)
10321026
else return FAILED;
10331027
}
10341028

1029+
int fcp_scsi_host_reset(Scsi_Cmnd *SCpnt)
1030+
{
1031+
int rc;
1032+
1033+
spin_lock_irqsave(SCpnt->device->host->host_lock, flags);
1034+
rc = __fcp_scsi_host_reset(SCpnt);
1035+
spin_unlock_irqrestore(SCpnt->device->host->host_lock, flags);
1036+
1037+
return rc;
1038+
}
1039+
10351040
static int fcp_els_queue_it(fc_channel *fc, fcp_cmnd *fcmd)
10361041
{
10371042
long i;

‎drivers/fc4/fc_syms.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ EXPORT_SYMBOL(fc_do_prli);
2727
EXPORT_SYMBOL(fcp_scsi_queuecommand);
2828
EXPORT_SYMBOL(fcp_scsi_abort);
2929
EXPORT_SYMBOL(fcp_scsi_dev_reset);
30-
EXPORT_SYMBOL(fcp_scsi_bus_reset);
3130
EXPORT_SYMBOL(fcp_scsi_host_reset);
3231

3332
#endif /* CONFIG_MODULES */

‎drivers/fc4/fcp_impl.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ int fc_do_prli(fc_channel *, unsigned char);
158158
int fcp_scsi_queuecommand(Scsi_Cmnd *, void (* done)(Scsi_Cmnd *));
159159
int fcp_scsi_abort(Scsi_Cmnd *);
160160
int fcp_scsi_dev_reset(Scsi_Cmnd *);
161-
int fcp_scsi_bus_reset(Scsi_Cmnd *);
162161
int fcp_scsi_host_reset(Scsi_Cmnd *);
163162

164163
#endif /* !(_FCP_SCSI_H) */

‎drivers/message/fusion/mptscsih.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,7 +1899,6 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt)
18991899
{
19001900
MPT_SCSI_HOST * hd;
19011901
int status = SUCCESS;
1902-
spinlock_t *host_lock = SCpnt->device->host->host_lock;
19031902

19041903
/* If we can't locate the host to reset, then we failed. */
19051904
if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
@@ -1915,7 +1914,6 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt)
19151914
/* If our attempts to reset the host failed, then return a failed
19161915
* status. The host will be taken off line by the SCSI mid-layer.
19171916
*/
1918-
spin_unlock_irq(host_lock);
19191917
if (mpt_HardResetHandler(hd->ioc, CAN_SLEEP) < 0){
19201918
status = FAILED;
19211919
} else {
@@ -1925,8 +1923,6 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt)
19251923
hd->tmPending = 0;
19261924
hd->tmState = TM_STATE_NONE;
19271925
}
1928-
spin_lock_irq(host_lock);
1929-
19301926

19311927
dtmprintk( ( KERN_WARNING MYNAM ": mptscsih_host_reset: "
19321928
"Status = %s\n",

‎drivers/s390/scsi/zfcp_scsi.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -755,16 +755,13 @@ zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
755755
struct zfcp_unit *unit;
756756
struct Scsi_Host *scsi_host = scpnt->device->host;
757757

758-
spin_unlock_irq(scsi_host->host_lock);
759-
760758
unit = (struct zfcp_unit *) scpnt->device->hostdata;
761759
ZFCP_LOG_NORMAL("host reset because of problems with "
762760
"unit 0x%016Lx\n", unit->fcp_lun);
763761
zfcp_erp_adapter_reopen(unit->port->adapter, 0);
764762
zfcp_erp_wait(unit->port->adapter);
765763
retval = SUCCESS;
766764

767-
spin_lock_irq(scsi_host->host_lock);
768765
return retval;
769766
}
770767

‎drivers/scsi/3w-9xxx.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,8 +1695,6 @@ static int twa_scsi_eh_reset(struct scsi_cmnd *SCpnt)
16951695

16961696
tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata;
16971697

1698-
spin_unlock_irq(tw_dev->host->host_lock);
1699-
17001698
tw_dev->num_resets++;
17011699

17021700
printk(KERN_WARNING "3w-9xxx: scsi%d: WARNING: (0x%02X:0x%04X): Unit #%d: Command (0x%x) timed out, resetting card.\n", tw_dev->host->host_no, TW_DRIVER, 0x2c, SCpnt->device->id, SCpnt->cmnd[0]);
@@ -1709,7 +1707,6 @@ static int twa_scsi_eh_reset(struct scsi_cmnd *SCpnt)
17091707

17101708
retval = SUCCESS;
17111709
out:
1712-
spin_lock_irq(tw_dev->host->host_lock);
17131710
return retval;
17141711
} /* End twa_scsi_eh_reset() */
17151712

‎drivers/scsi/3w-xxxx.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,8 +1430,6 @@ static int tw_scsi_eh_reset(struct scsi_cmnd *SCpnt)
14301430

14311431
tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata;
14321432

1433-
spin_unlock_irq(tw_dev->host->host_lock);
1434-
14351433
tw_dev->num_resets++;
14361434

14371435
printk(KERN_WARNING "3w-xxxx: scsi%d: WARNING: Unit #%d: Command (0x%x) timed out, resetting card.\n", tw_dev->host->host_no, SCpnt->device->id, SCpnt->cmnd[0]);
@@ -1444,7 +1442,6 @@ static int tw_scsi_eh_reset(struct scsi_cmnd *SCpnt)
14441442

14451443
retval = SUCCESS;
14461444
out:
1447-
spin_lock_irq(tw_dev->host->host_lock);
14481445
return retval;
14491446
} /* End tw_scsi_eh_reset() */
14501447

‎drivers/scsi/53c700.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1991,8 +1991,13 @@ NCR_700_host_reset(struct scsi_cmnd * SCp)
19911991
SCp->device->host->host_no, SCp->device->id, SCp->device->lun);
19921992
scsi_print_command(SCp);
19931993

1994+
spin_lock_irq(SCp->device->host->host_lock);
1995+
19941996
NCR_700_internal_bus_reset(SCp->device->host);
19951997
NCR_700_chip_reset(SCp->device->host);
1998+
1999+
spin_unlock_irq(SCp->device->host->host_lock);
2000+
19962001
return SUCCESS;
19972002
}
19982003

‎drivers/scsi/BusLogic.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2746,9 +2746,15 @@ static int BusLogic_host_reset(struct scsi_cmnd * SCpnt)
27462746

27472747
unsigned int id = SCpnt->device->id;
27482748
struct BusLogic_TargetStatistics *stats = &HostAdapter->TargetStatistics[id];
2749+
int rc;
2750+
2751+
spin_lock_irq(SCpnt->device->host->host_lock);
2752+
27492753
BusLogic_IncrementErrorCounter(&stats->HostAdapterResetsRequested);
27502754

2751-
return BusLogic_ResetHostAdapter(HostAdapter, false);
2755+
rc = BusLogic_ResetHostAdapter(HostAdapter, false);
2756+
spin_unlock_irq(SCpnt->device->host->host_lock);
2757+
return rc;
27522758
}
27532759

27542760
/*

0 commit comments

Comments
 (0)