xfs/419: remove irrelevant swapfile test
[xfstests-dev.git] / tests / xfs / 278
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2011 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 278
6 #
7 # Test xfs_repair to ensure it fixes the lost+found link count
8 # at the first run. See also commit 198b747f255346bca64408875763b6ca0ed3d57d
9 # from xfsprogs tree.
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=0        # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
19
20 _cleanup()
21 {
22     cd /
23     rm -f $tmp.*
24 }
25
26 # get standard environment, filters and checks
27 . ./common/rc
28 . ./common/filter
29
30 # real QA test starts here
31 _supported_fs xfs
32 _require_scratch
33
34 rm -f $seqres.full
35 _scratch_mkfs >$seqres.full 2>&1
36 _scratch_mount
37
38 mkdir -p $SCRATCH_MNT/dir/subdir
39
40 #get inodes to be changed
41 DIR_INO=`ls -i $SCRATCH_MNT |awk '{print $1}'`
42 SUBDIR_INO=`ls -i $SCRATCH_MNT/dir |awk '{print $1}'`
43
44 _scratch_unmount
45
46 echo "Silence is goodness..."
47
48 set_ifield() {
49         _scratch_xfs_set_metadata_field "$1" 0 "inode $2" >> $seqres.full
50 }
51
52 sfdir_prefix="$(_scratch_get_sfdir_prefix "$DIR_INO" || \
53         _fail "Cannot determine sfdir prefix")"
54
55 # Corrupt DIR
56
57 set_ifield "${sfdir_prefix}.list[0].inumber.i4" "$DIR_INO"
58 set_ifield "${sfdir_prefix}.list[0].name" "$DIR_INO"
59 set_ifield "${sfdir_prefix}.list[0].offset" "$DIR_INO"
60 set_ifield "${sfdir_prefix}.list[0].namelen" "$DIR_INO"
61 set_ifield "${sfdir_prefix}.hdr.parent.i4" "$DIR_INO"
62 set_ifield "core.nlinkv2" "$DIR_INO"
63
64 # Corrupt SUBDIR
65 set_ifield "${sfdir_prefix}.hdr.parent.i4" "$SUBDIR_INO"
66 set_ifield "core.nlinkv2" "$SUBDIR_INO"
67
68 echo "===== BEGIN of xfs_repair =====" >> $seqres.full
69 echo "" >>$seqres.full
70
71 _scratch_xfs_repair >> $seqres.full 2>&1
72 echo "===== END of xfs_repair =====" >> $seqres.full
73
74 exit