Make root_mount_hold() work after boot. This is important for two

reasons. First is rerooting into USB-mounted device that happens
to be not yet enumerated. The second is when mounting with (non-root)
filesystem on USB device on a hub that's enumerated later than the root
mount: the rc scripts explicitly mount for the root mount holds to be
released, but each USB bus takes the hold asynchronously, and if that
happens after root mount, it would just get ignored.

Reviewed by:	marcel
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D9388
This commit is contained in:
Edward Tomasz Napierala 2017-02-06 20:44:34 +00:00
parent 4f9d7bad48
commit 1110d0029a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=313351

View File

@ -171,9 +171,6 @@ 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(&root_holds_mtx);
@ -186,8 +183,8 @@ void
root_mount_rel(struct root_hold_token *h)
{
if (h == NULL)
return;
KASSERT(h != NULL, ("%s: NULL token", __func__));
mtx_lock(&root_holds_mtx);
LIST_REMOVE(h, list);
wakeup(&root_holds);