Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Dec 2009 20:16:28 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r200158 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <200912052016.nB5KGSqw098741@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Sat Dec  5 20:16:28 2009
New Revision: 200158
URL: http://svn.freebsd.org/changeset/base/200158

Log:
  We have to eventually look for provider without checking guid as this is need
  for attaching when there is no metadata yet.
  
  Before r200125 the order of looking for providers was wrong. It was:
  1. Find provider by name.
  2. Find provider by guid.
  3. Find provider by name and guid.
  
  Where it should have been:
  1. Find provider by name and guid.
  2. Find provider by guid.
  3. Find provider by name.
  
  MFC after:	1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c	Sat Dec  5 20:09:50 2009	(r200157)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c	Sat Dec  5 20:16:28 2009	(r200158)
@@ -453,7 +453,7 @@ vdev_geom_open_by_guid(vdev_t *vd)
 }
 
 static struct g_consumer *
-vdev_geom_open_by_path(vdev_t *vd)
+vdev_geom_open_by_path(vdev_t *vd, int check_guid)
 {
 	struct g_provider *pp;
 	struct g_consumer *cp;
@@ -465,7 +465,7 @@ vdev_geom_open_by_path(vdev_t *vd)
 	if (pp != NULL) {
 		ZFS_LOG(1, "Found provider by name %s.", vd->vdev_path);
 		cp = vdev_geom_attach(pp, !!(spa_mode & FWRITE));
-		if (cp != NULL) {
+		if (cp != NULL && check_guid) {
 			g_topology_unlock();
 			guid = vdev_geom_read_guid(cp);
 			g_topology_lock();
@@ -506,7 +506,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi
 
 	if ((owned = mtx_owned(&Giant)))
 		mtx_unlock(&Giant);
-	cp = vdev_geom_open_by_path(vd);
+	cp = vdev_geom_open_by_path(vd, 1);
 	if (cp == NULL) {
 		/*
 		 * The device at vd->vdev_path doesn't have the expected guid.
@@ -515,6 +515,8 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi
 		 */
 		cp = vdev_geom_open_by_guid(vd);
 	}
+	if (cp == NULL)
+		cp = vdev_geom_open_by_path(vd, 0);
 	if (cp == NULL) {
 		ZFS_LOG(1, "Provider %s not found.", vd->vdev_path);
 		vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED;



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