1#!/bin/ksh -p 2# 3# CDDL HEADER START 4# 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 8# 1.0 of the CDDL. 9# 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. 13# 14# CDDL HEADER END 15# 16 17# 18# Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved. 19# 20 21. $STF_SUITE/include/libtest.shlib 22 23# 24# DESCRIPTION: 25# refquota should be sent-and-received, but it should not interfere with 26# the receipt of intermediate snapshots that may have preceded the 27# final snapshot, where the refquota should hold. 28# 29# STRATEGY: 30# 1. Create a filesystem. 31# 2. Create two equal-sized large files. 32# 3. Snapshot the filesystem. 33# 4. Remove one of the two large files. 34# 5. Create a refquota larger than one file, but smaller than both. 35# 6. Snapshot the filesystem again. 36# 7. Send a replication stream of the second snapshot to a new filesystem. 37# 38# 39 40verify_runnable "both" 41 42typeset streamfile=/var/tmp/streamfile.$$ 43 44function cleanup 45{ 46 log_must $RM $streamfile 47 log_must $ZFS destroy -rf $TESTPOOL/$TESTFS1 48 log_must $ZFS destroy -rf $TESTPOOL/$TESTFS2 49} 50 51log_assert "refquota is properly sent-and-received, regardless of any " \ 52 "intermediate snapshots sent by a replication stream." 53log_onexit cleanup 54 55orig=$TESTPOOL/$TESTFS1 56dest=$TESTPOOL/$TESTFS2 57# 1. Create a filesystem. 58log_must $ZFS create $orig 59origdir=$(get_prop mountpoint $orig) 60 61# 2. Create two equal-sized large files. 62log_must $MKFILE 5M $origdir/file1 63log_must $MKFILE 5M $origdir/file2 64log_must $SYNC 65 66# 3. Snapshot the filesystem. 67log_must $ZFS snapshot $orig@1 68 69# 4. Remove one of the two large files. 70log_must $RM $origdir/file2 71log_must $SYNC 72 73# 5. Create a refquota larger than one file, but smaller than both. 74log_must $ZFS set refquota=8M $orig 75 76# 6. Snapshot the filesystem again. 77log_must $ZFS snapshot $orig@2 78 79# 7. Send a replication stream of the second snapshot to a new filesystem. 80log_must eval "$ZFS send -R $orig@2 > $streamfile" 81log_must eval "$ZFS recv $dest < $streamfile" 82 83log_pass "refquota is properly sent-and-received, regardless of any " \ 84 "intermediate snapshots sent by a replication stream." 85