--- a/usr/src/cmd/mdb/common/modules/zfs/zfs.c Sat Feb 20 06:04:42 2010 +0300
+++ b/usr/src/cmd/mdb/common/modules/zfs/zfs.c Sat Feb 20 06:04:42 2010 +0300
@@ -49,6 +49,10 @@
#define ZFS_OBJ_NAME "libzpool.so.1"
#endif
+#ifndef _KERNEL
+int aok;
+#endif
+
static int
getmember(uintptr_t addr, const char *type, mdb_ctf_id_t *idp,
const char *member, int len, void *buf)
--- a/usr/src/cmd/zdb/zdb.c Sat Feb 20 06:04:42 2010 +0300
+++ b/usr/src/cmd/zdb/zdb.c Sat Feb 20 06:04:42 2010 +0300
@@ -64,6 +64,12 @@
dmu_ot[(idx)].ot_name : "UNKNOWN")
#define ZDB_OT_TYPE(idx) ((idx) < DMU_OT_NUMTYPES ? (idx) : DMU_OT_NUMTYPES)
+#ifndef lint
+extern int zfs_recover;
+#else
+int zfs_recover;
+#endif
+
const char cmdname[] = "zdb";
uint8_t dump_opt[256];
@@ -94,8 +100,7 @@
usage(void)
{
(void) fprintf(stderr,
- "Usage: %s [-CumdibcsvhL] "
- "poolname [object...]\n"
+ "Usage: %s [-CumdibcsvhL] poolname [object...]\n"
" %s [-div] dataset [object...]\n"
" %s -m [-L] poolname [vdev [metaslab...]]\n"
" %s -R poolname vdev:offset:size[:flags]\n"
@@ -130,6 +135,8 @@
"device\n\n");
(void) fprintf(stderr, " Below options are intended for use "
"with other options (except -l):\n");
+ (void) fprintf(stderr, " -A ignore assertions (-A), enable "
+ "panic recovery (-AA) or both (-AAA)\n");
(void) fprintf(stderr, " -U <cachefile_path> -- use alternate "
"cachefile\n");
(void) fprintf(stderr, " -e pool is exported/destroyed/"
@@ -2729,7 +2736,7 @@
dprintf_setup(&argc, argv);
- while ((c = getopt(argc, argv, "bcdhilmsuCDRSLevp:t:U:")) != -1) {
+ while ((c = getopt(argc, argv, "bcdhilmsuCDRSALevp:t:U:")) != -1) {
switch (c) {
case 'b':
case 'c':
@@ -2747,6 +2754,7 @@
dump_opt[c]++;
dump_all = 0;
break;
+ case 'A':
case 'L':
case 'e':
dump_opt[c]++;
@@ -2799,12 +2807,15 @@
verbose = MAX(verbose, 1);
for (c = 0; c < 256; c++) {
- if (dump_all && !strchr("elLRS", c))
+ if (dump_all && !strchr("elALRS", c))
dump_opt[c] = 1;
if (dump_opt[c])
dump_opt[c] += verbose;
}
+ aok = (dump_opt['A'] == 1) || (dump_opt['A'] > 2);
+ zfs_recover = (dump_opt['A'] > 1);
+
argc -= optind;
argv += optind;
--- a/usr/src/cmd/zinject/translate.c Sat Feb 20 06:04:42 2010 +0300
+++ b/usr/src/cmd/zinject/translate.c Sat Feb 20 06:04:42 2010 +0300
@@ -19,14 +19,12 @@
* CDDL HEADER END
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <libzfs.h>
-#undef verify /* both libzfs.h and zfs_context.h want to define this */
-
#include <sys/zfs_context.h>
#include <errno.h>
--- a/usr/src/lib/libzpool/common/kernel.c Sat Feb 20 06:04:42 2010 +0300
+++ b/usr/src/lib/libzpool/common/kernel.c Sat Feb 20 06:04:42 2010 +0300
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -42,6 +42,7 @@
* Emulation of kernel services in userland.
*/
+int aok;
uint64_t physmem;
vnode_t *rootdir = (vnode_t *)0xabcd1234;
char hw_serial[HW_HOSTID_LEN];
--- a/usr/src/lib/libzpool/common/sys/zfs_context.h Sat Feb 20 06:04:42 2010 +0300
+++ b/usr/src/lib/libzpool/common/sys/zfs_context.h Sat Feb 20 06:04:42 2010 +0300
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -106,21 +106,27 @@
#define fm_panic panic
+extern int aok;
+
/* This definition is copied from assert.h. */
#if defined(__STDC__)
#if __STDC_VERSION__ - 0 >= 199901L
-#define verify(EX) (void)((EX) || \
+#define zverify(EX) (void)((EX) || (aok) || \
(__assert_c99(#EX, __FILE__, __LINE__, __func__), 0))
#else
-#define verify(EX) (void)((EX) || (__assert(#EX, __FILE__, __LINE__), 0))
+#define zverify(EX) (void)((EX) || (aok) || \
+ (__assert(#EX, __FILE__, __LINE__), 0))
#endif /* __STDC_VERSION__ - 0 >= 199901L */
#else
-#define verify(EX) (void)((EX) || (_assert("EX", __FILE__, __LINE__), 0))
+#define zverify(EX) (void)((EX) || (aok) || \
+ (_assert("EX", __FILE__, __LINE__), 0))
#endif /* __STDC__ */
-#define VERIFY verify
-#define ASSERT assert
+#define VERIFY zverify
+#define ASSERT zverify
+#undef assert
+#define assert zverify
extern void __assert(const char *, const char *, int);
@@ -131,7 +137,7 @@
#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) do { \
const TYPE __left = (TYPE)(LEFT); \
const TYPE __right = (TYPE)(RIGHT); \
- if (!(__left OP __right)) { \
+ if (!(__left OP __right) && (!aok)) { \
char *__buf = alloca(256); \
(void) snprintf(__buf, 256, "%s %s %s (0x%llx %s 0x%llx)", \
#LEFT, #OP, #RIGHT, \