Author: thompsa
Date: Fri Apr 10 04:08:34 2009
New Revision: 190878
URL: http://svn.freebsd.org/changeset/base/190878

Log:
  Revert r190676,190677
  
  The geom and CAM changes for root_hold are the wrong solution for USB design
  quirks.
  
  Requested by: scottl

Modified:
  head/sys/cam/cam_xpt.c
  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/geom.h
  head/sys/geom/geom_disk.c
  head/sys/geom/geom_disk.h
  head/sys/geom/geom_subr.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/cam/cam_xpt.c
==============================================================================
--- head/sys/cam/cam_xpt.c      Fri Apr 10 02:45:00 2009        (r190877)
+++ head/sys/cam/cam_xpt.c      Fri Apr 10 04:08:34 2009        (r190878)
@@ -5139,7 +5139,6 @@ xpt_find_device(struct cam_et *target, l
 typedef struct {
        union   ccb *request_ccb;
        struct  ccb_pathinq *cpi;
-       struct  root_hold_token *roothold;
        int     counter;
 } xpt_scan_bus_info;
 
@@ -5202,7 +5201,6 @@ xpt_scan_bus(struct cam_periph *periph, 
                }
                scan_info->request_ccb = request_ccb;
                scan_info->cpi = &work_ccb->cpi;
-               scan_info->roothold = root_mount_hold("CAM", M_NOWAIT);
 
                /* Cache on our stack so we can work asynchronously */
                max_target = scan_info->cpi->max_target;
@@ -5234,7 +5232,6 @@ xpt_scan_bus(struct cam_periph *periph, 
                                printf("xpt_scan_bus: xpt_create_path failed"
                                       " with status %#x, bus scan halted\n",
                                       status);
-                               root_mount_rel(scan_info->roothold);
                                free(scan_info, M_CAMXPT);
                                request_ccb->ccb_h.status = status;
                                xpt_free_ccb(work_ccb);
@@ -5243,7 +5240,6 @@ xpt_scan_bus(struct cam_periph *periph, 
                        }
                        work_ccb = xpt_alloc_ccb_nowait();
                        if (work_ccb == NULL) {
-                               root_mount_rel(scan_info->roothold);
                                free(scan_info, M_CAMXPT);
                                xpt_free_path(path);
                                request_ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
@@ -5357,7 +5353,6 @@ xpt_scan_bus(struct cam_periph *periph, 
                                xpt_free_ccb(request_ccb);
                                xpt_free_ccb((union ccb *)scan_info->cpi);
                                request_ccb = scan_info->request_ccb;
-                               root_mount_rel(scan_info->roothold);
                                free(scan_info, M_CAMXPT);
                                request_ccb->ccb_h.status = CAM_REQ_CMP;
                                xpt_done(request_ccb);
@@ -5377,7 +5372,6 @@ xpt_scan_bus(struct cam_periph *periph, 
                                xpt_free_ccb(request_ccb);
                                xpt_free_ccb((union ccb *)scan_info->cpi);
                                request_ccb = scan_info->request_ccb;
-                               root_mount_rel(scan_info->roothold);
                                free(scan_info, M_CAMXPT);
                                request_ccb->ccb_h.status = status;
                                xpt_done(request_ccb);

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 
10 02:45:00 2009        (r190877)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c     Fri Apr 
10 04:08:34 2009        (r190878)
@@ -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", M_WAITOK);
+               zfs_root_token = root_mount_hold("ZFS");
                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 10 02:45:00 2009        
(r190877)
+++ head/sys/dev/pccbb/pccbb_pci.c      Fri Apr 10 04:08:34 2009        
(r190878)
@@ -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), 
M_WAITOK);
+       sc->sc_root_token = root_mount_hold(device_get_nameunit(sc->dev));
        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 10 02:45:00 
2009        (r190877)
+++ head/sys/dev/usb/controller/usb_controller.c        Fri Apr 10 04:08:34 
2009        (r190878)
@@ -114,7 +114,7 @@ usb2_attach(device_t dev)
        }
 
        /* delay vfs_mountroot until the bus is explored */
-       bus->bus_roothold = root_mount_hold(device_get_nameunit(dev), M_WAITOK);
+       bus->bus_roothold = root_mount_hold(device_get_nameunit(dev));
 
        if (usb2_post_init_called) {
                mtx_lock(&Giant);

Modified: head/sys/geom/geom.h
==============================================================================
--- head/sys/geom/geom.h        Fri Apr 10 02:45:00 2009        (r190877)
+++ head/sys/geom/geom.h        Fri Apr 10 04:08:34 2009        (r190878)
@@ -193,8 +193,6 @@ struct g_provider {
        /* Two fields for the implementing class to use */
        void                    *private;
        u_int                   index;
-
-       struct root_hold_token  *roothold;
 };
 
 /* geom_dev.c */

Modified: head/sys/geom/geom_disk.c
==============================================================================
--- head/sys/geom/geom_disk.c   Fri Apr 10 02:45:00 2009        (r190877)
+++ head/sys/geom/geom_disk.c   Fri Apr 10 04:08:34 2009        (r190878)
@@ -381,7 +381,6 @@ g_disk_create(void *arg, int flag)
                printf("GEOM: new disk %s\n", gp->name);
        dp->d_geom = gp;
        g_error_provider(pp, 0);
-       root_mount_rel(dp->d_roothold);
 }
 
 static void
@@ -468,7 +467,6 @@ disk_create(struct disk *dp, int version
                    dp->d_sectorsize, DEVSTAT_ALL_SUPPORTED,
                    DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX);
        dp->d_geom = NULL;
-       dp->d_roothold = root_mount_hold(dp->d_name, M_WAITOK);
        g_disk_ident_adjust(dp->d_ident, sizeof(dp->d_ident));
        g_post_event(g_disk_create, dp, M_WAITOK, dp, NULL);
 }

Modified: head/sys/geom/geom_disk.h
==============================================================================
--- head/sys/geom/geom_disk.h   Fri Apr 10 02:45:00 2009        (r190877)
+++ head/sys/geom/geom_disk.h   Fri Apr 10 04:08:34 2009        (r190878)
@@ -88,8 +88,6 @@ struct disk {
 
        /* Fields private to the driver */
        void                    *d_drv1;
-
-       struct root_hold_token  *d_roothold;
 };
 
 #define DISKFLAG_NEEDSGIANT    0x1

Modified: head/sys/geom/geom_subr.c
==============================================================================
--- head/sys/geom/geom_subr.c   Fri Apr 10 02:45:00 2009        (r190877)
+++ head/sys/geom/geom_subr.c   Fri Apr 10 04:08:34 2009        (r190878)
@@ -545,10 +545,6 @@ g_new_provider_event(void *arg, int flag
                mp->taste(mp, pp, 0);
                g_topology_assert();
        }
-       if (pp->roothold != NULL) {
-               root_mount_rel(pp->roothold);
-               pp->roothold = NULL;
-       }
 }
 
 
@@ -585,7 +581,6 @@ g_new_providerf(struct g_geom *gp, const
        pp->stat = devstat_new_entry(pp, -1, 0, DEVSTAT_ALL_SUPPORTED,
            DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX);
        LIST_INSERT_HEAD(&gp->provider, pp, provider);
-       pp->roothold = root_mount_hold(pp->name, M_WAITOK);
        g_post_event(g_new_provider_event, pp, M_WAITOK, pp, gp, NULL);
        return (pp);
 }

Modified: head/sys/geom/journal/g_journal.c
==============================================================================
--- head/sys/geom/journal/g_journal.c   Fri Apr 10 02:45:00 2009        
(r190877)
+++ head/sys/geom/journal/g_journal.c   Fri Apr 10 04:08:34 2009        
(r190878)
@@ -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", M_WAITOK);
+               sc->sc_rootmount = root_mount_hold("GJOURNAL");
                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 10 02:45:00 2009        
(r190877)
+++ head/sys/geom/mirror/g_mirror.c     Fri Apr 10 04:08:34 2009        
(r190878)
@@ -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", M_WAITOK);
+       sc->sc_rootmount = root_mount_hold("GMIRROR");
        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 10 02:45:00 2009        (r190877)
+++ head/sys/geom/part/g_part.c Fri Apr 10 04:08:34 2009        (r190878)
@@ -1474,7 +1474,7 @@ g_part_taste(struct g_class *mp, struct 
                return (NULL);
        }
 
-       rht = root_mount_hold(mp->name, M_WAITOK);
+       rht = root_mount_hold(mp->name);
        g_topology_unlock();
 
        /*

Modified: head/sys/geom/raid3/g_raid3.c
==============================================================================
--- head/sys/geom/raid3/g_raid3.c       Fri Apr 10 02:45:00 2009        
(r190877)
+++ head/sys/geom/raid3/g_raid3.c       Fri Apr 10 04:08:34 2009        
(r190878)
@@ -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", M_WAITOK);
+       sc->sc_rootmount = root_mount_hold("GRAID3");
        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 10 02:45:00 2009        (r190877)
+++ head/sys/kern/vfs_mount.c   Fri Apr 10 04:08:34 2009        (r190878)
@@ -1353,18 +1353,14 @@ static int root_mount_complete;
  * Hold root mount.
  */
 struct root_hold_token *
-root_mount_hold(const char *identifier, int how)
+root_mount_hold(const char *identifier)
 {
        struct root_hold_token *h;
 
        if (root_mounted())
                return (NULL);
 
-       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 = malloc(sizeof *h, M_DEVBUF, M_ZERO | M_WAITOK);
        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 10 02:45:00 2009        (r190877)
+++ head/sys/sys/systm.h        Fri Apr 10 04:08:34 2009        (r190878)
@@ -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, int how);
+struct root_hold_token *root_mount_hold(const char *identifier);
 void root_mount_rel(struct root_hold_token *h);
 void root_mount_wait(void);
 int root_mounted(void);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to