summaryrefslogtreecommitdiff
path: root/usr/src/lib/libzfs/common/libzfs_import.c
diff options
context:
space:
mode:
authoreschrock <none@none>2007-01-08 11:15:07 -0800
committereschrock <none@none>2007-01-08 11:15:07 -0800
commit39c23413b8df94a95f67b34cfd4a4dfc3fd0b48d (patch)
treeeea889e04fa3d21b9bc5fe702a3eef1fc0148ebc /usr/src/lib/libzfs/common/libzfs_import.c
parent3dba6097f91d71408b4a7c824521f8f0687ab6ff (diff)
downloadillumos-joyent-39c23413b8df94a95f67b34cfd4a4dfc3fd0b48d.tar.gz
6393525 vdev_reopen() should verify that it's still the same device
6414648 zfs allows overlapping devices to be added 6435943 assertion failed: spare != 0L, file: ../../common/fs/zfs/spa_misc.c 6436000 import of actively spared device returns EBUSY 6478316 nfs/server doesn't respect auto_enable setting 6483675 want a private property to return number of clones 6485728 zpool iostat should flush output periodically 6494072 A device which was set as spare disk is not detach 6497563 zfs double-spared an already-spared disk on reboot 6503724 adding spare that is in use in another pool should be allowed 6505225 zpool(1M) can give misleading error when removing active spare
Diffstat (limited to 'usr/src/lib/libzfs/common/libzfs_import.c')
-rw-r--r--usr/src/lib/libzfs/common/libzfs_import.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/usr/src/lib/libzfs/common/libzfs_import.c b/usr/src/lib/libzfs/common/libzfs_import.c
index d8b8af1f92..0bc9245304 100644
--- a/usr/src/lib/libzfs/common/libzfs_import.c
+++ b/usr/src/lib/libzfs/common/libzfs_import.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -898,7 +898,7 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
uint64_t guid, vdev_guid;
zpool_handle_t *zhp;
nvlist_t *pool_config;
- uint64_t stateval;
+ uint64_t stateval, isspare;
spare_cbdata_t cb = { 0 };
boolean_t isactive;
@@ -961,6 +961,18 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
ret = B_FALSE;
}
+ /*
+ * If this is an active spare within another pool, we
+ * treat it like an unused hot spare. This allows the
+ * user to create a pool with a hot spare that currently
+ * in use within another pool. Since we return B_TRUE,
+ * libdiskmgt will continue to prevent generic consumers
+ * from using the device.
+ */
+ if (ret && nvlist_lookup_uint64(config,
+ ZPOOL_CONFIG_IS_SPARE, &isspare) == 0 && isspare)
+ stateval = POOL_STATE_SPARE;
+
if (zhp != NULL)
zpool_close(zhp);
} else {