summaryrefslogtreecommitdiff
path: root/tests/xfs/006
blob: cecceaa3bea671bf8b9e8367c3c1817fe9424897 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2016 Red Hat, Inc.  All Rights Reserved.
#
# FS QA Test 006
#
# Test xfs' "fail at unmount" error handling configuration. Stop
# XFS from retrying to writeback forever at unmount.
#
. ./common/preamble
_begin_fstest auto quick mount eio

# Override the default cleanup function.
_cleanup()
{
	cd /
	rm -f $tmp.*
	_dmerror_cleanup
}

# Import common functions.
. ./common/filter
. ./common/dmerror

# real QA test starts here
_supported_fs xfs
_require_scratch
_require_dm_target error
_require_fs_sysfs error/fail_at_unmount

_scratch_mkfs > $seqres.full 2>&1
_dmerror_init
_dmerror_mount

# Make sure all error handling attributes are original status
_reset_xfs_sysfs_error_handling $DMERROR_DEV

# Make sure fail_at_unmount is enabled, so XFS stops retrying on
# errors at unmount time. _fail the test if we fail to set it to 1,
# because the test probably will hang in such case and block
# subsequent tests.
attr=`_get_fs_sysfs_attr $DMERROR_DEV error/fail_at_unmount`
if [ "$attr" != "1" ]; then
	_fail "Failed to set error/fail_at_unmount: $attr"
fi

# start a metadata-intensive workload, but no data allocation operation.
# Because uncompleted new space allocation I/Os may cause XFS to shutdown
# after loading error table.
$FSSTRESS_PROG -z -n 5000 -p 10 \
	       -f creat=10 \
	       -f resvsp=1 \
	       -f truncate=1 \
	       -f punch=1 \
	       -f chown=5 \
	       -f mkdir=5 \
	       -f rmdir=1 \
	       -f mknod=1 \
	       -f unlink=1 \
	       -f symlink=1 \
	       -f rename=1 \
	       -d $SCRATCH_MNT/fsstress >> $seqres.full 2>&1

# Loading error table without "--nolockfs" option. Because "--nolockfs"
# won't freeze fs, then some running I/Os may cause XFS to shutdown
# prematurely. That's not what we want to test.
_dmerror_load_error_table lockfs
_dmerror_unmount

# Mount again to replay log after loading working table, so we have a
# consistent XFS after test.
_dmerror_load_working_table
_dmerror_mount
_dmerror_unmount

# success, all done
status=0
exit