diff options
author | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 1998-12-04 15:57:02 +0000 |
---|---|---|
committer | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 1998-12-04 15:57:02 +0000 |
commit | 8b4a4d8a81f1a5a5726b527185c202c3915d29d3 (patch) | |
tree | 864d99dbcdd1c3d6e3e61d2577f5f11990db3bfb /sys/kern/vfs_subr.c | |
parent | 823c72007308ffa3572b7f6fa4688c62826a6afb (diff) |
VFS-Lite2 requires stricter locking around vnode buffer queues. vinvalbuf
had insufficient protection
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r-- | sys/kern/vfs_subr.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index d5cb63c5512..a268067c23c 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.25 1998/11/20 01:35:32 art Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.26 1998/12/04 15:57:01 csapuntz Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -1853,6 +1853,7 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo) } splx(s); } + s = splbio(); for (;;) { if ((blist = vp->v_cleanblkhd.lh_first) && (flags & V_SAVEMETA)) @@ -1869,32 +1870,34 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo) nbp = bp->b_vnbufs.le_next; if (flags & V_SAVEMETA && bp->b_lblkno < 0) continue; - s = splbio(); if (bp->b_flags & B_BUSY) { bp->b_flags |= B_WANTED; error = tsleep((caddr_t)bp, slpflag | (PRIBIO + 1), "vinvalbuf", slptimeo); - splx(s); - if (error) + if (error) { + splx(s); return (error); + } break; } bp->b_flags |= B_BUSY | B_VFLUSH; - splx(s); /* * XXX Since there are no node locks for NFS, I believe * there is a slight chance that a delayed write will * occur while sleeping just above, so check for it. */ if ((bp->b_flags & B_DELWRI) && (flags & V_SAVE)) { + splx(s); (void) VOP_BWRITE(bp); + s = splbio(); break; } bp->b_flags |= B_INVAL; brelse(bp); } } + splx(s); if (!(flags & V_SAVEMETA) && (vp->v_dirtyblkhd.lh_first || vp->v_cleanblkhd.lh_first)) panic("vinvalbuf: flush failed"); |