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 2016, OmniTI Computer Consulting, Inc. All rights reserved.
21 . $STF_SUITE/include/libtest.shlib
25 # refquota, like regular quota, is loosely enforced. A dataset
26 # can exceed its refquota by one transaction. This loose enforcement
27 # used to cause problems upon receiving a datastream where its
28 # refquota is slightly exceeded. This test confirms that we can
29 # successfully receive a slightly over refquota stream.
32 # 1. Create a filesystem.
34 # 3. Snapshot the filesystem.
35 # 4. Send a replication stream to a new filesystem.
36 # 5. On the original filesystem, fill it up to its quota.
37 # 6. Snapshot the original filesystem again.
38 # 7. Send an incremental stream to the same new filesystem.
41 verify_runnable "both"
43 typeset streamfile=$TEST_BASE_DIR/streamfile.$$
47 log_must rm $streamfile
48 log_must zfs destroy -rf $TESTPOOL/$TESTFS1
49 log_must zfs destroy -rf $TESTPOOL/$TESTFS2
52 log_assert "The allowable slight refquota overage is properly sent-and-" \
56 orig=$TESTPOOL/$TESTFS1
57 dest=$TESTPOOL/$TESTFS2
59 # 1. Create a filesystem.
60 log_must zfs create $orig
61 origdir=$(get_prop mountpoint $orig)
64 log_must zfs set refquota=50M $orig
66 # 3. Snapshot the filesystem.
67 log_must zfs snapshot $orig@1
69 # 4. Send a replication stream to a new filesystem.
70 log_must eval "zfs send -R $orig@1 > $streamfile"
71 log_must eval "zfs recv $dest < $streamfile"
73 # 5. On the original filesystem, fill it up to its quota.
74 cat < /dev/urandom > $origdir/fill-it-up
76 # 6. Snapshot the original filesystem again.
77 log_must zfs snapshot $orig@2
79 # 7. Send an incremental stream to the same new filesystem.
80 log_must eval "zfs send -I 1 -R $orig@2 > $streamfile"
81 log_must eval "zfs recv $dest < $streamfile"
83 log_pass "Verified receiving a slightly-over-refquota stream succeeds."