summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2009-10-09 09:42:22 +0000
committerpjd <pjd@FreeBSD.org>2009-10-09 09:42:22 +0000
commitf5413acb70ea2e88c166cb6cd6b299589f5881a8 (patch)
tree60a15b285e372d2d672678038108727e91d53877
parent5c6baa445dcc7eb15b27fa3dc3fbb8b055eb7b47 (diff)
downloadFreeBSD-src-f5413acb70ea2e88c166cb6cd6b299589f5881a8.zip
FreeBSD-src-f5413acb70ea2e88c166cb6cd6b299589f5881a8.tar.gz
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 MFC after: 3 days
-rw-r--r--sys/geom/concat/g_concat.c4
-rw-r--r--sys/geom/label/g_label.c4
-rw-r--r--sys/geom/part/g_part.c4
-rw-r--r--sys/geom/shsec/g_shsec.c4
-rw-r--r--sys/geom/stripe/g_stripe.c4
-rw-r--r--sys/geom/uzip/g_uzip.c5
6 files changed, 25 insertions, 0 deletions
diff --git a/sys/geom/concat/g_concat.c b/sys/geom/concat/g_concat.c
index 021c9f5..a12f7b8 100644
--- a/sys/geom/concat/g_concat.c
+++ b/sys/geom/concat/g_concat.c
@@ -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");
diff --git a/sys/geom/label/g_label.c b/sys/geom/label/g_label.c
index 0a22dcf..e39c233 100644
--- a/sys/geom/label/g_label.c
+++ b/sys/geom/label/g_label.c
@@ -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);
diff --git a/sys/geom/part/g_part.c b/sys/geom/part/g_part.c
index 6e81a9c..92a1db0 100644
--- a/sys/geom/part/g_part.c
+++ b/sys/geom/part/g_part.c
@@ -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
diff --git a/sys/geom/shsec/g_shsec.c b/sys/geom/shsec/g_shsec.c
index 96650cf..7be39bb 100644
--- a/sys/geom/shsec/g_shsec.c
+++ b/sys/geom/shsec/g_shsec.c
@@ -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");
diff --git a/sys/geom/stripe/g_stripe.c b/sys/geom/stripe/g_stripe.c
index 17e258c..81f7561 100644
--- a/sys/geom/stripe/g_stripe.c
+++ b/sys/geom/stripe/g_stripe.c
@@ -912,6 +912,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");
diff --git a/sys/geom/uzip/g_uzip.c b/sys/geom/uzip/g_uzip.c
index 99d7c22..90eee02 100644
--- a/sys/geom/uzip/g_uzip.c
+++ b/sys/geom/uzip/g_uzip.c
@@ -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;
/*
OpenPOWER on IntegriCloud