Author: mav
Date: Fri Apr 24 19:43:07 2020
New Revision: 360279
URL: https://svnweb.freebsd.org/changeset/base/360279

Log:
  MFC r323977 (by cem): 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.

Modified:
  stable/11/sys/geom/geom_subr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/geom/geom_subr.c
==============================================================================
--- stable/11/sys/geom/geom_subr.c      Fri Apr 24 19:03:18 2020        
(r360278)
+++ stable/11/sys/geom/geom_subr.c      Fri Apr 24 19:43:07 2020        
(r360279)
@@ -627,6 +627,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);
                }
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to