svn commit: r271225 - vendor/illumos/dist/cmd/zpool
Xin LI
delphij at FreeBSD.org
Sun Sep 7 12:18:13 UTC 2014
Author: delphij
Date: Sun Sep 7 12:18:12 2014
New Revision: 271225
URL: http://svnweb.freebsd.org/changeset/base/271225
Log:
5118 When verifying or creating a storage pool, error messages only show one device
Reviewed by: Adam Leventhal <adam.leventhal at delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel at delphix.com>
Reviewed by: Matt Ahrens <mahrens at delphix.com>
Reviewed by: Boris Protopopov <boris.protopopov at me.com>
Approved by: Dan McDonald <danmcd at omniti.com>
Author: Basil Crow <basil.crow at delphix.com>
illumos/illumos-gate at 75fbdf9b9f63da7e23a9814982b78a782559c086
Modified:
vendor/illumos/dist/cmd/zpool/zpool_vdev.c
Modified: vendor/illumos/dist/cmd/zpool/zpool_vdev.c
==============================================================================
--- vendor/illumos/dist/cmd/zpool/zpool_vdev.c Sun Sep 7 12:13:49 2014 (r271224)
+++ vendor/illumos/dist/cmd/zpool/zpool_vdev.c Sun Sep 7 12:18:12 2014 (r271225)
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
/*
@@ -1027,8 +1028,8 @@ is_spare(nvlist_t *config, const char *p
* Go through and find any devices that are in use. We rely on libdiskmgt for
* the majority of this task.
*/
-static int
-check_in_use(nvlist_t *config, nvlist_t *nv, boolean_t force,
+static boolean_t
+is_device_in_use(nvlist_t *config, nvlist_t *nv, boolean_t force,
boolean_t replacing, boolean_t isspare)
{
nvlist_t **child;
@@ -1037,6 +1038,7 @@ check_in_use(nvlist_t *config, nvlist_t
int ret;
char buf[MAXPATHLEN];
uint64_t wholedisk;
+ boolean_t anyinuse = B_FALSE;
verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE, &type) == 0);
@@ -1059,38 +1061,37 @@ check_in_use(nvlist_t *config, nvlist_t
(void) strlcpy(buf, path, sizeof (buf));
if (is_spare(config, buf))
- return (0);
+ return (B_FALSE);
}
if (strcmp(type, VDEV_TYPE_DISK) == 0)
ret = check_device(path, force, isspare);
-
- if (strcmp(type, VDEV_TYPE_FILE) == 0)
+ else if (strcmp(type, VDEV_TYPE_FILE) == 0)
ret = check_file(path, force, isspare);
- return (ret);
+ return (ret != 0);
}
for (c = 0; c < children; c++)
- if ((ret = check_in_use(config, child[c], force,
- replacing, B_FALSE)) != 0)
- return (ret);
+ if (is_device_in_use(config, child[c], force, replacing,
+ B_FALSE))
+ anyinuse = B_TRUE;
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_SPARES,
&child, &children) == 0)
for (c = 0; c < children; c++)
- if ((ret = check_in_use(config, child[c], force,
- replacing, B_TRUE)) != 0)
- return (ret);
+ if (is_device_in_use(config, child[c], force, replacing,
+ B_TRUE))
+ anyinuse = B_TRUE;
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_L2CACHE,
&child, &children) == 0)
for (c = 0; c < children; c++)
- if ((ret = check_in_use(config, child[c], force,
- replacing, B_FALSE)) != 0)
- return (ret);
+ if (is_device_in_use(config, child[c], force, replacing,
+ B_FALSE))
+ anyinuse = B_TRUE;
- return (0);
+ return (anyinuse);
}
static const char *
@@ -1442,7 +1443,7 @@ make_root_vdev(zpool_handle_t *zhp, int
* uses (such as a dedicated dump device) that even '-f' cannot
* override.
*/
- if (check_in_use(poolconfig, newroot, force, replacing, B_FALSE) != 0) {
+ if (is_device_in_use(poolconfig, newroot, force, replacing, B_FALSE)) {
nvlist_free(newroot);
return (NULL);
}
More information about the svn-src-all
mailing list