Skip to contentSkip to conversation

ext4/046: Add a test for inline_data vs. DAX inode flag

PATCH Superseded Xiao Yang 1 participant 1 message Oct 9, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Xiao Yang

author
#0 lore raw

PATCH 1/1 ext4/046: Add a test for inline_data vs. DAX inode flag

Inline_data is mutually exclusive to DAX inode flag so enabling both of them is not expected and triggers some errors. It's a regression test for kernel patch:
ext4: disallow modifying DAX inode flag if inline_data has been set

---
 tests/ext4/046     | 56 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/ext4/046.out |  2 ++
 tests/ext4/group   |  1 +
 3 files changed, 59 insertions(+)
 create mode 100755 tests/ext4/046
 create mode 100644 tests/ext4/046.out
tests/ext4/046 new file +56 -0
new file mode 100755
index 00000000..f72b1cdb
@@ -0,0 +1,56 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Fujitsu.  All Rights Reserved.
+#
+# FS QA Test 046
+#
+# This is a regression test for kernel patch:
+#   ext4: disallow modifying DAX inode flag if inline_data has been set
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+_supported_fs ext4
+_require_scratch_dax_mountopt "dax=always"
+_require_dax_iflag
+_require_scratch_ext4_feature "inline_data"
+
+TESTFILE=$SCRATCH_MNT/testfile
+
+_scratch_mkfs_ext4 -O inline_data > $seqres.full 2>&1
+
+_scratch_mount "-o dax=inode" >> $seqres.full 2>&1
+
+echo "Need to make some inline data..." > $TESTFILE
+
+# It's fine to disallow modifying DAX inode flag on the file which
+# has inline_data flag.
+if $XFS_IO_PROG -c "chattr +x" $TESTFILE >> $seqres.full 2>&1; then
+	_scratch_cycle_mount "dax=inode"
+	echo 'Append data' >> $TESTFILE
+fi
+
+# success, all done
+echo "Silence is golden"
+status=0
+exit
tests/ext4/046.out new file +2 -0
new file mode 100644
index 00000000..52c445eb
@@ -0,0 +1,2 @@
+QA output created by 046
+Silence is golden
tests/ext4/group +1 -0
index 40351fd9..9a51b246 100644
@@ -48,6 +48,7 @@
 043 auto quick
 044 auto quick
 045 auto dir
+046 auto quick dax
 271 auto rw quick
 301 aio auto ioctl rw stress defrag
 302 aio auto ioctl rw stress defrag
Signature · 1 line
2.25.1