summaryrefslogtreecommitdiff
path: root/tests/xfs/132
blob: b46d3d28c84f3c00502b73dbb18f007adeea1f6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2018 Red Hat, Inc.  All Rights Reserved.
#
# FS QA Test No. 132
#
# Catch inobt/on disk inode free state mismatches on V4 filesystems
#
. ./common/preamble
_begin_fstest auto quick

# Import common functions.
. ./common/filter
. ./common/quota

# real QA test starts here

_supported_fs xfs

# we intentionally corrupt the filesystem, so don't check it after the test
_require_scratch_nocheck
_require_xfs_nocrc

# on success, we'll get a shutdown filesystem with a really noisy log message
# due to transaction cancellation.  Hence we don't want to check dmesg here.
_disable_dmesg_check

_scratch_mkfs -m crc=0 > $seqres.full 2>&1

# The files that EIO in the golden output changes if we have quotas enabled
# so leave it off.
_qmount_option "defaults"

# corrupt an inode in the root inode chunk
root_ino=$(_scratch_xfs_get_metadata_field 'rootino' 'sb 0')
corrupt_ino=$((root_ino + 15))
_scratch_xfs_set_metadata_field 'core.mode' 0100644 "inode $corrupt_ino"

_scratch_mount

# The corrupt inode should be tripped over during these initial file creates.
touch $SCRATCH_MNT/file{0,1,2,3,4,5}{0,1,2,3,4,5} 2>&1 | _filter_scratch

# success, all done
status=0
exit