summaryrefslogtreecommitdiff
path: root/tests/ext4/031
blob: ac16786ff15794d0cfde032c667d7cfec12ed199 (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
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2017-2018 Intel Corporation.  All Rights Reserved.
#
# FS QA Test ext4/031
#
# This is a regression test for kernel patch:
#   ext4: prevent data corruption with inline data + DAX
# created by Ross Zwisler <ross.zwisler@linux.intel.com>
#
. ./common/preamble
_begin_fstest auto quick dax

# Import common functions.
. ./common/filter

# DAX needs to be off so we can create an inode with inline data
SAVE_MOUNT_OPTIONS="$MOUNT_OPTIONS"
MOUNT_OPTIONS=""

# Modify as appropriate.
_supported_fs ext4
_require_scratch_dax_mountopt "dax"
_require_test_program "t_ext4_dax_inline_corruption"
_require_scratch_ext4_feature "inline_data"

# real QA test starts here
_scratch_mkfs_ext4 -O inline_data > $seqres.full 2>&1

TESTFILE=$SCRATCH_MNT/testfile

_scratch_mount  >> $seqres.full 2>&1

echo "Need to make some inline data..." > $TESTFILE

export MOUNT_OPTIONS="$SAVE_MOUNT_OPTIONS"

_scratch_unmount >> $seqres.full 2>&1
_try_scratch_mount "-o dax" >> $seqres.full 2>&1

if [[ $? != 0 ]]; then
	# _require_scratch_dax_mountopt already verified that we could mount with DAX.
	# Failure here is expected because we have inline data.
	echo "Silence is golden"
	status=0
	exit
fi

$here/src/t_ext4_dax_inline_corruption $TESTFILE

# success, all done
echo "Silence is golden"
status=0
exit