diff --git a/tests/golden/fallocate b/tests/golden/fallocate new file mode 100644 index 00000000..44b6c818 --- /dev/null +++ b/tests/golden/fallocate @@ -0,0 +1,3 @@ +== creating reasonably large per-mount files +== 10s of racing cold reads and fallocate nop +== cleaning up files diff --git a/tests/sequence b/tests/sequence index c6e463f1..b86452dd 100644 --- a/tests/sequence +++ b/tests/sequence @@ -4,6 +4,7 @@ inode-items-updated.sh simple-inode-index.sh simple-staging.sh simple-release-extents.sh +fallocate.sh setattr_more.sh offline-extent-waiting.sh move-blocks.sh diff --git a/tests/tests/fallocate.sh b/tests/tests/fallocate.sh new file mode 100644 index 00000000..bf49cbe7 --- /dev/null +++ b/tests/tests/fallocate.sh @@ -0,0 +1,38 @@ + +t_require_commands fallocate cat + +echo "== creating reasonably large per-mount files" +for n in $(t_fs_nrs); do + eval path="\$T_D${n}/file-$n" + + LC_ALL=C fallocate -l 128MiB "$path" || \ + t_fail "initial creating fallocate failed" +done + +# +# we had lock inversions between read and fallocate, dropping +# the cache each time forces waiting for IO during the calls +# with the inverted locks held so we have a better chance +# of the deadlock happening. +# +DURATION=10 +echo "== ${DURATION}s of racing cold reads and fallocate nop" +END=$((SECONDS + DURATION)) +while [ $SECONDS -le $END ]; do + + echo 3 > /proc/sys/vm/drop_caches + + for n in $(t_fs_nrs); do + eval path="\$T_D${n}/file-$n" + + LC_ALL=C fallocate -o 0 -l 4KiB "$path" & + cat "$path" > /dev/null & + done + + wait || t_fail "fallocate or cat failed" +done + +echo "== cleaning up files" +rm -f "$T_D0"/file-* + +t_pass