generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / xfs / 533
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2022 FUJITSU LIMITED. All rights reserved.
4 #
5 # FS QA Test 533
6 #
7 # Regression test for xfsprogs commit
8 # f4afdcb0ad11 ("xfs_db: clean up the salvage read callsites in set_cur()")
9 #
10 # This case test xfs_db whether can get the new magicnum field value even we
11 # just have corrupted this field value.
12 #
13
14 . ./common/preamble
15 _begin_fstest auto quick db
16
17 # real QA test starts here
18 _supported_fs xfs
19 _fixed_by_git_commit xfsprogs f4afdcb0ad11 \
20         "xfs_db: clean up the salvage read callsites in set_cur()"
21 #skip fs check because invalid superblock 1
22 _require_scratch_nocheck
23
24 # The error messages in the golden output come from the V5 superblock verifier
25 # routines, so ignore V4 filesystems.
26 _require_scratch_xfs_crc
27
28 _scratch_mkfs_xfs >>$seqres.full 2>&1
29
30 # write the bad magicnum field value(0) to the superblock 1
31 _scratch_xfs_set_metadata_field "magicnum" "0" "sb 1"
32
33 # Even magicnum field has been corrupted, we still can read this field value.
34 # The error message changed in xfsprogs 5.19.
35 _scratch_xfs_get_metadata_field "magicnum" "sb 1" 2>&1 | \
36         sed -e 's/Superblock has bad magic number 0x0. Not an XFS filesystem?/bad magic number/g'
37
38 # success, all done
39 status=0
40 exit