aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorloli10K <[email protected]>2019-09-24 21:01:37 +0200
committerBrian Behlendorf <[email protected]>2019-09-24 12:01:37 -0700
commitd359e99c38f66732d42278c32d52cfcf1839aa4f (patch)
tree7206eb4767afe1f831c67f20cb7e77061e5176f8 /tests
parent73d7820bba26dd61085cb6dd8348ebf0bb41b951 (diff)
diff_cb() does not handle large dnodes
Trying to 'zfs diff' a snapshot with large dnodes will incorrectly try to access its interior slots when dnodesize > sizeof(dnode_phys_t). This is normally not an issue because the interior slots are zero-filled, which report_dnode() handles calling report_free_dnode_range(). However this is not the case for encrypted large dnodes or filesystem using many SA based xattrs where the extra data past the legacy dnode size boundary is interpreted as a dnode_phys_t. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tom Caputi <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: loli10K <[email protected]> Closes #7678 Closes #8931 Closes #9343
Diffstat (limited to 'tests')
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_encrypted.ksh14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_encrypted.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_encrypted.ksh
index 471e9ca68..96e6d9b5a 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_encrypted.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_encrypted.ksh
@@ -24,14 +24,15 @@
# 1. Create an encrypted dataset
# 2. Create two snapshots of the dataset
# 3. Perform 'zfs diff -Ft' and verify no errors occur
+# 4. Perform the same test on a dataset with large dnodes
#
verify_runnable "both"
function cleanup
{
- datasetexists $TESTPOOL/$TESTFS1 && \
- log_must zfs destroy -r $TESTPOOL/$TESTFS1
+ destroy_dataset "$TESTPOOL/$TESTFS1" "-r"
+ destroy_dataset "$TESTPOOL/$TESTFS2" "-r"
}
log_assert "'zfs diff' should work with encrypted datasets"
@@ -50,4 +51,13 @@ log_must zfs snapshot $TESTPOOL/$TESTFS1@snap2
# 3. Perform 'zfs diff' and verify no errors occur
log_must zfs diff -Ft $TESTPOOL/$TESTFS1@snap1 $TESTPOOL/$TESTFS1@snap2
+# 4. Perform the same test on a dataset with large dnodes
+log_must eval "echo 'password' | zfs create -o dnodesize=4k \
+ -o encryption=on -o keyformat=passphrase $TESTPOOL/$TESTFS2"
+MNTPOINT="$(get_prop mountpoint $TESTPOOL/$TESTFS2)"
+log_must zfs snapshot $TESTPOOL/$TESTFS2@snap1
+log_must touch "$MNTPOINT/file"
+log_must zfs snapshot $TESTPOOL/$TESTFS2@snap2
+log_must zfs diff -Ft $TESTPOOL/$TESTFS2@snap1 $TESTPOOL/$TESTFS2@snap2
+
log_pass "'zfs diff' works with encrypted datasets"