generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / xfs / 451
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Red Hat Inc.  All Rights Reserved.
4 #
5 # FS QA Test 451
6 #
7 # Make sure xfs_repair can repair root inode parent's pointer
8 # when it contains a bogus ino when it's using shot form directory
9
10 . ./common/preamble
11 _begin_fstest auto quick metadata repair
12
13 # Import common functions.
14 . ./common/filter
15
16 echo "Silence is golden"
17
18 # real QA test starts here
19
20 # Modify as appropriate.
21 _supported_fs xfs
22 _require_scratch
23
24 _scratch_mkfs >> /dev/null 2>&1
25
26 rootino=$(_scratch_xfs_get_metadata_field 'rootino' 'sb 0')
27
28 prefix=$(_scratch_get_sfdir_prefix ${rootino} || \
29                         _fail "Cannot determine sfdir prefix")
30
31 # Corrupt root inode parent pointer
32 _scratch_xfs_set_metadata_field "${prefix}.hdr.parent.i4" 0 "inode ${rootino}"\
33                                                 >> $seqres.full 2>&1
34
35 _scratch_xfs_repair >> $seqres.full 2>&1
36
37 # Post-test integrity check will detect any remaining corruption
38
39 status=0
40 exit