Gentoo Archives: gentoo-commits

From: Alexys Jacob <ultrabug@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-cluster/glusterfs/files/, sys-cluster/glusterfs/
Date: Sun, 19 Jan 2020 09:47:18
Message-Id: 1579427074.d1dc56b8af7550ce3d2b4ceb1419cf9ab7d9276f.ultrabug@gentoo
1 commit: d1dc56b8af7550ce3d2b4ceb1419cf9ab7d9276f
2 Author: Tomáš Mózes <hydrapolic <AT> gmail <DOT> com>
3 AuthorDate: Sat Jan 18 05:32:11 2020 +0000
4 Commit: Alexys Jacob <ultrabug <AT> gentoo <DOT> org>
5 CommitDate: Sun Jan 19 09:44:34 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d1dc56b8
7
8 sys-cluster/glusterfs: bump to 6.7, drop old
9
10 Closes: https://bugs.gentoo.org/705396
11 Signed-off-by: Tomáš Mózes <hydrapolic <AT> gmail.com>
12 Closes: https://github.com/gentoo/gentoo/pull/14373
13 Signed-off-by: Alexys Jacob <ultrabug <AT> gentoo.org>
14
15 sys-cluster/glusterfs/Manifest | 2 +-
16 .../files/glusterfs-6.7-fix-rebalance-crash.patch | 185 +++++++++++++++++++++
17 .../{glusterfs-6.1.ebuild => glusterfs-6.7.ebuild} | 5 +-
18 3 files changed, 190 insertions(+), 2 deletions(-)
19
20 diff --git a/sys-cluster/glusterfs/Manifest b/sys-cluster/glusterfs/Manifest
21 index 7467705eeaf..3e30ba37cb9 100644
22 --- a/sys-cluster/glusterfs/Manifest
23 +++ b/sys-cluster/glusterfs/Manifest
24 @@ -1,3 +1,3 @@
25 DIST glusterfs-4.1.8.tar.gz 7835272 BLAKE2B 2546b9c0fe38989df71b8f72b193ce42c499621dcaaa4c5e3deeacfba68179f2280fc699cebeb87486171442152fa8b56b42a0d17465b739769eb227c82307d7 SHA512 950cd2fd774e3eb00f1ec06d54566736b6fbe8d1aed54477a19d9b2727eff8a70ef7ac32815cc7e01d45b5d357fc01af786e16c451f6ad314d472e61ba04ce85
26 -DIST glusterfs-6.1.tar.gz 7510074 BLAKE2B 8002597f8f695d11578be250cafb3f32358ac29d873b27f87bb26edd38b64d896050322d9591b156793fe6ee7af111904961d5a3e7a933f7c5176cf0c6793305 SHA512 53f4195ecb565a8dcc0d66e74d07dd7334e3c8b1cc1671517612be32a00e9e9bbfb5e983955c4f116b25f7df990bcd1c05bbd3d0b740e9f8c76a16b9b16bec00
27 DIST glusterfs-6.5.tar.gz 7536238 BLAKE2B 35c58da9e8564bda1f34b095f14316148cae2b5ff1820d22ae945a06d34ac57aea968e5914af3f5831250fd591a103fe4022e160bb96d491a7c915b5b68c54e7 SHA512 b7356de07e8126aea80b0489b9ac39ce0d10ea324fe38d05ff5740765e886f80fc7e6bdda9d4db1371d7b955b055cb76ea29e918e759a575db331a6436bad90f
28 +DIST glusterfs-6.7.tar.gz 7565257 BLAKE2B bb38383cad0cbf890b89dd75f7b260d21b381aed6da0bf7cf7b3335941d8e195fe5ff60a1c882df941daeb8ad627fddd1a44223c62d71e2388fd85a7ea46a386 SHA512 64d576c91e5accdb3547dc7216d854e96512c9035ddb87dc4018930f2b0a008ad929cd80ae89a340fca7a8d36e2106a30797d7b08768477b1415db95123e07d4
29
30 diff --git a/sys-cluster/glusterfs/files/glusterfs-6.7-fix-rebalance-crash.patch b/sys-cluster/glusterfs/files/glusterfs-6.7-fix-rebalance-crash.patch
31 new file mode 100644
32 index 00000000000..e5a31623a32
33 --- /dev/null
34 +++ b/sys-cluster/glusterfs/files/glusterfs-6.7-fix-rebalance-crash.patch
35 @@ -0,0 +1,185 @@
36 +From ff1eae7f882b8f12380e0c35a9a73b672583cd4c Mon Sep 17 00:00:00 2001
37 +From: N Balachandran <nbalacha@××××××.com>
38 +Date: Tue, 01 Oct 2019 17:37:15 +0530
39 +Subject: [PATCH] cluster/dht: Correct fd processing loop
40 +
41 +The fd processing loops in the
42 +dht_migration_complete_check_task and the
43 +dht_rebalance_inprogress_task functions were unsafe
44 +and could cause an open to be sent on an already freed
45 +fd. This has been fixed.
46 +
47 +> Change-Id: I0a3c7d2fba314089e03dfd704f9dceb134749540
48 +> Fixes: bz#1757399
49 +> Signed-off-by: N Balachandran <nbalacha@××××××.com>
50 +> (cherry picked from commit 9b15867070b0cc241ab165886292ecffc3bc0aed)
51 +
52 +Change-Id: I0a3c7d2fba314089e03dfd704f9dceb134749540
53 +Fixes: bz#1786983
54 +Signed-off-by: Mohit Agrawal <moagrawa@××××××.com>
55 +---
56 +
57 +diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c
58 +index acad493..4f7370d 100644
59 +--- a/xlators/cluster/dht/src/dht-helper.c
60 ++++ b/xlators/cluster/dht/src/dht-helper.c
61 +@@ -1290,6 +1290,7 @@
62 + fd_t *tmp = NULL;
63 + uint64_t tmp_miginfo = 0;
64 + dht_migrate_info_t *miginfo = NULL;
65 ++ gf_boolean_t skip_open = _gf_false;
66 + int open_failed = 0;
67 +
68 + this = THIS;
69 +@@ -1428,24 +1429,34 @@
70 + * the loop will cause the destruction of the fd. So we need to
71 + * iterate the list safely because iter_fd cannot be trusted.
72 + */
73 +- list_for_each_entry_safe(iter_fd, tmp, &inode->fd_list, inode_list)
74 +- {
75 +- if (fd_is_anonymous(iter_fd))
76 +- continue;
77 +-
78 +- if (dht_fd_open_on_dst(this, iter_fd, dst_node))
79 +- continue;
80 +-
81 ++ iter_fd = list_entry((&inode->fd_list)->next, typeof(*iter_fd), inode_list);
82 ++ while (&iter_fd->inode_list != (&inode->fd_list)) {
83 ++ if (fd_is_anonymous(iter_fd) ||
84 ++ (dht_fd_open_on_dst(this, iter_fd, dst_node))) {
85 ++ if (!tmp) {
86 ++ iter_fd = list_entry(iter_fd->inode_list.next, typeof(*iter_fd),
87 ++ inode_list);
88 ++ continue;
89 ++ }
90 ++ skip_open = _gf_true;
91 ++ }
92 + /* We need to release the inode->lock before calling
93 + * syncop_open() to avoid possible deadlocks. However this
94 + * can cause the iter_fd to be released by other threads.
95 + * To avoid this, we take a reference before releasing the
96 + * lock.
97 + */
98 +- __fd_ref(iter_fd);
99 ++ fd_ref(iter_fd);
100 +
101 + UNLOCK(&inode->lock);
102 +
103 ++ if (tmp) {
104 ++ fd_unref(tmp);
105 ++ tmp = NULL;
106 ++ }
107 ++ if (skip_open)
108 ++ goto next;
109 ++
110 + /* flags for open are stripped down to allow following the
111 + * new location of the file, otherwise we can get EEXIST or
112 + * truncate the file again as rebalance is moving the data */
113 +@@ -1467,9 +1478,11 @@
114 + dht_fd_ctx_set(this, iter_fd, dst_node);
115 + }
116 +
117 +- fd_unref(iter_fd);
118 +-
119 ++ next:
120 + LOCK(&inode->lock);
121 ++ skip_open = _gf_false;
122 ++ tmp = iter_fd;
123 ++ iter_fd = list_entry(tmp->inode_list.next, typeof(*tmp), inode_list);
124 + }
125 +
126 + SYNCTASK_SETID(frame->root->uid, frame->root->gid);
127 +@@ -1482,6 +1495,10 @@
128 +
129 + unlock:
130 + UNLOCK(&inode->lock);
131 ++ if (tmp) {
132 ++ fd_unref(tmp);
133 ++ tmp = NULL;
134 ++ }
135 +
136 + out:
137 + if (dict) {
138 +@@ -1563,6 +1580,7 @@
139 + int open_failed = 0;
140 + uint64_t tmp_miginfo = 0;
141 + dht_migrate_info_t *miginfo = NULL;
142 ++ gf_boolean_t skip_open = _gf_false;
143 +
144 + this = THIS;
145 + frame = data;
146 +@@ -1683,24 +1701,40 @@
147 + * the loop will cause the destruction of the fd. So we need to
148 + * iterate the list safely because iter_fd cannot be trusted.
149 + */
150 +- list_for_each_entry_safe(iter_fd, tmp, &inode->fd_list, inode_list)
151 +- {
152 +- if (fd_is_anonymous(iter_fd))
153 +- continue;
154 +-
155 +- if (dht_fd_open_on_dst(this, iter_fd, dst_node))
156 +- continue;
157 +-
158 ++ iter_fd = list_entry((&inode->fd_list)->next, typeof(*iter_fd), inode_list);
159 ++ while (&iter_fd->inode_list != (&inode->fd_list)) {
160 + /* We need to release the inode->lock before calling
161 + * syncop_open() to avoid possible deadlocks. However this
162 + * can cause the iter_fd to be released by other threads.
163 + * To avoid this, we take a reference before releasing the
164 + * lock.
165 + */
166 +- __fd_ref(iter_fd);
167 +
168 ++ if (fd_is_anonymous(iter_fd) ||
169 ++ (dht_fd_open_on_dst(this, iter_fd, dst_node))) {
170 ++ if (!tmp) {
171 ++ iter_fd = list_entry(iter_fd->inode_list.next, typeof(*iter_fd),
172 ++ inode_list);
173 ++ continue;
174 ++ }
175 ++ skip_open = _gf_true;
176 ++ }
177 ++
178 ++ /* Yes, this is ugly but there isn't a cleaner way to do this
179 ++ * the fd_ref is an atomic increment so not too bad. We want to
180 ++ * reduce the number of inode locks and unlocks.
181 ++ */
182 ++
183 ++ fd_ref(iter_fd);
184 + UNLOCK(&inode->lock);
185 +
186 ++ if (tmp) {
187 ++ fd_unref(tmp);
188 ++ tmp = NULL;
189 ++ }
190 ++ if (skip_open)
191 ++ goto next;
192 ++
193 + /* flags for open are stripped down to allow following the
194 + * new location of the file, otherwise we can get EEXIST or
195 + * truncate the file again as rebalance is moving the data */
196 +@@ -1721,9 +1755,11 @@
197 + dht_fd_ctx_set(this, iter_fd, dst_node);
198 + }
199 +
200 +- fd_unref(iter_fd);
201 +-
202 ++ next:
203 + LOCK(&inode->lock);
204 ++ skip_open = _gf_false;
205 ++ tmp = iter_fd;
206 ++ iter_fd = list_entry(tmp->inode_list.next, typeof(*tmp), inode_list);
207 + }
208 +
209 + SYNCTASK_SETID(frame->root->uid, frame->root->gid);
210 +@@ -1731,6 +1767,10 @@
211 + unlock:
212 + UNLOCK(&inode->lock);
213 +
214 ++ if (tmp) {
215 ++ fd_unref(tmp);
216 ++ tmp = NULL;
217 ++ }
218 + if (open_failed) {
219 + ret = -1;
220 + goto out;
221
222 diff --git a/sys-cluster/glusterfs/glusterfs-6.1.ebuild b/sys-cluster/glusterfs/glusterfs-6.7.ebuild
223 similarity index 97%
224 rename from sys-cluster/glusterfs/glusterfs-6.1.ebuild
225 rename to sys-cluster/glusterfs/glusterfs-6.7.ebuild
226 index 87b3e519ab2..9bb5a61620b 100644
227 --- a/sys-cluster/glusterfs/glusterfs-6.1.ebuild
228 +++ b/sys-cluster/glusterfs/glusterfs-6.7.ebuild
229 @@ -3,7 +3,7 @@
230
231 EAPI=7
232
233 -PYTHON_COMPAT=( python3_{6,7} )
234 +PYTHON_COMPAT=( python3_{6,7,8} )
235
236 inherit autotools elisp-common python-single-r1 systemd user
237
238 @@ -80,6 +80,9 @@ pkg_setup() {
239 src_prepare() {
240 default
241
242 + # https://bugzilla.redhat.com/show_bug.cgi?id=1786983
243 + eapply "${FILESDIR}/glusterfs-6.7-fix-rebalance-crash.patch"
244 +
245 # build rpc-transport and xlators only once as shared libs
246 find rpc/rpc-transport xlators -name Makefile.am |
247 xargs sed -i 's|.*$(top_srcdir).*\.sym|\0 -shared|' || die