summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
authorken <ken@FreeBSD.org>2016-06-22 14:39:13 +0000
committerken <ken@FreeBSD.org>2016-06-22 14:39:13 +0000
commitdc39e6d1fa18fc848f2e60eff38bc3a76f8db646 (patch)
tree07c4ea34b98293b24ce4217660f3eca7d6782c3c /sys/geom
parentc6ed0e2c5f077eb6eea41782962c317da97cc6cc (diff)
downloadFreeBSD-src-dc39e6d1fa18fc848f2e60eff38bc3a76f8db646.zip
FreeBSD-src-dc39e6d1fa18fc848f2e60eff38bc3a76f8db646.tar.gz
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
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/geom_subr.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c
index d912838..f67b744 100644
--- a/sys/geom/geom_subr.c
+++ b/sys/geom/geom_subr.c
@@ -620,6 +620,8 @@ g_resize_provider_event(void *arg, int flag)
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, off_t size)
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, int dcw, int dce)
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... */
OpenPOWER on IntegriCloud