summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPalash Gandhi <pbg4930@rit.edu>2021-03-19 22:47:50 -0700
committerBrian Behlendorf <behlendorf1@llnl.gov>2021-05-19 20:00:08 -0700
commit875303b2d31dcc55a61ff98f230f016ab1f7437f (patch)
treee369045f5df9d8629123079b2607742f8fa0f781
parent3d80f880b9cc36cad5d83c14f02388d76d65b686 (diff)
ZTS: New test for kernel panic induced by redacted send
This change adds a new test that covers a bug fix in the binary search in the redacted send resume logic that causes a kernel panic. The bug was fixed in https://github.com/openzfs/zfs/pull/11297. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Co-authored-by: John Kennedy <john.kennedy@delphix.com> Signed-off-by: Palash Gandhi <palash.gandhi@delphix.com> Closes #11764
-rw-r--r--tests/runfiles/common.run4
-rw-r--r--tests/zfs-tests/tests/functional/redacted_send/Makefile.am1
-rwxr-xr-xtests/zfs-tests/tests/functional/redacted_send/redacted_panic.ksh44
3 files changed, 47 insertions, 2 deletions
diff --git a/tests/runfiles/common.run b/tests/runfiles/common.run
index eceb91c82..1ac627260 100644
--- a/tests/runfiles/common.run
+++ b/tests/runfiles/common.run
@@ -722,8 +722,8 @@ tests = ['redacted_compressed', 'redacted_contents', 'redacted_deleted',
'redacted_disabled_feature', 'redacted_embedded', 'redacted_holes',
'redacted_incrementals', 'redacted_largeblocks', 'redacted_many_clones',
'redacted_mixed_recsize', 'redacted_mounts', 'redacted_negative',
- 'redacted_origin', 'redacted_props', 'redacted_resume', 'redacted_size',
- 'redacted_volume']
+ 'redacted_origin', 'redacted_panic', 'redacted_props', 'redacted_resume',
+ 'redacted_size', 'redacted_volume']
tags = ['functional', 'redacted_send']
[tests/functional/raidz]
diff --git a/tests/zfs-tests/tests/functional/redacted_send/Makefile.am b/tests/zfs-tests/tests/functional/redacted_send/Makefile.am
index dd6b4eb67..61d0ea213 100644
--- a/tests/zfs-tests/tests/functional/redacted_send/Makefile.am
+++ b/tests/zfs-tests/tests/functional/redacted_send/Makefile.am
@@ -15,6 +15,7 @@ dist_pkgdata_SCRIPTS = \
redacted_mounts.ksh \
redacted_negative.ksh \
redacted_origin.ksh \
+ redacted_panic.ksh \
redacted_props.ksh \
redacted_resume.ksh \
redacted_size.ksh \
diff --git a/tests/zfs-tests/tests/functional/redacted_send/redacted_panic.ksh b/tests/zfs-tests/tests/functional/redacted_send/redacted_panic.ksh
new file mode 100755
index 000000000..bf3b17f35
--- /dev/null
+++ b/tests/zfs-tests/tests/functional/redacted_send/redacted_panic.ksh
@@ -0,0 +1,44 @@
+#!/bin/ksh
+
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright (c) 2021 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/tests/functional/redacted_send/redacted.kshlib
+
+#
+# Description:
+# Verify edge case when midbufid is equal to minbufid for the bug fixed by
+# https://github.com/openzfs/zfs/pull/11297 (Fix kernel panic induced by
+# redacted send)
+#
+
+typeset ds_name="panic"
+typeset sendfs="$POOL/$ds_name"
+typeset recvfs="$POOL2/$ds_name"
+typeset clone="$POOL/${ds_name}_clone"
+typeset stream=$(mktemp $tmpdir/stream.XXXX)
+
+log_onexit redacted_cleanup $sendfs $recvfs
+
+log_must zfs create -o recsize=8k $sendfs
+log_must dd if=/dev/urandom of=/$sendfs/file bs=1024k count=2048
+log_must zfs snapshot $sendfs@init
+log_must zfs clone $sendfs@init $clone
+log_must stride_dd -i /dev/urandom -o /$clone/file -b 8192 -s 2 -c 7226
+log_must zfs snapshot $clone@init
+log_must zfs redact $sendfs@init book_init $clone@init
+log_must eval "zfs send --redact $sendfs#book_init $sendfs@init >$stream"
+log_must eval "zfs recv $recvfs <$stream"
+log_pass