mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Add a how argument to root_mount_hold() so it can be passed NOWAIT and be called
in situations where sleeping isnt allowed.
This commit is contained in:
parent
27b31641fb
commit
626fc9fe3d
9 changed files with 14 additions and 10 deletions
|
|
@ -3087,7 +3087,7 @@ zfs_modevent(module_t mod, int type, void *unused __unused)
|
|||
error = EOPNOTSUPP;
|
||||
switch (type) {
|
||||
case MOD_LOAD:
|
||||
zfs_root_token = root_mount_hold("ZFS");
|
||||
zfs_root_token = root_mount_hold("ZFS", M_WAITOK);
|
||||
printf("WARNING: ZFS is considered to be an experimental "
|
||||
"feature in FreeBSD.\n");
|
||||
TASK_INIT(&zfs_start_task, 0, zfs_start, NULL);
|
||||
|
|
|
|||
|
|
@ -439,7 +439,7 @@ cbb_pci_attach(device_t brdev)
|
|||
device_printf(brdev, "unable to create event thread.\n");
|
||||
panic("cbb_create_event_thread");
|
||||
}
|
||||
sc->sc_root_token = root_mount_hold(device_get_nameunit(sc->dev));
|
||||
sc->sc_root_token = root_mount_hold(device_get_nameunit(sc->dev), M_WAITOK);
|
||||
return (0);
|
||||
err:
|
||||
if (sc->irq_res)
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ usb2_attach(device_t dev)
|
|||
}
|
||||
|
||||
/* delay vfs_mountroot until the bus is explored */
|
||||
bus->bus_roothold = root_mount_hold(device_get_nameunit(dev));
|
||||
bus->bus_roothold = root_mount_hold(device_get_nameunit(dev), M_WAITOK);
|
||||
|
||||
if (usb2_post_init_called) {
|
||||
mtx_lock(&Giant);
|
||||
|
|
|
|||
|
|
@ -2310,7 +2310,7 @@ g_journal_create(struct g_class *mp, struct g_provider *pp,
|
|||
sc->sc_inactive.jj_queue = NULL;
|
||||
sc->sc_active.jj_queue = NULL;
|
||||
|
||||
sc->sc_rootmount = root_mount_hold("GJOURNAL");
|
||||
sc->sc_rootmount = root_mount_hold("GJOURNAL", M_WAITOK);
|
||||
GJ_DEBUG(1, "root_mount_hold %p", sc->sc_rootmount);
|
||||
|
||||
callout_init(&sc->sc_callout, CALLOUT_MPSAFE);
|
||||
|
|
|
|||
|
|
@ -2907,7 +2907,7 @@ g_mirror_create(struct g_class *mp, const struct g_mirror_metadata *md)
|
|||
G_MIRROR_DEBUG(1, "Device %s created (%u components, id=%u).",
|
||||
sc->sc_name, sc->sc_ndisks, sc->sc_id);
|
||||
|
||||
sc->sc_rootmount = root_mount_hold("GMIRROR");
|
||||
sc->sc_rootmount = root_mount_hold("GMIRROR", M_WAITOK);
|
||||
G_MIRROR_DEBUG(1, "root_mount_hold %p", sc->sc_rootmount);
|
||||
/*
|
||||
* Run timeout.
|
||||
|
|
|
|||
|
|
@ -1474,7 +1474,7 @@ g_part_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
rht = root_mount_hold(mp->name);
|
||||
rht = root_mount_hold(mp->name, M_WAITOK);
|
||||
g_topology_unlock();
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -3193,7 +3193,7 @@ g_raid3_create(struct g_class *mp, const struct g_raid3_metadata *md)
|
|||
G_RAID3_DEBUG(1, "Device %s created (%u components, id=%u).",
|
||||
sc->sc_name, sc->sc_ndisks, sc->sc_id);
|
||||
|
||||
sc->sc_rootmount = root_mount_hold("GRAID3");
|
||||
sc->sc_rootmount = root_mount_hold("GRAID3", M_WAITOK);
|
||||
G_RAID3_DEBUG(1, "root_mount_hold %p", sc->sc_rootmount);
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1353,14 +1353,18 @@ static int root_mount_complete;
|
|||
* Hold root mount.
|
||||
*/
|
||||
struct root_hold_token *
|
||||
root_mount_hold(const char *identifier)
|
||||
root_mount_hold(const char *identifier, int how)
|
||||
{
|
||||
struct root_hold_token *h;
|
||||
|
||||
if (root_mounted())
|
||||
return (NULL);
|
||||
|
||||
h = malloc(sizeof *h, M_DEVBUF, M_ZERO | M_WAITOK);
|
||||
h = malloc(sizeof *h, M_DEVBUF, M_ZERO | how);
|
||||
if (h == NULL) {
|
||||
printf("Unable to alloc root hold token for %s\n", identifier);
|
||||
return (NULL);
|
||||
}
|
||||
h->who = identifier;
|
||||
mtx_lock(&mountlist_mtx);
|
||||
LIST_INSERT_HEAD(&root_holds, h, list);
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ void DELAY(int usec);
|
|||
/* Root mount holdback API */
|
||||
struct root_hold_token;
|
||||
|
||||
struct root_hold_token *root_mount_hold(const char *identifier);
|
||||
struct root_hold_token *root_mount_hold(const char *identifier, int how);
|
||||
void root_mount_rel(struct root_hold_token *h);
|
||||
void root_mount_wait(void);
|
||||
int root_mounted(void);
|
||||
|
|
|
|||
Loading…
Reference in a new issue