diff options
author | jeff <jeff@FreeBSD.org> | 2003-03-13 07:31:45 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2003-03-13 07:31:45 +0000 |
commit | 459181e3edfeaec7cb190679e1e6490b441ee45b (patch) | |
tree | 98a7f2a073c45904ccdb9d77d843be13cc0222f9 /sys/fs/specfs | |
parent | ec5374265bec154d9330f861f2a089de4212a69d (diff) | |
download | FreeBSD-src-459181e3edfeaec7cb190679e1e6490b441ee45b.zip FreeBSD-src-459181e3edfeaec7cb190679e1e6490b441ee45b.tar.gz |
- Add a lock for protecting against msleep(bp, ...) wakeup(bp) races.
- Create a new function bdone() which sets B_DONE and calls wakup(bp). This
is suitable for use as b_iodone for buf consumers who are not going
through the buf cache.
- Create a new function bwait() which waits for the buf to be done at a set
priority and with a specific wmesg.
- Replace several cases where the above functionality was implemented
without locking with the new functions.
Diffstat (limited to 'sys/fs/specfs')
-rw-r--r-- | sys/fs/specfs/spec_vnops.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c index 4f2c145..b53c819 100644 --- a/sys/fs/specfs/spec_vnops.c +++ b/sys/fs/specfs/spec_vnops.c @@ -123,8 +123,6 @@ spec_vnoperate(ap) return (VOCALL(spec_vnodeop_p, ap->a_desc->vdesc_offset, ap)); } -static void spec_getpages_iodone(struct buf *bp); - /* * Open a special file. */ @@ -689,15 +687,6 @@ spec_advlock(ap) return (ap->a_flags & F_FLOCK ? EOPNOTSUPP : EINVAL); } -static void -spec_getpages_iodone(bp) - struct buf *bp; -{ - - bp->b_flags |= B_DONE; - wakeup(bp); -} - static int spec_getpages(ap) struct vop_getpages_args *ap; @@ -755,7 +744,7 @@ spec_getpages(ap) /* Build a minimal buffer header. */ bp->b_iocmd = BIO_READ; - bp->b_iodone = spec_getpages_iodone; + bp->b_iodone = bdone; /* B_PHYS is not set, but it is nice to fill this in. */ KASSERT(bp->b_rcred == NOCRED, ("leaking read ucred")); @@ -778,11 +767,7 @@ spec_getpages(ap) spec_xstrategy(bp->b_vp, bp); s = splbio(); - - /* We definitely need to be at splbio here. */ - while ((bp->b_flags & B_DONE) == 0) - tsleep(bp, PVM, "spread", 0); - + bwait(bp, PVM, "spread"); splx(s); if ((bp->b_ioflags & BIO_ERROR) != 0) { |