Skip to contentSkip to conversation

xfs/444: fix agfl reset warning detection for small log buffers

PATCH In review Darrick J. Wong 2 participants 2 messages Jul 3, 2024 – Jul 4, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs/444: fix agfl reset warning detection for small log buffers

From: Darrick J. Wong <[email protected]>

Collectively, the ten subtests in xfs/444 can generate a lot of kernel log data. If the amount of log data is enough to overflow the kernel log buffers, the AGFL reset warning generated by fix_start and fix_wrap might have been overwritten by subsequent log data. Fix this by checking for the reset warning after each test and only complaining if at the end if we have /never/ seen the warning.

Found by running on a kernel configured with CONFIG_LOG_BUF_SHIFT=14 (16K). This happened to be a Raspberry Pi, but in principle this can happen to anyone. I'd never noticed this before because x86 helpfully sets it to 17 (128K) by default.

---
 tests/xfs/444 |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
tests/xfs/444 +11 -3
index db7418c55d..cf78a9a1f0 100755
@@ -58,6 +58,10 @@ dump_ag0() {
 	_scratch_xfs_db -c 'sb 0' -c 'p' -c 'agf 0' -c 'p' -c 'agfl 0' -c 'p'
 }
 
+# Did we get the kernel warning too?
+warn_str='WARNING: Reset corrupted AGFL'
+saw_agfl_reset_warning=0
+
 runtest() {
 	cmd="$1"
 
@@ -208,6 +212,8 @@ ENDL
 	echo "FS REMOUNT" >> $seqres.full
 	dump_ag0 > $tmp.remount 2> /dev/null
 	diff -u $tmp.repair $tmp.remount >> $seqres.full
+
+	_check_dmesg_for "${warn_str}" && ((saw_agfl_reset_warning++))
 }
 
 runtest fix_end
@@ -221,9 +227,11 @@ runtest bad_start
 runtest no_move
 runtest simple_move
 
-# Did we get the kernel warning too?
-warn_str='WARNING: Reset corrupted AGFL'
-_check_dmesg_for "${warn_str}" || echo "Missing dmesg string \"${warn_str}\"."
+# We must see the AGFL reset warning at least once.  Collectively, the subtests
+# can generate enough kernel log data to overflow the buffer, so we check for
+# the warning after each subtest and summarize the output here.
+((saw_agfl_reset_warning > 0)) || \
+	echo "Missing dmesg string \"${warn_str}\"."
 
 # Now run the regular dmesg check, filtering out the agfl warning
 filter_agfl_reset_printk() {