svn commit: r190676 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs dev/pccbb dev/usb/controller geom/journal geom/mirror geom/part geom/raid3 kern sys

Andrew Thompson thompsa at FreeBSD.org
Fri Apr 3 12:46:13 PDT 2009


Author: thompsa
Date: Fri Apr  3 19:46:12 2009
New Revision: 190676
URL: http://svn.freebsd.org/changeset/base/190676

Log:
  Add a how argument to root_mount_hold() so it can be passed NOWAIT and be called
  in situations where sleeping isnt allowed.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  head/sys/dev/pccbb/pccbb_pci.c
  head/sys/dev/usb/controller/usb_controller.c
  head/sys/geom/journal/g_journal.c
  head/sys/geom/mirror/g_mirror.c
  head/sys/geom/part/g_part.c
  head/sys/geom/raid3/g_raid3.c
  head/sys/kern/vfs_mount.c
  head/sys/sys/systm.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Fri Apr  3 19:23:14 2009	(r190675)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Fri Apr  3 19:46:12 2009	(r190676)
@@ -3087,7 +3087,7 @@ zfs_modevent(module_t mod, int type, voi
 	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);

Modified: head/sys/dev/pccbb/pccbb_pci.c
==============================================================================
--- head/sys/dev/pccbb/pccbb_pci.c	Fri Apr  3 19:23:14 2009	(r190675)
+++ head/sys/dev/pccbb/pccbb_pci.c	Fri Apr  3 19:46:12 2009	(r190676)
@@ -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)

Modified: head/sys/dev/usb/controller/usb_controller.c
==============================================================================
--- head/sys/dev/usb/controller/usb_controller.c	Fri Apr  3 19:23:14 2009	(r190675)
+++ head/sys/dev/usb/controller/usb_controller.c	Fri Apr  3 19:46:12 2009	(r190676)
@@ -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);

Modified: head/sys/geom/journal/g_journal.c
==============================================================================
--- head/sys/geom/journal/g_journal.c	Fri Apr  3 19:23:14 2009	(r190675)
+++ head/sys/geom/journal/g_journal.c	Fri Apr  3 19:46:12 2009	(r190676)
@@ -2310,7 +2310,7 @@ g_journal_create(struct g_class *mp, str
 		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);

Modified: head/sys/geom/mirror/g_mirror.c
==============================================================================
--- head/sys/geom/mirror/g_mirror.c	Fri Apr  3 19:23:14 2009	(r190675)
+++ head/sys/geom/mirror/g_mirror.c	Fri Apr  3 19:46:12 2009	(r190676)
@@ -2907,7 +2907,7 @@ g_mirror_create(struct g_class *mp, cons
 	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.

Modified: head/sys/geom/part/g_part.c
==============================================================================
--- head/sys/geom/part/g_part.c	Fri Apr  3 19:23:14 2009	(r190675)
+++ head/sys/geom/part/g_part.c	Fri Apr  3 19:46:12 2009	(r190676)
@@ -1474,7 +1474,7 @@ g_part_taste(struct g_class *mp, struct 
 		return (NULL);
 	}
 
-	rht = root_mount_hold(mp->name);
+	rht = root_mount_hold(mp->name, M_WAITOK);
 	g_topology_unlock();
 
 	/*

Modified: head/sys/geom/raid3/g_raid3.c
==============================================================================
--- head/sys/geom/raid3/g_raid3.c	Fri Apr  3 19:23:14 2009	(r190675)
+++ head/sys/geom/raid3/g_raid3.c	Fri Apr  3 19:46:12 2009	(r190676)
@@ -3193,7 +3193,7 @@ g_raid3_create(struct g_class *mp, const
 	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);
 
 	/*

Modified: head/sys/kern/vfs_mount.c
==============================================================================
--- head/sys/kern/vfs_mount.c	Fri Apr  3 19:23:14 2009	(r190675)
+++ head/sys/kern/vfs_mount.c	Fri Apr  3 19:46:12 2009	(r190676)
@@ -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);

Modified: head/sys/sys/systm.h
==============================================================================
--- head/sys/sys/systm.h	Fri Apr  3 19:23:14 2009	(r190675)
+++ head/sys/sys/systm.h	Fri Apr  3 19:46:12 2009	(r190676)
@@ -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);


More information about the svn-src-head mailing list