MFC r197898:

If provider is open for writing when we taste it, skip it for classes that
depend on on-disk metadata. This was we won't attach to providers that are used
by other classes. For example we don't want to configure partitions on da0 if
it is part of gmirror, what we really want is partitions on mirror/foo.

During regular work it works like this: if provider is open for writing a class
receives the spoiled event from GEOM and detaches, once provider is closed the
taste event is send again and class can rediscover its metadata if it is still
there.  This doesn't work that way when new class arrives, because GEOM gives
all existing providers for it to taste, also those open for writing. Classes
have to decided on their own if they want to deal with such providers (eg.
geom_dev) or not (classes modified by this commit).

Reported by:	des, Oliver Lehmann <lehmann@ans-netz.de>
Tested by:	des, Oliver Lehmann <lehmann@ans-netz.de>
Discussed with:	phk, marcel
Reviewed by:	marcel
Approved by:	re (kib)
This commit is contained in:
Pawel Jakub Dawidek 2009-10-12 21:08:06 +00:00
parent 1d93d2aa4f
commit 69882ff11d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/stable/8/; revision=198003
6 changed files with 25 additions and 0 deletions

View File

@ -599,6 +599,10 @@ g_concat_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name);
g_topology_assert();
/* Skip providers that are already open for writing. */
if (pp->acw > 0)
return (NULL);
G_CONCAT_DEBUG(3, "Tasting %s.", pp->name);
gp = g_new_geomf(mp, "concat:taste");

View File

@ -271,6 +271,10 @@ g_label_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
G_LABEL_DEBUG(2, "Tasting %s.", pp->name);
/* Skip providers that are already open for writing. */
if (pp->acw > 0)
return (NULL);
if (strcmp(pp->geom->class->name, mp->name) == 0)
return (NULL);

View File

@ -1459,6 +1459,10 @@ g_part_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
G_PART_TRACE((G_T_TOPOLOGY, "%s(%s,%s)", __func__, mp->name, pp->name));
g_topology_assert();
/* Skip providers that are already open for writing. */
if (pp->acw > 0)
return (NULL);
/*
* Create a GEOM with consumer and hook it up to the provider.
* With that we become part of the topology. Optain read access

View File

@ -638,6 +638,10 @@ g_shsec_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name);
g_topology_assert();
/* Skip providers that are already open for writing. */
if (pp->acw > 0)
return (NULL);
G_SHSEC_DEBUG(3, "Tasting %s.", pp->name);
gp = g_new_geomf(mp, "shsec:taste");

View File

@ -913,6 +913,10 @@ g_stripe_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name);
g_topology_assert();
/* Skip providers that are already open for writing. */
if (pp->acw > 0)
return (NULL);
G_STRIPE_DEBUG(3, "Tasting %s.", pp->name);
gp = g_new_geomf(mp, "stripe:taste");

View File

@ -363,6 +363,11 @@ g_uzip_taste(struct g_class *mp, struct g_provider *pp, int flags)
g_trace(G_T_TOPOLOGY, "g_uzip_taste(%s,%s)", mp->name, pp->name);
g_topology_assert();
/* Skip providers that are already open for writing. */
if (pp->acw > 0)
return (NULL);
buf = NULL;
/*