From df0ae2497ddefd72a87f3a3b34ff32455d7d4ae0 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sat, 28 May 2005 07:57:14 -0400 Subject: [SCSI] allow sleeping in ->eh_host_reset_handler() Signed-off-by: James Bottomley --- drivers/scsi/ide-scsi.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'drivers/scsi/ide-scsi.c') diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 83f062ed908..3d62c9bcbff 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -1026,11 +1027,13 @@ static int idescsi_eh_reset (struct scsi_cmnd *cmd) return FAILED; } - spin_lock_irq(&ide_lock); + spin_lock_irq(cmd->device->host->host_lock); + spin_lock(&ide_lock); if (!scsi->pc || (req = scsi->pc->rq) != HWGROUP(drive)->rq || !HWGROUP(drive)->handler) { printk (KERN_WARNING "ide-scsi: No active request in idescsi_eh_reset\n"); spin_unlock(&ide_lock); + spin_unlock_irq(cmd->device->host->host_lock); return FAILED; } @@ -1052,16 +1055,15 @@ static int idescsi_eh_reset (struct scsi_cmnd *cmd) HWGROUP(drive)->rq = NULL; HWGROUP(drive)->handler = NULL; HWGROUP(drive)->busy = 1; /* will set this to zero when ide reset finished */ - spin_unlock_irq(&ide_lock); + spin_unlock(&ide_lock); ide_do_reset(drive); /* ide_do_reset starts a polling handler which restarts itself every 50ms until the reset finishes */ do { - set_current_state(TASK_UNINTERRUPTIBLE); spin_unlock_irq(cmd->device->host->host_lock); - schedule_timeout(HZ/20); + msleep(50); spin_lock_irq(cmd->device->host->host_lock); } while ( HWGROUP(drive)->handler ); @@ -1072,6 +1074,7 @@ static int idescsi_eh_reset (struct scsi_cmnd *cmd) ret = FAILED; } + spin_unlock_irq(cmd->device->host->host_lock); return ret; } -- cgit v1.2.3