From owner-svn-src-head@freebsd.org Sun Sep 24 19:59:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFB32E2EDBA; Sun, 24 Sep 2017 19:59:27 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 7F48CEA1; Sun, 24 Sep 2017 19:59:27 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8OJxQhO015126; Sun, 24 Sep 2017 19:59:26 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8OJxQbu015125; Sun, 24 Sep 2017 19:59:26 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201709241959.v8OJxQbu015125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sun, 24 Sep 2017 19:59:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323977 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 323977 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Sep 2017 19:59:27 -0000 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); }