diff options
Diffstat (limited to 'sys/kern/vfs_bio.c')
-rw-r--r-- | sys/kern/vfs_bio.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 063e7d0..b2e73b9 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -3098,18 +3098,24 @@ void dev_strategy(struct buf *bp) { struct cdevsw *csw; + struct cdev *dev; if ((!bp->b_iocmd) || (bp->b_iocmd & (bp->b_iocmd - 1))) panic("b_iocmd botch"); bp->b_io.bio_done = bufdonebio; bp->b_io.bio_caller2 = bp; - csw = devsw(bp->b_io.bio_dev); - KASSERT(bp->b_io.bio_dev->si_refcount > 0, + dev = bp->b_io.bio_dev; + csw = devsw(dev); + KASSERT(dev->si_refcount > 0, ("dev_strategy on un-referenced struct cdev *(%s)", - devtoname(bp->b_io.bio_dev))); - cdevsw_ref(csw); + devtoname(dev))); + dev_lock(); + dev->si_threadcount++; + dev_unlock(); (*devsw(bp->b_io.bio_dev)->d_strategy)(&bp->b_io); - cdevsw_rel(csw); + dev_lock(); + dev->si_threadcount--; + dev_unlock(); } /* |