* [LTP] [PATCH] cgroup: fix mount errors on cgroup subsys
@ 2016-11-23 11:09 Li Wang
2016-11-23 12:35 ` Cyril Hrubis
0 siblings, 1 reply; 4+ messages in thread
From: Li Wang @ 2016-11-23 11:09 UTC (permalink / raw)
To: ltp
This patch is on target to fix tiny errors:
mount: xxx is already mounted or /opt/ltp/testcases/bin/cgroup busy
cgroup_regression_test 3 TFAIL : ltpapicmd.c:190: Failed to mount cpu subsys
cgroup_regression_test 4 TCONF : ltpapicmd.c:190: CONFIG_LOCKDEP is not enabled
mount: xxx is already mounted or /opt/ltp/testcases/bin/cgroup busy
cgroup_regression_test 5 TFAIL : ltpapicmd.c:190: mount net_prio and pids failed
cgroup_regression_test 6 TCONF : ltpapicmd.c:190: CONFIG_CGROUP_NS
mount: xxx is already mounted or /opt/ltp/testcases/bin/cgroup busy
cgroup_regression_test 7 TFAIL : ltpapicmd.c:190: failed to mount net_prio
Test Environment: 23G RAM, 24 CPUS, x86_64, RHEL7.3GA
Signed-off-by: Li Wang <liwang@redhat.com>
---
.../controllers/cgroup/cgroup_regression_test.sh | 46 +++++++++++++++++++++-
1 file changed, 44 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
index 30d0dbf..971243f 100755
--- a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
+++ b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
@@ -181,10 +181,17 @@ test_3()
return
fi
+ local cpu=cpu
+
+ # For rhel7.3 or later, cpu is always binding with cpuacct subsys
+ if grep -w cpu /proc/mounts ; then
+ cpu=$(basename $(grep -w cpu /proc/mounts | cut -d ' ' -f 2))
+ fi
+
# Run the test for 30 secs
- mount -t cgroup -o cpu xxx cgroup/
+ mount -t cgroup -o $cpu xxx cgroup/
if [ $? -ne 0 ]; then
- tst_resm TFAIL "Failed to mount cpu subsys"
+ tst_resm TFAIL "Failed to mount $cpu subsys"
failed=1
return
fi
@@ -262,6 +269,20 @@ test_5()
subsys1=`tail -n 1 /proc/cgroups | awk '{ print $1 }'`
subsys2=`tail -n 2 /proc/cgroups | head -1 | awk '{ print $1 }'`
+ # On rhel7.3, cgroup subsystem is mounted automatically
+ # Here just unmout these two target temporarily for test
+ if grep -w $subsys1 /proc/mounts ; then
+ subsys1_orig=$(basename $(grep -w $subsys1 /proc/mounts | cut -d ' ' -f 2))
+ subsys1_path=$(grep -w $subsys1 /proc/mounts | cut -d ' ' -f 2)
+ umount $subsys1_path
+ fi
+
+ if grep -w $subsys2 /proc/mounts ; then
+ subsys2_orig=$(basename $(grep -w $subsys2 /proc/mounts | cut -d ' ' -f 2))
+ subsys2_path=$(grep -w $subsys2 /proc/mounts | cut -d ' ' -f 2)
+ umount $subsys2_path
+ fi
+
mount -t cgroup -o $subsys1,$subsys2 xxx cgroup/
if [ $? -ne 0 ]; then
tst_resm TFAIL "mount $subsys1 and $subsys2 failed"
@@ -298,6 +319,17 @@ test_5()
wait $!
rmdir cgroup/0
umount cgroup/
+
+ # waiting for cgroup/ unmout successfuly
+ tst_sleep 100ms
+
+ if [ -n "$subsys1_path" ]; then
+ mount -t cgroup -o $subsys1_orig cgroup $subsys1_path
+ fi
+
+ if [ -n "$subsys2_path" ]; then
+ mount -t cgroup -o $subsys2_orig cgroup $subsys2_path
+ fi
}
#---------------------------------------------------------------------------
@@ -411,6 +443,12 @@ test_7()
subsys=`tail -n 1 /proc/cgroups | awk '{ print $1 }'`
+ if grep -w $subsys /proc/mounts ; then
+ subsys_orig=$(basename $(grep -w $subsys /proc/mounts | cut -d ' ' -f 2))
+ subsys_path=$(grep -w $subsys /proc/mounts | cut -d ' ' -f 2)
+ umount $subsys_path
+ fi
+
# remount to add new subsystems to the hierarchy
i=1
while [ $i -le 2 ] ; do
@@ -426,6 +464,10 @@ test_7()
: $(( i += 1 ))
done
+ if [ -n "$subsys_path" ]; then
+ mount -t cgroup -o $subsys_orig cgroup $subsys_path
+ fi
+
tst_resm TPASS "no kernel bug was found"
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [LTP] [PATCH] cgroup: fix mount errors on cgroup subsys
2016-11-23 11:09 [LTP] [PATCH] cgroup: fix mount errors on cgroup subsys Li Wang
@ 2016-11-23 12:35 ` Cyril Hrubis
2016-11-24 10:08 ` Li Wang
0 siblings, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2016-11-23 12:35 UTC (permalink / raw)
To: ltp
Hi!
> ---
> .../controllers/cgroup/cgroup_regression_test.sh | 46 +++++++++++++++++++++-
> 1 file changed, 44 insertions(+), 2 deletions(-)
>
> diff --git a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
> index 30d0dbf..971243f 100755
> --- a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
> +++ b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
> @@ -181,10 +181,17 @@ test_3()
> return
> fi
>
> + local cpu=cpu
> +
> + # For rhel7.3 or later, cpu is always binding with cpuacct subsys
> + if grep -w cpu /proc/mounts ; then
> + cpu=$(basename $(grep -w cpu /proc/mounts | cut -d ' ' -f 2))
> + fi
> +
> # Run the test for 30 secs
> - mount -t cgroup -o cpu xxx cgroup/
> + mount -t cgroup -o $cpu xxx cgroup/
> if [ $? -ne 0 ]; then
> - tst_resm TFAIL "Failed to mount cpu subsys"
> + tst_resm TFAIL "Failed to mount $cpu subsys"
> failed=1
> return
> fi
Why can't we mount the cgroup only when it's not mounted yet and
use the path it's mounted on otherwise? We do that for the functional
tetscases already.
And I do not think that umounting system cgroups is a good idea either.
I would say that the test should use whatever is mounted on the system
and if that is not possible I would rather produce TCONF than fiddle
with umounting cgroups from the standard system path.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 4+ messages in thread
* [LTP] [PATCH] cgroup: fix mount errors on cgroup subsys
2016-11-23 12:35 ` Cyril Hrubis
@ 2016-11-24 10:08 ` Li Wang
2016-11-24 10:16 ` Cyril Hrubis
0 siblings, 1 reply; 4+ messages in thread
From: Li Wang @ 2016-11-24 10:08 UTC (permalink / raw)
To: ltp
On Wed, Nov 23, 2016 at 8:35 PM, Cyril Hrubis <chrubis@suse.cz> wrote:
> Hi!
>> ---
>> .../controllers/cgroup/cgroup_regression_test.sh | 46 +++++++++++++++++++++-
>> 1 file changed, 44 insertions(+), 2 deletions(-)
>>
>> diff --git a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
>> index 30d0dbf..971243f 100755
>> --- a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
>> +++ b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
>> @@ -181,10 +181,17 @@ test_3()
>> return
>> fi
>>
>> + local cpu=cpu
>> +
>> + # For rhel7.3 or later, cpu is always binding with cpuacct subsys
>> + if grep -w cpu /proc/mounts ; then
>> + cpu=$(basename $(grep -w cpu /proc/mounts | cut -d ' ' -f 2))
>> + fi
>> +
>> # Run the test for 30 secs
>> - mount -t cgroup -o cpu xxx cgroup/
>> + mount -t cgroup -o $cpu xxx cgroup/
>> if [ $? -ne 0 ]; then
>> - tst_resm TFAIL "Failed to mount cpu subsys"
>> + tst_resm TFAIL "Failed to mount $cpu subsys"
>> failed=1
>> return
>> fi
>
> Why can't we mount the cgroup only when it's not mounted yet and
> use the path it's mounted on otherwise? We do that for the functional
> tetscases already.
I thought that the original case including cgroup mounted test, so I
unmount the system cgroup and do itself mount & testing there.
>
> And I do not think that umounting system cgroups is a good idea either.
> I would say that the test should use whatever is mounted on the system
> and if that is not possible I would rather produce TCONF than fiddle
> with umounting cgroups from the standard system path.
Using system cgroups is not a bad idea, I hesitated about doing that
or just doing tiny fix. now you help me make a decision.
Thanks for your comments, I will rewrite this PATCH.
--
Regards,
Li Wang
Email: liwang@redhat.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [LTP] [PATCH] cgroup: fix mount errors on cgroup subsys
2016-11-24 10:08 ` Li Wang
@ 2016-11-24 10:16 ` Cyril Hrubis
0 siblings, 0 replies; 4+ messages in thread
From: Cyril Hrubis @ 2016-11-24 10:16 UTC (permalink / raw)
To: ltp
Hi!
> > Why can't we mount the cgroup only when it's not mounted yet and
> > use the path it's mounted on otherwise? We do that for the functional
> > tetscases already.
>
> I thought that the original case including cgroup mounted test, so I
> unmount the system cgroup and do itself mount & testing there.
Well the original test was written at times where cgroups were shiny and
new and were not mounted by default on some well defined location...
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-11-24 10:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-23 11:09 [LTP] [PATCH] cgroup: fix mount errors on cgroup subsys Li Wang
2016-11-23 12:35 ` Cyril Hrubis
2016-11-24 10:08 ` Li Wang
2016-11-24 10:16 ` Cyril Hrubis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.