1#!/bin/ksh -p 2# 3# This file and its contents are supplied under the terms of the 4# Common Development and Distribution License ("CDDL"), version 1.0. 5# You may only use this file in accordance with the terms of version 6# 1.0 of the CDDL. 7# 8# A full copy of the text of the CDDL should have accompanied this 9# source. A copy of the CDDL is also available via the Internet at 10# http://www.illumos.org/license/CDDL. 11# 12 13# 14# Copyright 2018, Datto Inc. 15# 16 17. $STF_SUITE/include/libtest.shlib 18 19# 20# DESCRIPTION: 21# 'zfs diff' should work with encrypted datasets 22# 23# STRATEGY: 24# 1. Create an encrypted dataset 25# 2. Create two snapshots of the dataset 26# 3. Perform 'zfs diff -Ft' and verify no errors occur 27# 4. Perform the same test on a dataset with large dnodes 28# 29 30verify_runnable "both" 31 32function cleanup 33{ 34 destroy_dataset "$TESTPOOL/$TESTFS1" "-r" 35 destroy_dataset "$TESTPOOL/$TESTFS2" "-r" 36} 37 38log_assert "'zfs diff' should work with encrypted datasets" 39log_onexit cleanup 40 41# 1. Create an encrypted dataset 42log_must eval "echo 'password' | zfs create -o encryption=on \ 43 -o keyformat=passphrase $TESTPOOL/$TESTFS1" 44MNTPOINT="$(get_prop mountpoint $TESTPOOL/$TESTFS1)" 45 46# 2. Create two snapshots of the dataset 47log_must zfs snapshot $TESTPOOL/$TESTFS1@snap1 48log_must touch "$MNTPOINT/file" 49log_must zfs snapshot $TESTPOOL/$TESTFS1@snap2 50 51# 3. Perform 'zfs diff' and verify no errors occur 52log_must zfs diff -Ft $TESTPOOL/$TESTFS1@snap1 $TESTPOOL/$TESTFS1@snap2 53 54# 4. Perform the same test on a dataset with large dnodes 55log_must eval "echo 'password' | zfs create -o dnodesize=4k \ 56 -o encryption=on -o keyformat=passphrase $TESTPOOL/$TESTFS2" 57MNTPOINT="$(get_prop mountpoint $TESTPOOL/$TESTFS2)" 58log_must zfs snapshot $TESTPOOL/$TESTFS2@snap1 59log_must touch "$MNTPOINT/file" 60log_must zfs snapshot $TESTPOOL/$TESTFS2@snap2 61log_must zfs diff -Ft $TESTPOOL/$TESTFS2@snap1 $TESTPOOL/$TESTFS2@snap2 62 63log_pass "'zfs diff' works with encrypted datasets" 64