]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Implement -A (ignore ASSERTs) for zdb
authorPaul Zuchowski <31706010+PaulZ-98@users.noreply.github.com>
Wed, 27 Nov 2019 18:45:56 +0000 (13:45 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 27 Nov 2019 18:45:56 +0000 (10:45 -0800)
The command line switch -A (ignore ASSERTs) has always been available
in zdb but was never connected up to the correct global variable.

There are times when you need zdb to ignore asserts and keep dumping
out whatever information it can get despite the ASSERT(s) failing.
It was always intended to be part of zdb but was incomplete.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Closes #9610

lib/libspl/include/assert.h
lib/libzpool/kernel.c

index f615fbdfe7c9b28e936a2f4a4519f17aac9aa37e..b7b406850f7a93979d5fd46c1f60e65b9fcd93e3 100644 (file)
 #include <stdlib.h>
 #include <stdarg.h>
 
+#ifndef _KERNEL
+int aok;
+#endif
+
 static inline int
 libspl_assert(const char *buf, const char *file, const char *func, int line)
 {
        fprintf(stderr, "%s\n", buf);
        fprintf(stderr, "ASSERT at %s:%d:%s()", file, line, func);
+       if (aok) {
+               return (0);
+       }
        abort();
 }
 
@@ -52,6 +59,9 @@ libspl_assertf(const char *file, const char *func, int line, char *format, ...)
        fprintf(stderr, "\n");
        fprintf(stderr, "ASSERT at %s:%d:%s()", file, line, func);
        va_end(args);
+       if (aok) {
+               return;
+       }
        abort();
 }
 
index ef52ed3afa2ace27456983f03dc5cf54ed734efb..6123b5d6ab10493eabebd3d62c32e0efc1ac9cec 100644 (file)
@@ -47,7 +47,6 @@
  * Emulation of kernel services in userland.
  */
 
-int aok;
 uint64_t physmem;
 char hw_serial[HW_HOSTID_LEN];
 struct utsname hw_utsname;