fstests: add a dio-read-into-mmap and sync race test case
Subsystems (2)
PATCH v2 1/1 fstests: add a dio-read-into-mmap and sync race test case
There is a report that on btrfs, if the following workload are running, btrfs can fail:
- A dio read into a mmaped range
Only the mmap range needs to be on btrfs.
The dio read source makes no difference.
- Sync_range on the mapped range
The btrfs errors include:
- Hang during data writeback
- Filesystem flips RO
The mmap range is dirtied but written back by the sync_range process, then dio read finished and found that the folios are no longer dirty, so dio endio will mark those folios dirty again so that the fs can write them back again.
However for non-experimental btrfs with 4K block size and 4K page size, there is a regression in v7.2 that such case is no longer handled properly, due to the enablement of large folios and removal of cow fixup.
And btrfs can never handle it for bs < ps from day 1.
Add a regression test for it.
---
Changelog:
v2:
- Rebased to the latest patches-in-queue branch
The old number is taken by another test case, now this one got the number 800.
- Fix a bug when the direct read failed short, the read buffer is not advanced
- Add _require_odirect
- Add _require_xfs_io_command sync_range
- Add missing tmp files cleanup
- Remove unneessary trap command for the main process
- Fix the unset command
--- .gitignore | 1 + src/Makefile | 2 +- src/dio-read-into-mmap.c | 81 ++++++++++++++++++++++++++++++++++++++++ tests/generic/800 | 79 +++++++++++++++++++++++++++++++++++++++ tests/generic/800.out | 2 + 5 files changed, 164 insertions(+), 1 deletion(-) create mode 100644 src/dio-read-into-mmap.c create mode 100755 tests/generic/800 create mode 100644 tests/generic/800.out
.gitignore +1 -0
@@ -216,6 +216,7 @@ tags /src/truncate /src/t_btrfs_received_uuid_ioctl /src/btrfs_ioctl +/src/dio-read-into-mmap # Symlinked files /tests/generic/035.out
src/Makefile +1 -1
@@ -21,7 +21,7 @@ TARGETS = dirstress fill fill2 getpagesize holes lstat64 \ t_mmap_writev_overlap checkpoint_journal mmap-rw-fault allocstale \ t_mmap_cow_memory_failure fake-dump-rootino dio-buf-fault rewinddir-test \ readdir-while-renames dio-append-buf-fault dio-write-fsync-same-fd \ - dio-writeback-race unlink-fsync truncate + dio-writeback-race unlink-fsync truncate dio-read-into-mmap LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \ preallo_rw_pattern_writer ftrunc trunc fs_perms testx looptest \
src/dio-read-into-mmap.c new file +81 -0
81 lines not on this page · raw message
tests/generic/800 new file +79 -0
79 lines not on this page · raw message
tests/generic/800.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 800 +Silence is golden
Signature · 1 line
2.51.2