Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Apr 2015 10:07:07 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r281299 - stable/9/sys/geom
Message-ID:  <201504091007.t39A7706010994@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504091007.t39A7706010994>