From owner-svn-src-head@freebsd.org Wed Jun 22 14:39:15 2016 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 27C7DB69F78; Wed, 22 Jun 2016 14:39:15 +0000 (UTC) (envelope-from ken@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 D3D772640; Wed, 22 Jun 2016 14:39:14 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5MEdE0M042150; Wed, 22 Jun 2016 14:39:14 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5MEdE3o042149; Wed, 22 Jun 2016 14:39:14 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201606221439.u5MEdE3o042149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Wed, 22 Jun 2016 14:39:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302087 - head/sys/geom X-SVN-Group: head 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.22 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: Wed, 22 Jun 2016 14:39:15 -0000 Author: ken Date: Wed Jun 22 14:39:13 2016 New Revision: 302087 URL: https://svnweb.freebsd.org/changeset/base/302087 Log: Fix a bug that caused da(4) peripheral drivers to not fully go away after the underlying device went away. The problem was that callers who queue the GEOM resize provider event didn't check to make sure that the provider had not been withered. For the other equivalent case, g_new_provider_event(), the code checks to see whether the provider has been withered before queueing a g_new_provider_event() to the event thread. In some cases, a resize provider event would come through after the provider had been withered and all of the existing consumers had been orphaned. When the resize event triggered a taste of the provider, that would attach a new consumer to the now withered provider. The wither washer (g_wither_washer() would never be able to completely tear down the GEOM because of the consumers that were hanging around. The solution was to check the G_PF_WITHER provider flag before queueing the g_resize_provider_event(), and add an assert to g_resize_provider_event() to insure that it isn't called on a withered provider. sys/geom/geom_subr.c: In g_resize_provider(), don't try to continue if the G_PF_WITHER flag is set. In g_resize_provider_event(), add an assert that the G_PF_WITHER flag is not set. In g_access(), if a provider has an error, print out the name of the provider with the error. Sponsored by: Spectra Logic Approved by: re (marius) MFC after: 3 days Modified: head/sys/geom/geom_subr.c Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Wed Jun 22 12:53:10 2016 (r302086) +++ head/sys/geom/geom_subr.c Wed Jun 22 14:39:13 2016 (r302087) @@ -620,6 +620,8 @@ g_resize_provider_event(void *arg, int f g_free(hh); G_VALID_PROVIDER(pp); + KASSERT(!(pp->flags & G_PF_WITHER), + ("g_resize_provider_event but withered")); g_trace(G_T_TOPOLOGY, "g_resize_provider_event(%p)", pp); LIST_FOREACH_SAFE(cp, &pp->consumers, consumers, cp2) { @@ -662,6 +664,8 @@ g_resize_provider(struct g_provider *pp, struct g_hh00 *hh; G_VALID_PROVIDER(pp); + if (pp->flags & G_PF_WITHER) + return; if (size == pp->mediasize) return; @@ -909,8 +913,11 @@ g_access(struct g_consumer *cp, int dcr, else if (dcw > 0 && pe > 0) return (EPERM); /* If we try to open more but provider is error'ed: fail */ - else if ((dcr > 0 || dcw > 0 || dce > 0) && pp->error != 0) + else if ((dcr > 0 || dcw > 0 || dce > 0) && pp->error != 0) { + printf("%s(%d): provider %s has error\n", + __func__, __LINE__, pp->name); return (pp->error); + } /* Ok then... */