svn commit: r187140 - projects/gvinum/sys/geom/vinum

Ulf Lilleengen lulf at FreeBSD.org
Tue Jan 13 03:24:15 PST 2009


Author: lulf
Date: Tue Jan 13 11:24:14 2009
New Revision: 187140
URL: http://svn.freebsd.org/changeset/base/187140

Log:
  - In the case of a volume in the up state but all plexes down (the state must
    have been forced by the user), avoid looping infinately while trying out all
    plexes, which are down.

Modified:
  projects/gvinum/sys/geom/vinum/geom_vinum_volume.c

Modified: projects/gvinum/sys/geom/vinum/geom_vinum_volume.c
==============================================================================
--- projects/gvinum/sys/geom/vinum/geom_vinum_volume.c	Tue Jan 13 10:59:54 2009	(r187139)
+++ projects/gvinum/sys/geom/vinum/geom_vinum_volume.c	Tue Jan 13 11:24:14 2009	(r187140)
@@ -43,6 +43,7 @@ gv_volume_start(struct gv_softc *sc, str
 	struct g_geom *gp;
 	struct gv_volume *v;
 	struct gv_plex *p, *lp;
+	int numwrites;
 
 	gp = sc->geom;
 	v = bp->bio_to->private;
@@ -69,8 +70,10 @@ gv_volume_start(struct gv_softc *sc, str
 			lp = LIST_FIRST(&v->plexes);
 		p = LIST_NEXT(lp, in_volume);
 		do {
-			if (p == NULL)
-				p = LIST_FIRST(&v->plexes);
+			if (p == NULL) {
+				p = lp;
+				break;
+			}
 			if ((p->state > GV_PLEX_DEGRADED) ||
 			    (p->state >= GV_PLEX_DEGRADED &&
 			    p->org == GV_PLEX_RAID5))
@@ -100,12 +103,16 @@ gv_volume_start(struct gv_softc *sc, str
 			}
 		}
 
+		numwrites = 0;
 		/* Give the BIO to each plex of this volume. */
 		LIST_FOREACH(p, &v->plexes, in_volume) {
 			if (p->state < GV_PLEX_DEGRADED)
 				continue;
 			gv_plex_start(p, bp);
+			numwrites++;
 		}
+		if (numwrites == 0)
+			g_io_deliver(bp, ENXIO);
 		break;
 	}
 }


More information about the svn-src-projects mailing list