blob: 563669c67741dc7bdb609be7d14d24f8b13a845d (
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#!/bin/bash
. $(dirname $0)/../include.rc
. $(dirname $0)/../volume.rc
cleanup;
# Start glusterd [1]
TEST glusterd
# Create and verify the volume information [2-4]
TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2};
EXPECT "$V0" volinfo_field $V0 'Volume Name';
EXPECT 'Created' volinfo_field $V0 'Status';
# Turn off the performance translators [5-9]
TEST $CLI volume set $V0 performance.open-behind off
TEST $CLI volume set $V0 performance.write-behind off
TEST $CLI volume set $V0 performance.quick-read off
TEST $CLI volume set $V0 performance.io-cache off
TEST $CLI volume set $V0 performance.read-ahead off
# Start and mount the volume [10-11]
TEST $CLI volume start $V0;
TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0
build_tester $(dirname $0)/mandatory-lock-forced.c -o $(dirname $0)/mandatory-lock
# Various read/write tests without enabling mandatory-locking [12-18]
$(dirname $0)/mandatory-lock RD_LCK NONE READ
TEST [ $? -eq 0 ]
$(dirname $0)/mandatory-lock RD_LCK NONE WRITE
TEST [ $? -eq 0 ]
$(dirname $0)/mandatory-lock WR_LCK NONE READ
TEST [ $? -eq 0 ]
$(dirname $0)/mandatory-lock WR_LCK NONE WRITE
TEST [ $? -eq 0 ]
# Specifies O_TRUNC during open
$(dirname $0)/mandatory-lock RD_LCK TRUNC READ
TEST [ $? -eq 0 ]
$(dirname $0)/mandatory-lock RD_LCK NONE FTRUNCATE
TEST [ $? -eq 0 ]
$(dirname $0)/mandatory-lock RD_LCK BLOCK WRITE
TEST [ $? -eq 0 ]
# Enable mandatory-locking [19]
TEST $CLI volume set $V0 mandatory-locking forced
# Restart the volume to take the change into effect [20-23]
TEST umount $M0
TEST $CLI volume stop $V0
TEST $CLI volume start $V0
TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0
# Repeat the above tests with mandatory-locking [24-30]
$(dirname $0)/mandatory-lock RD_LCK NONE READ
TEST [ $? -eq 0 ]
EXPECT "Resource temporarily unavailable" $(dirname $0)/mandatory-lock RD_LCK NONE WRITE
EXPECT "Resource temporarily unavailable" $(dirname $0)/mandatory-lock WR_LCK NONE READ
EXPECT "Resource temporarily unavailable" $(dirname $0)/mandatory-lock WR_LCK NONE WRITE
EXPECT "Resource temporarily unavailable" $(dirname $0)/mandatory-lock RD_LCK TRUNC READ
EXPECT "Resource temporarily unavailable" $(dirname $0)/mandatory-lock RD_LCK NONE FTRUNCATE
EXPECT "Resource temporarily unavailable" $(dirname $0)/mandatory-lock RD_LCK BLOCK WRITE
rm -rf $(dirname $0)/mandatory-lock
cleanup
#G_TESTDEF_TEST_STATUS_NETBSD7=KNOWN_ISSUE,BUG=1326464
|