Date: Wed, 22 Jun 2016 09:08:18 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r302078 - stable/10/sys/fs/devfs Message-ID: <201606220908.u5M98IvT018907@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Wed Jun 22 09:08:18 2016 New Revision: 302078 URL: https://svnweb.freebsd.org/changeset/base/302078 Log: MFC r301928: Only access vp->v_rdev for VCHR vnodes in devfs_reclaim(). Modified: stable/10/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/10/sys/fs/devfs/devfs_vnops.c Wed Jun 22 09:05:21 2016 (r302077) +++ stable/10/sys/fs/devfs/devfs_vnops.c Wed Jun 22 09:08:18 2016 (r302078) @@ -1325,10 +1325,10 @@ devfs_readlink(struct vop_readlink_args static int devfs_reclaim(struct vop_reclaim_args *ap) { - struct vnode *vp = ap->a_vp; + struct vnode *vp; struct devfs_dirent *de; - struct cdev *dev; + vp = ap->a_vp; mtx_lock(&devfs_de_interlock); de = vp->v_data; if (de != NULL) { @@ -1336,24 +1336,31 @@ devfs_reclaim(struct vop_reclaim_args *a vp->v_data = NULL; } mtx_unlock(&devfs_de_interlock); - vnode_destroy_vobject(vp); + return (0); +} + +static int +devfs_reclaim_vchr(struct vop_reclaim_args *ap) +{ + struct vnode *vp; + struct cdev *dev; + + vp = ap->a_vp; + MPASS(vp->v_type == VCHR); + + devfs_reclaim(ap); VI_LOCK(vp); dev_lock(); dev = vp->v_rdev; vp->v_rdev = NULL; - - if (dev == NULL) { - dev_unlock(); - VI_UNLOCK(vp); - return (0); - } - - dev->si_usecount -= vp->v_usecount; + if (dev != NULL) + dev->si_usecount -= vp->v_usecount; dev_unlock(); VI_UNLOCK(vp); - dev_rel(dev); + if (dev != NULL) + dev_rel(dev); return (0); } @@ -1791,7 +1798,7 @@ static struct vop_vector devfs_specops = .vop_readdir = VOP_PANIC, .vop_readlink = VOP_PANIC, .vop_reallocblks = VOP_PANIC, - .vop_reclaim = devfs_reclaim, + .vop_reclaim = devfs_reclaim_vchr, .vop_remove = devfs_remove, .vop_rename = VOP_PANIC, .vop_revoke = devfs_revoke,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606220908.u5M98IvT018907>