Skip to contentSkip to conversation

generic/639: Test page faults during read and write

PATCH New Andreas Gruenbacher 1 participant 1 message May 31, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 generic/639: Test page faults during read and write

Some filesystems have problems when the buffer passed to read or write is memory-mapped to the file being read from or written to and the buffer is faulted in during the read or write. (That's probably not a recommended use case, but it should work nevertheless.)

---
 src/Makefile          |   2 +-
 src/mmap-rw-fault.c   | 169 ++++++++++++++++++++++++++++++++++++++++++
 tests/generic/639     |  40 ++++++++++
 tests/generic/639.out |   2 +
 tests/generic/group   |   1 +
 5 files changed, 213 insertions(+), 1 deletion(-)
 create mode 100644 src/mmap-rw-fault.c
 create mode 100755 tests/generic/639
 create mode 100644 tests/generic/639.out
src/Makefile +1 -1
index 1279e4b9..6e3871b9 100644
@@ -18,7 +18,7 @@ TARGETS = dirstress fill fill2 getpagesize holes lstat64 \
 	t_ext4_dax_journal_corruption t_ext4_dax_inline_corruption \
 	t_ofd_locks t_mmap_collision mmap-write-concurrent \
 	t_get_file_time t_create_short_dirs t_create_long_dirs t_enospc \
-	t_mmap_writev_overlap
+	t_mmap_writev_overlap mmap-rw-fault
 
 LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
 	preallo_rw_pattern_writer ftrunc trunc fs_perms testx looptest \
src/mmap-rw-fault.c new file +169 -0

169 lines not on this page · raw message

tests/generic/639 new file +40 -0
new file mode 100755
index 00000000..4406be98
@@ -0,0 +1,40 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2021 Red Hat, Inc.  All Rights Reserved.
+#
+# FS QA Test 639
+#
+# Trigger mmap page faults in the same file during pread and pwrite
+#
+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
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs generic
+_require_test
+_require_test_program mmap-rw-fault
+
+$here/src/mmap-rw-fault $TEST_DIR/mmap-rw-fault.tmp 2>&1
+
+# success, all done
+echo "Silence is golden"
+status=0
+exit
tests/generic/639.out new file +2 -0
new file mode 100644
index 00000000..62c66537
@@ -0,0 +1,2 @@
+QA output created by 639
+Silence is golden
tests/generic/group +1 -0
index 9a636b23..d6f11cda 100644
@@ -641,3 +641,4 @@
 636 auto quick swap
 637 auto quick dir
 638 auto quick rw
+639 auto
Signature · 1 line
2.26.3