summaryrefslogtreecommitdiff
path: root/usr/src/cmd/fm/schemes
diff options
context:
space:
mode:
authoreschrock <none@none>2006-03-03 20:08:16 -0800
committereschrock <none@none>2006-03-03 20:08:16 -0800
commitea8dc4b6d2251b437950c0056bc626b311c73c27 (patch)
tree69cc1808568f2ef8fd1e21c61e186ba452ea64da /usr/src/cmd/fm/schemes
parent5c18afbc96a46bc3a9e6f3667512daa374d6cd79 (diff)
downloadillumos-gate-ea8dc4b6d2251b437950c0056bc626b311c73c27.tar.gz
PSARC 2006/077 zpool clear
PSARC 2006/139 FMA for ZFS 6284889 arc should replace the znode cache 6333006 DMU & DSL should not panic upon I/O error 6333092 concurrent reads to a file not scaling with number of readers 6338081 ZFS/FMA phase 1 6338386 need persistent error log 6341326 i/o error causes arc buf hash table corruption 6341639 zfs backup/restore should compute/verify checksum of backup stream 6348002 out of space due to changing properties 6354724 inaccurate error message from zfs restore 6354872 dmu_sync() blows predictive accounting 6355416 zpool scrubbing consumes all memory, system hung 6363995 df should only load libzfs when it encounters a ZFS filesystem 6366320 zfs backup/restore doesn't like signals 6368892 mount -m support needed for legacy mounts 6368902 boot archive fstat support needed for ZFS Mountroot 6369424 BFU complains when bfu'ing a ZFS root filesystem 6374062 mountroot support needed for ZFS 6376356 dirtying dbuf obj=43 lvl=0 blkid=0 but not tx_held 6378391 unused members of dmu_objset_stats_t 6378392 clean up zfs_cmd_t structure 6378685 buf_init should allocate its hash table more carefully 6378976 ziltest should be a first class citizen 6381086 zdb segfaults if there is a spa deferred-free bplist 6381203 deadlock due to i/o while assigning (tc_lock held) 6381209 freed space is not immediately available 6381344 'zpool clear' 6381345 FAULTED devices should really be UNAVAIL 6381346 import should mark devices as persistently unavailable 6383272 recursive mutex_enter() during log replay with zfs root 6386326 origin property is not displayed 6386354 libzfs does too much in its _init section, calls exit(1) 6386624 zpool should not complain about non-existent devices from libdiskmgt 6386910 spa needs to be i/o error hardened 6387735 need a mechanism to inject faults into ZFS 6387736 internal ZFS utilities should be placed in an ON-private package 6389928 libzfs should ship a lint library 6390609 malformed vdev config panics on zpool_create() 6390677 version number checking makes upgrades challenging 6390713 ztest hangs in zil_suspend() 6391873 metadata compression should be turned back on 6392113 ztest sometimes reports leaked blocks because ZIL isn't resilvered 6393004 minor memory leak in unique_insert()
Diffstat (limited to 'usr/src/cmd/fm/schemes')
-rw-r--r--usr/src/cmd/fm/schemes/Makefile8
-rw-r--r--usr/src/cmd/fm/schemes/zfs/Makefile32
-rw-r--r--usr/src/cmd/fm/schemes/zfs/amd64/Makefile33
-rw-r--r--usr/src/cmd/fm/schemes/zfs/i386/Makefile32
-rw-r--r--usr/src/cmd/fm/schemes/zfs/scheme.c191
-rw-r--r--usr/src/cmd/fm/schemes/zfs/sparc/Makefile32
-rw-r--r--usr/src/cmd/fm/schemes/zfs/sparcv9/Makefile33
7 files changed, 357 insertions, 4 deletions
diff --git a/usr/src/cmd/fm/schemes/Makefile b/usr/src/cmd/fm/schemes/Makefile
index 4f1dd443df..8dfc6ff36d 100644
--- a/usr/src/cmd/fm/schemes/Makefile
+++ b/usr/src/cmd/fm/schemes/Makefile
@@ -2,9 +2,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
@@ -33,6 +32,7 @@ SUBDIRS = \
legacy-hc \
mem \
mod \
- pkg
+ pkg \
+ zfs
include ../Makefile.subdirs
diff --git a/usr/src/cmd/fm/schemes/zfs/Makefile b/usr/src/cmd/fm/schemes/zfs/Makefile
new file mode 100644
index 0000000000..0c82190bb3
--- /dev/null
+++ b/usr/src/cmd/fm/schemes/zfs/Makefile
@@ -0,0 +1,32 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+include ../../../Makefile.cmd
+
+SUBDIRS = $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
+
+include ../../Makefile.subdirs
diff --git a/usr/src/cmd/fm/schemes/zfs/amd64/Makefile b/usr/src/cmd/fm/schemes/zfs/amd64/Makefile
new file mode 100644
index 0000000000..b3e2565271
--- /dev/null
+++ b/usr/src/cmd/fm/schemes/zfs/amd64/Makefile
@@ -0,0 +1,33 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+include ../../Makefile.com
+include $(SRC)/Makefile.master.64
+include ../../Makefile.targ
+
+LDLIBS += -lzfs
+
+install: all $(ROOTPROG64)
diff --git a/usr/src/cmd/fm/schemes/zfs/i386/Makefile b/usr/src/cmd/fm/schemes/zfs/i386/Makefile
new file mode 100644
index 0000000000..11a1534892
--- /dev/null
+++ b/usr/src/cmd/fm/schemes/zfs/i386/Makefile
@@ -0,0 +1,32 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+include ../../Makefile.com
+include ../../Makefile.targ
+
+LDLIBS += -lzfs
+
+install: all $(ROOTPROG)
diff --git a/usr/src/cmd/fm/schemes/zfs/scheme.c b/usr/src/cmd/fm/schemes/zfs/scheme.c
new file mode 100644
index 0000000000..7f2532a637
--- /dev/null
+++ b/usr/src/cmd/fm/schemes/zfs/scheme.c
@@ -0,0 +1,191 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <fm/fmd_fmri.h>
+#include <strings.h>
+#include <libzfs.h>
+
+typedef struct cbdata {
+ uint64_t cb_guid;
+ zpool_handle_t *cb_pool;
+} cbdata_t;
+
+static int
+find_pool(zpool_handle_t *zhp, void *data)
+{
+ cbdata_t *cbp = data;
+
+ if (zpool_get_guid(zhp) == cbp->cb_guid) {
+ cbp->cb_pool = zhp;
+ return (1);
+ }
+
+ zpool_close(zhp);
+
+ return (0);
+}
+
+ssize_t
+fmd_fmri_nvl2str(nvlist_t *nvl, char *buf, size_t buflen)
+{
+ uint64_t pool_guid, vdev_guid;
+ cbdata_t cb;
+ ssize_t len;
+ const char *name;
+ char guidbuf[64];
+
+ (void) nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_POOL, &pool_guid);
+
+ /*
+ * Attempt to convert the pool guid to a name.
+ */
+ cb.cb_guid = pool_guid;
+ cb.cb_pool = NULL;
+
+ if (zpool_iter(find_pool, &cb) == 1) {
+ name = zpool_get_name(cb.cb_pool);
+ } else {
+ (void) snprintf(guidbuf, sizeof (guidbuf), "%llx", pool_guid);
+ name = guidbuf;
+ }
+
+ if (nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_VDEV, &vdev_guid) == 0)
+ len = snprintf(buf, buflen, "%s://pool=%s/vdev=%llx",
+ FM_FMRI_SCHEME_ZFS, name, vdev_guid);
+ else
+ len = snprintf(buf, buflen, "%s://pool=%s",
+ FM_FMRI_SCHEME_ZFS, name);
+
+ if (cb.cb_pool)
+ zpool_close(cb.cb_pool);
+
+ return (len);
+}
+
+static nvlist_t *
+find_vdev_iter(nvlist_t *nv, uint64_t search)
+{
+ uint_t c, children;
+ nvlist_t **child;
+ uint64_t guid;
+ nvlist_t *ret;
+
+ (void) nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, &guid);
+
+ if (search == guid)
+ return (nv);
+
+ if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
+ &child, &children) != 0)
+ return (0);
+
+ for (c = 0; c < children; c++)
+ if ((ret = find_vdev_iter(child[c], search)) != 0)
+ return (ret);
+
+ return (NULL);
+}
+
+static nvlist_t *
+find_vdev(zpool_handle_t *zhp, uint64_t guid)
+{
+ nvlist_t *config;
+ nvlist_t *nvroot;
+
+ config = zpool_get_config(zhp, NULL);
+
+ (void) nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvroot);
+
+ return (find_vdev_iter(nvroot, guid));
+}
+
+int
+fmd_fmri_present(nvlist_t *nvl)
+{
+ uint64_t pool_guid, vdev_guid;
+ cbdata_t cb;
+ int ret;
+
+ (void) nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_POOL, &pool_guid);
+
+ cb.cb_guid = pool_guid;
+ cb.cb_pool = NULL;
+
+ if (zpool_iter(find_pool, &cb) != 1)
+ return (0);
+
+ if (nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_VDEV, &vdev_guid) != 0) {
+ zpool_close(cb.cb_pool);
+ return (1);
+ }
+
+ ret = (find_vdev(cb.cb_pool, vdev_guid) != NULL);
+
+ zpool_close(cb.cb_pool);
+
+ return (ret);
+}
+
+int
+fmd_fmri_unusable(nvlist_t *nvl)
+{
+ uint64_t pool_guid, vdev_guid;
+ cbdata_t cb;
+ nvlist_t *vd;
+ int ret;
+
+ (void) nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_POOL, &pool_guid);
+
+ cb.cb_guid = pool_guid;
+ cb.cb_pool = NULL;
+
+ if (zpool_iter(find_pool, &cb) != 1)
+ return (1);
+
+ if (nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_VDEV, &vdev_guid) != 0) {
+ ret = (zpool_get_state(cb.cb_pool) == POOL_STATE_UNAVAIL);
+ zpool_close(cb.cb_pool);
+ return (ret);
+ }
+
+ vd = find_vdev(cb.cb_pool, vdev_guid);
+ if (vd == NULL) {
+ ret = 1;
+ } else {
+ vdev_stat_t *vs;
+ uint_t c;
+
+ (void) nvlist_lookup_uint64_array(vd, ZPOOL_CONFIG_STATS,
+ (uint64_t **)&vs, &c);
+
+ ret = (vs->vs_state < VDEV_STATE_DEGRADED);
+ }
+
+ zpool_close(cb.cb_pool);
+
+ return (ret);
+}
diff --git a/usr/src/cmd/fm/schemes/zfs/sparc/Makefile b/usr/src/cmd/fm/schemes/zfs/sparc/Makefile
new file mode 100644
index 0000000000..11a1534892
--- /dev/null
+++ b/usr/src/cmd/fm/schemes/zfs/sparc/Makefile
@@ -0,0 +1,32 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+include ../../Makefile.com
+include ../../Makefile.targ
+
+LDLIBS += -lzfs
+
+install: all $(ROOTPROG)
diff --git a/usr/src/cmd/fm/schemes/zfs/sparcv9/Makefile b/usr/src/cmd/fm/schemes/zfs/sparcv9/Makefile
new file mode 100644
index 0000000000..b3e2565271
--- /dev/null
+++ b/usr/src/cmd/fm/schemes/zfs/sparcv9/Makefile
@@ -0,0 +1,33 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+include ../../Makefile.com
+include $(SRC)/Makefile.master.64
+include ../../Makefile.targ
+
+LDLIBS += -lzfs
+
+install: all $(ROOTPROG64)