Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 May 2014 16:05:43 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r266444 - head/sys/geom
Message-ID:  <201405191605.s4JG5hIm043014@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Mon May 19 16:05:42 2014
New Revision: 266444
URL: http://svnweb.freebsd.org/changeset/base/266444

Log:
  We have two functions from where a geom orphan method could be called:
  g_orphan_register and g_resize_provider_event. Both are called from the
  event queue. Also we have GEOM_DEV class, which does deferred destroy
  for its consumers via g_dev_destroy (also called from the event queue).
  So it is possible, that for some consumers an orphan method will be
  called twice. This triggers panic in g_dev_orphan.
  Check that consumer isn't already orphaned before call orphan method.
  
  MFC after:	2 weeks

Modified:
  head/sys/geom/geom_event.c

Modified: head/sys/geom/geom_event.c
==============================================================================
--- head/sys/geom/geom_event.c	Mon May 19 14:01:48 2014	(r266443)
+++ head/sys/geom/geom_event.c	Mon May 19 16:05:42 2014	(r266444)
@@ -206,6 +206,14 @@ g_orphan_register(struct g_provider *pp)
 		KASSERT(cp->geom->orphan != NULL,
 		    ("geom %s has no orphan, class %s",
 		    cp->geom->name, cp->geom->class->name));
+		/*
+		 * XXX: g_dev_orphan method does deferred destroying
+		 * and it is possible, that other event could already
+		 * call the orphan method. Check consumer's flags to
+		 * do not schedule it twice.
+		 */
+		if (cp->flags & G_CF_ORPHAN)
+			continue;
 		cp->flags |= G_CF_ORPHAN;
 		cp->geom->orphan(cp);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405191605.s4JG5hIm043014>