diff options
author | marcel <marcel@FreeBSD.org> | 2013-07-10 15:35:25 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2013-07-10 15:35:25 +0000 |
commit | c660176671bf640bee3fd09dbfa32ad187a9b942 (patch) | |
tree | d00804d0a0ad0d7be57e1603daa31bf232bf72bf /sys/kern/vfs_mount.c | |
parent | 86d89cd580c92d438f4d63e0afa67b604bb85d1e (diff) | |
download | FreeBSD-src-c660176671bf640bee3fd09dbfa32ad187a9b942.zip FreeBSD-src-c660176671bf640bee3fd09dbfa32ad187a9b942.tar.gz |
Add vfs_mounted and vfs_unmounted events so that components can be informed
about mount and unmount events. This is used by Juniper to implement a more
optimal implementation of NetBSD's veriexec.
This change differs from r253224 in the following way:
o The vfs_mounted handler is called before mountcheckdirs() and with
newdp locked. vp is unlocked.
o The event handlers are declared in <sys/eventhandler.h> and not in
<sys/mount.h>. The <sys/mount.h> header is used in user land code
that pretends to be kernel code and as such creates a very convoluted
environment. It's hard to untangle.
Submitted by: stevek@juniper.net
Discussed with: pjd@
Obtained from: Juniper Networks, Inc.
Diffstat (limited to 'sys/kern/vfs_mount.c')
-rw-r--r-- | sys/kern/vfs_mount.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 448fdbb..493bb98 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -861,8 +861,9 @@ vfs_domount_first( vfs_event_signal(NULL, VQ_MOUNT, 0); if (VFS_ROOT(mp, LK_EXCLUSIVE, &newdp)) panic("mount: lost mount"); - VOP_UNLOCK(newdp, 0); VOP_UNLOCK(vp, 0); + EVENTHANDLER_INVOKE(vfs_mounted, mp, newdp, td); + VOP_UNLOCK(newdp, 0); mountcheckdirs(vp, newdp); vrele(newdp); if ((mp->mnt_flag & MNT_RDONLY) == 0) @@ -1355,6 +1356,7 @@ dounmount(mp, flags, td) mtx_lock(&mountlist_mtx); TAILQ_REMOVE(&mountlist, mp, mnt_list); mtx_unlock(&mountlist_mtx); + EVENTHANDLER_INVOKE(vfs_unmounted, mp, td); if (coveredvp != NULL) { coveredvp->v_mountedhere = NULL; vput(coveredvp); |