summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_conf.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2006-10-20 07:59:50 +0000
committerkib <kib@FreeBSD.org>2006-10-20 07:59:50 +0000
commit5f5bf9dadc00a7cc8dc6b37e8abf10a23ced17f4 (patch)
tree0c8a260910037a642d1dd98c671e553817da8b56 /sys/kern/kern_conf.c
parent5b6bf7eb1c1469a528a6e28e72f035a6aed74314 (diff)
downloadFreeBSD-src-5f5bf9dadc00a7cc8dc6b37e8abf10a23ced17f4.zip
FreeBSD-src-5f5bf9dadc00a7cc8dc6b37e8abf10a23ced17f4.tar.gz
Fix the race between devfs_fp_check and devfs_reclaim. Derefence the
vnode' v_rdev and increment the dev threadcount , as well as clear it (in devfs_reclaim) under the dev_lock(). Reviewed by: tegge Approved by: pjd (mentor)
Diffstat (limited to 'sys/kern/kern_conf.c')
-rw-r--r--sys/kern/kern_conf.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index d331d53..5520da8 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -125,6 +125,24 @@ dev_refthread(struct cdev *dev)
return (csw);
}
+struct cdevsw *
+devvn_refthread(struct vnode *vp, struct cdev **devp)
+{
+ struct cdevsw *csw;
+
+ mtx_assert(&devmtx, MA_NOTOWNED);
+ csw = NULL;
+ dev_lock();
+ *devp = vp->v_rdev;
+ if (*devp != NULL) {
+ csw = (*devp)->si_devsw;
+ if (csw != NULL)
+ (*devp)->si_threadcount++;
+ }
+ dev_unlock();
+ return (csw);
+}
+
void
dev_relthread(struct cdev *dev)
{
OpenPOWER on IntegriCloud