Index: sys/geom/part/g_part.c =================================================================== --- sys/geom/part/g_part.c +++ sys/geom/part/g_part.c @@ -200,6 +200,7 @@ * Support functions. */ +static int g_part_commit(struct g_consumer *); static void g_part_wither(struct g_geom *, int); const char * @@ -880,25 +881,37 @@ { struct g_consumer *cp; struct g_geom *gp; + int error; + + gp = gpp->gpp_geom; + cp = LIST_FIRST(&gp->consumer); + G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, gp->name)); + g_topology_assert(); + + if ((error = g_part_commit(cp)) != 0) + gctl_error(req, "%d\n", error); + + return (error); +} + +static int +g_part_commit(struct g_consumer *cp) +{ struct g_provider *pp; struct g_part_entry *entry, *tmp; struct g_part_table *table; char *buf; int error, i; - gp = gpp->gpp_geom; - G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, gp->name)); + G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, cp->geom->name)); g_topology_assert(); - table = gp->softc; - if (!table->gpt_opened) { - gctl_error(req, "%d", EPERM); + table = cp->geom->softc; + if (!table->gpt_opened) return (EPERM); - } g_topology_unlock(); - cp = LIST_FIRST(&gp->consumer); if ((table->gpt_smhead | table->gpt_smtail) != 0) { pp = cp->provider; buf = g_malloc(pp->sectorsize, M_WAITOK | M_ZERO); @@ -928,7 +941,7 @@ if (table->gpt_scheme == &g_part_null_scheme) { g_topology_lock(); g_access(cp, -1, -1, -1); - g_part_wither(gp, ENXIO); + g_part_wither(cp->geom, ENXIO); return (0); } @@ -959,7 +972,6 @@ fail: g_topology_lock(); - gctl_error(req, "%d", error); return (error); }