summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2016-03-19 15:37:34 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2016-03-19 15:37:34 +0000
commitc26d2c6b00487207c82b90e48dba4498d4967391 (patch)
tree2fbb20c89a8c6a5013a2000fcbd8bd53019f414f /sys/scsi
parent3183b82eb8e796e9632db437539942c48959b5c7 (diff)
Do not run into sdgetdisklabel() when scsi disk is dying. Add
special error handling in sdopen() as temporary hack. OK krw@
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/sd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 9e3bc82380f..30fb36b2786 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.268 2016/03/18 18:12:37 bluhm Exp $ */
+/* $OpenBSD: sd.c,v 1.269 2016/03/19 15:37:33 bluhm Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -450,10 +450,9 @@ sdopen(dev_t dev, int flag, int fmt, struct proc *p)
SC_DEBUG(link, SDEV_DB3, ("Params loaded\n"));
/* Load the partition info if not already loaded. */
- if (sdgetdisklabel(dev, sc, sc->sc_dk.dk_label, 0) == EIO) {
- error = EIO;
+ error = sdgetdisklabel(dev, sc, sc->sc_dk.dk_label, 0);
+ if (error == EIO || error == ENXIO)
goto bad;
- }
SC_DEBUG(link, SDEV_DB3, ("Disklabel loaded\n"));
}
@@ -1140,6 +1139,8 @@ sdgetdisklabel(dev_t dev, struct sd_softc *sc, struct disklabel *lp,
char packname[sizeof(lp->d_packname) + 1];
char product[17], vendor[9];
+ if (sc->flags & SDF_DYING)
+ return (ENXIO);
link = sc->sc_link;
bzero(lp, sizeof(struct disklabel));