Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F149728760
D12531.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D12531.diff
View Options
Index: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
===================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
@@ -193,7 +193,7 @@
}
static struct g_consumer *
-vdev_geom_attach(struct g_provider *pp, vdev_t *vd)
+vdev_geom_attach(struct g_provider *pp, vdev_t *vd, boolean_t sanity)
{
struct g_geom *gp;
struct g_consumer *cp;
@@ -203,14 +203,18 @@
ZFS_LOG(1, "Attaching to %s.", pp->name);
- if (pp->sectorsize > VDEV_PAD_SIZE || !ISP2(pp->sectorsize)) {
- ZFS_LOG(1, "Failing attach of %s. Incompatible sectorsize %d\n",
- pp->name, pp->sectorsize);
- return (NULL);
- } else if (pp->mediasize < SPA_MINDEVSIZE) {
- ZFS_LOG(1, "Failing attach of %s. Incompatible mediasize %ju\n",
- pp->name, pp->mediasize);
- return (NULL);
+ if (sanity) {
+ if (pp->sectorsize > VDEV_PAD_SIZE || !ISP2(pp->sectorsize)) {
+ ZFS_LOG(1, "Failing attach of %s. "
+ "Incompatible sectorsize %d\n",
+ pp->name, pp->sectorsize);
+ return (NULL);
+ } else if (pp->mediasize < SPA_MINDEVSIZE) {
+ ZFS_LOG(1, "Failing attach of %s. "
+ "Incompatible mediasize %ju\n",
+ pp->name, pp->mediasize);
+ return (NULL);
+ }
}
/* Do we have geom already? No? Create one. */
@@ -587,7 +591,7 @@
LIST_FOREACH(pp, &gp->provider, provider) {
if (pp->flags & G_PF_WITHER)
continue;
- zcp = vdev_geom_attach(pp, NULL);
+ zcp = vdev_geom_attach(pp, NULL, B_TRUE);
if (zcp == NULL)
continue;
g_topology_unlock();
@@ -627,7 +631,7 @@
struct g_consumer *cp;
int nlabels;
- cp = vdev_geom_attach(pp, NULL);
+ cp = vdev_geom_attach(pp, NULL, B_TRUE);
if (cp == NULL) {
ZFS_LOG(1, "Unable to attach tasting instance to %s.",
pp->name);
@@ -635,14 +639,12 @@
}
g_topology_unlock();
nlabels = vdev_geom_read_config(cp, &config);
+ g_topology_lock();
+ vdev_geom_detach(cp, B_TRUE);
if (nlabels == 0) {
- g_topology_lock();
- vdev_geom_detach(cp, B_TRUE);
ZFS_LOG(1, "Unable to read config from %s.", pp->name);
return (NO_MATCH);
}
- g_topology_lock();
- vdev_geom_detach(cp, B_TRUE);
pool_guid = 0;
(void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, &pool_guid);
@@ -714,7 +716,7 @@
out:
if (best_pp) {
- cp = vdev_geom_attach(best_pp, vd);
+ cp = vdev_geom_attach(best_pp, vd, B_TRUE);
if (cp == NULL) {
printf("ZFS WARNING: Unable to attach to %s.\n",
best_pp->name);
@@ -768,7 +770,7 @@
if (pp != NULL) {
ZFS_LOG(1, "Found provider by name %s.", vd->vdev_path);
if (!check_guid || vdev_attach_ok(vd, pp) == FULL_MATCH)
- cp = vdev_geom_attach(pp, vd);
+ cp = vdev_geom_attach(pp, vd, B_FALSE);
}
return (cp);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 27, 2:07 PM (7 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30430940
Default Alt Text
D12531.diff (2 KB)
Attached To
Mode
D12531: Fix the error message when creating a zpool on a too-small device
Attached
Detach File
Event Timeline
Log In to Comment