2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Oracle, Inc. All Rights Reserved.
7 # Test for race between delete a file while rewriting its reflinked twin
10 _begin_fstest auto quick clone
12 _register_cleanup "_cleanup" BUS
14 # Override the default cleanup function.
22 # Import common functions.
26 # real QA test starts here
27 _require_scratch_reflink
30 echo "Format and mount"
31 _scratch_mkfs > $seqres.full 2>&1
32 _scratch_mount >> $seqres.full 2>&1
34 testdir=$SCRATCH_MNT/test-$seq
40 echo "Initialize files"
42 _pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file1 >> $seqres.full
43 _cp_reflink $testdir/file1 $testdir/file2
46 echo "Delete while rewriting"
47 rm -rf $testdir/file1 &
48 _pwrite_byte 0x62 0 $((loops * blksz)) $testdir/file1 >> $seqres.full