summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2011-02-21 20:51:03 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2011-02-21 20:51:03 +0000
commit9427ae2c5de561e555c9ff82a44d384ec937ecbf (patch)
tree9d487f56fa016857c342e19065a82e00f0a5b1ca /sys
parente74166c4013a44d1b6681802d88bc4a626a1bdbf (diff)
If a spin up command can't be started becaause of a lack of openings,
delay and retry the original command rather than immediately erroring out. Fixes USB drives that spin themselves down due to inactivity, as confirmed by pirofti@ and jsg@. ok miod@, rough agreement pending more general solution dlg@.
Diffstat (limited to 'sys')
-rw-r--r--sys/scsi/sd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index d83f33ff0d1..69870d445a9 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.219 2010/12/24 02:45:33 krw Exp $ */
+/* $OpenBSD: sd.c,v 1.220 2011/02/21 20:51:02 krw Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -1226,6 +1226,9 @@ sd_interpret_sense(struct scsi_xfer *xs)
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_NOSLEEP);
if (retval == 0)
retval = ERESTART;
+ else if (retval == ENOMEM)
+ /* Can't issue the command. Fall back on a delay. */
+ retval = scsi_delay(xs, 5);
else
SC_DEBUG(sc_link, SDEV_DB1, ("spin up failed (%#x)\n",
retval));