From owner-svn-src-stable@FreeBSD.ORG Mon Jun 2 10:14:03 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C2ECCD81; Mon, 2 Jun 2014 10:14:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF56A2171; Mon, 2 Jun 2014 10:14:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s52AE3Rx033481; Mon, 2 Jun 2014 10:14:03 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s52AE3DY033480; Mon, 2 Jun 2014 10:14:03 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201406021014.s52AE3DY033480@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 2 Jun 2014 10:14:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r266970 - stable/10/sys/geom X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jun 2014 10:14:03 -0000 Author: ae Date: Mon Jun 2 10:14:03 2014 New Revision: 266970 URL: http://svnweb.freebsd.org/changeset/base/266970 Log: MFC r266444: 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. Modified: stable/10/sys/geom/geom_event.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/geom/geom_event.c ============================================================================== --- stable/10/sys/geom/geom_event.c Mon Jun 2 07:08:34 2014 (r266969) +++ stable/10/sys/geom/geom_event.c Mon Jun 2 10:14:03 2014 (r266970) @@ -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); }