1#!/bin/ksh -p 2# SPDX-License-Identifier: CDDL-1.0 3# 4# CDDL HEADER START 5# 6# The contents of this file are subject to the terms of the 7# Common Development and Distribution License (the "License"). 8# You may not use this file except in compliance with the License. 9# 10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11# or https://opensource.org/licenses/CDDL-1.0. 12# See the License for the specific language governing permissions 13# and limitations under the License. 14# 15# When distributing Covered Code, include this CDDL HEADER in each 16# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17# If applicable, add the following below this CDDL HEADER, with the 18# fields enclosed by brackets "[]" replaced with your own identifying 19# information: Portions Copyright [yyyy] [name of copyright owner] 20# 21# CDDL HEADER END 22# 23 24. $STF_SUITE/include/libtest.shlib 25. $STF_SUITE/tests/functional/block_cloning/block_cloning.kshlib 26 27# 28# DESCRIPTION: 29# When block cloning is used to implement copy_file_range(2), the 30# RLIMIT_FSIZE limit must be respected. 31# 32# STRATEGY: 33# 1. Create a pool. 34# 2. ??? 35# 36 37verify_runnable "global" 38 39VDIR=$TEST_BASE_DIR/disk-bclone 40VDEV="$VDIR/a" 41 42function cleanup 43{ 44 datasetexists $TESTPOOL && destroy_pool $TESTPOOL 45 rm -rf $VDIR 46} 47 48log_onexit cleanup 49 50log_assert "Test for RLIMIT_FSIZE handling with block cloning enabled" 51 52log_must rm -rf $VDIR 53log_must mkdir -p $VDIR 54log_must truncate -s 1G $VDEV 55 56log_must zpool create -o feature@block_cloning=enabled $TESTPOOL $VDEV 57 58log_must dd if=/dev/urandom of=/$TESTPOOL/file1 bs=1 count=1000 59 60ulimit -f 2 61log_must clonefile -f /$TESTPOOL/file1 /$TESTPOOL/file2 0 0 all 62ulimit -f 1 63log_mustnot clonefile -f /$TESTPOOL/file1 /$TESTPOOL/file3 0 0 all 64 65log_pass "copy_file_range(2) respects RLIMIT_FSIZE" 66