sanity-quota test_29() needs sleep enough seconds to take into account
both service time and network latency.
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: Ide2b321fbd104eede17eee109998d40d98fb2d30
Reviewed-on: http://review.whamcloud.com/2601
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yu Jian <yujian@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Jay J Lan <jay.j.lan@nasa.gov>
- local BLK_LIMIT=$((100 * 1024 * 1024)) # 100G
- local timeout
- local pid
+ local BLK_LIMIT=$((100 * 1024 * 1024)) # 100G
+ local timeout
+ local at_max_val
+ local pid
+ local waited
+ local deadline
- if at_is_enabled; then
- timeout=$(at_max_get client)
- at_max_set 10 client
- else
- timeout=$(lctl get_param -n timeout)
- lctl set_param timeout=10
- fi
+ at_max_val=10
+
+ if at_is_enabled; then
+ timeout=$(at_max_get client)
+ [ $(at_min_get client) -gt $at_max_val ] &&
+ at_max_val=$(at_min_get client)
+ at_max_set $at_max_val client
+ else
+ timeout=$(lctl get_param -n timeout)
+ lctl set_param timeout=$at_max_val
+ fi
# actually send a RPC to make service at_current confined within at_max
# actually send a RPC to make service at_current confined within at_max
- $LFS setquota -u $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I 0 $DIR || error "should succeed"
+ $LFS setquota -u $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I 0 $DIR ||
+ error "should succeed"
- #define OBD_FAIL_MDS_QUOTACTL_NET 0x12e
- lustre_fail mds 0x12e
+ #define OBD_FAIL_MDS_QUOTACTL_NET 0x12e
+ lustre_fail mds 0x12e
- $LFS setquota -u $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I 0 $DIR & pid=$!
+ $LFS setquota -u $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I 0 $DIR & pid=$!
- echo "sleeping for 10 * 1.25 + 5 + 10 seconds"
- sleep 28
- ps -p $pid && error "lfs hadn't finished by timeout"
- wait $pid && error "succeeded, but should have failed"
+ deadline=$((2 * (($at_max_val << 1) + ($at_max_val >> 2) + 5)))
+ echo "wait at most 2 * ($at_max_val * 2.25 + 5) = $deadline seconds," \
+ "it is server process time add the network latency."
+ waited=0
+ while [ $waited -lt $deadline ]; do
+ echo -n "."
+ sleep 1
+ waited=$(($waited + 1))
+ ps -p $pid > /dev/null || break
+ done
+ echo "waited $waited seconds"
+ ps -p $pid && error "lfs hadn't finished by $deadline seconds"
+ wait $pid && error "succeeded, but should have failed"
- if at_is_enabled; then
- at_max_set $timeout client
- else
- lctl set_param timeout=$timeout
- fi
+ if at_is_enabled; then
+ at_max_set $timeout client
+ else
+ lctl set_param timeout=$timeout
+ fi
+
+ resetquota -u $TSTUSR
}
run_test_with_stat 29 "unhandled quotactls must not hang lustre client (19778) ========"
}
run_test_with_stat 29 "unhandled quotactls must not hang lustre client (19778) ========"
+at_min_get() {
+ at_get $1 at_min
+}
+
at_max_set() {
local at_max=$1
shift
at_max_set() {
local at_max=$1
shift