svn commit: r281299 - stable/9/sys/geom

Alexander Motin mav at FreeBSD.org
Thu Apr 9 10:07:07 UTC 2015


Author: mav
Date: Thu Apr  9 10:07:06 2015
New Revision: 281299
URL: https://svnweb.freebsd.org/changeset/base/281299

Log:
  MFC r280685: When searching for provider by name, prefer non-withered one.

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

Modified: stable/9/sys/geom/geom_subr.c
==============================================================================
--- stable/9/sys/geom/geom_subr.c	Thu Apr  9 10:05:58 2015	(r281298)
+++ stable/9/sys/geom/geom_subr.c	Thu Apr  9 10:07:06 2015	(r281299)
@@ -606,21 +606,27 @@ g_provider_by_name(char const *arg)
 {
 	struct g_class *cp;
 	struct g_geom *gp;
-	struct g_provider *pp;
+	struct g_provider *pp, *wpp;
 
 	if (strncmp(arg, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
 		arg += sizeof(_PATH_DEV) - 1;
 
+	wpp = NULL;
 	LIST_FOREACH(cp, &g_classes, class) {
 		LIST_FOREACH(gp, &cp->geom, geom) {
 			LIST_FOREACH(pp, &gp->provider, provider) {
-				if (!strcmp(arg, pp->name))
+				if (strcmp(arg, pp->name) != 0)
+					continue;
+				if ((gp->flags & G_GEOM_WITHER) == 0 &&
+				    (pp->flags & G_PF_WITHER) == 0)
 					return (pp);
+				else
+					wpp = pp;
 			}
 		}
 	}
 
-	return (NULL);
+	return (wpp);
 }
 
 void


More information about the svn-src-stable-9 mailing list