| #!/bin/bash | |
| # | |
| # Copyright (C) 2007 Karel Zak <kzak@redhat.com> | |
| # | |
| # This file is part of util-linux-ng. | |
| # | |
| # 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 | |
| # | |
| # 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 | |