5 # This file and its contents are supplied under the terms of the
6 # Common Development and Distribution License ("CDDL"), version 1.0.
7 # You may only use this file in accordance with the terms of version
10 # A full copy of the text of the CDDL should have accompanied this
11 # source. A copy of the CDDL is also available via the Internet at
12 # http://www.illumos.org/license/CDDL.
18 # Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
22 # Copyright (c) 2016 by Delphix. All rights reserved.
25 . $STF_SUITE/include/libtest.shlib
29 # refquota should be sent-and-received, but it should not interfere with
30 # the receipt of intermediate snapshots that may have preceded the
31 # final snapshot, where the refquota should hold.
34 # 1. Create a filesystem.
35 # 2. Create two equal-sized large files.
36 # 3. Snapshot the filesystem.
37 # 4. Remove one of the two large files.
38 # 5. Create a refquota larger than one file, but smaller than both.
39 # 6. Snapshot the filesystem again.
40 # 7. Send a replication stream of the second snapshot to a new filesystem.
44 verify_runnable "both"
46 typeset streamfile=$TEST_BASE_DIR/streamfile.$$
50 log_must rm $streamfile
51 log_must zfs destroy -rf $TESTPOOL/$TESTFS1
52 log_must zfs destroy -rf $TESTPOOL/$TESTFS2
55 log_assert "refquota is properly sent-and-received, regardless of any " \
56 "intermediate snapshots sent by a replication stream."
59 orig=$TESTPOOL/$TESTFS1
60 dest=$TESTPOOL/$TESTFS2
61 # 1. Create a filesystem.
62 log_must zfs create $orig
63 origdir=$(get_prop mountpoint $orig)
65 # 2. Create two equal-sized large files.
66 log_must mkfile 5M $origdir/file1
67 log_must mkfile 5M $origdir/file2
70 # 3. Snapshot the filesystem.
71 log_must zfs snapshot $orig@1
73 # 4. Remove one of the two large files.
74 log_must rm $origdir/file2
77 # 5. Create a refquota larger than one file, but smaller than both.
78 log_must zfs set refquota=8M $orig
80 # 6. Snapshot the filesystem again.
81 log_must zfs snapshot $orig@2
83 # 7. Send a replication stream of the second snapshot to a new filesystem.
84 log_must eval "zfs send -R $orig@2 > $streamfile"
85 log_must eval "zfs recv $dest < $streamfile"
87 log_pass "refquota is properly sent-and-received, regardless of any " \
88 "intermediate snapshots sent by a replication stream."