PERFORCE change 82099 for review

soc-cjones soc-cjones at FreeBSD.org
Wed Aug 17 04:32:18 GMT 2005


http://perforce.freebsd.org/chv.cgi?CH=82099

Change 82099 by soc-cjones at soc-cjones_ishtar on 2005/08/17 04:31:49

	Add some extras to try avoiding deadlock.

Affected files ...

.. //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_move.c#9 edit

Differences ...

==== //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_move.c#9 (text+ko) ====

@@ -91,8 +91,6 @@
 				gctl_error(req, "unknown volume '%s'", object);
 				return;
 			}
-			gctl_error(req, "no touching volumes!");
-			return 1;
 			err = gv_move_vol(sc, req, v, destination, *flags);
 			if (err)
 				return;
@@ -103,8 +101,6 @@
 				gctl_error(req, "unknown plex '%s'", object);
 				return;
 			}
-			gctl_error(req, "no touching plexes!");
-			return 1;
 			err = gv_move_plex(sc, req, p, destination, *flags);
 			if (err)
 				return;
@@ -160,9 +156,8 @@
         g_topology_assert();
         KASSERT(p != NULL, ("gv_move_plex: NULL p")); 
 
-	/* TODO identify all sds for the plex, then move 'em. */
-
-	return (0);
+	gctl_error(req, "moving a plex makes no sense");
+	return 99;
 }
 
 /* Move a subdisk. */
@@ -198,6 +193,7 @@
 	   on the new drive. Unfortunately, we can't use gv_new_sd, 
 	   since we don't really want to deal with tokenizing stuff.  
 	   Oh well. */
+	g_topology_lock();
 	s2 = g_malloc(sizeof(*s2), M_WAITOK | M_ZERO);
 	snprintf(s2->name, GV_MAXSDNAME, "temp.s0"); /* TODO Come up with temp name. */
 	printf("gv_move_sd: B (s2->name = %s)\n", s2->name);
@@ -215,13 +211,14 @@
 	  printf("gv_move_sd: F errstr = %s\n", errstr);
 	  gctl_error(req, errstr);
 	  g_free(s2);
+	  g_topology_unlock();
 	  return err;
 	}
 	printf("gv_move_sd: G\n");
 	s2->flags |= GV_SD_NEWBORN;
 	LIST_INSERT_HEAD(&sc->subdisks, s2, sd);
 	printf("gv_move_sd: I\n");
-	s2->state = GV_SD_STALE;
+
 	printf("gv_move_sd: J\n");
 	gv_save_config_all(sc);
 	printf("gv_move_sd: K\n");
@@ -244,13 +241,17 @@
 	printf("gv_move_sd: N\n");
 	err = gv_rm_sd(sc, req, s, flags);
 	printf("gv_move_sd: O, err = %d\n", err);
-	if (err)
+	if (err) {
+	    g_topology_unlock();
 	    return (err);
+	}
 
 	gv_sd_to_plex(p, s2, 0);
 	printf("gv_move_sd: P\n");
-
+	gv_set_sd_state(s2, GV_SD_STALE, GV_SETSTATE_CONFIG);
+	printf("gv_move_sd: Q\n");
 	gv_save_config_all(sc);	
+	g_topology_unlock();
 	printf("gv_move_sd: done gv_move_sd\n");
 	return (0);
 }
@@ -259,13 +260,13 @@
 static int
 gv_move_drive(struct gv_softc *sc, struct gctl_req *req, struct gv_drive *d, char *destination, int flags)
 {
-        int err;
+        int err = 0;
                  
         g_topology_assert();
         KASSERT(d != NULL, ("gv_move_drive: NULL d")); 
 
 	/* TODO find all sds on drive, then move them. */
 
-	return (0);
+	return (err);
 }
 


More information about the p4-projects mailing list