summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2007-12-06 21:49:38 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2007-12-06 21:49:38 +0000
commitf4d1d2e9812bcd7058ad834334285bf456929bfb (patch)
treecdab52fca28e5a21a4b0893ee39bc156d0b17d30
parentf1a7c4834b78598466969697d619b1b40ccac8cc (diff)
solve the biggest problem with concurrent buflist access; makes mfs on
SMP machines reliable. few corner cases remain, which will be dealt with later; ok deraadt@ millert@
-rw-r--r--sys/ufs/mfs/mfs_vfsops.c13
-rw-r--r--sys/ufs/mfs/mfs_vnops.c5
2 files changed, 14 insertions, 4 deletions
diff --git a/sys/ufs/mfs/mfs_vfsops.c b/sys/ufs/mfs/mfs_vfsops.c
index 6264f1a0aef..894534ae7b1 100644
--- a/sys/ufs/mfs/mfs_vfsops.c
+++ b/sys/ufs/mfs/mfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfs_vfsops.c,v 1.37 2007/12/04 19:32:13 otto Exp $ */
+/* $OpenBSD: mfs_vfsops.c,v 1.38 2007/12/06 21:49:37 otto Exp $ */
/* $NetBSD: mfs_vfsops.c,v 1.10 1996/02/09 22:31:28 christos Exp $ */
/*
@@ -172,11 +172,18 @@ mfs_start(struct mount *mp, int flags, struct proc *p)
struct vnode *vp = VFSTOUFS(mp)->um_devvp;
struct mfsnode *mfsp = VTOMFS(vp);
struct buf *bp;
- int sleepreturn = 0;
+ int sleepreturn = 0, s;
while (mfsp->mfs_buflist != (struct buf *)-1) {
- while ((bp = mfsp->mfs_buflist) != NULL) {
+ while (1) {
+ s = splbio();
+ bp = mfsp->mfs_buflist;
+ if (bp == NULL) {
+ splx(s);
+ break;
+ }
mfsp->mfs_buflist = bp->b_actf;
+ splx(s);
mfs_doio(mfsp, bp);
wakeup((caddr_t)bp);
}
diff --git a/sys/ufs/mfs/mfs_vnops.c b/sys/ufs/mfs/mfs_vnops.c
index 1a28d53a378..f9dd66574d3 100644
--- a/sys/ufs/mfs/mfs_vnops.c
+++ b/sys/ufs/mfs/mfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfs_vnops.c,v 1.30 2007/12/04 19:32:13 otto Exp $ */
+/* $OpenBSD: mfs_vnops.c,v 1.31 2007/12/06 21:49:37 otto Exp $ */
/* $NetBSD: mfs_vnops.c,v 1.8 1996/03/17 02:16:32 christos Exp $ */
/*
@@ -140,6 +140,7 @@ mfs_strategy(void *v)
struct mfsnode *mfsp;
struct vnode *vp;
struct proc *p = curproc;
+ int s;
if (!vfinddev(bp->b_dev, VBLK, &vp) || vp->v_usecount == 0)
panic("mfs_strategy: bad dev");
@@ -148,8 +149,10 @@ mfs_strategy(void *v)
if (p != NULL && mfsp->mfs_pid == p->p_pid) {
mfs_doio(mfsp, bp);
} else {
+ s = splbio();
bp->b_actf = mfsp->mfs_buflist;
mfsp->mfs_buflist = bp;
+ splx(s);
wakeup((caddr_t)vp);
}
return (0);