Author: ae
Date: Tue Jun 22 07:38:30 2010
New Revision: 209414
URL: http://svn.freebsd.org/changeset/base/209414

Log:
  MFC r207178:
  Fix undo for schemes that have internal partitions. Internal partitions
  do not constitute user-visible or active partitions and as such should
  not prevent undoing pending operations.
  
  While here, initialize the last usable sector for the placeholder geom
  based on the null scheme, created to allow undoing the destruction of
  a scheme. This gives consistent output with "gpart show".
  
  Approved by:  mav (mentor)

Modified:
  stable/8/sys/geom/part/g_part.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/ixgbe/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/geom/sched/   (props changed)

Modified: stable/8/sys/geom/part/g_part.c
==============================================================================
--- stable/8/sys/geom/part/g_part.c     Tue Jun 22 07:31:05 2010        
(r209413)
+++ stable/8/sys/geom/part/g_part.c     Tue Jun 22 07:38:30 2010        
(r209414)
@@ -845,7 +845,9 @@ g_part_ctl_delete(struct gctl_req *req, 
 static int
 g_part_ctl_destroy(struct gctl_req *req, struct g_part_parms *gpp)
 {
+       struct g_consumer *cp;
        struct g_geom *gp;
+       struct g_provider *pp;
        struct g_part_entry *entry;
        struct g_part_table *null, *table;
        struct sbuf *sb;
@@ -875,6 +877,11 @@ g_part_ctl_destroy(struct gctl_req *req,
        null->gpt_gp = gp;
        null->gpt_scheme = &g_part_null_scheme;
        LIST_INIT(&null->gpt_entry);
+
+       cp = LIST_FIRST(&gp->consumer);
+       pp = cp->provider;
+       null->gpt_last = pp->mediasize / pp->sectorsize - 1;
+
        null->gpt_depth = table->gpt_depth;
        null->gpt_opened = table->gpt_opened;
        null->gpt_smhead = table->gpt_smhead;
@@ -1055,10 +1062,16 @@ g_part_ctl_undo(struct gctl_req *req, st
            table->gpt_created) ? 1 : 0;
 
        if (reprobe) {
-               if (!LIST_EMPTY(&table->gpt_entry)) {
+               LIST_FOREACH(entry, &table->gpt_entry, gpe_entry) {
+                       if (entry->gpe_internal)
+                               continue;
                        error = EBUSY;
                        goto fail;
                }
+               while ((entry = LIST_FIRST(&table->gpt_entry)) != NULL) {
+                       LIST_REMOVE(entry, gpe_entry);
+                       g_free(entry);
+               }
                error = g_part_probe(gp, cp, table->gpt_depth);
                if (error) {
                        g_topology_lock();
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to