summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1998-12-19 01:32:26 +0000
committerderaadt <deraadt@openbsd.org>1998-12-19 01:32:26 +0000
commit3789f9dff555f785312ee82c5e488c6ae4ddc7d6 (patch)
tree40e1591dd20d113126df38710e3cdd8050b83290
parentsquish program args together more (diff)
downloadwireguard-openbsd-3789f9dff555f785312ee82c5e488c6ae4ddc7d6.tar.xz
wireguard-openbsd-3789f9dff555f785312ee82c5e488c6ae4ddc7d6.zip
for sense code "Logical Unit Is in Process Of Becoming Ready", make
the sense code evaluation function return ERESTART with xs->error = XS_BUSY; then higher up catch this case and drop into the scbusy tsleep code. For exabyte 8500 units, this makes st opening reprobe repeatedly, rather than fail with an EIO while the tape is being loaded.
-rw-r--r--sys/scsi/scsi_base.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index a366a548902..2f0a8a24dda 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.21 1998/02/14 08:56:50 deraadt Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.22 1998/12/19 01:32:26 deraadt Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -238,7 +238,7 @@ scsi_test_unit_ready(sc_link, flags)
scsi_cmd.opcode = TEST_UNIT_READY;
return scsi_scsi_cmd(sc_link, (struct scsi_generic *) &scsi_cmd,
- sizeof(scsi_cmd), 0, 0, 2, 10000, NULL, flags);
+ sizeof(scsi_cmd), 0, 0, 50, 10000, NULL, flags);
}
/*
@@ -531,19 +531,25 @@ sc_err1(xs, async)
break;
case XS_SENSE:
- if ((error = scsi_interpret_sense(xs)) == ERESTART)
+ if ((error = scsi_interpret_sense(xs)) == ERESTART) {
+ if (xs->error == XS_BUSY) {
+ xs->error = XS_SENSE;
+ goto sense_retry;
+ }
goto retry;
+ }
SC_DEBUG(xs->sc_link, SDEV_DB3,
("scsi_interpret_sense returned %d\n", error));
break;
case XS_BUSY:
+ sense_retry:
if (xs->retries) {
if ((xs->flags & SCSI_POLL) != 0)
delay(1000000);
- else if ((xs->flags & SCSI_NOSLEEP) == 0)
+ else if ((xs->flags & SCSI_NOSLEEP) == 0) {
tsleep(&lbolt, PRIBIO, "scbusy", 0);
- else
+ } else
#if 0
timeout(scsi_requeue, xs, hz);
#else
@@ -659,6 +665,11 @@ scsi_interpret_sense(xs)
sc_link->flags &= ~SDEV_MEDIA_LOADED;
if ((xs->flags & SCSI_IGNORE_NOT_READY) != 0)
return 0;
+ if (xs->retries && sense->add_sense_code == 0x04 &&
+ sense->add_sense_code_qual == 0x01) {
+ xs->error = XS_BUSY; /* ie. sense_retry */
+ return ERESTART;
+ }
if (xs->retries && !(sc_link->flags & SDEV_REMOVABLE)) {
delay(1000000);
return ERESTART;