From owner-svn-src-stable-8@FreeBSD.ORG Sat Nov 27 03:55:23 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 041CE106566C; Sat, 27 Nov 2010 03:55:23 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DBC5E8FC12; Sat, 27 Nov 2010 03:55:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAR3tMex011112; Sat, 27 Nov 2010 03:55:22 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAR3tMlw011110; Sat, 27 Nov 2010 03:55:22 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201011270355.oAR3tMlw011110@svn.freebsd.org> From: Matt Jacob Date: Sat, 27 Nov 2010 03:55:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215930 - stable/8/sys/geom/multipath X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Nov 2010 03:55:23 -0000 Author: mjacob Date: Sat Nov 27 03:55:22 2010 New Revision: 215930 URL: http://svn.freebsd.org/changeset/base/215930 Log: Roll out 209279, 200279 (which were unfortunate direct commits) and merges 204071 and 205847. This is attempt to rectify errors made in past merges. Modified: stable/8/sys/geom/multipath/g_multipath.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/geom/multipath/g_multipath.c ============================================================================== --- stable/8/sys/geom/multipath/g_multipath.c Sat Nov 27 03:46:32 2010 (r215929) +++ stable/8/sys/geom/multipath/g_multipath.c Sat Nov 27 03:55:22 2010 (r215930) @@ -97,8 +97,9 @@ g_mpd(void *arg, int flags __unused) g_topology_assert(); cp = arg; - if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0) + if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0) { g_access(cp, -cp->acr, -cp->acw, -cp->ace); + } if (cp->provider) { printf("GEOM_MULTIPATH: %s removed from %s\n", cp->provider->name, cp->geom->name); @@ -196,7 +197,7 @@ g_multipath_done_error(struct bio *bp) break; } } - if (sc->cp_active == NULL || sc->cp_active->provider == NULL) { + if (sc->cp_active == NULL) { printf("GEOM_MULTIPATH: out of providers for %s\n", sc->sc_name); g_topology_unlock(); @@ -223,16 +224,15 @@ g_multipath_done_error(struct bio *bp) static void g_multipath_kt(void *arg) { - g_multipath_kt_state = GKT_RUN; mtx_lock(&gmtbq_mtx); while (g_multipath_kt_state == GKT_RUN) { for (;;) { struct bio *bp; - bp = bioq_takefirst(&gmtbq); - if (bp == NULL) + if (bp == NULL) { break; + } mtx_unlock(&gmtbq_mtx); g_multipath_done_error(bp); mtx_lock(&gmtbq_mtx); @@ -266,8 +266,9 @@ g_multipath_access(struct g_provider *pp fail: LIST_FOREACH(cp, &gp->consumer, consumer) { - if (cp == badcp) + if (cp == badcp) { break; + } (void) g_access(cp, -dr, -dw, -de); } return (error); @@ -291,8 +292,9 @@ g_multipath_create(struct g_class *mp, s } gp = g_new_geomf(mp, md->md_name); - if (gp == NULL) + if (gp == NULL) { goto fail; + } sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); gp->softc = sc; @@ -303,8 +305,9 @@ g_multipath_create(struct g_class *mp, s memcpy(sc->sc_name, md->md_name, sizeof (sc->sc_name)); pp = g_new_providerf(gp, "multipath/%s", md->md_name); - if (pp == NULL) + if (pp == NULL) { goto fail; + } /* limit the provider to not have it stomp on metadata */ pp->mediasize = md->md_size - md->md_sectorsize; pp->sectorsize = md->md_sectorsize; @@ -313,8 +316,9 @@ g_multipath_create(struct g_class *mp, s return (gp); fail: if (gp != NULL) { - if (gp->softc != NULL) + if (gp->softc != NULL) { g_free(gp->softc); + } g_destroy_geom(gp); } return (NULL); @@ -336,8 +340,9 @@ g_multipath_add_disk(struct g_geom *gp, * Make sure that the passed provider isn't already attached */ LIST_FOREACH(cp, &gp->consumer, consumer) { - if (cp->provider == pp) + if (cp->provider == pp) { break; + } } if (cp) { printf("GEOM_MULTIPATH: provider %s already attached to %s\n", @@ -346,8 +351,9 @@ g_multipath_add_disk(struct g_geom *gp, } nxtcp = LIST_FIRST(&gp->consumer); cp = g_new_consumer(gp); - if (cp == NULL) + if (cp == NULL) { return (ENOMEM); + } error = g_attach(cp, pp); if (error != 0) { printf("GEOM_MULTIPATH: cannot attach %s to %s", @@ -388,11 +394,13 @@ g_multipath_destroy(struct g_geom *gp) struct g_provider *pp; g_topology_assert(); - if (gp->softc == NULL) + if (gp->softc == NULL) { return (ENXIO); + } pp = LIST_FIRST(&gp->provider); - if (pp != NULL && (pp->acr != 0 || pp->acw != 0 || pp->ace != 0)) + if (pp != NULL && (pp->acr != 0 || pp->acw != 0 || pp->ace != 0)) { return (EBUSY); + } printf("GEOM_MULTIPATH: destroying %s\n", gp->name); g_free(gp->softc); gp->softc = NULL; @@ -404,7 +412,6 @@ static int g_multipath_destroy_geom(struct gctl_req *req, struct g_class *mp, struct g_geom *gp) { - return (g_multipath_destroy(gp)); } @@ -437,8 +444,9 @@ g_multipath_init(struct g_class *mp) { bioq_init(&gmtbq); mtx_init(&gmtbq_mtx, "gmtbq", NULL, MTX_DEF); - if (kproc_create(g_multipath_kt, mp, NULL, 0, 0, "g_mp_kt") == 0) + if (kproc_create(g_multipath_kt, mp, NULL, 0, 0, "g_mp_kt") == 0) { g_multipath_kt_state = GKT_RUN; + } } static void @@ -464,16 +472,18 @@ g_multipath_read_metadata(struct g_consu g_topology_assert(); error = g_access(cp, 1, 0, 0); - if (error != 0) + if (error != 0) { return (error); + } pp = cp->provider; g_topology_unlock(); buf = g_read_data(cp, pp->mediasize - pp->sectorsize, pp->sectorsize, &error); g_topology_lock(); g_access(cp, -1, 0, 0); - if (buf == NULL) + if (buf == NULL) { return (error); + } multipath_metadata_decode(buf, md); g_free(buf); return (0); @@ -500,13 +510,15 @@ g_multipath_taste(struct g_class *mp, st g_detach(cp); g_destroy_consumer(cp); g_destroy_geom(gp); - if (error != 0) + if (error != 0) { return (NULL); + } gp = NULL; if (strcmp(md.md_magic, G_MULTIPATH_MAGIC) != 0) { - if (g_multipath_debug) + if (g_multipath_debug) { printf("%s is not MULTIPATH\n", pp->name); + } return (NULL); } if (md.md_version != G_MULTIPATH_VERSION) { @@ -515,8 +527,9 @@ g_multipath_taste(struct g_class *mp, st G_MULTIPATH_VERSION); return (NULL); } - if (g_multipath_debug) + if (g_multipath_debug) { printf("MULTIPATH: %s/%s\n", md.md_name, md.md_uuid); + } /* * Let's check if such a device already is present. We check against @@ -532,20 +545,25 @@ g_multipath_taste(struct g_class *mp, st sc = NULL; LIST_FOREACH(gp, &mp->geom, geom) { sc = gp->softc; - if (sc == NULL) + if (sc == NULL) { continue; - if (strncmp(md.md_uuid, sc->sc_uuid, sizeof(md.md_uuid)) == 0) + } + if (strncmp(md.md_uuid, sc->sc_uuid, sizeof(md.md_uuid)) == 0) { break; + } } LIST_FOREACH(gp1, &mp->geom, geom) { - if (gp1 == gp) + if (gp1 == gp) { continue; + } sc = gp1->softc; - if (sc == NULL) + if (sc == NULL) { continue; - if (strncmp(md.md_name, sc->sc_name, sizeof(md.md_name)) == 0) + } + if (strncmp(md.md_name, sc->sc_name, sizeof(md.md_name)) == 0) { break; + } } /* @@ -572,9 +590,9 @@ g_multipath_taste(struct g_class *mp, st sc->sc_name, sc->sc_uuid); printf("GEOM_MULTIPATH: %s will be (temporarily) %s\n", md.md_uuid, buf); - strlcpy(md.md_name, buf, sizeof(md.md_name)); + strlcpy(md.md_name, buf, sizeof (md.md_name)); } else { - strlcpy(md.md_name, sc->sc_name, sizeof(md.md_name)); + strlcpy(md.md_name, sc->sc_name, sizeof (md.md_name)); } } @@ -594,8 +612,9 @@ g_multipath_taste(struct g_class *mp, st KASSERT(sc != NULL, ("sc is NULL")); error = g_multipath_add_disk(gp, pp); if (error != 0) { - if (isnew) + if (isnew) { g_multipath_destroy(gp); + } return (NULL); } return (gp); @@ -634,8 +653,9 @@ g_multipath_ctl_create(struct gctl_req * gctl_error(req, "No 'arg1' argument"); return; } - if (strncmp(name, devpf, 5) == 0) + if (strncmp(name, devpf, 5) == 0) { name += 5; + } pp0 = g_provider_by_name(name); if (pp0 == NULL) { gctl_error(req, "Provider %s is invalid", name); @@ -647,8 +667,9 @@ g_multipath_ctl_create(struct gctl_req * gctl_error(req, "No 'arg2' argument"); return; } - if (strncmp(name, devpf, 5) == 0) + if (strncmp(name, devpf, 5) == 0) { name += 5; + } pp1 = g_provider_by_name(name); if (pp1 == NULL) { gctl_error(req, "Provider %s is invalid", name); @@ -692,12 +713,13 @@ g_multipath_ctl_create(struct gctl_req * memset(&md, 0, sizeof(md)); md.md_size = pp0->mediasize; md.md_sectorsize = pp0->sectorsize; - strlcpy(md.md_name, mpname, sizeof(md.md_name)); - strlcpy(md.md_uuid, uuid, sizeof(md.md_uuid)); + strncpy(md.md_name, mpname, sizeof (md.md_name)); + strncpy(md.md_uuid, uuid, sizeof (md.md_uuid)); gp = g_multipath_create(mp, &md); - if (gp == NULL) + if (gp == NULL) { return; + } error = g_multipath_add_disk(gp, pp0); if (error) { g_multipath_destroy(gp); @@ -795,7 +817,7 @@ g_multipath_ctl_getactive(struct gctl_re return; } sc = gp->softc; - if (sc->cp_active && sc->cp_active->provider) { + if (sc->cp_active) { sbuf_printf(sb, "%s\n", sc->cp_active->provider->name); } else { sbuf_printf(sb, "none\n");