summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorgrog <grog@FreeBSD.org>2000-04-06 03:03:31 +0000
committergrog <grog@FreeBSD.org>2000-04-06 03:03:31 +0000
commita5759b7139c3a4101078a011ded212697861390e (patch)
treea1d9831cb47ff3f692ce4971a04b541489aacb6f /sys
parenta8855860943fb96b6b309bd4d7da393020874dab (diff)
downloadFreeBSD-src-a5759b7139c3a4101078a011ded212697861390e.zip
FreeBSD-src-a5759b7139c3a4101078a011ded212697861390e.tar.gz
complete_rqe: Remove a race condition in RAID-4 and RAID-5 where a
request could be deallocated before the top half had finished issuing it. The problem seems only to happen with IDE drives and vn devices, but theoretically it could happen with any drive. This is the most important part of a possible series of fixes designed to remove race conditions without locking out interrupts for longer than absolutely necessary. Reported-by: sos Fix-supplied-by: dillon
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/vinum/vinuminterrupt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/vinum/vinuminterrupt.c b/sys/dev/vinum/vinuminterrupt.c
index dee1bbe..1a1725c 100644
--- a/sys/dev/vinum/vinuminterrupt.c
+++ b/sys/dev/vinum/vinuminterrupt.c
@@ -124,7 +124,6 @@ complete_rqe(struct buf *bp)
if (PLEX[rqe->rqg->plexno].volno >= 0)
VOL[PLEX[rqe->rqg->plexno].volno].bytes_written += bp->b_bcount;
}
- rqg->active--; /* one less request active */
if (rqg->flags & XFR_RECOVERY_READ) { /* recovery read, */
int *sdata; /* source */
int *data; /* and group data */
@@ -155,8 +154,9 @@ complete_rqe(struct buf *bp)
bcopy(src, dst, length); /* move it */
}
} else if ((rqg->flags & (XFR_NORMAL_WRITE | XFR_DEGRADED_WRITE)) /* RAID 4/5 group write operation */
- &&(rqg->active == 0)) /* and we've finished phase 1 */
+ &&(rqg->active == 1)) /* and this is the last rq of phase 1 */
complete_raid5_write(rqe);
+ rqg->active--; /* one less request active */
if (rqg->active == 0) { /* request group finished, */
rq->active--; /* one less */
if (rqg->lock) { /* got a lock? */
OpenPOWER on IntegriCloud