git: 72f61780a47d - stable/13 - vfs_mountroot: Wait for GEOM idle post root holds

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Wed, 12 Jan 2022 19:31:00 UTC
The branch stable/13 has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=72f61780a47dd6b299b30787ad7ac8cc68e83a65

commit 72f61780a47dd6b299b30787ad7ac8cc68e83a65
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2021-12-20 17:51:34 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2022-01-12 19:29:48 +0000

    vfs_mountroot: Wait for GEOM idle post root holds
    
    In the case of a root hold related to the initialization of a disk
    device, a flurry of GEOM tasting is likely to take place as soon as
    the device is initialized and the root hold is released.  If we
    don't wait for GEOM idle it's easy for vfs_mountroot to "win" the
    race and proceed before the root filesystem GEOM is ready.
    
    Reviewed by:    imp
    Sponsored by:   https://www.patreon.com/cperciva
    Differential Revision:  https://reviews.freebsd.org/D33592
    
    (cherry picked from commit 19a172158cc12b3bdd848fead732f2151c36e526)
---
 sys/kern/vfs_mountroot.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/kern/vfs_mountroot.c b/sys/kern/vfs_mountroot.c
index 3ea9a7397d06..851a9c839669 100644
--- a/sys/kern/vfs_mountroot.c
+++ b/sys/kern/vfs_mountroot.c
@@ -1006,6 +1006,7 @@ vfs_mountroot_wait(void)
 		    hz);
 		TSUNWAIT("root mount");
 	}
+	g_waitidle();
 
 	TSEXIT();
 }