glusterfs

Форк
0
/
bug-1244613.t 
95 строк · 2.7 Кб
1
#!/bin/bash
2

3
. $(dirname $0)/../include.rc
4
. $(dirname $0)/../volume.rc
5
. $(dirname $0)/../nfs.rc
6
. $(dirname $0)/../fileio.rc
7

8
#G_TESTDEF_TEST_STATUS_CENTOS6=NFS_TEST
9

10
cleanup;
11

12
TESTS_EXPECTED_IN_LOOP=16
13
TEST glusterd
14
TEST pidof glusterd
15
TEST $CLI volume info;
16

17
TEST $CLI volume create $V0 $H0:$B0/brick1;
18
EXPECT 'Created' volinfo_field $V0 'Status';
19
TEST $CLI volume set $V0 nfs.disable false
20

21
# The test makes use of inode-lru-limit to hit a scenario, where we
22
# find an inode whose ancestry is not there. Following is the
23
# hypothesis (which is confirmed by seeing logs indicating that
24
# codepath has been executed, but not through a good understanding of
25
# NFS internals).
26

27
#     At the end of an fop, the reference count of an inode would be
28
#     zero. The inode (and its ancestry) persists in memory only
29
#     because of non-zero lookup count. These looked up inodes are put
30
#     in an lru queue of size 1 (here). So, there can be at most one
31
#     such inode in memory.
32

33
#     NFS Server makes use of anonymous fds. So, if it cannot find
34
#     valid fd, it does a nameless lookup. This gives us an inode
35
#     whose ancestry is NULL. When a write happens on this inode,
36
#     quota-enforcer/marker finds a NULL ancestry and asks
37
#     storage/posix to build it.
38

39
TEST $CLI volume set $V0 network.inode-lru-limit 1
40
TEST $CLI volume set $V0 performance.nfs.write-behind off
41

42
TEST $CLI volume start $V0;
43
EXPECT 'Started' volinfo_field $V0 'Status';
44

45
## Enable bitrot
46
TEST $CLI volume bitrot $V0 enable;
47

48
## Wait for gluster nfs to come up
49
EXPECT_WITHIN $NFS_EXPORT_TIMEOUT "1" is_nfs_export_available
50

51
TEST mount_nfs $H0:/$V0 $N0;
52
deep=/0/1/2/3/4/5/6/7/8/9
53
TEST mkdir -p $N0/$deep
54

55
TEST touch $N0/$deep/file1 $N0/$deep/file2 $N0/$deep/file3 $N0/$deep/file4
56

57
TEST fd_open 3 'w' "$N0/$deep/file1"
58
TEST fd_open 4 'w' "$N0/$deep/file2"
59
TEST fd_open 5 'w' "$N0/$deep/file3"
60
TEST fd_open 6 'w' "$N0/$deep/file4"
61

62
# consume all quota
63
echo "Hello" > $N0/$deep/new_file_1
64
echo "World" >> $N0/$deep/new_file_1
65
echo 1 >> $N0/$deep/new_file_1
66
echo 2 >> $N0/$deep/new_file_1
67

68

69
# At the end of each fop in server, reference count of the
70
# inode associated with each of the file above drops to zero and hence
71
# put into lru queue. Since lru-limit is set to 1, an fop next file
72
# will displace the current inode from itable. This will ensure that
73
# when writes happens on same fd, fd resolution results in
74
# nameless lookup from server and encounters an fd
75
# associated with an inode whose parent is not present in itable.
76

77
for j in $(seq 1 2); do
78
    for i in $(seq 3 6); do
79
        TEST_IN_LOOP fd_write $i "content"
80
        TEST_IN_LOOP sync
81
    done
82
done
83

84
exec 3>&-
85
exec 4>&-
86
exec 5>&-
87
exec 6>&-
88

89
$CLI volume statedump $V0 all
90

91
EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $N0
92

93
TEST $CLI volume stop $V0
94

95
cleanup;
96

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.