A fresh fix is available at:
http://cr.opensolaris.org/~pavelf/6778894-v2 (yes, the previous and
fragile v2 workspace is lost)
This fix is short and easy to read.
Performance of the fix is good, I have a setup with 1.000 and 5.000 NFS
mounts and 14 and 78 autofs mounts.
I was measuring the time of 'umountall -ln'
1)
nfs mounts: 1.000
autofs mounts: 14
time:
real 0m8.071s
user 0m7.233s
sys 0m0.720s
time without the fix:
real 0m1.522s
user 0m0.866s
sys 0m0.721s
2)
nfs mounts: 5.000
autofs mounts: 14
time:
real 2m3.760s
user 2m1.470s
sys 0m2.217s
time without the fix:
real 0m5.312s
user 0m3.385s
sys 0m2.086s
3)
nfs mounts: 1.000
autofs mounts: 78
time:
real 0m8.612s
user 0m7.577s
sys 0m0.972s
time without the fix:
real 0m1.972s
user 0m1.099s
sys 0m0.953s
4)
nfs mounts: 5.000
autofs mounts: 78
time:
real 2m12.247s
user 2m1.785s
sys 0m3.325s
time with the previous fix based on string_grep()
real 2m2.689s
user 2m0.188s
sys 0m2.468s
time without the fix:
real 0m5.429s
user 0m3.390s
sys 0m2.248s
============
Perfomance testing shows that the most important is the number of NFS
mounts,
number of autos mounts is less important.
The costly operation is the memory allocation for the nfs list at line 288:
288 + NFS_LIST="$NFS_LIST $mountp"
============
For comparison, umountall -rn (unmount only nfs) need also similar time
- again it is also doing lot of malloc in a loop on line 331
331 fslist="$fslist $mountp"
My fix:
real 2m16.532s
user 1m58.620s
sys 0m41.238s
Original:
real 2m10.853s
user 1m53.127s
sys 0m41.642s
--Pavel
> This is what you added:
>
> 239 +# Find if a given string is in a pipe separated list
> 240 +# Usage: string_grep string pattern
> 241 +# Example:
> 242 +# string_grep /var/tmp "/var/tmp|/net/server.domain|/home/user"
> 243 +string_grep() {
> 244 + eval "case $1 in '$2') return 0;; esac; return 1"
> 245 +}
>
> Try:
>
> string_grep() {
> eval "case \"$1\" in $2) return 0;; esac; return 1"
> }
>
>
The quotes arround the '$2' were only in my debug workspace and I have
put it incorrectly to cr.opensolaris.org.
Testing which was done without the quotes showed a problem if a
mountpoint was "/*" - it was matching
all mountpoints.
> The difference: a) cause $1 to be quoted in the eval'ed string, b) cause
> $2 not to be so quoted.
>