From owner-svn-src-all@FreeBSD.ORG Mon Jun 10 01:06:58 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 37D73DB8; Mon, 10 Jun 2013 01:06:58 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id C266F1224; Mon, 10 Jun 2013 01:06:57 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id BAA85F13; Mon, 10 Jun 2013 03:02:29 +0200 (CEST) Date: Mon, 10 Jun 2013 03:06:52 +0200 From: Pawel Jakub Dawidek To: Marcel Moolenaar Subject: Re: svn commit: r251590 - in head/sys: kern sys Message-ID: <20130610010652.GD2468@garage.freebsd.pl> References: <201306092351.r59NpRTZ024888@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="pQhZXvAqiZgbeUkD" Content-Disposition: inline In-Reply-To: <201306092351.r59NpRTZ024888@svn.freebsd.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jun 2013 01:06:58 -0000 --pQhZXvAqiZgbeUkD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jun 09, 2013 at 11:51:27PM +0000, Marcel Moolenaar wrote: > Author: marcel > Date: Sun Jun 9 23:51:26 2013 > New Revision: 251590 > URL: http://svnweb.freebsd.org/changeset/base/251590 >=20 > Log: > Add vfs_mounted and vfs_unmounted events so that components can be info= rmed > about mount and unmount events. This is used by Juniper to implement a = more > optimal implementation of NetBSD's veriexec. Both handlers are executes after dropping the locks. How can you safely use 'newdp' in vfs_mounted and 'mp' in vfs_unmounted? > Submitted by: stevek@juniper.net > Obtained from: Juniper Networks, Inc >=20 > Modified: > head/sys/kern/vfs_mount.c > head/sys/sys/mount.h >=20 > Modified: head/sys/kern/vfs_mount.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/kern/vfs_mount.c Sun Jun 9 23:50:30 2013 (r251589) > +++ head/sys/kern/vfs_mount.c Sun Jun 9 23:51:26 2013 (r251590) > @@ -864,6 +864,7 @@ vfs_domount_first( > VOP_UNLOCK(newdp, 0); > VOP_UNLOCK(vp, 0); > mountcheckdirs(vp, newdp); > + EVENTHANDLER_INVOKE(vfs_mounted, mp, newdp, td); > vrele(newdp); > if ((mp->mnt_flag & MNT_RDONLY) =3D=3D 0) > vfs_allocate_syncvnode(mp); > @@ -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 !=3D NULL) { > coveredvp->v_mountedhere =3D NULL; > vput(coveredvp); >=20 > Modified: head/sys/sys/mount.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/sys/mount.h Sun Jun 9 23:50:30 2013 (r251589) > +++ head/sys/sys/mount.h Sun Jun 9 23:51:26 2013 (r251590) > @@ -39,6 +39,7 @@ > #include > #include > #include > +#include > #endif > =20 > /* > @@ -798,6 +799,17 @@ vfs_statfs_t __vfs_statfs; > extern char *mountrootfsname; > =20 > /* > + * Event handlers > + */ > + > +typedef void (*vfs_mounted_notify_fn)(void *, struct mount *, struct vno= de *, > + struct thread *); > +typedef void (*vfs_unmounted_notify_fn)(void *, struct mount *, > + struct thread *); > +EVENTHANDLER_DECLARE(vfs_mounted, vfs_mounted_notify_fn); > +EVENTHANDLER_DECLARE(vfs_unmounted, vfs_unmounted_notify_fn); > + > +/* > * exported vnode operations > */ > =20 --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://mobter.com --pQhZXvAqiZgbeUkD Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iEYEARECAAYFAlG1JqwACgkQForvXbEpPzTvdACeN3YIWDvAiASUDmJJ2NvqvIw6 RVYAnR69oB9B12DqNsw++tT1+RuitQB7 =L4vi -----END PGP SIGNATURE----- --pQhZXvAqiZgbeUkD--