samples/bpf: detach prog from cgroup
authorPrashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Thu, 1 Mar 2018 05:47:40 +0000 (14:47 +0900)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 1 Mar 2018 23:16:36 +0000 (00:16 +0100)
test_cgrp2_sock.sh and test_cgrp2_sock2.sh tests keep the program
attached to cgroup even after completion.
Using detach functionality of test_cgrp2_sock in both scripts.

Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Acked-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
samples/bpf/test_cgrp2_sock.sh
samples/bpf/test_cgrp2_sock2.sh

index 8ee0371a100af1f82741ff09e49f29b950ccd074..9f617423685618fab136aaf41743578f1d4f2bd2 100755 (executable)
@@ -61,6 +61,7 @@ cleanup_and_exit()
 
        [ -n "$msg" ] && echo "ERROR: $msg"
 
+       test_cgrp2_sock -d ${CGRP_MNT}/sockopts
        ip li del cgrp2_sock
        umount ${CGRP_MNT}
 
index fc4e64d00cb3063a065cc07ec6c02c7184d19626..0f396a86e0cbebd68e9ddf2d5c8557ce40028f38 100755 (executable)
@@ -28,6 +28,9 @@ function attach_bpf {
 }
 
 function cleanup {
+       if [ -d /tmp/cgroupv2/foo ]; then
+               test_cgrp2_sock -d /tmp/cgroupv2/foo
+       fi
        ip link del veth0b
        ip netns delete at_ns0
        umount /tmp/cgroupv2