Author: jh Date: Wed Dec 15 16:42:44 2010 New Revision: 216461 URL: http://svn.freebsd.org/changeset/base/216461
Log: - Assert that dm_lock is exclusively held in devfs_rules_apply() and in devfs_vmkdir() while adding the entry to de_list of the parent. - Apply devfs rules to newly created directories and symbolic links. PR: kern/125034 Submitted by: Mateusz Guzik (original version) Modified: head/sys/fs/devfs/devfs_devs.c head/sys/fs/devfs/devfs_rule.c head/sys/fs/devfs/devfs_vnops.c Modified: head/sys/fs/devfs/devfs_devs.c ============================================================================== --- head/sys/fs/devfs/devfs_devs.c Wed Dec 15 16:21:59 2010 (r216460) +++ head/sys/fs/devfs/devfs_devs.c Wed Dec 15 16:42:44 2010 (r216461) @@ -281,8 +281,10 @@ devfs_vmkdir(struct devfs_mount *dmp, ch de->de_dir = dd; } else { de->de_dir = dotdot; + sx_assert(&dmp->dm_lock, SX_XLOCKED); TAILQ_INSERT_TAIL(&dotdot->de_dlist, dd, de_list); dotdot->de_links++; + devfs_rules_apply(dmp, dd); } #ifdef MAC Modified: head/sys/fs/devfs/devfs_rule.c ============================================================================== --- head/sys/fs/devfs/devfs_rule.c Wed Dec 15 16:21:59 2010 (r216460) +++ head/sys/fs/devfs/devfs_rule.c Wed Dec 15 16:42:44 2010 (r216461) @@ -139,6 +139,8 @@ devfs_rules_apply(struct devfs_mount *dm { struct devfs_ruleset *ds; + sx_assert(&dm->dm_lock, SX_XLOCKED); + if (dm->dm_ruleset == 0) return; sx_slock(&sx_rules); Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Wed Dec 15 16:21:59 2010 (r216460) +++ head/sys/fs/devfs/devfs_vnops.c Wed Dec 15 16:42:44 2010 (r216461) @@ -1589,6 +1589,7 @@ devfs_symlink(struct vop_symlink_args *a de_dotdot = TAILQ_NEXT(de_dotdot, de_list); /* ".." */ TAILQ_INSERT_AFTER(&dd->de_dlist, de_dotdot, de, de_list); devfs_dir_ref_de(dmp, dd); + devfs_rules_apply(dmp, de); return (devfs_allocv(de, ap->a_dvp->v_mount, LK_EXCLUSIVE, ap->a_vpp)); } _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"