4 # Test hardlink to unlinked file.
6 # Regression test for commit:
7 # aae8a97 fs: Don't allow to create hardlink for deleted file
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2015 Red Hat Inc. All Rights Reserved.
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #-----------------------------------------------------------------------
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
33 status=1 # failure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
42 # get standard environment, filters and checks
46 # real QA test starts here
58 ln -f $src $target.$i >/dev/null 2>&1
59 rm -f $target.$i >/dev/null 2>&1
65 nr_cpu=`$here/src/feature -o`
66 echo "Silence is golden"
68 _scratch_mkfs >>$seqres.full 2>&1
71 # create, open & unlinked files so unlinked inode list is not empty
72 src/multi_open_unlink -f $SCRATCH_MNT/$seq.unlinked -n $nr_cpu &
75 # start link/unlink storm
76 src=$SCRATCH_MNT/$seq.target
78 for i in `seq 1 $nr_cpu`; do
79 target=$SCRATCH_MNT/$seq.target.link.$i
80 link_unlink_storm $src $target &
81 link_pids="$link_pids $!"
84 # remove & re-create target to race with link/unlink
90 kill $! >/dev/null 2>&1
92 kill $open_pid $link_pids >/dev/null 2>&1
93 wait $open_pid $link_pids
95 # all done, no oops/hang expected, _check_filesystems checks SCRATCH_DEV after test