diff options
author | 2005-10-22 16:51:28 +0000 | |
---|---|---|
committer | 2005-10-22 16:51:28 +0000 | |
commit | 19ecea73e97aefe8f7e0935b58425cb3df0a52d8 (patch) | |
tree | 0f09e1583566b38750fd94307d39a40408bb48fb | |
parent | always display the list of packages we can't update. (diff) | |
download | wireguard-openbsd-19ecea73e97aefe8f7e0935b58425cb3df0a52d8.tar.xz wireguard-openbsd-19ecea73e97aefe8f7e0935b58425cb3df0a52d8.zip |
When a scsi command is waiting for an opening or is waiting to be retried,
abort it when a signal interrupts the tsleep().
Suggested by deraadt@.
"I really like this" deraadt@ "I like this" marco@
-rw-r--r-- | sys/scsi/scsi_base.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index 101d4cd0919..94e6f543a73 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi_base.c,v 1.91 2005/10/16 19:16:36 krw Exp $ */ +/* $OpenBSD: scsi_base.c,v 1.92 2005/10/22 16:51:28 krw Exp $ */ /* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */ /* @@ -113,7 +113,11 @@ scsi_get_xs(sc_link, flags) return (NULL); } sc_link->flags |= SDEV_WAITING; - (void) tsleep(sc_link, PRIBIO, "getxs", 0); + if (tsleep(sc_link, PRIBIO, "getxs", 0)) { + /* Bail out on getting a signal. */ + sc_link->flags &= ~SDEV_WAITING; + return (NULL); + } } SC_DEBUG(sc_link, SDEV_DB3, ("calling pool_get\n")); xs = pool_get(&scsi_xfer_pool, @@ -764,6 +768,7 @@ retry: panic("scsi_execute_xs: NOSLEEP and POLL"); #endif s = splbio(); + /* Since the xs is active we can't bail out on a signal. */ while ((xs->flags & ITSDONE) == 0) tsleep(xs, PRIBIO + 1, "scsicmd", 0); splx(s); @@ -879,7 +884,9 @@ sc_err1(xs) if ((xs->flags & SCSI_POLL) != 0) delay(1000000); else if ((xs->flags & SCSI_NOSLEEP) == 0) { - tsleep(&lbolt, PRIBIO, "scbusy", 0); + if (tsleep(&lbolt, PRIBIO, "scbusy", 0)) + /* Bail out on getting a signal. */ + goto lose; } else goto lose; } |