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 (c) 2020 by Delphix. All rights reserved. 19# 20 21. $STF_SUITE/include/libtest.shlib 22 23# 24# DESCRIPTION: 25# ZFS receive test to handle Issue #10698 26# 27# STRATEGY: 28# 1. Create a pool with filesystem_limits disabled 29# 2. Create a filesystem on that pool 30# 3. Enable filesystem limits on that pool 31# 4. On a pool with filesystem limits enabled, create a filesystem and set a 32# limit 33# 5. Snapshot limited filesystem 34# 6. send -R limited filesystem and receive over filesystem with limits disabled 35# 36 37verify_runnable "both" 38 39function cleanup 40{ 41 destroy_pool "$poolname" 42 destroy_pool "$rpoolname" 43 log_must rm -f "$vdevfile" 44 log_must rm -f "$rvdevfile" 45 log_must rm -f "$streamfile" 46} 47 48log_onexit cleanup 49 50log_assert "ZFS should handle receiving streams with filesystem limits on \ 51 pools where the feature was recently enabled" 52 53poolname=sendpool 54rpoolname=recvpool 55vdevfile="$TEST_BASE_DIR/vdevfile.$$" 56rvdevfile="$TEST_BASE_DIR/rvdevfile.$$" 57sendfs="$poolname/fs" 58recvfs="$rpoolname/rfs" 59streamfile="$TEST_BASE_DIR/streamfile.$$" 60 61log_must truncate -s $MINVDEVSIZE "$rvdevfile" 62log_must truncate -s $MINVDEVSIZE "$vdevfile" 63log_must zpool create -O mountpoint=none -o feature@filesystem_limits=disabled \ 64 "$rpoolname" "$rvdevfile" 65log_must zpool create -O mountpoint=none "$poolname" "$vdevfile" 66 67log_must zfs create "$recvfs" 68log_must zpool set feature@filesystem_limits=enabled "$rpoolname" 69 70log_must zfs create -o filesystem_limit=100 "$sendfs" 71log_must zfs snapshot "$sendfs@a" 72 73log_must zfs send -R "$sendfs@a" >"$streamfile" 74log_must eval "zfs recv -svuF $recvfs <$streamfile" 75 76log_pass "ZFS can handle receiving streams with filesystem limits on \ 77 pools where the feature was recently enabled" 78