generic: test PF_MEMALLOC interfering with accounting file write
PATCH v2 1/1 generic: test PF_MEMALLOC interfering with accounting file write
From: Eric Biggers <[email protected]>
Add a regression test for the bug fixed by commit 10a98cb16d80 ("xfs:
clear PF_MEMALLOC before exiting xfsaild thread").
---
Changed since v1:
- Fix _require_bsd_process_accounting() to not leave process accounting enabled.
- Removed RFC tag since the kernel fix is now in mainline.
common/config | 1 + common/rc | 12 +++++++++ tests/generic/901 | 60 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/901.out | 2 ++ tests/generic/group | 1 + 5 files changed, 76 insertions(+) create mode 100644 tests/generic/901 create mode 100644 tests/generic/901.out
common/config +1 -0
@@ -220,6 +220,7 @@ export DUPEREMOVE_PROG="$(type -P duperemove)" export CC_PROG="$(type -P cc)" export FSVERITY_PROG="$(type -P fsverity)" export OPENSSL_PROG="$(type -P openssl)" +export ACCTON_PROG="$(type -P accton)" # use 'udevadm settle' or 'udevsettle' to wait for lv to be settled. # newer systems have udevadm command but older systems like RHEL5 don't.
common/rc +12 -0
@@ -4168,6 +4168,18 @@ _check_xfs_scrub_does_unicode() { return 0 } +# Require the 'accton' userspace tool and CONFIG_BSD_PROCESS_ACCT=y. +_require_bsd_process_accounting() +{ + _require_command "$ACCTON_PROG" accton + $ACCTON_PROG on &> $tmp.test_accton + cat $tmp.test_accton >> $seqres.full + if grep 'Function not implemented' $tmp.test_accton; then + _notrun "BSD process accounting support unavailable" + fi + $ACCTON_PROG off >> $seqres.full +} + init_rc ################################################################################
tests/generic/901 new file +60 -0
60 lines not on this page · raw message
tests/generic/901.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 901 +Silence is golden
tests/generic/group +1 -0
@@ -595,3 +595,4 @@ 591 auto quick rw pipe splice 592 auto quick encrypt 593 auto quick encrypt +901 auto quick
Signature · 1 line
2.26.0
Quoted 108 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Add a regression test for the bug fixed by commit
10a98cb16d80("xfs:
clearPF_MEMALLOCbefore exiting xfsaild thread").Signed-off-by Eric Biggers <[email protected]>---
Changed since v1:
- Fix_require_bsd_process_accounting()to not leave process accounting enabled.
- Removed RFC tag since the kernel fix is now in mainline.common/config | 1 + common/rc | 12 +++++++++ tests/generic/901 | 60 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/901.out | 2 ++ tests/generic/group | 1 + 5 files changed, 76 insertions(+) create mode 100644 tests/generic/901 create mode 100644 tests/generic/901.outcommon/config +1
-0@@ -220,6 +220,7 @@ export DUPEREMOVE_PROG="$(type -P duperemove)" export CC_PROG="$(type -P cc)" export FSVERITY_PROG="$(type -P fsverity)" export OPENSSL_PROG="$(type -P openssl)" +export ACCTON_PROG="$(type -P accton)" # use 'udevadm settle' or 'udevsettle' to wait for lv to be settled. # newer systems have udevadm command but older systems like RHEL5 don't.common/rc +12
-0@@ -4168,6 +4168,18 @@ _check_xfs_scrub_does_unicode() { return 0 } +# Require the 'accton' userspace tool and CONFIG_BSD_PROCESS_ACCT=y. +_require_bsd_process_accounting() +{ + _require_command "$ACCTON_PROG" accton + $ACCTON_PROG on &> $tmp.test_accton + cat $tmp.test_accton >> $seqres.full + if grep 'Function not implemented' $tmp.test_accton; then + _notrun "BSD process accounting support unavailable" + fi + $ACCTON_PROG off >> $seqres.full +} + init_rc ################################################################################tests/generic/901 new file +44
-0@@ -0,0 +1,60 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright 2020 Google LLC +# +# FS QA Test No. 901 +# +# Regression test for the bug fixed by commit 10a98cb16d80 ("xfs: clear +# PF_MEMALLOC before exiting xfsaild thread"). If the bug exists, a kernel +# WARNING should be triggered. See the commit message for details. +# +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() +{ + $ACCTON_PROG off >> $seqres.full + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_bsd_process_accounting +_require_chattr S +_require_test +_require_scratch + +# To trigger the bug we must unmount a filesystem while BSD process accounting +# is enabled. The accounting file must also be located on a different +# filesystem and have the sync flag set. +
tests/generic/901 line 54
Quoted 10 lines
tests/generic/901 new file +10
-0+accounting_file=$TEST_DIR/$seq + +rm -f $accounting_file +touch $accounting_file +$CHATTR_PROG +S $accounting_file + +_scratch_mkfs &>> $seqres.full +$ACCTON_PROG $accounting_file >> $seqres.full +_scratch_mount +_scratch_unmount
_scratch_cycle_mount
With that fixed,
Thanks for submitting a regression test!
--D
Quoted 26 lines
tests/generic/901 new file +6
-0+$ACCTON_PROG off >> $seqres.full + +echo "Silence is golden" + +status=0 +exittests/generic/901.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 901 +Silence is goldentests/generic/group +1
-0@@ -595,3 +595,4 @@ 591 auto quick rw pipe splice 592 auto quick encrypt 593 auto quick encrypt +901 auto quickSignature · 1 line
2.26.0
Quoted 8 lines · Darrick J. Wong
tests/generic/901 line 54
Quoted 2 lines
tests/generic/901 new file +2
-0+_scratch_mount +_scratch_unmount
_scratch_cycle_mountWith that fixed,
Reviewed-by Darrick J. Wong <[email protected]>
That doesn't work because _scratch_cycle_mount does unmount, then mount. This test wants mount, then unmount.
- Eric
Quoted 6 lines · Eric Biggers
Quoted 5 lines · Darrick J. Wong
tests/generic/901 line 54
Quoted 2 lines
tests/generic/901 new file +2
-0+_scratch_mount +_scratch_unmount
_scratch_cycle_mount
Quoted 6 lines
Quoted 3 lines
With that fixed,
Reviewed-by Darrick J. Wong <[email protected]>That doesn't work because
_scratch_cycle_mountdoes unmount, then mount. This test wants mount, then unmount.
LOL, and I even stumbled over the same thing last time. :(
Test looks fine as it is, and you can still add my RVB.
Ok, time to go do something else.
--D
--D
Quoted 1 line
- Eric