summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2010-04-12 09:51:49 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2010-04-12 09:51:49 +0000
commit92c48865f5205b2178d91f1d1523d13de2be9d51 (patch)
tree744445513143bcb041f94961146990f376eda910 /sys
parentb3799e5c1782267f78506c4bd7678e409cfc4c5f (diff)
i snuck fine grained locking into the midlayer as part of all the
other stuff ive been doing in here. everything that needs protection inside the midlayer and the scsi device drivers (sd, cd, etc) uses mutexes now. this pushes splbio out of the midlayer. splbio is only taken before biodone is called now. ok beck@ marco@ krw@ deraadt@. theyre all terrified, but they all say if we're going to do then now is the right stage of the dev cycle.
Diffstat (limited to 'sys')
-rw-r--r--sys/scsi/cd.c7
-rw-r--r--sys/scsi/scsi_base.c4
-rw-r--r--sys/scsi/sd.c7
-rw-r--r--sys/scsi/ss.c7
-rw-r--r--sys/scsi/ss_mustek.c7
-rw-r--r--sys/scsi/ss_scanjet.c7
-rw-r--r--sys/scsi/st.c7
7 files changed, 25 insertions, 21 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index b93486e61ab..3f49a9a1e5c 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd.c,v 1.164 2010/02/28 21:17:00 krw Exp $ */
+/* $OpenBSD: cd.c,v 1.165 2010/04/12 09:51:48 dlg Exp $ */
/* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */
/*
@@ -683,9 +683,8 @@ cd_buf_done(struct scsi_xfer *xs)
{
struct cd_softc *sc = xs->sc_link->device_softc;
struct buf *bp = xs->cookie;
+ int s;
- splassert(IPL_BIO);
-
switch (xs->error) {
case XS_NOERROR:
bp->b_error = 0;
@@ -733,7 +732,9 @@ retry:
disk_unbusy(&sc->sc_dk, bp->b_bcount - xs->resid,
bp->b_flags & B_READ);
+ s = splbio();
biodone(bp);
+ splx(s);
scsi_xs_put(xs);
cdstart(sc); /* restart io */
}
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index 939cc22d502..76277c7a874 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.168 2010/04/06 00:58:00 dlg Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.169 2010/04/12 09:51:48 dlg Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -1102,8 +1102,6 @@ scsi_xs_exec(struct scsi_xfer *xs)
void
scsi_done(struct scsi_xfer *xs)
{
- splassert(IPL_BIO);
-
#ifdef SCSIDEBUG
if (xs->sc_link->flags & SDEV_DB1) {
if (xs->datalen && (xs->flags & SCSI_DATA_IN))
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index a36d03ca9ed..a6d9ba5adab 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.183 2010/04/06 00:59:50 dlg Exp $ */
+/* $OpenBSD: sd.c,v 1.184 2010/04/12 09:51:48 dlg Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -728,8 +728,7 @@ sd_buf_done(struct scsi_xfer *xs)
{
struct sd_softc *sc = xs->sc_link->device_softc;
struct buf *bp = xs->cookie;
-
- splassert(IPL_BIO);
+ int s;
switch (xs->error) {
case XS_NOERROR:
@@ -778,7 +777,9 @@ retry:
disk_unbusy(&sc->sc_dk, bp->b_bcount - xs->resid,
bp->b_flags & B_READ);
+ s = splbio();
biodone(bp);
+ splx(s);
scsi_xs_put(xs);
}
diff --git a/sys/scsi/ss.c b/sys/scsi/ss.c
index 10d030cc770..3eb378bd312 100644
--- a/sys/scsi/ss.c
+++ b/sys/scsi/ss.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ss.c,v 1.70 2010/01/15 05:50:31 krw Exp $ */
+/* $OpenBSD: ss.c,v 1.71 2010/04/12 09:51:48 dlg Exp $ */
/* $NetBSD: ss.c,v 1.10 1996/05/05 19:52:55 christos Exp $ */
/*
@@ -682,8 +682,7 @@ ssdone(struct scsi_xfer *xs)
{
struct ss_softc *ss = xs->sc_link->device_softc;
struct buf *bp = xs->cookie;
-
- splassert(IPL_BIO);
+ int s;
switch (xs->error) {
case XS_NOERROR:
@@ -727,7 +726,9 @@ retry:
break;
}
+ s = splbio();
biodone(bp);
+ splx(s);
scsi_xs_put(xs);
}
diff --git a/sys/scsi/ss_mustek.c b/sys/scsi/ss_mustek.c
index ee3b42b9f4a..47899c45fa4 100644
--- a/sys/scsi/ss_mustek.c
+++ b/sys/scsi/ss_mustek.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ss_mustek.c,v 1.20 2010/01/15 05:50:31 krw Exp $ */
+/* $OpenBSD: ss_mustek.c,v 1.21 2010/04/12 09:51:48 dlg Exp $ */
/* $NetBSD: ss_mustek.c,v 1.4 1996/05/05 19:52:57 christos Exp $ */
/*
@@ -472,8 +472,7 @@ mustek_read_done(struct scsi_xfer *xs)
{
struct ss_softc *ss = xs->sc_link->device_softc;
struct buf *bp = xs->cookie;
-
- splassert(IPL_BIO);
+ int s;
switch (xs->error) {
case XS_NOERROR:
@@ -521,7 +520,9 @@ retry:
break;
}
+ s = splbio();
biodone(bp);
+ splx(s);
scsi_xs_put(xs);
}
diff --git a/sys/scsi/ss_scanjet.c b/sys/scsi/ss_scanjet.c
index 313a281e52f..1a63981ca0f 100644
--- a/sys/scsi/ss_scanjet.c
+++ b/sys/scsi/ss_scanjet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ss_scanjet.c,v 1.37 2010/01/15 05:50:31 krw Exp $ */
+/* $OpenBSD: ss_scanjet.c,v 1.38 2010/04/12 09:51:48 dlg Exp $ */
/* $NetBSD: ss_scanjet.c,v 1.6 1996/05/18 22:58:01 christos Exp $ */
/*
@@ -309,8 +309,7 @@ scanjet_read_done(struct scsi_xfer *xs)
{
struct ss_softc *ss = xs->sc_link->device_softc;
struct buf *bp = xs->cookie;
-
- splassert(IPL_BIO);
+ int s;
switch (xs->error) {
case XS_NOERROR:
@@ -359,7 +358,9 @@ retry:
break;
}
+ s = splbio();
biodone(bp);
+ splx(s);
scsi_xs_put(xs);
}
diff --git a/sys/scsi/st.c b/sys/scsi/st.c
index 96878b51f35..c53129ce6b0 100644
--- a/sys/scsi/st.c
+++ b/sys/scsi/st.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: st.c,v 1.93 2010/01/15 05:50:31 krw Exp $ */
+/* $OpenBSD: st.c,v 1.94 2010/04/12 09:51:48 dlg Exp $ */
/* $NetBSD: st.c,v 1.71 1997/02/21 23:03:49 thorpej Exp $ */
/*
@@ -1088,8 +1088,7 @@ st_buf_done(struct scsi_xfer *xs)
{
struct st_softc *st = xs->sc_link->device_softc;
struct buf *bp = xs->cookie;
-
- splassert(IPL_BIO);
+ int s;
switch (xs->error) {
case XS_NOERROR:
@@ -1133,7 +1132,9 @@ retry:
break;
}
+ s = splbio();
biodone(bp);
+ splx(s);
scsi_xs_put(xs);
ststart(st); /* restart io */
}