aboutsummaryrefslogtreecommitdiff
path: root/sys/fs
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2004-03-10 20:56:28 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2004-03-10 20:56:28 +0000
commit39a78f8cf49948cfb3ad933b44ea4baa71cd0d12 (patch)
treef360b628b2e93cde720868f754d8bed43705f3ba /sys/fs
parentd385de74fa5a63313a4d6fb334ae16930403d5c7 (diff)
downloadsrc-39a78f8cf49948cfb3ad933b44ea4baa71cd0d12.tar.gz
src-39a78f8cf49948cfb3ad933b44ea4baa71cd0d12.zip
Don't call devsw() more than we need to, and in particular do not expose
ourselves to device removal by not checking for it the second time. Use count_dev(dev) rather than vcount(vp)
Notes
Notes: svn path=/head/; revision=126823
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/specfs/spec_vnops.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c
index 4fc055332056..97c3804d994e 100644
--- a/sys/fs/specfs/spec_vnops.c
+++ b/sys/fs/specfs/spec_vnops.c
@@ -517,13 +517,13 @@ spec_xstrategy(struct vnode *vp, struct buf *bp)
mp->mnt_stat.f_syncreads++;
}
}
- if (devsw(bp->b_dev) == NULL) {
+ dsw = devsw(bp->b_dev);
+ if (dsw == NULL) {
bp->b_io.bio_error = ENXIO;
bp->b_io.bio_flags |= BIO_ERROR;
biodone(&bp->b_io);
return (0);
}
- dsw = devsw(bp->b_dev);
KASSERT(dsw->d_strategy != NULL,
("No strategy on dev %s responsible for buffer %p\n",
devtoname(bp->b_dev), bp));
@@ -621,7 +621,7 @@ spec_close(ap)
if (td && vp == td->td_proc->p_session->s_ttyvp) {
SESS_LOCK(td->td_proc->p_session);
VI_LOCK(vp);
- if (vcount(vp) == 2 && (vp->v_iflag & VI_XLOCK) == 0) {
+ if (count_dev(dev) == 2 && (vp->v_iflag & VI_XLOCK) == 0) {
td->td_proc->p_session->s_ttyvp = NULL;
oldvp = vp;
}
@@ -645,7 +645,7 @@ spec_close(ap)
/* Forced close. */
} else if (dsw->d_flags & D_TRACKCLOSE) {
/* Keep device updated on status. */
- } else if (vcount(vp) > 1) {
+ } else if (count_dev(dev) > 1) {
VI_UNLOCK(vp);
return (0);
}