generic/563: selectively remove the io cgroup controller

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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Darrick J. Wong
2021-04-13 18:04:42 -07:00
committed by Eryu Guan
parent f7a8c5c4ad
commit d57433fc99
+5
View File
@@ -103,6 +103,9 @@ sminor=$((0x`stat -L -c %T $LOOP_DEV`))
_mkfs_dev $LOOP_DEV >> $seqres.full 2>&1 _mkfs_dev $LOOP_DEV >> $seqres.full 2>&1
_mount $LOOP_DEV $SCRATCH_MNT || _fail "mount failed" _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" echo "+io" > $cgdir/cgroup.subtree_control || _fail "subtree control"
# Read and write from a single group. # 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 $iosize $iosize
check_cg $cgdir/$seq-cg-2 0 0 check_cg $cgdir/$seq-cg-2 0 0
if [ "$drop_io_cgroup" = 1 ]; then
echo "-io" > $cgdir/cgroup.subtree_control || _fail "subtree control" echo "-io" > $cgdir/cgroup.subtree_control || _fail "subtree control"
fi
# success, all done # success, all done
status=0 status=0