generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / xfs / 497
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Oracle, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 497
6 #
7 # Populate a XFS filesystem and fuzz every single-leafn-format dir block field.
8 # Use xfs_scrub to fix the corruption.
9 #
10 . ./common/preamble
11 _begin_fstest dangerous_fuzzers dangerous_scrub dangerous_online_repair
12
13 _register_cleanup "_cleanup" BUS
14
15 # Import common functions.
16 . ./common/filter
17 . ./common/populate
18 . ./common/fuzzy
19
20 # real QA test starts here
21 _supported_fs xfs
22 _require_scratch_xfs_fuzz_fields
23
24 echo "Format and populate"
25 _scratch_populate_cached nofill > $seqres.full 2>&1
26
27 echo "Find single-leafn-format dir block"
28 _scratch_mount
29 inum=$(stat -c '%i' $SCRATCH_MNT/S_IFDIR.FMT_LEAFN)
30 blk_sz=$(_get_block_size $SCRATCH_MNT)
31 _scratch_unmount
32
33 leaf_offset=$(( (2 ** 35) / blk_sz ))
34 echo "Fuzz single-leafn-format dir block"
35 _scratch_xfs_fuzz_metadata '' 'online'  "inode ${inum}" "dblock ${leaf_offset}" >> $seqres.full
36 echo "Done fuzzing single-leafn-format dir block"
37
38 # success, all done
39 status=0
40 exit