aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Ertl <le@FreeBSD.org>2004-07-30 23:40:38 +0000
committerLukas Ertl <le@FreeBSD.org>2004-07-30 23:40:38 +0000
commit663e5a33114b51aba8e4f6436562c682a28c6eb6 (patch)
tree8d3c36014654b5634ea8f262bb760ab54bdde705
parent8a8fbaca32286119424e183b92f6633143fc5c4d (diff)
downloadsrc-663e5a33114b51aba8e4f6436562c682a28c6eb6.tar.gz
src-663e5a33114b51aba8e4f6436562c682a28c6eb6.zip
Set the access counts of a subdisk correctly when attaching it
to a plex that already has subdisks.
Notes
Notes: svn path=/head/; revision=132906
-rw-r--r--sys/geom/vinum/geom_vinum_plex.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/sys/geom/vinum/geom_vinum_plex.c b/sys/geom/vinum/geom_vinum_plex.c
index c993917a7da2..bcb1327f04cf 100644
--- a/sys/geom/vinum/geom_vinum_plex.c
+++ b/sys/geom/vinum/geom_vinum_plex.c
@@ -342,11 +342,12 @@ static struct g_geom *
gv_plex_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
{
struct g_geom *gp;
- struct g_consumer *cp;
+ struct g_consumer *cp, *cp2;
struct g_provider *pp2;
struct gv_plex *p;
struct gv_sd *s;
struct gv_softc *sc;
+ int error;
g_trace(G_T_TOPOLOGY, "gv_plex_taste(%s, %s)", mp->name, pp->name);
g_topology_assert();
@@ -382,9 +383,27 @@ gv_plex_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
/* Yes, there is already a geom, so we just add the consumer. */
if (gp != NULL) {
+ cp2 = LIST_FIRST(&gp->consumer);
/* Need to attach a new consumer to this subdisk. */
cp = g_new_consumer(gp);
- g_attach(cp, pp);
+ error = g_attach(cp, pp);
+ if (error) {
+ printf("geom_vinum: couldn't attach consumer to %s\n",
+ pp->name);
+ g_destroy_consumer(cp);
+ return (NULL);
+ }
+ /* Adjust the access counts of the new consumer. */
+ if ((cp2 != NULL) && (cp2->acr || cp2->acw || cp2->ace)) {
+ error = g_access(cp, cp2->acr, cp2->acw, cp2->ace);
+ if (error) {
+ printf("geom_vinum: couldn't set access counts"
+ " for consumer on %s\n", pp->name);
+ g_detach(cp);
+ g_destroy_consumer(cp);
+ return (NULL);
+ }
+ }
s->consumer = cp;
/* Adjust the size of the providers this plex has. */