blob: b9f710ef8eb1d2ab84073066c37218af0130783b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#!/bin/bash
#
# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
#
# This file is part of util-linux.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
TS_TOPDIR="$(dirname $0)/../.."
TS_DESC="mtab lock"
. $TS_TOPDIR/functions.sh
ts_init "$*"
ts_skip_nonroot
if [ ! -x "$TS_CMD_MTABLOCK" ]; then
ts_slip "not compiled"
fi
#
# Be careful with number of processes. Don't forget that there is time limit
# when the mount waits on the mtab lock. If you define too much processes some
# of them will fail with timeout.
#
# Note: the original version (< 2.13) of util-linux is completely useless for
# this test (maximum for this old version is NLOOPS=10 and NPROCESSES=5 (2-way
# 2GHz machine)). It has terrible performance due a bad timeouts implemntation
# in lock_mtab().
#
NLOOPS=1000
NPROCESSES=50
> $TS_OUTPUT.debug
echo 0 > $TS_OUTPUT
SYNCTIME=$(( $(date +%s) + 10 ))
for id in $(seq 0 $(( $NPROCESSES - 1 ))); do
$TS_CMD_MTABLOCK $id $SYNCTIME $TS_OUTPUT $NLOOPS >> $TS_OUTPUT.debug 2>&1 &
done
wait
ts_finalize
|