diff mbox series

[2/9] generic/563: selectively remove the io cgroup controller

Message ID 161836228218.2754991.5899063640535008629.stgit@magnolia (mailing list archive)
State New, archived
Headers show
Series fstests: random fixes | expand

Commit Message

Darrick J. Wong April 14, 2021, 1:04 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

If a system configuration tool such as systemd sets up the io cgroup
controller for its own purposes, it's possible that the last line of
this test will not be able to remove the io controller from the system
configuration.  This causes the test to fail even though the inability
to tear down systemd should not be considered (in this case) a failure.

Change this test to set the "io" component of subtree control back to
whatever it was when the test started.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/generic/563 |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Christoph Hellwig April 14, 2021, 6:13 a.m. UTC | #1
On Tue, Apr 13, 2021 at 06:04:42PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> If a system configuration tool such as systemd sets up the io cgroup
> controller for its own purposes, it's possible that the last line of
> this test will not be able to remove the io controller from the system
> configuration.  This causes the test to fail even though the inability
> to tear down systemd should not be considered (in this case) a failure.
> 
> Change this test to set the "io" component of subtree control back to
> whatever it was when the test started.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/tests/generic/563 b/tests/generic/563
index b113eacf..fe7394c0 100755
--- a/tests/generic/563
+++ b/tests/generic/563
@@ -103,6 +103,9 @@  sminor=$((0x`stat -L -c %T $LOOP_DEV`))
 _mkfs_dev $LOOP_DEV >> $seqres.full 2>&1
 _mount $LOOP_DEV $SCRATCH_MNT || _fail "mount failed"
 
+drop_io_cgroup=
+grep -q -w io $cgdir/cgroup.subtree_control || drop_io_cgroup=1
+
 echo "+io" > $cgdir/cgroup.subtree_control || _fail "subtree control"
 
 # Read and write from a single group.
@@ -143,7 +146,9 @@  $XFS_IO_PROG -c fsync $SCRATCH_MNT/file
 check_cg $cgdir/$seq-cg $iosize $iosize
 check_cg $cgdir/$seq-cg-2 0 0
 
-echo "-io" > $cgdir/cgroup.subtree_control || _fail "subtree control"
+if [ "$drop_io_cgroup" = 1 ]; then
+	echo "-io" > $cgdir/cgroup.subtree_control || _fail "subtree control"
+fi
 
 # success, all done
 status=0