Skip to contentSkip to conversation

controllers/cgroup_fj_common.sh: Fix mountpoint mismatch

PATCH New Guangwen Feng 2 participants 3 messages May 24, 2017 – Jul 27, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 controllers/cgroup_fj_common.sh: Fix mountpoint mismatch

Only grepping subsystem name in /proc/cgroups may lead to mismatch, e.g. grep -w debug /proc/mounts will wrongly return debugfs /sys/kernel/debug debugfs as well, so fix this by adding a grep for "cgroup".

---
 testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +2 -1
index 2c8dfd3..907881c 100755
@@ -93,7 +93,8 @@ setup()
     tst_tmpdir
     TST_CLEANUP=cleanup
 
-    mount_point=`grep -w $subsystem /proc/mounts | cut -f 2 | cut -d " " -f2`
+    mount_point=`grep -w $subsystem /proc/mounts | grep -w "cgroup" | \
+	cut -f 2 | cut -d " " -f2`
 
     if [ -z "$mount_point" ]; then
         try_umount=1
Signature · 1 line
1.8.4.2
#1 lore raw

PATCH 1/1 controllers/cgroup_fj_common.sh: Fix mountpoint mismatch

Hi!

Ping, thanks!

Best Regards,
Guangwen Feng

Quoted 24 lines · Guangwen Feng

Only grepping subsystem name in /proc/cgroups may lead to mismatch, e.g. grep -w debug /proc/mounts will wrongly return debugfs /sys/kernel/debug debugfs as well, so fix this by adding a grep for "cgroup".

---
 testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +2 -1
index 2c8dfd3..907881c 100755
@@ -93,7 +93,8 @@ setup()
     tst_tmpdir
     TST_CLEANUP=cleanup
 
-    mount_point=`grep -w $subsystem /proc/mounts | cut -f 2 | cut -d " " -f2`
+    mount_point=`grep -w $subsystem /proc/mounts | grep -w "cgroup" | \
+	cut -f 2 | cut -d " " -f2`
 
     if [ -z "$mount_point" ]; then
         try_umount=1