summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorThierry Deval <tdeval@cvs.openbsd.org>2002-05-28 23:38:11 +0000
committerThierry Deval <tdeval@cvs.openbsd.org>2002-05-28 23:38:11 +0000
commit3c59f256ec7736ab8b346e98c01333e951f28f83 (patch)
treeffe23c62e42c2ffccdf894329e487bcfe95f860c /sys
parent409d348818f03f3f84d9365d27d044790c1a4324 (diff)
splbio protection for biodone()
ok art@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/raidframe/rf_openbsdkintf.c31
-rw-r--r--sys/dev/raidframe/rf_states.c5
2 files changed, 22 insertions, 14 deletions
diff --git a/sys/dev/raidframe/rf_openbsdkintf.c b/sys/dev/raidframe/rf_openbsdkintf.c
index 36d5f4125e1..ca856ea232a 100644
--- a/sys/dev/raidframe/rf_openbsdkintf.c
+++ b/sys/dev/raidframe/rf_openbsdkintf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rf_openbsdkintf.c,v 1.16 2002/03/14 03:16:07 millert Exp $ */
+/* $OpenBSD: rf_openbsdkintf.c,v 1.17 2002/05/28 23:38:10 tdeval Exp $ */
/* $NetBSD: rf_netbsdkintf.c,v 1.109 2001/07/27 03:30:07 oster Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -775,19 +775,21 @@ raidstrategy(bp)
struct disklabel *lp;
int wlabel;
+ s = splbio();
+
if ((rs->sc_flags & RAIDF_INITED) ==0) {
bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
biodone(bp);
- return;
+ goto raidstrategy_end;
}
if (raidID >= numraid || !raidPtrs[raidID]) {
bp->b_error = ENODEV;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
biodone(bp);
- return;
+ goto raidstrategy_end;
}
raidPtr = raidPtrs[raidID];
if (!raidPtr->valid) {
@@ -795,12 +797,12 @@ raidstrategy(bp)
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
biodone(bp);
- return;
+ goto raidstrategy_end;
}
if (bp->b_bcount == 0) {
db1_printf(("b_bcount is zero..\n"));
biodone(bp);
- return;
+ goto raidstrategy_end;
}
lp = rs->sc_dkdev.dk_label;
@@ -815,11 +817,9 @@ raidstrategy(bp)
db1_printf(("Bounds check failed!!:%d %d\n",
(int)bp->b_blkno, (int)wlabel));
biodone(bp);
- return;
+ goto raidstrategy_end;
}
- s = splbio();
-
bp->b_resid = 0;
bp->b_actf = rs->sc_q.b_actf;
@@ -828,6 +828,7 @@ raidstrategy(bp)
raidstart(raidPtrs[raidID]);
+raidstrategy_end:
splx(s);
}
@@ -1808,6 +1809,9 @@ raidstart(raidPtr)
bp->b_error = ENOSPC;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
+ /* db1_printf(("%s: Calling biodone on 0x%x\n",
+ __func__, bp)); */
+ splassert(IPL_BIO);
biodone(bp);
RF_LOCK_MUTEX(raidPtr->mutex);
continue;
@@ -1820,6 +1824,9 @@ raidstart(raidPtr)
bp->b_error = EINVAL;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
+ /* db1_printf(("%s: Calling biodone on 0x%x\n",
+ __func__, bp)); */
+ splassert(IPL_BIO);
biodone(bp);
RF_LOCK_MUTEX(raidPtr->mutex);
continue;
@@ -2705,10 +2712,9 @@ rf_RewriteParityThread(raidPtr)
int retcode;
int s;
- raidPtr->parity_rewrite_in_progress = 1;
s = splbio();
+ raidPtr->parity_rewrite_in_progress = 1;
retcode = rf_RewriteParity(raidPtr);
- splx(s);
if (retcode) {
printf("raid%d: Error re-writing parity!\n",raidPtr->raidid);
} else {
@@ -2718,6 +2724,7 @@ rf_RewriteParityThread(raidPtr)
raidPtr->parity_good = RF_RAID_CLEAN;
}
raidPtr->parity_rewrite_in_progress = 0;
+ splx(s);
/* Anyone waiting for us to stop? If so, inform them... */
if (raidPtr->waitShutdown) {
@@ -2735,11 +2742,11 @@ rf_CopybackThread(raidPtr)
{
int s;
- raidPtr->copyback_in_progress = 1;
s = splbio();
+ raidPtr->copyback_in_progress = 1;
rf_CopybackReconstructedData(raidPtr);
- splx(s);
raidPtr->copyback_in_progress = 0;
+ splx(s);
/* That's all... */
kthread_exit(0); /* does not return */
diff --git a/sys/dev/raidframe/rf_states.c b/sys/dev/raidframe/rf_states.c
index b7470a8e190..0b78cc14233 100644
--- a/sys/dev/raidframe/rf_states.c
+++ b/sys/dev/raidframe/rf_states.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rf_states.c,v 1.7 2001/12/29 21:51:18 tdeval Exp $ */
+/* $OpenBSD: rf_states.c,v 1.8 2002/05/28 23:38:10 tdeval Exp $ */
/* $NetBSD: rf_states.c,v 1.15 2000/10/20 02:24:45 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
@@ -220,7 +220,8 @@ rf_State_LastState(RF_RaidAccessDesc_t * desc)
/* wake up any pending IO */
raidstart(((RF_Raid_t *) desc->raidPtr));
- /* printf("Calling biodone on 0x%x\n",desc->bp); */
+ /* printf("%s: Calling biodone on 0x%x\n", __func__, desc->bp); */
+ splassert(IPL_BIO);
biodone(desc->bp); /* access came through ioctl */
if (callbackFunc)