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 reflink immutable files
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
21 rm -rf $tmp.* $testdir1
24 # get standard environment, filters and checks
30 # real QA test starts here
37 echo "Format and mount"
38 testdir1="$TEST_DIR/test-$seq"
42 echo "Create the original files"
43 blksz="$(_get_block_size $testdir1)"
47 free_blocks0=$(stat -f $testdir1 -c '%f')
49 filesize=$((blksz * nr))
50 _pwrite_byte 0x61 0 $sz $testdir1/file1 >> $seqres.full
51 _pwrite_byte 0x61 0 $sz $testdir1/file2 >> $seqres.full
56 _filter_test_dir | sed -e 's/Operation not permitted/Permission denied/g'
59 echo "Try reflink on immutable files"
60 $CHATTR_PROG +i $testdir1/file1 $testdir1/file2
61 _reflink_range $testdir1/file1 0 $testdir1/file2 0 $blksz 2>&1 | do_filter_output
62 $CHATTR_PROG -i $testdir1/file1 $testdir1/file2