Implement random wait to eliminate race.
This commit is contained in:
parent
4506edf751
commit
f27ca34a40
12
automount
12
automount
|
|
@ -256,10 +256,20 @@ __wait_for_boot() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
__wait_for_boot
|
__random_wait() {
|
||||||
|
RANDOM=$( head -c 256 /dev/urandom | env LC_ALL=C tr -c -d '1-9' )
|
||||||
|
MODULO=$(( ${RANDOM} % 24 ))
|
||||||
|
WAIT=$( echo ${MODULO} / 10 | bc -l )
|
||||||
|
WAIT=$( printf "%.1f" ${WAIT} )
|
||||||
|
sleep ${WAIT}
|
||||||
|
__log "${DEV}: random wait for '${WAIT}' seconds before 'attach' action"
|
||||||
|
}
|
||||||
|
|
||||||
DEV=/dev/${1}
|
DEV=/dev/${1}
|
||||||
|
|
||||||
|
__wait_for_boot
|
||||||
|
__random_wait
|
||||||
|
|
||||||
case ${2} in
|
case ${2} in
|
||||||
(attach)
|
(attach)
|
||||||
__log "${DEV}: attach"
|
__log "${DEV}: attach"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue