Date: Fri, 9 Oct 2009 09:42:22 +0000 (UTC) From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r197898 - in head/sys/geom: concat label part shsec stripe uzip Message-ID: <200910090942.n999gMb5048731@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pjd Date: Fri Oct 9 09:42:22 2009 New Revision: 197898 URL: http://svn.freebsd.org/changeset/base/197898 Log: 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 Modified: head/sys/geom/concat/g_concat.c head/sys/geom/label/g_label.c head/sys/geom/part/g_part.c head/sys/geom/shsec/g_shsec.c head/sys/geom/stripe/g_stripe.c head/sys/geom/uzip/g_uzip.c Modified: head/sys/geom/concat/g_concat.c ============================================================================== --- head/sys/geom/concat/g_concat.c Fri Oct 9 09:38:57 2009 (r197897) +++ head/sys/geom/concat/g_concat.c Fri Oct 9 09:42:22 2009 (r197898) @@ -599,6 +599,10 @@ g_concat_taste(struct g_class *mp, struc 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"); Modified: head/sys/geom/label/g_label.c ============================================================================== --- head/sys/geom/label/g_label.c Fri Oct 9 09:38:57 2009 (r197897) +++ head/sys/geom/label/g_label.c Fri Oct 9 09:42:22 2009 (r197898) @@ -271,6 +271,10 @@ g_label_taste(struct g_class *mp, struct 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); Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Fri Oct 9 09:38:57 2009 (r197897) +++ head/sys/geom/part/g_part.c Fri Oct 9 09:42:22 2009 (r197898) @@ -1459,6 +1459,10 @@ g_part_taste(struct g_class *mp, struct 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 Modified: head/sys/geom/shsec/g_shsec.c ============================================================================== --- head/sys/geom/shsec/g_shsec.c Fri Oct 9 09:38:57 2009 (r197897) +++ head/sys/geom/shsec/g_shsec.c Fri Oct 9 09:42:22 2009 (r197898) @@ -638,6 +638,10 @@ g_shsec_taste(struct g_class *mp, struct 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"); Modified: head/sys/geom/stripe/g_stripe.c ============================================================================== --- head/sys/geom/stripe/g_stripe.c Fri Oct 9 09:38:57 2009 (r197897) +++ head/sys/geom/stripe/g_stripe.c Fri Oct 9 09:42:22 2009 (r197898) @@ -912,6 +912,10 @@ g_stripe_taste(struct g_class *mp, struc 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"); Modified: head/sys/geom/uzip/g_uzip.c ============================================================================== --- head/sys/geom/uzip/g_uzip.c Fri Oct 9 09:38:57 2009 (r197897) +++ head/sys/geom/uzip/g_uzip.c Fri Oct 9 09:42:22 2009 (r197898) @@ -363,6 +363,11 @@ g_uzip_taste(struct g_class *mp, struct 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; /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910090942.n999gMb5048731>