summaryrefslogtreecommitdiff
path: root/usr/src/lib/libzfs/common/libzfs_pool.c
diff options
context:
space:
mode:
authoreschrock <none@none>2008-07-04 13:08:26 -0700
committereschrock <none@none>2008-07-04 13:08:26 -0700
commit0430f8daa551890e0788d3fd28aef3be44cf8730 (patch)
tree9ad8454e39d3c89b4675c3d4d8f77a1e8b2eed6d /usr/src/lib/libzfs/common/libzfs_pool.c
parent91d632c867159b669d90fc7e172295433d0519ef (diff)
downloadillumos-joyent-0430f8daa551890e0788d3fd28aef3be44cf8730.tar.gz
6721901 uninitialized variable in zfs_fm_recv() can confuse diagnosis
6721906 probe failure should be ignored during pool open 6721920 cache device failure should not trigger pool I/O failure 6722096 ZFS DE case clearing logic for vdevs is busted 6722098 ZFS DE should avoid ereports against non-leaf vdevs 6722100 replacing a hot spare with an idle spare doesn't work
Diffstat (limited to 'usr/src/lib/libzfs/common/libzfs_pool.c')
-rw-r--r--usr/src/lib/libzfs/common/libzfs_pool.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/usr/src/lib/libzfs/common/libzfs_pool.c b/usr/src/lib/libzfs/common/libzfs_pool.c
index 639bae9a24..00df5ca616 100644
--- a/usr/src/lib/libzfs/common/libzfs_pool.c
+++ b/usr/src/lib/libzfs/common/libzfs_pool.c
@@ -1502,7 +1502,7 @@ zpool_vdev_attach(zpool_handle_t *zhp,
nvlist_t *tgt;
boolean_t avail_spare, l2cache;
uint64_t val, is_log;
- char *path;
+ char *path, *newname;
nvlist_t **child;
uint_t children;
nvlist_t *config_root;
@@ -1538,17 +1538,20 @@ zpool_vdev_attach(zpool_handle_t *zhp,
verify(nvlist_lookup_nvlist(zpool_get_config(zhp, NULL),
ZPOOL_CONFIG_VDEV_TREE, &config_root) == 0);
+ if ((newname = zpool_vdev_name(NULL, NULL, child[0])) == NULL)
+ return (-1);
+
/*
* If the target is a hot spare that has been swapped in, we can only
* replace it with another hot spare.
*/
if (replacing &&
nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_IS_SPARE, &val) == 0 &&
- nvlist_lookup_string(child[0], ZPOOL_CONFIG_PATH, &path) == 0 &&
- (zpool_find_vdev(zhp, path, &avail_spare, &l2cache) == NULL ||
+ (zpool_find_vdev(zhp, newname, &avail_spare, &l2cache) == NULL ||
!avail_spare) && is_replacing_spare(config_root, tgt, 1)) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"can only be replaced by another hot spare"));
+ free(newname);
return (zfs_error(hdl, EZFS_BADTARGET, msg));
}
@@ -1558,13 +1561,16 @@ zpool_vdev_attach(zpool_handle_t *zhp,
*/
if (replacing &&
nvlist_lookup_string(child[0], ZPOOL_CONFIG_PATH, &path) == 0 &&
- zpool_find_vdev(zhp, path, &avail_spare, &l2cache) != NULL &&
+ zpool_find_vdev(zhp, newname, &avail_spare, &l2cache) != NULL &&
avail_spare && is_replacing_spare(config_root, tgt, 0)) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"device has already been replaced with a spare"));
+ free(newname);
return (zfs_error(hdl, EZFS_BADTARGET, msg));
}
+ free(newname);
+
if (zcmd_write_conf_nvlist(hdl, &zc, nvroot) != 0)
return (-1);