Fun with looping binds over proc
From: Serge Kosyrev
Date: Thu Oct 30 2014 - 08:22:50 EST
Good day!
First, let me show how it looks and feels on my system:
[deepfire@andromedae:~/repro-kernel-loop-mount]$ uname -a
Linux andromedae 3.14.22 #1-NixOS SMP Thu Jan 1 00:00:01 UTC 1970 x86_64 GNU/Linux
[deepfire@andromedae:~/repro-kernel-loop-mount]$ ls
repro.sh
[deepfire@andromedae:~/repro-kernel-loop-mount]$ cat repro.sh
#!/bin/sh
test -d dir/rec || mkdir -p dir/rec
test -d dir/proc || mkdir -p dir/proc
mount --bind . dir/rec
mount --make-private --make-unbindable dir/rec
mount none -t proc dir/proc
umount dir/rec
umount dir/proc
[deepfire@andromedae:~/repro-kernel-loop-mount]$ time sudo ./repro.sh
real 0m0.045s
user 0m0.012s
sys 0m0.007s
[deepfire@andromedae:~/repro-kernel-loop-mount]$ time sudo ./repro.sh
real 0m0.035s
user 0m0.009s
sys 0m0.009s
[deepfire@andromedae:~/repro-kernel-loop-mount]$ time sudo ./repro.sh
real 0m0.042s
user 0m0.012s
sys 0m0.010s
[deepfire@andromedae:~/repro-kernel-loop-mount]$ time sudo ./repro.sh
real 0m0.039s
user 0m0.013s
sys 0m0.011s
[deepfire@andromedae:~/repro-kernel-loop-mount]$ time sudo ./repro.sh
real 0m0.043s
user 0m0.009s
sys 0m0.011s
[deepfire@andromedae:~/repro-kernel-loop-mount]$ time sudo ./repro.sh
real 0m0.048s
user 0m0.011s
sys 0m0.013s
[deepfire@andromedae:~/repro-kernel-loop-mount]$ time sudo ./repro.sh
real 0m0.052s
user 0m0.016s
sys 0m0.012s
[deepfire@andromedae:~/repro-kernel-loop-mount]$ time sudo ./repro.sh
real 0m0.059s
user 0m0.008s
sys 0m0.031s
[deepfire@andromedae:~/repro-kernel-loop-mount]$ time sudo ./repro.sh
real 0m0.067s
user 0m0.005s
sys 0m0.042s
[deepfire@andromedae:~/repro-kernel-loop-mount]$ time sudo ./repro.sh
real 0m0.116s
user 0m0.011s
sys 0m0.088s
[deepfire@andromedae:~/repro-kernel-loop-mount]$ time sudo ./repro.sh
real 0m0.291s
user 0m0.009s
sys 0m0.262s
[deepfire@andromedae:~/repro-kernel-loop-mount]$ time sudo ./repro.sh
real 0m0.857s
user 0m0.011s
sys 0m0.819s
[deepfire@andromedae:~/repro-kernel-loop-mount]$ time sudo ./repro.sh
real 0m1.710s
user 0m0.012s
sys 0m1.634s
[deepfire@andromedae:~/repro-kernel-loop-mount]$ time sudo ./repro.sh
real 0m3.186s
user 0m0.010s
sys 0m3.023s
[deepfire@andromedae:~/repro-kernel-loop-mount]$ time sudo ./repro.sh
real 0m6.732s
user 0m0.013s
sys 0m6.032s
[deepfire@andromedae:~/repro-kernel-loop-mount]$ time sudo ./repro.sh
real 0m14.541s
user 0m0.008s
sys 0m12.115s
* * *
Some extra data points:
1. Exchanging the two umounts results in expected behavior
2. Exchanging the two umounts absolves the need in 'mount --make-private --make-unbindable dir/rec'
3. I don't see it on 3.12.something Ubuntu kernels
--
regards,
ÐÐÑÑÐÐ ÐÐÑÑÑÐÐ
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/