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
42 ln -f $src $target.$i >/dev/null 2>&1
43 rm -f $target.$i >/dev/null 2>&1
49 nr_cpu=`$here/src/feature -o`
50 echo "Silence is golden"
52 _scratch_mkfs >>$seqres.full 2>&1
55 # create, open & unlinked files so unlinked inode list is not empty
56 $here/src/multi_open_unlink -f $SCRATCH_MNT/$seq.unlinked -n $nr_cpu &
59 # start link/unlink storm
60 src=$SCRATCH_MNT/$seq.target
62 for i in `seq 1 $nr_cpu`; do
63 target=$SCRATCH_MNT/$seq.target.link.$i
64 link_unlink_storm $src $target &
65 link_pids="$link_pids $!"
68 # remove & re-create target to race with link/unlink
74 kill $! >/dev/null 2>&1
76 kill $open_pid $link_pids >/dev/null 2>&1
77 wait $open_pid $link_pids
79 # all done, no oops/hang expected, _check_filesystems checks SCRATCH_DEV after test