From d24d45d9a903acefe097488eacc8d84115ac143b Mon Sep 17 00:00:00 2001 From: Andrew Thompson Date: Fri, 27 Mar 2009 03:52:08 +0000 Subject: [PATCH] Skip the allocation of the root hold token if the mount already happened. --- sys/kern/vfs_mount.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index e489d8097783..9253affcaa44 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -1357,6 +1357,9 @@ root_mount_hold(const char *identifier) { struct root_hold_token *h; + if (root_mounted()) + return (NULL); + h = malloc(sizeof *h, M_DEVBUF, M_ZERO | M_WAITOK); h->who = identifier; mtx_lock(&mountlist_mtx); @@ -1372,6 +1375,8 @@ void root_mount_rel(struct root_hold_token *h) { + if (h == NULL) + return; mtx_lock(&mountlist_mtx); LIST_REMOVE(h, list); wakeup(&root_holds);