summaryrefslogblamecommitdiffstats
path: root/tests/ts-mount-mtablock
blob: b2f989ed9b00612d9ed89991003f13ee56037e7b (plain) (tree)
1
2

           














                                                                      

                



                    
            
               
 









                                                                              

             
 












                                                                                    
#!/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.
#
. ./commands.sh
. ./functions.sh

TS_COMPONENT="mount"
TS_DESC="mtablock"

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