aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.in2
-rw-r--r--cmd/Makefile.in1
-rw-r--r--cmd/mount_zfs/Makefile.in1
-rw-r--r--cmd/sas_switch_id/Makefile.in1
-rw-r--r--cmd/zdb/Makefile.in1
-rw-r--r--cmd/zfs/Makefile.in1
-rw-r--r--cmd/zinject/Makefile.in1
-rw-r--r--cmd/zpios/Makefile.in1
-rw-r--r--cmd/zpool/Makefile.in1
-rw-r--r--cmd/zpool_id/Makefile.in1
-rw-r--r--cmd/zpool_layout/Makefile.in1
-rw-r--r--cmd/ztest/Makefile.in1
-rw-r--r--cmd/zvol_id/Makefile.in1
-rw-r--r--config/rpm.am1
-rw-r--r--config/zfs-build.m44
-rwxr-xr-xconfigure37
-rw-r--r--dracut/90zfs/Makefile.in1
-rw-r--r--dracut/Makefile.in1
-rw-r--r--etc/Makefile.in1
-rw-r--r--etc/init.d/Makefile.in1
-rw-r--r--etc/zfs/Makefile.in1
-rw-r--r--include/Makefile.in1
-rw-r--r--include/linux/Makefile.in1
-rw-r--r--include/sys/Makefile.in1
-rw-r--r--include/sys/fm/Makefile.in1
-rw-r--r--include/sys/fm/fs/Makefile.in1
-rw-r--r--include/sys/fs/Makefile.in1
-rw-r--r--include/sys/zfs_debug.h2
-rw-r--r--lib/Makefile.in1
-rw-r--r--lib/libavl/Makefile.in1
-rw-r--r--lib/libefi/Makefile.in1
-rw-r--r--lib/libnvpair/Makefile.in1
-rw-r--r--lib/libshare/Makefile.in1
-rw-r--r--lib/libspl/Makefile.in1
-rw-r--r--lib/libspl/asm-generic/Makefile.in1
-rw-r--r--lib/libspl/asm-i386/Makefile.in1
-rw-r--r--lib/libspl/asm-x86_64/Makefile.in1
-rw-r--r--lib/libspl/include/Makefile.in1
-rw-r--r--lib/libspl/include/ia32/Makefile.in1
-rw-r--r--lib/libspl/include/ia32/sys/Makefile.in1
-rw-r--r--lib/libspl/include/rpc/Makefile.in1
-rw-r--r--lib/libspl/include/sys/Makefile.in1
-rw-r--r--lib/libspl/include/sys/dktp/Makefile.in1
-rw-r--r--lib/libspl/include/sys/sysevent/Makefile.in1
-rw-r--r--lib/libspl/include/util/Makefile.in1
-rw-r--r--lib/libunicode/Makefile.in1
-rw-r--r--lib/libuutil/Makefile.in1
-rw-r--r--lib/libzfs/Makefile.in1
-rw-r--r--lib/libzpool/Makefile.in1
-rw-r--r--man/Makefile.in1
-rw-r--r--man/man8/Makefile.in1
-rw-r--r--scripts/Makefile.in1
-rw-r--r--scripts/zpios-profile/Makefile.in1
-rw-r--r--scripts/zpios-test/Makefile.in1
-rw-r--r--scripts/zpool-config/Makefile.in1
-rw-r--r--scripts/zpool-layout/Makefile.in1
-rw-r--r--udev/Makefile.in1
-rw-r--r--udev/rules.d/Makefile.in1
-rw-r--r--zfs-modules.spec.in13
-rw-r--r--zfs_config.h.in3
60 files changed, 99 insertions, 16 deletions
diff --git a/Makefile.in b/Makefile.in
index 67412c63d..bb9bc1d99 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -209,6 +209,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
@@ -961,6 +962,7 @@ rpm-common:
--define "require_spldir $(SPL)" \
--define "require_splobj $(SPL_OBJ)" \
--define "require_splver $(SPL_VERSION)" \
+ --define "$(DEBUG_ZFS) 1" \
--nodeps --rebuild $$rpmpkg || exit 1; \
cp $$rpmbuild/RPMS/*/* . || exit 1; \
$(RM) -R $$rpmbuild
diff --git a/cmd/Makefile.in b/cmd/Makefile.in
index b362f4bc4..a6ab6cca9 100644
--- a/cmd/Makefile.in
+++ b/cmd/Makefile.in
@@ -169,6 +169,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/cmd/mount_zfs/Makefile.in b/cmd/mount_zfs/Makefile.in
index 5945bd1c1..94d9d05b1 100644
--- a/cmd/mount_zfs/Makefile.in
+++ b/cmd/mount_zfs/Makefile.in
@@ -165,6 +165,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/cmd/sas_switch_id/Makefile.in b/cmd/sas_switch_id/Makefile.in
index 64d07e09b..ba0535f53 100644
--- a/cmd/sas_switch_id/Makefile.in
+++ b/cmd/sas_switch_id/Makefile.in
@@ -154,6 +154,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/cmd/zdb/Makefile.in b/cmd/zdb/Makefile.in
index 0c99ae803..0029e5dfe 100644
--- a/cmd/zdb/Makefile.in
+++ b/cmd/zdb/Makefile.in
@@ -167,6 +167,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/cmd/zfs/Makefile.in b/cmd/zfs/Makefile.in
index 71941603d..e0ba1e55d 100644
--- a/cmd/zfs/Makefile.in
+++ b/cmd/zfs/Makefile.in
@@ -167,6 +167,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/cmd/zinject/Makefile.in b/cmd/zinject/Makefile.in
index 08aaa40ed..14f1b2a8a 100644
--- a/cmd/zinject/Makefile.in
+++ b/cmd/zinject/Makefile.in
@@ -167,6 +167,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/cmd/zpios/Makefile.in b/cmd/zpios/Makefile.in
index 8ab6938cc..b74b113df 100644
--- a/cmd/zpios/Makefile.in
+++ b/cmd/zpios/Makefile.in
@@ -161,6 +161,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/cmd/zpool/Makefile.in b/cmd/zpool/Makefile.in
index 85d09af71..bb17ef5b4 100644
--- a/cmd/zpool/Makefile.in
+++ b/cmd/zpool/Makefile.in
@@ -168,6 +168,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/cmd/zpool_id/Makefile.in b/cmd/zpool_id/Makefile.in
index 204efe831..4b6f04c1e 100644
--- a/cmd/zpool_id/Makefile.in
+++ b/cmd/zpool_id/Makefile.in
@@ -154,6 +154,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/cmd/zpool_layout/Makefile.in b/cmd/zpool_layout/Makefile.in
index 09ed6de1d..95e802cce 100644
--- a/cmd/zpool_layout/Makefile.in
+++ b/cmd/zpool_layout/Makefile.in
@@ -154,6 +154,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/cmd/ztest/Makefile.in b/cmd/ztest/Makefile.in
index f6c5deda7..d1c8029a2 100644
--- a/cmd/ztest/Makefile.in
+++ b/cmd/ztest/Makefile.in
@@ -167,6 +167,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/cmd/zvol_id/Makefile.in b/cmd/zvol_id/Makefile.in
index f369599ee..5d96d2b07 100644
--- a/cmd/zvol_id/Makefile.in
+++ b/cmd/zvol_id/Makefile.in
@@ -161,6 +161,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/config/rpm.am b/config/rpm.am
index c352fc582..d557f77b4 100644
--- a/config/rpm.am
+++ b/config/rpm.am
@@ -68,6 +68,7 @@ rpm-common:
--define "require_spldir $(SPL)" \
--define "require_splobj $(SPL_OBJ)" \
--define "require_splver $(SPL_VERSION)" \
+ --define "$(DEBUG_ZFS) 1" \
--nodeps --rebuild $$rpmpkg || exit 1; \
cp $$rpmbuild/RPMS/*/* . || exit 1; \
$(RM) -R $$rpmbuild
diff --git a/config/zfs-build.m4 b/config/zfs-build.m4
index aa8d3e5ee..823f33266 100644
--- a/config/zfs-build.m4
+++ b/config/zfs-build.m4
@@ -20,16 +20,20 @@ AC_DEFUN([ZFS_AC_DEBUG], [
HOSTCFLAGS="${HOSTCFLAGS} -DDEBUG -Werror"
DEBUG_CFLAGS="-DDEBUG -Werror"
DEBUG_STACKFLAGS="-fstack-check"
+ DEBUG_ZFS="_with_debug"
+ AC_DEFINE(ZFS_DEBUG, 1, [zfs debugging enabled])
],
[
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG "
HOSTCFLAGS="${HOSTCFLAGS} -DNDEBUG "
DEBUG_CFLAGS="-DNDEBUG"
DEBUG_STACKFLAGS=""
+ DEBUG_ZFS="_without_debug"
])
AC_SUBST(DEBUG_CFLAGS)
AC_SUBST(DEBUG_STACKFLAGS)
+ AC_SUBST(DEBUG_ZFS)
AC_MSG_RESULT([$enable_debug])
])
diff --git a/configure b/configure
index 0b00c6ddd..d63c1a1dc 100755
--- a/configure
+++ b/configure
@@ -787,6 +787,7 @@ ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
+DEBUG_ZFS
DEBUG_STACKFLAGS
DEBUG_CFLAGS
CONFIG_KERNEL_FALSE
@@ -4835,13 +4836,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:4838: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:4839: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:4841: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:4842: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:4844: output\"" >&5)
+ (eval echo "\"\$as_me:4845: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -6047,7 +6048,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 6050 "configure"' > conftest.$ac_ext
+ echo '#line 6051 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -7900,11 +7901,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7903: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7904: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7907: \$? = $ac_status" >&5
+ echo "$as_me:7908: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -8239,11 +8240,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8242: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8243: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8246: \$? = $ac_status" >&5
+ echo "$as_me:8247: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -8344,11 +8345,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8347: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8348: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:8351: \$? = $ac_status" >&5
+ echo "$as_me:8352: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -8399,11 +8400,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8402: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8403: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:8406: \$? = $ac_status" >&5
+ echo "$as_me:8407: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -11202,7 +11203,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11205 "configure"
+#line 11206 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11298,7 +11299,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11301 "configure"
+#line 11302 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -23848,6 +23849,12 @@ fi
HOSTCFLAGS="${HOSTCFLAGS} -DDEBUG -Werror"
DEBUG_CFLAGS="-DDEBUG -Werror"
DEBUG_STACKFLAGS="-fstack-check"
+ DEBUG_ZFS="_with_debug"
+
+cat >>confdefs.h <<\_ACEOF
+#define ZFS_DEBUG 1
+_ACEOF
+
else
@@ -23855,12 +23862,14 @@ else
HOSTCFLAGS="${HOSTCFLAGS} -DNDEBUG "
DEBUG_CFLAGS="-DNDEBUG"
DEBUG_STACKFLAGS=""
+ DEBUG_ZFS="_without_debug"
fi
+
{ $as_echo "$as_me:$LINENO: result: $enable_debug" >&5
$as_echo "$enable_debug" >&6; }
diff --git a/dracut/90zfs/Makefile.in b/dracut/90zfs/Makefile.in
index 0725bbc74..470f20400 100644
--- a/dracut/90zfs/Makefile.in
+++ b/dracut/90zfs/Makefile.in
@@ -153,6 +153,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/dracut/Makefile.in b/dracut/Makefile.in
index 1544385b4..d65ef24ed 100644
--- a/dracut/Makefile.in
+++ b/dracut/Makefile.in
@@ -169,6 +169,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/etc/Makefile.in b/etc/Makefile.in
index 14737685d..c8c8821f7 100644
--- a/etc/Makefile.in
+++ b/etc/Makefile.in
@@ -169,6 +169,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/etc/init.d/Makefile.in b/etc/init.d/Makefile.in
index cbed8c0ac..9ff3e2252 100644
--- a/etc/init.d/Makefile.in
+++ b/etc/init.d/Makefile.in
@@ -153,6 +153,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/etc/zfs/Makefile.in b/etc/zfs/Makefile.in
index e161cb455..0382b0c7a 100644
--- a/etc/zfs/Makefile.in
+++ b/etc/zfs/Makefile.in
@@ -153,6 +153,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/include/Makefile.in b/include/Makefile.in
index 9f3972782..ad01d2bd6 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -213,6 +213,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/include/linux/Makefile.in b/include/linux/Makefile.in
index 9c69b6257..5dfa3de4b 100644
--- a/include/linux/Makefile.in
+++ b/include/linux/Makefile.in
@@ -160,6 +160,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/include/sys/Makefile.in b/include/sys/Makefile.in
index 91fd34b65..a2afe1422 100644
--- a/include/sys/Makefile.in
+++ b/include/sys/Makefile.in
@@ -338,6 +338,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/include/sys/fm/Makefile.in b/include/sys/fm/Makefile.in
index 0dcd27b10..9fe283acf 100644
--- a/include/sys/fm/Makefile.in
+++ b/include/sys/fm/Makefile.in
@@ -198,6 +198,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/include/sys/fm/fs/Makefile.in b/include/sys/fm/fs/Makefile.in
index 03c32de06..bc2db281f 100644
--- a/include/sys/fm/fs/Makefile.in
+++ b/include/sys/fm/fs/Makefile.in
@@ -158,6 +158,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/include/sys/fs/Makefile.in b/include/sys/fs/Makefile.in
index 1f8de0f07..00ed240c6 100644
--- a/include/sys/fs/Makefile.in
+++ b/include/sys/fs/Makefile.in
@@ -158,6 +158,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/include/sys/zfs_debug.h b/include/sys/zfs_debug.h
index e83b66147..591d0df8f 100644
--- a/include/sys/zfs_debug.h
+++ b/include/sys/zfs_debug.h
@@ -36,7 +36,7 @@
/*
* ZFS debugging - Always enabled for user space builds.
*/
-#if defined(DEBUG) || !defined(_KERNEL)
+#if !defined(ZFS_DEBUG) && !defined(_KERNEL)
#define ZFS_DEBUG
#endif
diff --git a/lib/Makefile.in b/lib/Makefile.in
index daaf306b1..8d57296c6 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -169,6 +169,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libavl/Makefile.in b/lib/libavl/Makefile.in
index d28c6acde..8c2be9a28 100644
--- a/lib/libavl/Makefile.in
+++ b/lib/libavl/Makefile.in
@@ -159,6 +159,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libefi/Makefile.in b/lib/libefi/Makefile.in
index 4a935784a..4f954417b 100644
--- a/lib/libefi/Makefile.in
+++ b/lib/libefi/Makefile.in
@@ -159,6 +159,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libnvpair/Makefile.in b/lib/libnvpair/Makefile.in
index e982a68bd..c736a500a 100644
--- a/lib/libnvpair/Makefile.in
+++ b/lib/libnvpair/Makefile.in
@@ -185,6 +185,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libshare/Makefile.in b/lib/libshare/Makefile.in
index 61b61a700..65133e1bf 100644
--- a/lib/libshare/Makefile.in
+++ b/lib/libshare/Makefile.in
@@ -159,6 +159,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libspl/Makefile.in b/lib/libspl/Makefile.in
index 2d1a8ad17..15c672074 100644
--- a/lib/libspl/Makefile.in
+++ b/lib/libspl/Makefile.in
@@ -210,6 +210,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libspl/asm-generic/Makefile.in b/lib/libspl/asm-generic/Makefile.in
index 63b0ef392..6ad997114 100644
--- a/lib/libspl/asm-generic/Makefile.in
+++ b/lib/libspl/asm-generic/Makefile.in
@@ -130,6 +130,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libspl/asm-i386/Makefile.in b/lib/libspl/asm-i386/Makefile.in
index 2d43d8918..e68762c87 100644
--- a/lib/libspl/asm-i386/Makefile.in
+++ b/lib/libspl/asm-i386/Makefile.in
@@ -134,6 +134,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libspl/asm-x86_64/Makefile.in b/lib/libspl/asm-x86_64/Makefile.in
index c6d61a5fa..6b7f4beca 100644
--- a/lib/libspl/asm-x86_64/Makefile.in
+++ b/lib/libspl/asm-x86_64/Makefile.in
@@ -134,6 +134,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libspl/include/Makefile.in b/lib/libspl/include/Makefile.in
index ab1d8511e..480b998be 100644
--- a/lib/libspl/include/Makefile.in
+++ b/lib/libspl/include/Makefile.in
@@ -194,6 +194,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libspl/include/ia32/Makefile.in b/lib/libspl/include/ia32/Makefile.in
index f1f6cb87f..634415864 100644
--- a/lib/libspl/include/ia32/Makefile.in
+++ b/lib/libspl/include/ia32/Makefile.in
@@ -169,6 +169,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libspl/include/ia32/sys/Makefile.in b/lib/libspl/include/ia32/sys/Makefile.in
index 70eb6a35d..c00dc4dce 100644
--- a/lib/libspl/include/ia32/sys/Makefile.in
+++ b/lib/libspl/include/ia32/sys/Makefile.in
@@ -156,6 +156,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libspl/include/rpc/Makefile.in b/lib/libspl/include/rpc/Makefile.in
index a217ab6dc..3513cb88e 100644
--- a/lib/libspl/include/rpc/Makefile.in
+++ b/lib/libspl/include/rpc/Makefile.in
@@ -156,6 +156,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libspl/include/sys/Makefile.in b/lib/libspl/include/sys/Makefile.in
index efa77adc6..c02b3ea75 100644
--- a/lib/libspl/include/sys/Makefile.in
+++ b/lib/libspl/include/sys/Makefile.in
@@ -194,6 +194,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libspl/include/sys/dktp/Makefile.in b/lib/libspl/include/sys/dktp/Makefile.in
index 1656d9d4e..cadff828c 100644
--- a/lib/libspl/include/sys/dktp/Makefile.in
+++ b/lib/libspl/include/sys/dktp/Makefile.in
@@ -156,6 +156,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libspl/include/sys/sysevent/Makefile.in b/lib/libspl/include/sys/sysevent/Makefile.in
index 5a37394e3..3e5f21946 100644
--- a/lib/libspl/include/sys/sysevent/Makefile.in
+++ b/lib/libspl/include/sys/sysevent/Makefile.in
@@ -156,6 +156,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libspl/include/util/Makefile.in b/lib/libspl/include/util/Makefile.in
index 8894eb57a..3d49a92df 100644
--- a/lib/libspl/include/util/Makefile.in
+++ b/lib/libspl/include/util/Makefile.in
@@ -156,6 +156,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libunicode/Makefile.in b/lib/libunicode/Makefile.in
index 6135529f8..d05c40a35 100644
--- a/lib/libunicode/Makefile.in
+++ b/lib/libunicode/Makefile.in
@@ -159,6 +159,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libuutil/Makefile.in b/lib/libuutil/Makefile.in
index e10118898..4aca16091 100644
--- a/lib/libuutil/Makefile.in
+++ b/lib/libuutil/Makefile.in
@@ -188,6 +188,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libzfs/Makefile.in b/lib/libzfs/Makefile.in
index 84e9e2a7e..720cf0729 100644
--- a/lib/libzfs/Makefile.in
+++ b/lib/libzfs/Makefile.in
@@ -189,6 +189,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/lib/libzpool/Makefile.in b/lib/libzpool/Makefile.in
index 6c6b3b1e7..67130c315 100644
--- a/lib/libzpool/Makefile.in
+++ b/lib/libzpool/Makefile.in
@@ -201,6 +201,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/man/Makefile.in b/man/Makefile.in
index 1552a216a..5a065b740 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -169,6 +169,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/man/man8/Makefile.in b/man/man8/Makefile.in
index 5d1fcd726..5b4ca6154 100644
--- a/man/man8/Makefile.in
+++ b/man/man8/Makefile.in
@@ -154,6 +154,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index a3822d902..5c81ae66d 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -194,6 +194,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/scripts/zpios-profile/Makefile.in b/scripts/zpios-profile/Makefile.in
index ed4e3192c..3ee1ec310 100644
--- a/scripts/zpios-profile/Makefile.in
+++ b/scripts/zpios-profile/Makefile.in
@@ -154,6 +154,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/scripts/zpios-test/Makefile.in b/scripts/zpios-test/Makefile.in
index 637dfd7fa..ee881748e 100644
--- a/scripts/zpios-test/Makefile.in
+++ b/scripts/zpios-test/Makefile.in
@@ -154,6 +154,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/scripts/zpool-config/Makefile.in b/scripts/zpool-config/Makefile.in
index 6afa78fc0..eed157329 100644
--- a/scripts/zpool-config/Makefile.in
+++ b/scripts/zpool-config/Makefile.in
@@ -154,6 +154,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/scripts/zpool-layout/Makefile.in b/scripts/zpool-layout/Makefile.in
index ca0927382..75593b81d 100644
--- a/scripts/zpool-layout/Makefile.in
+++ b/scripts/zpool-layout/Makefile.in
@@ -154,6 +154,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/udev/Makefile.in b/udev/Makefile.in
index 6b20a9fc6..b4033bbab 100644
--- a/udev/Makefile.in
+++ b/udev/Makefile.in
@@ -169,6 +169,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/udev/rules.d/Makefile.in b/udev/rules.d/Makefile.in
index fe559cd73..aba04ee46 100644
--- a/udev/rules.d/Makefile.in
+++ b/udev/rules.d/Makefile.in
@@ -153,6 +153,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEBUG_ZFS = @DEBUG_ZFS@
DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
diff --git a/zfs-modules.spec.in b/zfs-modules.spec.in
index 4c13adf63..f1db8c3a6 100644
--- a/zfs-modules.spec.in
+++ b/zfs-modules.spec.in
@@ -22,6 +22,17 @@
%define kobj %{require_kobj}
%endif
+# Set using 'rpmbuild ... --with debug ...', defaults to disabled.
+%if %{defined _with_debug}
+ %define kdebug --enable-debug
+%else
+ %if %{defined _without_debug}
+ %define kdebug --disable-debug
+ %else
+ %define kdebug --disable-debug
+ %endif
+%endif
+
# SLES:
%if %{defined suse_version}
%if %{undefined kver}
@@ -253,7 +264,7 @@ which use %{name}.
%build
%configure --with-linux=%{kdir} --with-linux-obj=%{kobj} \
--with-spl=%{spldir} --with-spl-obj=%{splobj} \
- --with-config=kernel
+ --with-config=kernel %{kdebug}
make
%install
diff --git a/zfs_config.h.in b/zfs_config.h.in
index 887f0f7c9..f51bd1868 100644
--- a/zfs_config.h.in
+++ b/zfs_config.h.in
@@ -260,6 +260,9 @@
/* Version number of package */
#undef VERSION
+/* zfs debugging enabled */
+#undef ZFS_DEBUG
+
/* Define the project alias string. */
#undef ZFS_META_ALIAS