Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Sep 2017 19:59:26 +0000 (UTC)
From:      Conrad Meyer <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r323977 - head/sys/geom
Message-ID:  <201709241959.v8OJxQbu015125@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cem
Date: Sun Sep 24 19:59:26 2017
New Revision: 323977
URL: https://svnweb.freebsd.org/changeset/base/323977

Log:
  g_resize_provider_event: Do not invoke orphan method twice
  
  Like r266444, g_resize_provider_event can attempt to orphan an already
  orphaned geom_dev consumer.  This will cause a panic in g_dev_orphan.  Apply
  the same fix as was applied to g_orphan_register.
  
  Reviewed by:	ae
  Sponsored by:	Dell EMC Isilon
  Differential Revision:	https://reviews.freebsd.org/D12469

Modified:
  head/sys/geom/geom_subr.c

Modified: head/sys/geom/geom_subr.c
==============================================================================
--- head/sys/geom/geom_subr.c	Sun Sep 24 19:53:17 2017	(r323976)
+++ head/sys/geom/geom_subr.c	Sun Sep 24 19:59:26 2017	(r323977)
@@ -631,6 +631,14 @@ g_resize_provider_event(void *arg, int flag)
 	LIST_FOREACH_SAFE(cp, &pp->consumers, consumers, cp2) {
 		gp = cp->geom;
 		if (gp->resize == NULL && size < pp->mediasize) {
+			/*
+			 * 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?201709241959.v8OJxQbu015125>