diff options
author | ae <ae@FreeBSD.org> | 2014-05-19 16:05:42 +0000 |
---|---|---|
committer | ae <ae@FreeBSD.org> | 2014-05-19 16:05:42 +0000 |
commit | 120b176ceadfbd6ff146ad700597b71b6ac1564f (patch) | |
tree | 1197a8e36b88dc10e51b36368c950176d4590672 | |
parent | 56f5be6dbc97c0e14decdfd7a06914d5f5d3ad16 (diff) | |
download | FreeBSD-src-120b176ceadfbd6ff146ad700597b71b6ac1564f.zip FreeBSD-src-120b176ceadfbd6ff146ad700597b71b6ac1564f.tar.gz |
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.
MFC after: 2 weeks
-rw-r--r-- | sys/geom/geom_event.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/geom/geom_event.c b/sys/geom/geom_event.c index 3a1363e..2ded638 100644 --- a/sys/geom/geom_event.c +++ b/sys/geom/geom_event.c @@ -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); } |