2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Red Hat Inc. All Rights Reserved.
7 # Test hardlink to unlinked file.
9 # Regression test for commit:
10 # aae8a97 fs: Don't allow to create hardlink for deleted file
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
27 # get standard environment, filters and checks
31 # real QA test starts here
43 ln -f $src $target.$i >/dev/null 2>&1
44 rm -f $target.$i >/dev/null 2>&1
50 nr_cpu=`$here/src/feature -o`
51 echo "Silence is golden"
53 _scratch_mkfs >>$seqres.full 2>&1
56 # create, open & unlinked files so unlinked inode list is not empty
57 $here/src/multi_open_unlink -f $SCRATCH_MNT/$seq.unlinked -n $nr_cpu &
60 # start link/unlink storm
61 src=$SCRATCH_MNT/$seq.target
63 for i in `seq 1 $nr_cpu`; do
64 target=$SCRATCH_MNT/$seq.target.link.$i
65 link_unlink_storm $src $target &
66 link_pids="$link_pids $!"
69 # remove & re-create target to race with link/unlink
75 kill $! >/dev/null 2>&1
77 kill $open_pid $link_pids >/dev/null 2>&1
78 wait $open_pid $link_pids
80 # all done, no oops/hang expected, _check_filesystems checks SCRATCH_DEV after test