From: Darrick J. Wong <djwong@xxxxxxxxxx> Fork xfs/286 so that we can ensure that the xfile and xmbuf code in fsck can handle THPs and large folios. This actually caused a regression in the mm code during 6.10. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- tests/xfs/1877 | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1877.out | 2 + 2 files changed, 78 insertions(+) create mode 100755 tests/xfs/1877 create mode 100644 tests/xfs/1877.out diff --git a/tests/xfs/1877 b/tests/xfs/1877 new file mode 100755 index 0000000000..e546ad854f --- /dev/null +++ b/tests/xfs/1877 @@ -0,0 +1,76 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2017 Oracle, Inc. All Rights Reserved. +# +# FS QA Test No. 1877 +# +# Force-enable THPs/large folios in tmpfs, then race fsstress and xfs_scrub in +# force-repair mode for a while to see if we crash, livelock, or corrupt data +# because the xfile code wasn't folioized. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +declare -A oldvalues + +_cleanup() { + cd / + for knob in "${!oldvalues[@]}"; do + echo "${oldvalues["$knob"]}" > "$knob" + done + + _scratch_xfs_stress_scrub_cleanup &> /dev/null + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +_require_scratch +_require_xfs_stress_online_repair + +_fixed_by_git_commit kernel 099d90642a711 \ + "mm/filemap: make MAX_PAGECACHE_ORDER acceptable to xarray" + +# Make sure that the xfile code can handle large folios +knob="/sys/kernel/mm/transparent_hugepage/shmem_enabled" +test -w "$knob" || _notrun "tmpfs transparent hugepages disabled" + +pagesize=`getconf PAGE_SIZE` +pagesize_kb=$((pagesize / 1024)) + +echo "settings now: pagesize=${pagesize_kb}KB" >> $seqres.full +sysfs-dump /sys/kernel/mm/transparent_hugepage/* >> $seqres.full + +# Enable large folios for each of the relevant page sizes. +for ((i = 0; i <= 31; i++)); do + hugepagesize_kb=$(( pagesize_kb * (2**i) )) + knob="/sys/kernel/mm/transparent_hugepage/hugepages-${hugepagesize_kb}kB/enabled" + test -e "$knob" || continue + + echo "setting $knob to inherit" >> $seqres.full + oldvalue="$(sed -e 's/^.*\[//g' -e 's/\].*$//g' < "$knob")" + oldvalues["$knob"]="$oldvalue" + echo inherit > "$knob" +done + +# Turn on large folios +knob="/sys/kernel/mm/transparent_hugepage/shmem_enabled" +echo "setting $knob to force" >> $seqres.full +oldvalues["$knob"]="$(sed -e 's/^.*\[//g' -e 's/\].*$//g' < "$knob")" +echo force > "$knob" || _fail "could not force tmpfs transparent hugepages" + +echo "settings now" >> $seqres.full +sysfs-dump /sys/kernel/mm/transparent_hugepage/* >> $seqres.full + +_scratch_mkfs >> "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_online_repair -S '-k' + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/1877.out b/tests/xfs/1877.out new file mode 100644 index 0000000000..88d845a112 --- /dev/null +++ b/tests/xfs/1877.out @@ -0,0 +1,2 @@ +QA output created by 1877 +Silence is golden