summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2009-04-03 19:46:12 +0000
committerthompsa <thompsa@FreeBSD.org>2009-04-03 19:46:12 +0000
commitfe5458f66537db2116edb0ad1cfa8b9da5fb1ba3 (patch)
tree55afba560e3d37dfdc20bbbb68db00bf16a00f1d /sys
parentd8382f158111ab26e940097a0ca91abe5de5035a (diff)
downloadFreeBSD-src-fe5458f66537db2116edb0ad1cfa8b9da5fb1ba3.zip
FreeBSD-src-fe5458f66537db2116edb0ad1cfa8b9da5fb1ba3.tar.gz
Add a how argument to root_mount_hold() so it can be passed NOWAIT and be called
in situations where sleeping isnt allowed.
Diffstat (limited to 'sys')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c2
-rw-r--r--sys/dev/pccbb/pccbb_pci.c2
-rw-r--r--sys/dev/usb/controller/usb_controller.c2
-rw-r--r--sys/geom/journal/g_journal.c2
-rw-r--r--sys/geom/mirror/g_mirror.c2
-rw-r--r--sys/geom/part/g_part.c2
-rw-r--r--sys/geom/raid3/g_raid3.c2
-rw-r--r--sys/kern/vfs_mount.c8
-rw-r--r--sys/sys/systm.h2
9 files changed, 14 insertions, 10 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
index a6829eb..e91695b 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
@@ -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);
diff --git a/sys/dev/pccbb/pccbb_pci.c b/sys/dev/pccbb/pccbb_pci.c
index c89e5ad..4fcd7ea 100644
--- a/sys/dev/pccbb/pccbb_pci.c
+++ b/sys/dev/pccbb/pccbb_pci.c
@@ -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)
diff --git a/sys/dev/usb/controller/usb_controller.c b/sys/dev/usb/controller/usb_controller.c
index fc31f15..bea3e77 100644
--- a/sys/dev/usb/controller/usb_controller.c
+++ b/sys/dev/usb/controller/usb_controller.c
@@ -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);
diff --git a/sys/geom/journal/g_journal.c b/sys/geom/journal/g_journal.c
index 2db2364..d3274a2 100644
--- a/sys/geom/journal/g_journal.c
+++ b/sys/geom/journal/g_journal.c
@@ -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);
diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c
index 13ff6ea..85b5b24 100644
--- a/sys/geom/mirror/g_mirror.c
+++ b/sys/geom/mirror/g_mirror.c
@@ -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.
diff --git a/sys/geom/part/g_part.c b/sys/geom/part/g_part.c
index 447221a..58fa797 100644
--- a/sys/geom/part/g_part.c
+++ b/sys/geom/part/g_part.c
@@ -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();
/*
diff --git a/sys/geom/raid3/g_raid3.c b/sys/geom/raid3/g_raid3.c
index 1cbce25..cb19ef2 100644
--- a/sys/geom/raid3/g_raid3.c
+++ b/sys/geom/raid3/g_raid3.c
@@ -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);
/*
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index e4256c7..164eb12 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -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);
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index 31fb750..244d218 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -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);
OpenPOWER on IntegriCloud