mountroot event

Andriy Gapon avg at FreeBSD.org
Wed Mar 20 08:30:33 UTC 2013


I would like to propose the following change.

My understanding is that it was never a true intention to post 'mountroot' event
on every set_rootvnode() call, but rather an accident in the original commit.
But I could be wrong here.  In either case I think that it is more appropriate
to post the event only once.  I do not expect that there could be any consumers
interested in all the details of root fs manipulations.

It looks like there is just a single subscriber to this event in
subr_firmware.c.  I am not familiar with that code, so I would like to ask for
confirmation that the proposed change won't break anything there.

Thank you.

commit 9dc8eaa50afa6ac88c44fbaad82509721e106f1a
Author: Andriy Gapon <avg at icyb.net.ua>
Date:   Wed Mar 6 08:57:35 2013 +0200

    post mountroot event after a real/final root is mounted

    not every time an intermediate root (including the first devfs) is mounted.

diff --git a/sys/kern/vfs_mountroot.c b/sys/kern/vfs_mountroot.c
index 147926e..162738d 100644
--- a/sys/kern/vfs_mountroot.c
+++ b/sys/kern/vfs_mountroot.c
@@ -199,8 +199,6 @@ set_rootvnode(void)
 	VREF(rootvnode);

 	FILEDESC_XUNLOCK(p->p_fd);
-
-	EVENTHANDLER_INVOKE(mountroot);
 }

 static int
@@ -991,6 +989,8 @@ vfs_mountroot(void)
 	atomic_store_rel_int(&root_mount_complete, 1);
 	wakeup(&root_mount_complete);
 	mtx_unlock(&mountlist_mtx);
+
+	EVENTHANDLER_INVOKE(mountroot);
 }

 static struct mntarg *

-- 
Andriy Gapon


More information about the freebsd-hackers mailing list