Last active
February 25, 2016 14:24
-
-
Save iaguis/1f1bdf2086a7b4f122ff to your computer and use it in GitHub Desktop.
CentOS is different!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Try with: | |
| # sudo $PWD/udevd-experiment.sh | |
| THIS_SCRIPT=$0 | |
| if [ "$1" = "udevd1" ] ; then | |
| unshare --propagation unchanged -m $THIS_SCRIPT udevd2 | |
| exit 0 | |
| fi | |
| if [ "$1" = "udevd2" ] ; then | |
| mount --make-rslave / | |
| mount --make-rshared / | |
| sleep 5000 | |
| exit 0 | |
| fi | |
| $THIS_SCRIPT udevd1 & | |
| sleep 1 | |
| DIR=/tmp/udevd-experiment-$RANDOM | |
| mkdir $DIR | |
| cd $DIR | |
| mkdir s1 | |
| mount -t tmpfs tmpfs $DIR/s1 | |
| mkdir s1/rootfs | |
| mount -t tmpfs tmpfs $DIR/s1/rootfs | |
| echo In the host namespace: | |
| cat /proc/self/mountinfo|grep udevd || true | |
| echo In the udevd namespace: | |
| cat /proc/$(pidof sleep)/mountinfo|grep udevd || true | |
| echo Simulating GC... | |
| mount --make-private $DIR/s1/rootfs | |
| mount --make-private $DIR/s1 | |
| umount $DIR/s1/rootfs | |
| umount $DIR/s1 | |
| rm -rf $DIR/s1 | |
| echo In the host namespace: | |
| cat /proc/self/mountinfo|grep udevd || true | |
| echo In the udevd namespace: | |
| cat /proc/$(pidof sleep)/mountinfo|grep udevd || true | |
| # Cleanup | |
| killall sleep |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment