2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015, Oracle and/or its affiliates. All Rights Reserved.
7 # Check that we can't dedupe immutable files
10 _begin_fstest auto quick clone dedupe
12 # Override the default cleanup function.
16 rm -rf $tmp.* $testdir1
19 # Import common functions.
24 # real QA test starts here
28 echo "Format and mount"
29 testdir1="$TEST_DIR/test-$seq"
33 echo "Create the original files"
34 blksz="$(_get_block_size $testdir1)"
38 free_blocks0=$(stat -f $testdir1 -c '%f')
40 filesize=$((blksz * nr))
41 _pwrite_byte 0x61 0 $sz $testdir1/file1 >> $seqres.full
42 _pwrite_byte 0x61 0 $sz $testdir1/file2 >> $seqres.full
47 _filter_test_dir | sed -e 's/Operation not permitted/Permission denied/g'
50 echo "Try dedupe on immutable files"
51 $CHATTR_PROG +i $testdir1/file1 $testdir1/file2
52 _dedupe_range $testdir1/file1 0 $testdir1/file2 0 $blksz 2>&1 | do_filter_output
53 $CHATTR_PROG -i $testdir1/file1 $testdir1/file2