File: | xlators/debug/error-gen/src/error-gen.c |
Location: | line 2083, column 9 |
Description: | Access to field 'name' results in a dereference of a null pointer (loaded from variable 'this') |
1 | /* | |||||
2 | Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com> | |||||
3 | This file is part of GlusterFS. | |||||
4 | ||||||
5 | This file is licensed to you under your choice of the GNU Lesser | |||||
6 | General Public License, version 3 or any later version (LGPLv3 or | |||||
7 | later), or the GNU General Public License, version 2 (GPLv2), in all | |||||
8 | cases as published by the Free Software Foundation. | |||||
9 | */ | |||||
10 | #ifndef _CONFIG_H | |||||
11 | #define _CONFIG_H | |||||
12 | #include "config.h" | |||||
13 | #endif | |||||
14 | ||||||
15 | #include "xlator.h" | |||||
16 | #include "error-gen.h" | |||||
17 | #include "statedump.h" | |||||
18 | ||||||
19 | sys_error_t error_no_list[] = { | |||||
20 | [GF_FOP_LOOKUP] = { .error_no_count = 4, | |||||
21 | .error_no = {ENOENT2,ENOTDIR20, | |||||
22 | ENAMETOOLONG36,EAGAIN11}}, | |||||
23 | [GF_FOP_STAT] = { .error_no_count = 7, | |||||
24 | .error_no = {EACCES13,EBADF9,EFAULT14, | |||||
25 | ENAMETOOLONG36,ENOENT2, | |||||
26 | ENOMEM12,ENOTDIR20}}, | |||||
27 | [GF_FOP_READLINK] = { .error_no_count = 8, | |||||
28 | .error_no = {EACCES13,EFAULT14,EINVAL22,EIO5, | |||||
29 | ENAMETOOLONG36,ENOENT2,ENOMEM12, | |||||
30 | ENOTDIR20}}, | |||||
31 | [GF_FOP_MKNOD] = { .error_no_count = 11, | |||||
32 | .error_no = {EACCES13,EEXIST17,EFAULT14, | |||||
33 | EINVAL22,ENAMETOOLONG36, | |||||
34 | ENOENT2,ENOMEM12,ENOSPC28, | |||||
35 | ENOTDIR20,EPERM1,EROFS30}}, | |||||
36 | [GF_FOP_MKDIR] = { .error_no_count = 10, | |||||
37 | .error_no = {EACCES13,EEXIST17,EFAULT14, | |||||
38 | ENAMETOOLONG36,ENOENT2, | |||||
39 | ENOMEM12,ENOSPC28,ENOTDIR20, | |||||
40 | EPERM1,EROFS30}}, | |||||
41 | [GF_FOP_UNLINK] = { .error_no_count = 10, | |||||
42 | .error_no = {EACCES13,EBUSY16,EFAULT14,EIO5, | |||||
43 | EISDIR21,ENAMETOOLONG36, | |||||
44 | ENOENT2,ENOMEM12,ENOTDIR20, | |||||
45 | EPERM1,EROFS30}}, | |||||
46 | [GF_FOP_RMDIR] = { .error_no_count = 8, | |||||
47 | .error_no = {EACCES13,EBUSY16,EFAULT14, | |||||
48 | ENOMEM12,ENOTDIR20,ENOTEMPTY39, | |||||
49 | EPERM1,EROFS30}}, | |||||
50 | [GF_FOP_SYMLINK] = { .error_no_count = 11, | |||||
51 | .error_no = {EACCES13,EEXIST17,EFAULT14,EIO5, | |||||
52 | ENAMETOOLONG36,ENOENT2,ENOMEM12, | |||||
53 | ENOSPC28,ENOTDIR20,EPERM1, | |||||
54 | EROFS30}}, | |||||
55 | [GF_FOP_RENAME] = { .error_no_count = 13, | |||||
56 | .error_no = {EACCES13,EBUSY16,EFAULT14, | |||||
57 | EINVAL22,EISDIR21,EMLINK31, | |||||
58 | ENAMETOOLONG36,ENOENT2,ENOMEM12, | |||||
59 | ENOSPC28,ENOTDIR20,EEXIST17, | |||||
60 | EXDEV18}}, | |||||
61 | [GF_FOP_LINK] = { .error_no_count = 13, | |||||
62 | .error_no = {EACCES13,EFAULT14,EEXIST17,EIO5, | |||||
63 | EMLINK31,ENAMETOOLONG36, | |||||
64 | ENOENT2,ENOMEM12,ENOSPC28, | |||||
65 | ENOTDIR20,EPERM1,EROFS30, | |||||
66 | EXDEV18}}, | |||||
67 | [GF_FOP_TRUNCATE] = { .error_no_count = 10, | |||||
68 | .error_no = {EACCES13,EFAULT14,EFBIG27, | |||||
69 | EINTR4,EINVAL22,EIO5,EISDIR21, | |||||
70 | ENAMETOOLONG36,ENOENT2, | |||||
71 | EISDIR21}}, | |||||
72 | [GF_FOP_CREATE] = {.error_no_count = 10, | |||||
73 | .error_no = {EACCES13,EEXIST17,EFAULT14, | |||||
74 | EISDIR21,EMFILE24,ENAMETOOLONG36, | |||||
75 | ENFILE23,ENODEV19,ENOENT2, | |||||
76 | ENODEV19}}, | |||||
77 | [GF_FOP_OPEN] = { .error_no_count = 10, | |||||
78 | .error_no = {EACCES13,EEXIST17,EFAULT14, | |||||
79 | EISDIR21,EMFILE24, | |||||
80 | ENAMETOOLONG36,ENFILE23, | |||||
81 | ENODEV19,ENOENT2,ENOMEM12}}, | |||||
82 | [GF_FOP_READ] = { .error_no_count = 5, | |||||
83 | .error_no = {EINVAL22,EBADF9,EFAULT14,EISDIR21, | |||||
84 | ENAMETOOLONG36}}, | |||||
85 | [GF_FOP_WRITE] = { .error_no_count = 7, | |||||
86 | .error_no = {EINVAL22,EBADF9,EFAULT14,EISDIR21, | |||||
87 | ENAMETOOLONG36,ENOSPC28, | |||||
88 | GF_ERROR_SHORT_WRITE}}, | |||||
89 | [GF_FOP_STATFS] = {.error_no_count = 10, | |||||
90 | .error_no = {EACCES13,EBADF9,EFAULT14,EINTR4, | |||||
91 | EIO5,ENAMETOOLONG36,ENOENT2, | |||||
92 | ENOMEM12,ENOSYS38,ENOTDIR20}}, | |||||
93 | [GF_FOP_FLUSH] = { .error_no_count = 5, | |||||
94 | .error_no = {EACCES13,EFAULT14, | |||||
95 | ENAMETOOLONG36,ENOSYS38, | |||||
96 | ENOENT2}}, | |||||
97 | [GF_FOP_FSYNC] = { .error_no_count = 4, | |||||
98 | .error_no = {EBADF9,EIO5,EROFS30,EINVAL22}}, | |||||
99 | [GF_FOP_SETXATTR] = { .error_no_count = 4, | |||||
100 | .error_no = {EACCES13,EBADF9,EINTR4, | |||||
101 | ENAMETOOLONG36}}, | |||||
102 | [GF_FOP_GETXATTR] = { .error_no_count = 4, | |||||
103 | .error_no = {EACCES13,EBADF9,ENAMETOOLONG36, | |||||
104 | EINTR4}}, | |||||
105 | [GF_FOP_REMOVEXATTR] = { .error_no_count = 4, | |||||
106 | .error_no = {EACCES13,EBADF9,ENAMETOOLONG36, | |||||
107 | EINTR4}}, | |||||
108 | [GF_FOP_FSETXATTR] = { .error_no_count = 4, | |||||
109 | .error_no = {EACCES13,EBADF9,EINTR4, | |||||
110 | ENAMETOOLONG36}}, | |||||
111 | [GF_FOP_FGETXATTR] = { .error_no_count = 4, | |||||
112 | .error_no = {EACCES13,EBADF9,ENAMETOOLONG36, | |||||
113 | EINTR4}}, | |||||
114 | [GF_FOP_FREMOVEXATTR] = { .error_no_count = 4, | |||||
115 | .error_no = {EACCES13,EBADF9,ENAMETOOLONG36, | |||||
116 | EINTR4}}, | |||||
117 | [GF_FOP_OPENDIR] = { .error_no_count = 8, | |||||
118 | .error_no = {EACCES13,EEXIST17,EFAULT14, | |||||
119 | EISDIR21,EMFILE24, | |||||
120 | ENAMETOOLONG36,ENFILE23, | |||||
121 | ENODEV19}}, | |||||
122 | [GF_FOP_READDIR] = { .error_no_count = 5, | |||||
123 | .error_no = {EINVAL22,EACCES13,EBADF9, | |||||
124 | EMFILE24,ENOENT2}}, | |||||
125 | [GF_FOP_READDIRP] = { .error_no_count = 5, | |||||
126 | .error_no = {EINVAL22,EACCES13,EBADF9, | |||||
127 | EMFILE24,ENOENT2}}, | |||||
128 | [GF_FOP_FSYNCDIR] = { .error_no_count = 4, | |||||
129 | .error_no = {EBADF9,EIO5,EROFS30,EINVAL22}}, | |||||
130 | [GF_FOP_ACCESS] = { .error_no_count = 8, | |||||
131 | .error_no = {EACCES13,ENAMETOOLONG36, | |||||
132 | ENOENT2,ENOTDIR20,EROFS30, | |||||
133 | EFAULT14,EINVAL22,EIO5}}, | |||||
134 | [GF_FOP_FTRUNCATE] = { .error_no_count = 9, | |||||
135 | .error_no = {EACCES13,EFAULT14,EFBIG27, | |||||
136 | EINTR4,EINVAL22,EIO5,EISDIR21, | |||||
137 | ENAMETOOLONG36,ENOENT2}}, | |||||
138 | [GF_FOP_FSTAT] = { .error_no_count = 7, | |||||
139 | .error_no = {EACCES13,EBADF9,EFAULT14, | |||||
140 | ENAMETOOLONG36,ENOENT2, | |||||
141 | ENOMEM12,ENOTDIR20}}, | |||||
142 | [GF_FOP_LK] = { .error_no_count = 4, | |||||
143 | .error_no = {EACCES13,EFAULT14,ENOENT2, | |||||
144 | EINTR4}}, | |||||
145 | [GF_FOP_XATTROP] = { .error_no_count = 5, | |||||
146 | .error_no = {EACCES13,EFAULT14, | |||||
147 | ENAMETOOLONG36,ENOSYS38, | |||||
148 | ENOENT2}}, | |||||
149 | [GF_FOP_FXATTROP] = { .error_no_count = 4, | |||||
150 | .error_no = {EBADF9,EIO5,EROFS30,EINVAL22}}, | |||||
151 | [GF_FOP_INODELK] = { .error_no_count = 4, | |||||
152 | .error_no = {EACCES13,EBADF9,EINTR4, | |||||
153 | ENAMETOOLONG36}}, | |||||
154 | [GF_FOP_FINODELK] = { .error_no_count = 4, | |||||
155 | .error_no = {EACCES13,EBADF9,EINTR4, | |||||
156 | ENAMETOOLONG36}}, | |||||
157 | [GF_FOP_ENTRYLK] = { .error_no_count = 4, | |||||
158 | .error_no = {EACCES13,EBADF9, | |||||
159 | ENAMETOOLONG36,EINTR4}}, | |||||
160 | [GF_FOP_FENTRYLK] = { .error_no_count = 10, | |||||
161 | .error_no = {EACCES13,EEXIST17,EFAULT14, | |||||
162 | EISDIR21,EMFILE24, | |||||
163 | ENAMETOOLONG36,ENFILE23, | |||||
164 | ENODEV19,ENOENT2,ENOMEM12}}, | |||||
165 | [GF_FOP_SETATTR] = {.error_no_count = 11, | |||||
166 | .error_no = {EACCES13,EFAULT14,EIO5, | |||||
167 | ENAMETOOLONG36,ENOENT2, | |||||
168 | ENOMEM12,ENOTDIR20,EPERM1, | |||||
169 | EROFS30,EBADF9,EIO5}}, | |||||
170 | [GF_FOP_FSETATTR] = { .error_no_count = 11, | |||||
171 | .error_no = {EACCES13,EFAULT14,EIO5, | |||||
172 | ENAMETOOLONG36,ENOENT2, | |||||
173 | ENOMEM12,ENOTDIR20,EPERM1, | |||||
174 | EROFS30,EBADF9,EIO5}}, | |||||
175 | [GF_FOP_GETSPEC] = { .error_no_count = 4, | |||||
176 | .error_no = {EACCES13,EBADF9,ENAMETOOLONG36, | |||||
177 | EINTR4}} | |||||
178 | }; | |||||
179 | ||||||
180 | int | |||||
181 | generate_rand_no (int op_no) | |||||
182 | { | |||||
183 | int rand_no = 0; | |||||
184 | ||||||
185 | if (op_no < GF_FOP_MAXVALUE) | |||||
186 | rand_no = rand () % error_no_list[op_no].error_no_count; | |||||
187 | return rand_no; | |||||
188 | } | |||||
189 | ||||||
190 | int | |||||
191 | conv_errno_to_int (char **error_no) | |||||
192 | { | |||||
193 | if (!strcmp ((*error_no), "ENOENT")) | |||||
194 | return ENOENT2; | |||||
195 | else if (!strcmp ((*error_no), "ENOTDIR")) | |||||
196 | return ENOTDIR20; | |||||
197 | else if (!strcmp ((*error_no), "ENAMETOOLONG")) | |||||
198 | return ENAMETOOLONG36; | |||||
199 | else if (!strcmp ((*error_no), "EACCES")) | |||||
200 | return EACCES13; | |||||
201 | else if (!strcmp ((*error_no), "EBADF")) | |||||
202 | return EBADF9; | |||||
203 | else if (!strcmp ((*error_no), "EFAULT")) | |||||
204 | return EFAULT14; | |||||
205 | else if (!strcmp ((*error_no), "ENOMEM")) | |||||
206 | return ENOMEM12; | |||||
207 | else if (!strcmp ((*error_no), "EINVAL")) | |||||
208 | return EINVAL22; | |||||
209 | else if (!strcmp ((*error_no), "EIO")) | |||||
210 | return EIO5; | |||||
211 | else if (!strcmp ((*error_no), "EEXIST")) | |||||
212 | return EEXIST17; | |||||
213 | else if (!strcmp ((*error_no), "ENOSPC")) | |||||
214 | return ENOSPC28; | |||||
215 | else if (!strcmp ((*error_no), "EPERM")) | |||||
216 | return EPERM1; | |||||
217 | else if (!strcmp ((*error_no), "EROFS")) | |||||
218 | return EROFS30; | |||||
219 | else if (!strcmp ((*error_no), "EBUSY")) | |||||
220 | return EBUSY16; | |||||
221 | else if (!strcmp ((*error_no), "EISDIR")) | |||||
222 | return EISDIR21; | |||||
223 | else if (!strcmp ((*error_no), "ENOTEMPTY")) | |||||
224 | return ENOTEMPTY39; | |||||
225 | else if (!strcmp ((*error_no), "EMLINK")) | |||||
226 | return EMLINK31; | |||||
227 | else if (!strcmp ((*error_no), "ENODEV")) | |||||
228 | return ENODEV19; | |||||
229 | else if (!strcmp ((*error_no), "EXDEV")) | |||||
230 | return EXDEV18; | |||||
231 | else if (!strcmp ((*error_no), "EMFILE")) | |||||
232 | return EMFILE24; | |||||
233 | else if (!strcmp ((*error_no), "ENFILE")) | |||||
234 | return ENFILE23; | |||||
235 | else if (!strcmp ((*error_no), "ENOSYS")) | |||||
236 | return ENOSYS38; | |||||
237 | else if (!strcmp ((*error_no), "EINTR")) | |||||
238 | return EINTR4; | |||||
239 | else if (!strcmp ((*error_no), "EFBIG")) | |||||
240 | return EFBIG27; | |||||
241 | else if (!strcmp((*error_no), "GF_ERROR_SHORT_WRITE")) | |||||
242 | return GF_ERROR_SHORT_WRITE; | |||||
243 | else | |||||
244 | return EAGAIN11; | |||||
245 | } | |||||
246 | ||||||
247 | int | |||||
248 | get_fop_int (char **op_no_str) | |||||
249 | { | |||||
250 | if (!strcmp ((*op_no_str), "lookup")) | |||||
251 | return GF_FOP_LOOKUP; | |||||
252 | else if (!strcmp ((*op_no_str), "stat")) | |||||
253 | return GF_FOP_STAT; | |||||
254 | else if (!strcmp ((*op_no_str), "readlink")) | |||||
255 | return GF_FOP_READLINK; | |||||
256 | else if (!strcmp ((*op_no_str), "mknod")) | |||||
257 | return GF_FOP_MKNOD; | |||||
258 | else if (!strcmp ((*op_no_str), "mkdir")) | |||||
259 | return GF_FOP_MKDIR; | |||||
260 | else if (!strcmp ((*op_no_str), "unlink")) | |||||
261 | return GF_FOP_UNLINK; | |||||
262 | else if (!strcmp ((*op_no_str), "rmdir")) | |||||
263 | return GF_FOP_RMDIR; | |||||
264 | else if (!strcmp ((*op_no_str), "symlink")) | |||||
265 | return GF_FOP_SYMLINK; | |||||
266 | else if (!strcmp ((*op_no_str), "rename")) | |||||
267 | return GF_FOP_RENAME; | |||||
268 | else if (!strcmp ((*op_no_str), "link")) | |||||
269 | return GF_FOP_LINK; | |||||
270 | else if (!strcmp ((*op_no_str), "truncate")) | |||||
271 | return GF_FOP_TRUNCATE; | |||||
272 | else if (!strcmp ((*op_no_str), "create")) | |||||
273 | return GF_FOP_CREATE; | |||||
274 | else if (!strcmp ((*op_no_str), "open")) | |||||
275 | return GF_FOP_OPEN; | |||||
276 | else if (!strcmp ((*op_no_str), "readv")) | |||||
277 | return GF_FOP_READ; | |||||
278 | else if (!strcmp ((*op_no_str), "writev")) | |||||
279 | return GF_FOP_WRITE; | |||||
280 | else if (!strcmp ((*op_no_str), "statfs")) | |||||
281 | return GF_FOP_STATFS; | |||||
282 | else if (!strcmp ((*op_no_str), "flush")) | |||||
283 | return GF_FOP_FLUSH; | |||||
284 | else if (!strcmp ((*op_no_str), "fsync")) | |||||
285 | return GF_FOP_FSYNC; | |||||
286 | else if (!strcmp ((*op_no_str), "setxattr")) | |||||
287 | return GF_FOP_SETXATTR; | |||||
288 | else if (!strcmp ((*op_no_str), "getxattr")) | |||||
289 | return GF_FOP_GETXATTR; | |||||
290 | else if (!strcmp ((*op_no_str), "removexattr")) | |||||
291 | return GF_FOP_REMOVEXATTR; | |||||
292 | else if (!strcmp ((*op_no_str), "fsetxattr")) | |||||
293 | return GF_FOP_FSETXATTR; | |||||
294 | else if (!strcmp ((*op_no_str), "fgetxattr")) | |||||
295 | return GF_FOP_FGETXATTR; | |||||
296 | else if (!strcmp ((*op_no_str), "fremovexattr")) | |||||
297 | return GF_FOP_FREMOVEXATTR; | |||||
298 | else if (!strcmp ((*op_no_str), "opendir")) | |||||
299 | return GF_FOP_OPENDIR; | |||||
300 | else if (!strcmp ((*op_no_str), "readdir")) | |||||
301 | return GF_FOP_READDIR; | |||||
302 | else if (!strcmp ((*op_no_str), "readdirp")) | |||||
303 | return GF_FOP_READDIRP; | |||||
304 | else if (!strcmp ((*op_no_str), "fsyncdir")) | |||||
305 | return GF_FOP_FSYNCDIR; | |||||
306 | else if (!strcmp ((*op_no_str), "access")) | |||||
307 | return GF_FOP_ACCESS; | |||||
308 | else if (!strcmp ((*op_no_str), "ftruncate")) | |||||
309 | return GF_FOP_FTRUNCATE; | |||||
310 | else if (!strcmp ((*op_no_str), "fstat")) | |||||
311 | return GF_FOP_FSTAT; | |||||
312 | else if (!strcmp ((*op_no_str), "lk")) | |||||
313 | return GF_FOP_LK; | |||||
314 | else if (!strcmp ((*op_no_str), "xattrop")) | |||||
315 | return GF_FOP_XATTROP; | |||||
316 | else if (!strcmp ((*op_no_str), "fxattrop")) | |||||
317 | return GF_FOP_FXATTROP; | |||||
318 | else if (!strcmp ((*op_no_str), "inodelk")) | |||||
319 | return GF_FOP_INODELK; | |||||
320 | else if (!strcmp ((*op_no_str), "finodelk")) | |||||
321 | return GF_FOP_FINODELK; | |||||
322 | else if (!strcmp ((*op_no_str), "etrylk")) | |||||
323 | return GF_FOP_ENTRYLK; | |||||
324 | else if (!strcmp ((*op_no_str), "fentrylk")) | |||||
325 | return GF_FOP_FENTRYLK; | |||||
326 | else if (!strcmp ((*op_no_str), "setattr")) | |||||
327 | return GF_FOP_SETATTR; | |||||
328 | else if (!strcmp ((*op_no_str), "fsetattr")) | |||||
329 | return GF_FOP_FSETATTR; | |||||
330 | else if (!strcmp ((*op_no_str), "getspec")) | |||||
331 | return GF_FOP_GETSPEC; | |||||
332 | else | |||||
333 | return -1; | |||||
334 | } | |||||
335 | ||||||
336 | int | |||||
337 | error_gen (xlator_t *this, int op_no) | |||||
338 | { | |||||
339 | eg_t *egp = NULL((void*)0); | |||||
340 | int count = 0; | |||||
341 | int failure_iter_no = GF_FAILURE_DEFAULT10; | |||||
342 | char *error_no = NULL((void*)0); | |||||
343 | int rand_no = 0; | |||||
344 | int ret = 0; | |||||
345 | ||||||
346 | egp = this->private; | |||||
347 | ||||||
348 | LOCK (&egp->lock)pthread_spin_lock (&egp->lock); | |||||
349 | { | |||||
350 | count = ++egp->op_count; | |||||
351 | failure_iter_no = egp->failure_iter_no; | |||||
352 | error_no = egp->error_no; | |||||
353 | } | |||||
354 | UNLOCK (&egp->lock)pthread_spin_unlock (&egp->lock); | |||||
355 | ||||||
356 | if((count % failure_iter_no) == 0) { | |||||
357 | LOCK (&egp->lock)pthread_spin_lock (&egp->lock); | |||||
358 | { | |||||
359 | egp->op_count = 0; | |||||
360 | } | |||||
361 | UNLOCK (&egp->lock)pthread_spin_unlock (&egp->lock); | |||||
362 | ||||||
363 | if (error_no) | |||||
364 | ret = conv_errno_to_int (&error_no); | |||||
365 | else { | |||||
366 | ||||||
367 | rand_no = generate_rand_no (op_no); | |||||
368 | if (op_no >= GF_FOP_MAXVALUE) | |||||
369 | op_no = 0; | |||||
370 | if (rand_no >= error_no_list[op_no].error_no_count) | |||||
371 | rand_no = 0; | |||||
372 | ret = error_no_list[op_no].error_no[rand_no]; | |||||
373 | } | |||||
374 | if (egp->random_failure == _gf_true) | |||||
375 | egp->failure_iter_no = 3 + (rand () % GF_UNIVERSAL_ANSWER42); | |||||
376 | } | |||||
377 | return ret; | |||||
378 | } | |||||
379 | ||||||
380 | ||||||
381 | int | |||||
382 | error_gen_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
383 | int32_t op_ret, int32_t op_errno, inode_t *inode, | |||||
384 | struct iatt *buf, dict_t *xdata, struct iatt *postparent) | |||||
385 | { | |||||
386 | STACK_UNWIND_STRICT (lookup, frame, op_ret, op_errno, inode,do { fop_lookup_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 387, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_lookup_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, xdata, postparent); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
387 | buf, xdata, postparent)do { fop_lookup_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 387, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_lookup_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, xdata, postparent); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
388 | return 0; | |||||
389 | } | |||||
390 | ||||||
391 | ||||||
392 | int | |||||
393 | error_gen_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, | |||||
394 | dict_t *xdata) | |||||
395 | { | |||||
396 | int op_errno = 0; | |||||
397 | eg_t *egp = NULL((void*)0); | |||||
398 | int enable = 1; | |||||
399 | ||||||
400 | egp = this->private; | |||||
401 | enable = egp->enable[GF_FOP_LOOKUP]; | |||||
402 | ||||||
403 | if (enable) | |||||
404 | op_errno = error_gen (this, GF_FOP_LOOKUP); | |||||
405 | ||||||
406 | if (op_errno) { | |||||
407 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 407, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
408 | STACK_UNWIND_STRICT (lookup, frame, -1, op_errno, NULL, NULL, NULL,do { fop_lookup_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 409, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_lookup_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0)); ( *__glusterfs_this_location()) = old_THIS; } while (0) | |||||
409 | NULL)do { fop_lookup_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 409, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_lookup_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0)); ( *__glusterfs_this_location()) = old_THIS; } while (0); | |||||
410 | return 0; | |||||
411 | } | |||||
412 | ||||||
413 | STACK_WIND (frame, error_gen_lookup_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 416, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->lookup_cbk) tmp_cbk = error_gen_lookup_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->lookup"; _new->unwind_to = "error_gen_lookup_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->lookup); (this->children->xlator )->fops->lookup (_new, (this->children->xlator), loc , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||||
414 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 416, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->lookup_cbk) tmp_cbk = error_gen_lookup_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->lookup"; _new->unwind_to = "error_gen_lookup_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->lookup); (this->children->xlator )->fops->lookup (_new, (this->children->xlator), loc , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||||
415 | FIRST_CHILD(this)->fops->lookup,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 416, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->lookup_cbk) tmp_cbk = error_gen_lookup_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->lookup"; _new->unwind_to = "error_gen_lookup_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->lookup); (this->children->xlator )->fops->lookup (_new, (this->children->xlator), loc , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||||
416 | loc, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 416, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->lookup_cbk) tmp_cbk = error_gen_lookup_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->lookup"; _new->unwind_to = "error_gen_lookup_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->lookup); (this->children->xlator )->fops->lookup (_new, (this->children->xlator), loc , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0); | |||||
417 | return 0; | |||||
418 | } | |||||
419 | ||||||
420 | ||||||
421 | int | |||||
422 | error_gen_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
423 | int32_t op_ret, int32_t op_errno, struct iatt *buf, dict_t *xdata) | |||||
424 | { | |||||
425 | STACK_UNWIND_STRICT (stat, frame, op_ret, op_errno, buf, xdata)do { fop_stat_cbk_t fn = ((void*)0); call_frame_t *_parent = ( (void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 425, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_stat_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, buf, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
426 | return 0; | |||||
427 | } | |||||
428 | ||||||
429 | int | |||||
430 | error_gen_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) | |||||
431 | { | |||||
432 | int op_errno = 0; | |||||
433 | eg_t *egp = NULL((void*)0); | |||||
434 | int enable = 1; | |||||
435 | ||||||
436 | egp = this->private; | |||||
437 | enable = egp->enable[GF_FOP_STAT]; | |||||
438 | ||||||
439 | if (enable) | |||||
440 | op_errno = error_gen (this, GF_FOP_STAT); | |||||
441 | ||||||
442 | if (op_errno) { | |||||
443 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 443, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
444 | STACK_UNWIND_STRICT (stat, frame, -1, op_errno, NULL, xdata)do { fop_stat_cbk_t fn = ((void*)0); call_frame_t *_parent = ( (void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 444, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_stat_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); | |||||
445 | return 0; | |||||
446 | } | |||||
447 | ||||||
448 | STACK_WIND (frame, error_gen_stat_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 451, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->stat_cbk) tmp_cbk = error_gen_stat_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->stat"; _new ->unwind_to = "error_gen_stat_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->stat); (this->children->xlator )->fops->stat (_new, (this->children->xlator), loc , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||||
449 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 451, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->stat_cbk) tmp_cbk = error_gen_stat_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->stat"; _new ->unwind_to = "error_gen_stat_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->stat); (this->children->xlator )->fops->stat (_new, (this->children->xlator), loc , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||||
450 | FIRST_CHILD(this)->fops->stat,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 451, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->stat_cbk) tmp_cbk = error_gen_stat_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->stat"; _new ->unwind_to = "error_gen_stat_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->stat); (this->children->xlator )->fops->stat (_new, (this->children->xlator), loc , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||||
451 | loc, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 451, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->stat_cbk) tmp_cbk = error_gen_stat_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->stat"; _new ->unwind_to = "error_gen_stat_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->stat); (this->children->xlator )->fops->stat (_new, (this->children->xlator), loc , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0); | |||||
452 | return 0; | |||||
453 | } | |||||
454 | ||||||
455 | ||||||
456 | int | |||||
457 | error_gen_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
458 | int32_t op_ret, int32_t op_errno, | |||||
459 | struct iatt *preop, struct iatt *postop, dict_t *xdata) | |||||
460 | { | |||||
461 | STACK_UNWIND_STRICT (setattr, frame, op_ret, op_errno, preop, postop, xdata)do { fop_setattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 461, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_setattr_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, preop, postop, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
462 | return 0; | |||||
463 | } | |||||
464 | ||||||
465 | ||||||
466 | int | |||||
467 | error_gen_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, | |||||
468 | struct iatt *stbuf, int32_t valid, dict_t *xdata) | |||||
469 | { | |||||
470 | int op_errno = 0; | |||||
471 | eg_t *egp = NULL((void*)0); | |||||
472 | int enable = 1; | |||||
473 | ||||||
474 | egp = this->private; | |||||
475 | enable = egp->enable[GF_FOP_SETATTR]; | |||||
476 | ||||||
477 | if (enable) | |||||
478 | op_errno = error_gen (this, GF_FOP_SETATTR); | |||||
479 | ||||||
480 | if (op_errno) { | |||||
481 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 481, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
482 | STACK_UNWIND_STRICT (setattr, frame, -1, op_errno, NULL, NULL, xdata)do { fop_setattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 482, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_setattr_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
483 | return 0; | |||||
484 | } | |||||
485 | ||||||
486 | STACK_WIND (frame, error_gen_setattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 489, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setattr_cbk) tmp_cbk = error_gen_setattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->setattr" ; _new->unwind_to = "error_gen_setattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->setattr); (this->children->xlator )->fops->setattr (_new, (this->children->xlator), loc, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
487 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 489, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setattr_cbk) tmp_cbk = error_gen_setattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->setattr" ; _new->unwind_to = "error_gen_setattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->setattr); (this->children->xlator )->fops->setattr (_new, (this->children->xlator), loc, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
488 | FIRST_CHILD(this)->fops->setattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 489, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setattr_cbk) tmp_cbk = error_gen_setattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->setattr" ; _new->unwind_to = "error_gen_setattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->setattr); (this->children->xlator )->fops->setattr (_new, (this->children->xlator), loc, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
489 | loc, stbuf, valid, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 489, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setattr_cbk) tmp_cbk = error_gen_setattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->setattr" ; _new->unwind_to = "error_gen_setattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->setattr); (this->children->xlator )->fops->setattr (_new, (this->children->xlator), loc, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
490 | return 0; | |||||
491 | } | |||||
492 | ||||||
493 | ||||||
494 | int | |||||
495 | error_gen_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, | |||||
496 | struct iatt *stbuf, int32_t valid, dict_t *xdata) | |||||
497 | { | |||||
498 | int op_errno = 0; | |||||
499 | eg_t *egp = NULL((void*)0); | |||||
500 | int enable = 1; | |||||
501 | ||||||
502 | egp = this->private; | |||||
503 | enable = egp->enable[GF_FOP_FSETATTR]; | |||||
504 | ||||||
505 | if (enable) | |||||
506 | op_errno = error_gen (this, GF_FOP_FSETATTR); | |||||
507 | ||||||
508 | if (op_errno) { | |||||
509 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 509, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
510 | STACK_UNWIND_STRICT (fsetattr, frame, -1, op_errno, NULL, NULL, xdata)do { fop_fsetattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 510, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fsetattr_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
511 | return 0; | |||||
512 | } | |||||
513 | ||||||
514 | STACK_WIND (frame, error_gen_setattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 517, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetattr_cbk) tmp_cbk = error_gen_setattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsetattr" ; _new->unwind_to = "error_gen_setattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsetattr); (this->children->xlator )->fops->fsetattr (_new, (this->children->xlator) , fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
515 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 517, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetattr_cbk) tmp_cbk = error_gen_setattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsetattr" ; _new->unwind_to = "error_gen_setattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsetattr); (this->children->xlator )->fops->fsetattr (_new, (this->children->xlator) , fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
516 | FIRST_CHILD(this)->fops->fsetattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 517, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetattr_cbk) tmp_cbk = error_gen_setattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsetattr" ; _new->unwind_to = "error_gen_setattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsetattr); (this->children->xlator )->fops->fsetattr (_new, (this->children->xlator) , fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
517 | fd, stbuf, valid, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 517, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetattr_cbk) tmp_cbk = error_gen_setattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsetattr" ; _new->unwind_to = "error_gen_setattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsetattr); (this->children->xlator )->fops->fsetattr (_new, (this->children->xlator) , fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
518 | return 0; | |||||
519 | } | |||||
520 | ||||||
521 | ||||||
522 | int | |||||
523 | error_gen_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
524 | int32_t op_ret, int32_t op_errno, | |||||
525 | struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata) | |||||
526 | { | |||||
527 | STACK_UNWIND_STRICT (truncate, frame, op_ret, op_errno,do { fop_truncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 528, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_truncate_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
528 | prebuf, postbuf, xdata)do { fop_truncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 528, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_truncate_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
529 | return 0; | |||||
530 | } | |||||
531 | ||||||
532 | ||||||
533 | int | |||||
534 | error_gen_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, | |||||
535 | off_t offset, dict_t *xdata) | |||||
536 | { | |||||
537 | int op_errno = 0; | |||||
538 | eg_t *egp = NULL((void*)0); | |||||
539 | int enable = 1; | |||||
540 | ||||||
541 | egp = this->private; | |||||
542 | enable = egp->enable[GF_FOP_TRUNCATE]; | |||||
543 | ||||||
544 | if (enable) | |||||
545 | op_errno = error_gen (this, GF_FOP_TRUNCATE); | |||||
546 | ||||||
547 | if (op_errno) { | |||||
548 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 548, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
549 | STACK_UNWIND_STRICT (truncate, frame, -1, op_errno,do { fop_truncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 550, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_truncate_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
550 | NULL, NULL, xdata)do { fop_truncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 550, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_truncate_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
551 | return 0; | |||||
552 | } | |||||
553 | ||||||
554 | STACK_WIND (frame, error_gen_truncate_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 557, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->truncate_cbk) tmp_cbk = error_gen_truncate_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->truncate" ; _new->unwind_to = "error_gen_truncate_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->truncate); (this->children->xlator )->fops->truncate (_new, (this->children->xlator) , loc, offset, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
555 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 557, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->truncate_cbk) tmp_cbk = error_gen_truncate_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->truncate" ; _new->unwind_to = "error_gen_truncate_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->truncate); (this->children->xlator )->fops->truncate (_new, (this->children->xlator) , loc, offset, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
556 | FIRST_CHILD(this)->fops->truncate,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 557, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->truncate_cbk) tmp_cbk = error_gen_truncate_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->truncate" ; _new->unwind_to = "error_gen_truncate_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->truncate); (this->children->xlator )->fops->truncate (_new, (this->children->xlator) , loc, offset, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
557 | loc, offset, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 557, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->truncate_cbk) tmp_cbk = error_gen_truncate_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->truncate" ; _new->unwind_to = "error_gen_truncate_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->truncate); (this->children->xlator )->fops->truncate (_new, (this->children->xlator) , loc, offset, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
558 | return 0; | |||||
559 | } | |||||
560 | ||||||
561 | ||||||
562 | int | |||||
563 | error_gen_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
564 | int32_t op_ret, int32_t op_errno, struct iatt *prebuf, | |||||
565 | struct iatt *postbuf, dict_t *xdata) | |||||
566 | { | |||||
567 | STACK_UNWIND_STRICT (ftruncate, frame, op_ret, op_errno,do { fop_ftruncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 568, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_ftruncate_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
568 | prebuf, postbuf, xdata)do { fop_ftruncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 568, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_ftruncate_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
569 | return 0; | |||||
570 | } | |||||
571 | ||||||
572 | ||||||
573 | int | |||||
574 | error_gen_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, | |||||
575 | off_t offset, dict_t *xdata) | |||||
576 | { | |||||
577 | int op_errno = 0; | |||||
578 | eg_t *egp =NULL((void*)0); | |||||
579 | int enable = 1; | |||||
580 | ||||||
581 | egp = this->private; | |||||
582 | enable = egp->enable[GF_FOP_FTRUNCATE]; | |||||
583 | ||||||
584 | if (enable) | |||||
585 | op_errno = error_gen (this, GF_FOP_FTRUNCATE); | |||||
586 | ||||||
587 | if (op_errno) { | |||||
588 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 588, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
589 | STACK_UNWIND_STRICT (ftruncate, frame, -1, op_errno,do { fop_ftruncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 590, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_ftruncate_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
590 | NULL, NULL, xdata)do { fop_ftruncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 590, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_ftruncate_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
591 | return 0; | |||||
592 | } | |||||
593 | ||||||
594 | STACK_WIND (frame, error_gen_ftruncate_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 597, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->ftruncate_cbk) tmp_cbk = error_gen_ftruncate_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->ftruncate" ; _new->unwind_to = "error_gen_ftruncate_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->ftruncate); (this->children-> xlator)->fops->ftruncate (_new, (this->children-> xlator), fd, offset, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
595 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 597, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->ftruncate_cbk) tmp_cbk = error_gen_ftruncate_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->ftruncate" ; _new->unwind_to = "error_gen_ftruncate_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->ftruncate); (this->children-> xlator)->fops->ftruncate (_new, (this->children-> xlator), fd, offset, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
596 | FIRST_CHILD(this)->fops->ftruncate,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 597, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->ftruncate_cbk) tmp_cbk = error_gen_ftruncate_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->ftruncate" ; _new->unwind_to = "error_gen_ftruncate_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->ftruncate); (this->children-> xlator)->fops->ftruncate (_new, (this->children-> xlator), fd, offset, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
597 | fd, offset, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 597, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->ftruncate_cbk) tmp_cbk = error_gen_ftruncate_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->ftruncate" ; _new->unwind_to = "error_gen_ftruncate_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->ftruncate); (this->children-> xlator)->fops->ftruncate (_new, (this->children-> xlator), fd, offset, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||||
598 | return 0; | |||||
599 | } | |||||
600 | ||||||
601 | ||||||
602 | int | |||||
603 | error_gen_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
604 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | |||||
605 | { | |||||
606 | STACK_UNWIND_STRICT (access, frame, op_ret, op_errno, xdata)do { fop_access_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 606, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_access_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
607 | return 0; | |||||
608 | } | |||||
609 | ||||||
610 | ||||||
611 | int | |||||
612 | error_gen_access (call_frame_t *frame, xlator_t *this, loc_t *loc, | |||||
613 | int32_t mask, dict_t *xdata) | |||||
614 | { | |||||
615 | int op_errno = 0; | |||||
616 | eg_t *egp = NULL((void*)0); | |||||
617 | int enable = 1; | |||||
618 | ||||||
619 | egp = this->private; | |||||
620 | enable = egp->enable[GF_FOP_ACCESS]; | |||||
621 | ||||||
622 | if (enable) | |||||
623 | op_errno = error_gen (this, GF_FOP_ACCESS); | |||||
624 | ||||||
625 | if (op_errno) { | |||||
626 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 626, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
627 | STACK_UNWIND_STRICT (access, frame, -1, op_errno, xdata)do { fop_access_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 627, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_access_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
628 | return 0; | |||||
629 | } | |||||
630 | ||||||
631 | STACK_WIND (frame, error_gen_access_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 634, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->access_cbk) tmp_cbk = error_gen_access_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->access"; _new->unwind_to = "error_gen_access_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->access); (this->children->xlator )->fops->access (_new, (this->children->xlator), loc , mask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
632 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 634, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->access_cbk) tmp_cbk = error_gen_access_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->access"; _new->unwind_to = "error_gen_access_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->access); (this->children->xlator )->fops->access (_new, (this->children->xlator), loc , mask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
633 | FIRST_CHILD(this)->fops->access,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 634, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->access_cbk) tmp_cbk = error_gen_access_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->access"; _new->unwind_to = "error_gen_access_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->access); (this->children->xlator )->fops->access (_new, (this->children->xlator), loc , mask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
634 | loc, mask, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 634, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->access_cbk) tmp_cbk = error_gen_access_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->access"; _new->unwind_to = "error_gen_access_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->access); (this->children->xlator )->fops->access (_new, (this->children->xlator), loc , mask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||||
635 | return 0; | |||||
636 | } | |||||
637 | ||||||
638 | ||||||
639 | int | |||||
640 | error_gen_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
641 | int32_t op_ret, int32_t op_errno, | |||||
642 | const char *path, struct iatt *sbuf, dict_t *xdata) | |||||
643 | { | |||||
644 | STACK_UNWIND_STRICT (readlink, frame, op_ret, op_errno, path, sbuf, xdata)do { fop_readlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 644, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_readlink_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, path, sbuf, xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); | |||||
645 | return 0; | |||||
646 | } | |||||
647 | ||||||
648 | ||||||
649 | int | |||||
650 | error_gen_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, | |||||
651 | size_t size, dict_t *xdata) | |||||
652 | { | |||||
653 | int op_errno = 0; | |||||
654 | eg_t *egp = NULL((void*)0); | |||||
655 | int enable = 1; | |||||
656 | ||||||
657 | egp = this->private; | |||||
658 | enable = egp->enable[GF_FOP_READLINK]; | |||||
659 | ||||||
660 | if (enable) | |||||
661 | op_errno = error_gen (this, GF_FOP_READLINK); | |||||
662 | ||||||
663 | if (op_errno) { | |||||
664 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 664, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
665 | STACK_UNWIND_STRICT (readlink, frame, -1, op_errno, NULL, NULL, xdata)do { fop_readlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 665, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_readlink_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
666 | return 0; | |||||
667 | } | |||||
668 | ||||||
669 | STACK_WIND (frame, error_gen_readlink_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 672, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readlink_cbk) tmp_cbk = error_gen_readlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->readlink" ; _new->unwind_to = "error_gen_readlink_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->readlink); (this->children->xlator )->fops->readlink (_new, (this->children->xlator) , loc, size, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
670 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 672, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readlink_cbk) tmp_cbk = error_gen_readlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->readlink" ; _new->unwind_to = "error_gen_readlink_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->readlink); (this->children->xlator )->fops->readlink (_new, (this->children->xlator) , loc, size, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
671 | FIRST_CHILD(this)->fops->readlink,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 672, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readlink_cbk) tmp_cbk = error_gen_readlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->readlink" ; _new->unwind_to = "error_gen_readlink_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->readlink); (this->children->xlator )->fops->readlink (_new, (this->children->xlator) , loc, size, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
672 | loc, size, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 672, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readlink_cbk) tmp_cbk = error_gen_readlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->readlink" ; _new->unwind_to = "error_gen_readlink_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->readlink); (this->children->xlator )->fops->readlink (_new, (this->children->xlator) , loc, size, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
673 | return 0; | |||||
674 | } | |||||
675 | ||||||
676 | ||||||
677 | int | |||||
678 | error_gen_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
679 | int32_t op_ret, int32_t op_errno, inode_t *inode, | |||||
680 | struct iatt *buf, struct iatt *preparent, | |||||
681 | struct iatt *postparent, dict_t *xdata) | |||||
682 | { | |||||
683 | STACK_UNWIND_STRICT (mknod, frame, op_ret, op_errno,do { fop_mknod_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 685, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_mknod_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
684 | inode, buf,do { fop_mknod_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 685, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_mknod_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
685 | preparent, postparent, xdata)do { fop_mknod_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 685, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_mknod_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
686 | return 0; | |||||
687 | } | |||||
688 | ||||||
689 | ||||||
690 | int | |||||
691 | error_gen_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, | |||||
692 | mode_t mode, dev_t rdev, mode_t umask, dict_t *xdata) | |||||
693 | { | |||||
694 | int op_errno = 0; | |||||
695 | eg_t *egp = NULL((void*)0); | |||||
696 | int enable = 1; | |||||
697 | ||||||
698 | egp = this->private; | |||||
699 | enable = egp->enable[GF_FOP_MKNOD]; | |||||
700 | ||||||
701 | if (enable) | |||||
702 | op_errno = error_gen (this, GF_FOP_MKNOD); | |||||
703 | ||||||
704 | if (op_errno) { | |||||
705 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 705, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
706 | STACK_UNWIND_STRICT (mknod, frame, -1, op_errno, NULL, NULL,do { fop_mknod_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 707, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_mknod_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
707 | NULL, NULL, xdata)do { fop_mknod_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 707, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_mknod_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||||
708 | return 0; | |||||
709 | } | |||||
710 | ||||||
711 | STACK_WIND (frame, error_gen_mknod_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 714, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mknod_cbk) tmp_cbk = error_gen_mknod_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->mknod"; _new ->unwind_to = "error_gen_mknod_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->mknod); (this->children->xlator )->fops->mknod (_new, (this->children->xlator), loc , mode, rdev, umask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
712 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 714, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mknod_cbk) tmp_cbk = error_gen_mknod_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->mknod"; _new ->unwind_to = "error_gen_mknod_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->mknod); (this->children->xlator )->fops->mknod (_new, (this->children->xlator), loc , mode, rdev, umask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
713 | FIRST_CHILD(this)->fops->mknod,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 714, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mknod_cbk) tmp_cbk = error_gen_mknod_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->mknod"; _new ->unwind_to = "error_gen_mknod_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->mknod); (this->children->xlator )->fops->mknod (_new, (this->children->xlator), loc , mode, rdev, umask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
714 | loc, mode, rdev, umask, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 714, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mknod_cbk) tmp_cbk = error_gen_mknod_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->mknod"; _new ->unwind_to = "error_gen_mknod_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->mknod); (this->children->xlator )->fops->mknod (_new, (this->children->xlator), loc , mode, rdev, umask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||||
715 | return 0; | |||||
716 | } | |||||
717 | ||||||
718 | ||||||
719 | int | |||||
720 | error_gen_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
721 | int32_t op_ret, int32_t op_errno, inode_t *inode, | |||||
722 | struct iatt *buf, struct iatt *preparent, | |||||
723 | struct iatt *postparent, dict_t *xdata) | |||||
724 | { | |||||
725 | STACK_UNWIND_STRICT (mkdir, frame, op_ret, op_errno,do { fop_mkdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 727, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_mkdir_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
726 | inode, buf,do { fop_mkdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 727, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_mkdir_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
727 | preparent, postparent, xdata)do { fop_mkdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 727, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_mkdir_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
728 | return 0; | |||||
729 | } | |||||
730 | ||||||
731 | int | |||||
732 | error_gen_mkdir (call_frame_t *frame, xlator_t *this, | |||||
733 | loc_t *loc, mode_t mode, mode_t umask, dict_t *xdata) | |||||
734 | { | |||||
735 | int op_errno = 0; | |||||
736 | eg_t *egp = NULL((void*)0); | |||||
737 | int enable = 1; | |||||
738 | ||||||
739 | egp = this->private; | |||||
740 | enable = egp->enable[GF_FOP_MKDIR]; | |||||
741 | ||||||
742 | if (enable) | |||||
743 | op_errno = error_gen (this, GF_FOP_MKDIR); | |||||
744 | ||||||
745 | if (op_errno) { | |||||
746 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 746, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
747 | STACK_UNWIND_STRICT (mkdir, frame, -1, op_errno, NULL, NULL,do { fop_mkdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 748, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_mkdir_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
748 | NULL, NULL, xdata)do { fop_mkdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 748, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_mkdir_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||||
749 | return 0; | |||||
750 | } | |||||
751 | ||||||
752 | STACK_WIND (frame, error_gen_mkdir_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 755, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mkdir_cbk) tmp_cbk = error_gen_mkdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->mkdir"; _new ->unwind_to = "error_gen_mkdir_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->mkdir); (this->children->xlator )->fops->mkdir (_new, (this->children->xlator), loc , mode, umask, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
753 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 755, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mkdir_cbk) tmp_cbk = error_gen_mkdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->mkdir"; _new ->unwind_to = "error_gen_mkdir_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->mkdir); (this->children->xlator )->fops->mkdir (_new, (this->children->xlator), loc , mode, umask, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
754 | FIRST_CHILD(this)->fops->mkdir,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 755, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mkdir_cbk) tmp_cbk = error_gen_mkdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->mkdir"; _new ->unwind_to = "error_gen_mkdir_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->mkdir); (this->children->xlator )->fops->mkdir (_new, (this->children->xlator), loc , mode, umask, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
755 | loc, mode, umask, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 755, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mkdir_cbk) tmp_cbk = error_gen_mkdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->mkdir"; _new ->unwind_to = "error_gen_mkdir_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->mkdir); (this->children->xlator )->fops->mkdir (_new, (this->children->xlator), loc , mode, umask, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
756 | return 0; | |||||
757 | } | |||||
758 | ||||||
759 | ||||||
760 | int | |||||
761 | error_gen_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
762 | int32_t op_ret, int32_t op_errno, | |||||
763 | struct iatt *preparent, struct iatt *postparent, dict_t *xdata) | |||||
764 | { | |||||
765 | STACK_UNWIND_STRICT (unlink, frame, op_ret, op_errno,do { fop_unlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 766, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_unlink_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
766 | preparent, postparent, xdata)do { fop_unlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 766, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_unlink_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
767 | return 0; | |||||
768 | } | |||||
769 | ||||||
770 | ||||||
771 | int | |||||
772 | error_gen_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag, | |||||
773 | dict_t *xdata) | |||||
774 | { | |||||
775 | int op_errno = 0; | |||||
776 | eg_t *egp = NULL((void*)0); | |||||
777 | int enable = 1; | |||||
778 | ||||||
779 | egp = this->private; | |||||
780 | enable = egp->enable[GF_FOP_UNLINK]; | |||||
781 | ||||||
782 | if (enable) | |||||
783 | op_errno = error_gen (this, GF_FOP_UNLINK); | |||||
784 | ||||||
785 | if (op_errno) { | |||||
786 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 786, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
787 | STACK_UNWIND_STRICT (unlink, frame, -1, op_errno, NULL, NULL,do { fop_unlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 788, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_unlink_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
788 | xdata)do { fop_unlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 788, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_unlink_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
789 | return 0; | |||||
790 | } | |||||
791 | ||||||
792 | STACK_WIND (frame, error_gen_unlink_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 795, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->unlink_cbk) tmp_cbk = error_gen_unlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->unlink"; _new->unwind_to = "error_gen_unlink_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->unlink); (this->children->xlator )->fops->unlink (_new, (this->children->xlator), loc , xflag, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
793 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 795, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->unlink_cbk) tmp_cbk = error_gen_unlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->unlink"; _new->unwind_to = "error_gen_unlink_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->unlink); (this->children->xlator )->fops->unlink (_new, (this->children->xlator), loc , xflag, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
794 | FIRST_CHILD(this)->fops->unlink,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 795, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->unlink_cbk) tmp_cbk = error_gen_unlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->unlink"; _new->unwind_to = "error_gen_unlink_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->unlink); (this->children->xlator )->fops->unlink (_new, (this->children->xlator), loc , xflag, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
795 | loc, xflag, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 795, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->unlink_cbk) tmp_cbk = error_gen_unlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->unlink"; _new->unwind_to = "error_gen_unlink_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->unlink); (this->children->xlator )->fops->unlink (_new, (this->children->xlator), loc , xflag, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||||
796 | return 0; | |||||
797 | } | |||||
798 | ||||||
799 | ||||||
800 | int | |||||
801 | error_gen_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
802 | int32_t op_ret, int32_t op_errno, | |||||
803 | struct iatt *preparent, struct iatt *postparent, | |||||
804 | dict_t *xdata) | |||||
805 | { | |||||
806 | STACK_UNWIND_STRICT (rmdir, frame, op_ret, op_errno,do { fop_rmdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 807, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_rmdir_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
807 | preparent, postparent, xdata)do { fop_rmdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 807, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_rmdir_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
808 | return 0; | |||||
809 | } | |||||
810 | ||||||
811 | ||||||
812 | int | |||||
813 | error_gen_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, | |||||
814 | dict_t *xdata) | |||||
815 | { | |||||
816 | int op_errno = 0; | |||||
817 | eg_t *egp = NULL((void*)0); | |||||
818 | int enable = 1; | |||||
819 | ||||||
820 | egp = this->private; | |||||
821 | enable = egp->enable[GF_FOP_RMDIR]; | |||||
822 | ||||||
823 | if (enable) | |||||
824 | op_errno = error_gen (this, GF_FOP_RMDIR); | |||||
825 | ||||||
826 | if (op_errno) { | |||||
827 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 827, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
828 | STACK_UNWIND_STRICT (rmdir, frame, -1, op_errno, NULL, NULL, xdata)do { fop_rmdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 828, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_rmdir_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
829 | return 0; | |||||
830 | } | |||||
831 | ||||||
832 | STACK_WIND (frame, error_gen_rmdir_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 835, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rmdir_cbk) tmp_cbk = error_gen_rmdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->rmdir"; _new ->unwind_to = "error_gen_rmdir_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->rmdir); (this->children->xlator )->fops->rmdir (_new, (this->children->xlator), loc , flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
833 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 835, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rmdir_cbk) tmp_cbk = error_gen_rmdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->rmdir"; _new ->unwind_to = "error_gen_rmdir_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->rmdir); (this->children->xlator )->fops->rmdir (_new, (this->children->xlator), loc , flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
834 | FIRST_CHILD(this)->fops->rmdir,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 835, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rmdir_cbk) tmp_cbk = error_gen_rmdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->rmdir"; _new ->unwind_to = "error_gen_rmdir_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->rmdir); (this->children->xlator )->fops->rmdir (_new, (this->children->xlator), loc , flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
835 | loc, flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 835, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rmdir_cbk) tmp_cbk = error_gen_rmdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->rmdir"; _new ->unwind_to = "error_gen_rmdir_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->rmdir); (this->children->xlator )->fops->rmdir (_new, (this->children->xlator), loc , flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||||
836 | return 0; | |||||
837 | } | |||||
838 | ||||||
839 | ||||||
840 | int | |||||
841 | error_gen_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
842 | int32_t op_ret, int32_t op_errno, inode_t *inode, | |||||
843 | struct iatt *buf, struct iatt *preparent, | |||||
844 | struct iatt *postparent, dict_t *xdata) | |||||
845 | { | |||||
846 | STACK_UNWIND_STRICT (symlink, frame, op_ret, op_errno, inode, buf,do { fop_symlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 847, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_symlink_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
847 | preparent, postparent, xdata)do { fop_symlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 847, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_symlink_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
848 | return 0; | |||||
849 | } | |||||
850 | ||||||
851 | ||||||
852 | int | |||||
853 | error_gen_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, | |||||
854 | loc_t *loc, mode_t umask, dict_t *xdata) | |||||
855 | { | |||||
856 | int op_errno = 0; | |||||
857 | eg_t *egp = NULL((void*)0); | |||||
858 | int enable = 1; | |||||
859 | ||||||
860 | egp = this->private; | |||||
861 | enable = egp->enable[GF_FOP_SYMLINK]; | |||||
862 | ||||||
863 | if (enable) | |||||
864 | op_errno = error_gen (this, GF_FOP_SYMLINK); | |||||
865 | ||||||
866 | if (op_errno) { | |||||
867 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 867, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
868 | STACK_UNWIND_STRICT (symlink, frame, -1, op_errno, NULL, NULL,do { fop_symlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 869, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_symlink_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ( (void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
869 | NULL, NULL, NULL)do { fop_symlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 869, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_symlink_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ( (void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); /* pre & post parent attr */ | |||||
870 | return 0; | |||||
871 | } | |||||
872 | ||||||
873 | STACK_WIND (frame, error_gen_symlink_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 876, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->symlink_cbk) tmp_cbk = error_gen_symlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->symlink" ; _new->unwind_to = "error_gen_symlink_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->symlink); (this->children->xlator )->fops->symlink (_new, (this->children->xlator), linkpath, loc, umask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
874 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 876, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->symlink_cbk) tmp_cbk = error_gen_symlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->symlink" ; _new->unwind_to = "error_gen_symlink_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->symlink); (this->children->xlator )->fops->symlink (_new, (this->children->xlator), linkpath, loc, umask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
875 | FIRST_CHILD(this)->fops->symlink,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 876, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->symlink_cbk) tmp_cbk = error_gen_symlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->symlink" ; _new->unwind_to = "error_gen_symlink_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->symlink); (this->children->xlator )->fops->symlink (_new, (this->children->xlator), linkpath, loc, umask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
876 | linkpath, loc, umask, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 876, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->symlink_cbk) tmp_cbk = error_gen_symlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->symlink" ; _new->unwind_to = "error_gen_symlink_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->symlink); (this->children->xlator )->fops->symlink (_new, (this->children->xlator), linkpath, loc, umask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||||
877 | return 0; | |||||
878 | } | |||||
879 | ||||||
880 | ||||||
881 | int | |||||
882 | error_gen_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
883 | int32_t op_ret, int32_t op_errno, struct iatt *buf, | |||||
884 | struct iatt *preoldparent, struct iatt *postoldparent, | |||||
885 | struct iatt *prenewparent, struct iatt *postnewparent, | |||||
886 | dict_t *xdata) | |||||
887 | { | |||||
888 | STACK_UNWIND_STRICT (rename, frame, op_ret, op_errno, buf,do { fop_rename_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 890, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_rename_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, buf, preoldparent, postoldparent, prenewparent, postnewparent , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||||
889 | preoldparent, postoldparent,do { fop_rename_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 890, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_rename_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, buf, preoldparent, postoldparent, prenewparent, postnewparent , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||||
890 | prenewparent, postnewparent, xdata)do { fop_rename_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 890, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_rename_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, buf, preoldparent, postoldparent, prenewparent, postnewparent , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0); | |||||
891 | return 0; | |||||
892 | } | |||||
893 | ||||||
894 | ||||||
895 | int | |||||
896 | error_gen_rename (call_frame_t *frame, xlator_t *this, | |||||
897 | loc_t *oldloc, loc_t *newloc, dict_t *xdata) | |||||
898 | { | |||||
899 | int op_errno = 0; | |||||
900 | eg_t *egp = NULL((void*)0); | |||||
901 | int enable = 1; | |||||
902 | ||||||
903 | egp = this->private; | |||||
904 | enable = egp->enable[GF_FOP_RENAME]; | |||||
905 | ||||||
906 | if (enable) | |||||
907 | op_errno = error_gen (this, GF_FOP_RENAME); | |||||
908 | ||||||
909 | if (op_errno) { | |||||
910 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 910, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
911 | STACK_UNWIND_STRICT (rename, frame, -1, op_errno, NULL,do { fop_rename_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 912, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_rename_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ( (void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
912 | NULL, NULL, NULL, NULL, NULL)do { fop_rename_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 912, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_rename_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ( (void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
913 | return 0; | |||||
914 | } | |||||
915 | ||||||
916 | STACK_WIND (frame, error_gen_rename_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 919, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rename_cbk) tmp_cbk = error_gen_rename_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->rename"; _new->unwind_to = "error_gen_rename_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->rename); (this->children->xlator )->fops->rename (_new, (this->children->xlator), oldloc , newloc, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
917 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 919, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rename_cbk) tmp_cbk = error_gen_rename_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->rename"; _new->unwind_to = "error_gen_rename_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->rename); (this->children->xlator )->fops->rename (_new, (this->children->xlator), oldloc , newloc, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
918 | FIRST_CHILD(this)->fops->rename,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 919, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rename_cbk) tmp_cbk = error_gen_rename_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->rename"; _new->unwind_to = "error_gen_rename_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->rename); (this->children->xlator )->fops->rename (_new, (this->children->xlator), oldloc , newloc, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
919 | oldloc, newloc, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 919, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rename_cbk) tmp_cbk = error_gen_rename_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->rename"; _new->unwind_to = "error_gen_rename_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->rename); (this->children->xlator )->fops->rename (_new, (this->children->xlator), oldloc , newloc, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||||
920 | return 0; | |||||
921 | } | |||||
922 | ||||||
923 | ||||||
924 | int | |||||
925 | error_gen_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
926 | int32_t op_ret, int32_t op_errno, inode_t *inode, | |||||
927 | struct iatt *buf, struct iatt *preparent, | |||||
928 | struct iatt *postparent, dict_t *xdata) | |||||
929 | { | |||||
930 | STACK_UNWIND_STRICT (link, frame, op_ret, op_errno, inode, buf,do { fop_link_cbk_t fn = ((void*)0); call_frame_t *_parent = ( (void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 931, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_link_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
931 | preparent, postparent, xdata)do { fop_link_cbk_t fn = ((void*)0); call_frame_t *_parent = ( (void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 931, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_link_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
932 | return 0; | |||||
933 | } | |||||
934 | ||||||
935 | ||||||
936 | int | |||||
937 | error_gen_link (call_frame_t *frame, xlator_t *this, | |||||
938 | loc_t *oldloc, loc_t *newloc, dict_t *xdata) | |||||
939 | { | |||||
940 | int op_errno = 0; | |||||
941 | eg_t *egp = NULL((void*)0); | |||||
942 | int enable = 1; | |||||
943 | ||||||
944 | egp = this->private; | |||||
945 | enable = egp->enable[GF_FOP_LINK]; | |||||
946 | ||||||
947 | if (enable) | |||||
948 | op_errno = error_gen (this, GF_FOP_LINK); | |||||
949 | ||||||
950 | if (op_errno) { | |||||
951 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 951, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
952 | STACK_UNWIND_STRICT (link, frame, -1, op_errno, NULL, NULL,do { fop_link_cbk_t fn = ((void*)0); call_frame_t *_parent = ( (void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 953, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_link_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ( (void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
953 | NULL, NULL, NULL)do { fop_link_cbk_t fn = ((void*)0); call_frame_t *_parent = ( (void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 953, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_link_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ( (void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||||
954 | return 0; | |||||
955 | } | |||||
956 | ||||||
957 | STACK_WIND (frame, error_gen_link_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 960, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->link_cbk) tmp_cbk = error_gen_link_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->link"; _new ->unwind_to = "error_gen_link_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->link); (this->children->xlator )->fops->link (_new, (this->children->xlator), oldloc , newloc, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
958 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 960, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->link_cbk) tmp_cbk = error_gen_link_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->link"; _new ->unwind_to = "error_gen_link_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->link); (this->children->xlator )->fops->link (_new, (this->children->xlator), oldloc , newloc, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
959 | FIRST_CHILD(this)->fops->link,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 960, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->link_cbk) tmp_cbk = error_gen_link_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->link"; _new ->unwind_to = "error_gen_link_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->link); (this->children->xlator )->fops->link (_new, (this->children->xlator), oldloc , newloc, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
960 | oldloc, newloc, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 960, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->link_cbk) tmp_cbk = error_gen_link_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->link"; _new ->unwind_to = "error_gen_link_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->link); (this->children->xlator )->fops->link (_new, (this->children->xlator), oldloc , newloc, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||||
961 | return 0; | |||||
962 | } | |||||
963 | ||||||
964 | ||||||
965 | int | |||||
966 | error_gen_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
967 | int32_t op_ret, int32_t op_errno, | |||||
968 | fd_t *fd, inode_t *inode, struct iatt *buf, | |||||
969 | struct iatt *preparent, struct iatt *postparent, dict_t *xdata) | |||||
970 | { | |||||
971 | STACK_UNWIND_STRICT (create, frame, op_ret, op_errno, fd, inode, buf,do { fop_create_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 972, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_create_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, fd, inode, buf, preparent, postparent, xdata); (* __glusterfs_this_location()) = old_THIS; } while (0) | |||||
972 | preparent, postparent, xdata)do { fop_create_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 972, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_create_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, fd, inode, buf, preparent, postparent, xdata); (* __glusterfs_this_location()) = old_THIS; } while (0); | |||||
973 | return 0; | |||||
974 | } | |||||
975 | ||||||
976 | ||||||
977 | int | |||||
978 | error_gen_create (call_frame_t *frame, xlator_t *this, loc_t *loc, | |||||
979 | int32_t flags, mode_t mode, mode_t umask, fd_t *fd, | |||||
980 | dict_t *xdata) | |||||
981 | { | |||||
982 | int op_errno = 0; | |||||
983 | eg_t *egp = NULL((void*)0); | |||||
984 | int enable = 1; | |||||
985 | ||||||
986 | egp = this->private; | |||||
987 | enable = egp->enable[GF_FOP_CREATE]; | |||||
988 | ||||||
989 | if (enable) | |||||
990 | op_errno = error_gen (this, GF_FOP_CREATE); | |||||
991 | ||||||
992 | if (op_errno) { | |||||
993 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 993, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
994 | STACK_UNWIND_STRICT (create, frame, -1, op_errno, NULL, NULL,do { fop_create_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 995, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_create_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ( (void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
995 | NULL, NULL, NULL, NULL)do { fop_create_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 995, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_create_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ( (void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
996 | return 0; | |||||
997 | } | |||||
998 | ||||||
999 | STACK_WIND (frame, error_gen_create_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1002, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->create_cbk) tmp_cbk = error_gen_create_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->create"; _new->unwind_to = "error_gen_create_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->create); (this->children->xlator )->fops->create (_new, (this->children->xlator), loc , flags, mode, umask, fd, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
1000 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1002, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->create_cbk) tmp_cbk = error_gen_create_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->create"; _new->unwind_to = "error_gen_create_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->create); (this->children->xlator )->fops->create (_new, (this->children->xlator), loc , flags, mode, umask, fd, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
1001 | FIRST_CHILD(this)->fops->create,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1002, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->create_cbk) tmp_cbk = error_gen_create_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->create"; _new->unwind_to = "error_gen_create_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->create); (this->children->xlator )->fops->create (_new, (this->children->xlator), loc , flags, mode, umask, fd, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
1002 | loc, flags, mode, umask, fd, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1002, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->create_cbk) tmp_cbk = error_gen_create_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->create"; _new->unwind_to = "error_gen_create_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->create); (this->children->xlator )->fops->create (_new, (this->children->xlator), loc , flags, mode, umask, fd, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
1003 | return 0; | |||||
1004 | } | |||||
1005 | ||||||
1006 | ||||||
1007 | int | |||||
1008 | error_gen_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1009 | int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) | |||||
1010 | { | |||||
1011 | STACK_UNWIND_STRICT (open, frame, op_ret, op_errno, fd, xdata)do { fop_open_cbk_t fn = ((void*)0); call_frame_t *_parent = ( (void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1011, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_open_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, fd, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1012 | return 0; | |||||
1013 | } | |||||
1014 | ||||||
1015 | ||||||
1016 | int | |||||
1017 | error_gen_open (call_frame_t *frame, xlator_t *this, loc_t *loc, | |||||
1018 | int32_t flags, fd_t *fd, dict_t *xdata) | |||||
1019 | { | |||||
1020 | int op_errno = 0; | |||||
1021 | eg_t *egp = NULL((void*)0); | |||||
1022 | int enable = 1; | |||||
1023 | ||||||
1024 | egp = this->private; | |||||
1025 | enable = egp->enable[GF_FOP_OPEN]; | |||||
1026 | ||||||
1027 | if (enable) | |||||
1028 | op_errno = error_gen (this, GF_FOP_OPEN); | |||||
1029 | ||||||
1030 | if (op_errno) { | |||||
1031 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1031, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1032 | STACK_UNWIND_STRICT (open, frame, -1, op_errno, NULL, xdata)do { fop_open_cbk_t fn = ((void*)0); call_frame_t *_parent = ( (void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1032, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_open_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); | |||||
1033 | return 0; | |||||
1034 | } | |||||
1035 | ||||||
1036 | STACK_WIND (frame, error_gen_open_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1039, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->open_cbk) tmp_cbk = error_gen_open_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->open"; _new ->unwind_to = "error_gen_open_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->open); (this->children->xlator )->fops->open (_new, (this->children->xlator), loc , flags, fd, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1037 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1039, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->open_cbk) tmp_cbk = error_gen_open_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->open"; _new ->unwind_to = "error_gen_open_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->open); (this->children->xlator )->fops->open (_new, (this->children->xlator), loc , flags, fd, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1038 | FIRST_CHILD(this)->fops->open,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1039, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->open_cbk) tmp_cbk = error_gen_open_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->open"; _new ->unwind_to = "error_gen_open_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->open); (this->children->xlator )->fops->open (_new, (this->children->xlator), loc , flags, fd, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1039 | loc, flags, fd, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1039, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->open_cbk) tmp_cbk = error_gen_open_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->open"; _new ->unwind_to = "error_gen_open_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->open); (this->children->xlator )->fops->open (_new, (this->children->xlator), loc , flags, fd, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1040 | return 0; | |||||
1041 | } | |||||
1042 | ||||||
1043 | ||||||
1044 | int | |||||
1045 | error_gen_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1046 | int32_t op_ret, int32_t op_errno, | |||||
1047 | struct iovec *vector, int32_t count, | |||||
1048 | struct iatt *stbuf, struct iobref *iobref, dict_t *xdata) | |||||
1049 | { | |||||
1050 | STACK_UNWIND_STRICT (readv, frame, op_ret, op_errno,do { fop_readv_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1051, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_readv_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, vector, count, stbuf, iobref, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
1051 | vector, count, stbuf, iobref, xdata)do { fop_readv_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1051, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_readv_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, vector, count, stbuf, iobref, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
1052 | return 0; | |||||
1053 | } | |||||
1054 | ||||||
1055 | ||||||
1056 | int | |||||
1057 | error_gen_readv (call_frame_t *frame, xlator_t *this, | |||||
1058 | fd_t *fd, size_t size, off_t offset, uint32_t flags, dict_t *xdata) | |||||
1059 | { | |||||
1060 | int op_errno = 0; | |||||
1061 | eg_t *egp = NULL((void*)0); | |||||
1062 | int enable = 1; | |||||
1063 | ||||||
1064 | egp = this->private; | |||||
1065 | enable = egp->enable[GF_FOP_READ]; | |||||
1066 | ||||||
1067 | if (enable) | |||||
1068 | op_errno = error_gen (this, GF_FOP_READ); | |||||
1069 | ||||||
1070 | if (op_errno) { | |||||
1071 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1071, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1072 | STACK_UNWIND_STRICT (readv, frame, -1, op_errno, NULL, 0,do { fop_readv_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1073, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_readv_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), 0, ((void*)0), ((void*)0), xdata); (* __glusterfs_this_location()) = old_THIS; } while (0) | |||||
1073 | NULL, NULL, xdata)do { fop_readv_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1073, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_readv_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), 0, ((void*)0), ((void*)0), xdata); (* __glusterfs_this_location()) = old_THIS; } while (0); | |||||
1074 | return 0; | |||||
1075 | } | |||||
1076 | ||||||
1077 | ||||||
1078 | STACK_WIND (frame, error_gen_readv_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1081, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readv_cbk) tmp_cbk = error_gen_readv_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->readv"; _new ->unwind_to = "error_gen_readv_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->readv); (this->children->xlator )->fops->readv (_new, (this->children->xlator), fd , size, offset, flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
1079 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1081, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readv_cbk) tmp_cbk = error_gen_readv_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->readv"; _new ->unwind_to = "error_gen_readv_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->readv); (this->children->xlator )->fops->readv (_new, (this->children->xlator), fd , size, offset, flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
1080 | FIRST_CHILD(this)->fops->readv,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1081, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readv_cbk) tmp_cbk = error_gen_readv_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->readv"; _new ->unwind_to = "error_gen_readv_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->readv); (this->children->xlator )->fops->readv (_new, (this->children->xlator), fd , size, offset, flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
1081 | fd, size, offset, flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1081, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readv_cbk) tmp_cbk = error_gen_readv_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->readv"; _new ->unwind_to = "error_gen_readv_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->readv); (this->children->xlator )->fops->readv (_new, (this->children->xlator), fd , size, offset, flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||||
1082 | return 0; | |||||
1083 | } | |||||
1084 | ||||||
1085 | ||||||
1086 | int | |||||
1087 | error_gen_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1088 | int32_t op_ret, int32_t op_errno, | |||||
1089 | struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata) | |||||
1090 | { | |||||
1091 | STACK_UNWIND_STRICT (writev, frame, op_ret, op_errno, prebuf, postbuf, xdata)do { fop_writev_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1091, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_writev_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
1092 | return 0; | |||||
1093 | } | |||||
1094 | ||||||
1095 | ||||||
1096 | int | |||||
1097 | error_gen_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, | |||||
1098 | struct iovec *vector, int32_t count, | |||||
1099 | off_t off, uint32_t flags, struct iobref *iobref, dict_t *xdata) | |||||
1100 | { | |||||
1101 | int op_errno = 0; | |||||
1102 | eg_t *egp = NULL((void*)0); | |||||
1103 | int enable = 1; | |||||
1104 | ||||||
1105 | egp = this->private; | |||||
1106 | enable = egp->enable[GF_FOP_WRITE]; | |||||
1107 | ||||||
1108 | if (enable) | |||||
1109 | op_errno = error_gen (this, GF_FOP_WRITE); | |||||
1110 | ||||||
1111 | if (op_errno == GF_ERROR_SHORT_WRITE) { | |||||
1112 | struct iovec *shortvec; | |||||
1113 | ||||||
1114 | /* | |||||
1115 | * A short write error returns some value less than what was | |||||
1116 | * requested from a write. To simulate this, replace the vector | |||||
1117 | * with one half the size; | |||||
1118 | */ | |||||
1119 | shortvec = iov_dup(vector, 1); | |||||
1120 | shortvec->iov_len /= 2; | |||||
1121 | ||||||
1122 | STACK_WIND(frame, error_gen_writev_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1124, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->writev_cbk) tmp_cbk = error_gen_writev_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->writev"; _new->unwind_to = "error_gen_writev_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->writev); (this->children->xlator )->fops->writev (_new, (this->children->xlator), fd , shortvec, count, off, flags, iobref, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
1123 | FIRST_CHILD(this)->fops->writev, fd, shortvec, count,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1124, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->writev_cbk) tmp_cbk = error_gen_writev_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->writev"; _new->unwind_to = "error_gen_writev_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->writev); (this->children->xlator )->fops->writev (_new, (this->children->xlator), fd , shortvec, count, off, flags, iobref, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
1124 | off, flags, iobref, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1124, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->writev_cbk) tmp_cbk = error_gen_writev_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->writev"; _new->unwind_to = "error_gen_writev_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->writev); (this->children->xlator )->fops->writev (_new, (this->children->xlator), fd , shortvec, count, off, flags, iobref, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
1125 | GF_FREE(shortvec)__gf_free (shortvec); | |||||
1126 | return 0; | |||||
1127 | } else if (op_errno) { | |||||
1128 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1128, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1129 | STACK_UNWIND_STRICT (writev, frame, -1, op_errno, NULL, NULL, xdata)do { fop_writev_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1129, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_writev_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
1130 | return 0; | |||||
1131 | } | |||||
1132 | ||||||
1133 | STACK_WIND (frame, error_gen_writev_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1136, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->writev_cbk) tmp_cbk = error_gen_writev_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->writev"; _new->unwind_to = "error_gen_writev_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->writev); (this->children->xlator )->fops->writev (_new, (this->children->xlator), fd , vector, count, off, flags, iobref, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
1134 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1136, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->writev_cbk) tmp_cbk = error_gen_writev_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->writev"; _new->unwind_to = "error_gen_writev_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->writev); (this->children->xlator )->fops->writev (_new, (this->children->xlator), fd , vector, count, off, flags, iobref, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
1135 | FIRST_CHILD(this)->fops->writev,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1136, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->writev_cbk) tmp_cbk = error_gen_writev_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->writev"; _new->unwind_to = "error_gen_writev_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->writev); (this->children->xlator )->fops->writev (_new, (this->children->xlator), fd , vector, count, off, flags, iobref, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
1136 | fd, vector, count, off, flags, iobref, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1136, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->writev_cbk) tmp_cbk = error_gen_writev_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->writev"; _new->unwind_to = "error_gen_writev_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->writev); (this->children->xlator )->fops->writev (_new, (this->children->xlator), fd , vector, count, off, flags, iobref, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
1137 | return 0; | |||||
1138 | } | |||||
1139 | ||||||
1140 | ||||||
1141 | int | |||||
1142 | error_gen_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1143 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | |||||
1144 | { | |||||
1145 | STACK_UNWIND_STRICT (flush, frame, op_ret, op_errno, xdata)do { fop_flush_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1145, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_flush_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1146 | return 0; | |||||
1147 | } | |||||
1148 | ||||||
1149 | ||||||
1150 | int | |||||
1151 | error_gen_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) | |||||
1152 | { | |||||
1153 | int op_errno = 0; | |||||
1154 | eg_t *egp = NULL((void*)0); | |||||
1155 | int enable = 1; | |||||
1156 | ||||||
1157 | egp = this->private; | |||||
1158 | enable = egp->enable[GF_FOP_FLUSH]; | |||||
1159 | ||||||
1160 | if (enable) | |||||
1161 | op_errno = error_gen (this, GF_FOP_FLUSH); | |||||
1162 | ||||||
1163 | if (op_errno) { | |||||
1164 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1164, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1165 | STACK_UNWIND_STRICT (flush, frame, -1, op_errno, xdata)do { fop_flush_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1165, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_flush_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1166 | return 0; | |||||
1167 | } | |||||
1168 | ||||||
1169 | STACK_WIND (frame, error_gen_flush_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1172, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->flush_cbk) tmp_cbk = error_gen_flush_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->flush"; _new ->unwind_to = "error_gen_flush_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->flush); (this->children->xlator )->fops->flush (_new, (this->children->xlator), fd , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||||
1170 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1172, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->flush_cbk) tmp_cbk = error_gen_flush_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->flush"; _new ->unwind_to = "error_gen_flush_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->flush); (this->children->xlator )->fops->flush (_new, (this->children->xlator), fd , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||||
1171 | FIRST_CHILD(this)->fops->flush,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1172, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->flush_cbk) tmp_cbk = error_gen_flush_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->flush"; _new ->unwind_to = "error_gen_flush_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->flush); (this->children->xlator )->fops->flush (_new, (this->children->xlator), fd , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||||
1172 | fd, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1172, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->flush_cbk) tmp_cbk = error_gen_flush_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->flush"; _new ->unwind_to = "error_gen_flush_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->flush); (this->children->xlator )->fops->flush (_new, (this->children->xlator), fd , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0); | |||||
1173 | return 0; | |||||
1174 | } | |||||
1175 | ||||||
1176 | ||||||
1177 | int | |||||
1178 | error_gen_fsync_cbk (call_frame_t *frame, void *cookie, | |||||
1179 | xlator_t *this, int32_t op_ret, | |||||
1180 | int32_t op_errno, struct iatt *prebuf, | |||||
1181 | struct iatt *postbuf, dict_t *xdata) | |||||
1182 | { | |||||
1183 | STACK_UNWIND_STRICT (fsync, frame, op_ret, op_errno, prebuf, postbuf, xdata)do { fop_fsync_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1183, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fsync_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
1184 | return 0; | |||||
1185 | } | |||||
1186 | ||||||
1187 | ||||||
1188 | int | |||||
1189 | error_gen_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, dict_t *xdata) | |||||
1190 | { | |||||
1191 | int op_errno = 0; | |||||
1192 | eg_t *egp = NULL((void*)0); | |||||
1193 | int enable = 1; | |||||
1194 | ||||||
1195 | egp = this->private; | |||||
1196 | enable = egp->enable[GF_FOP_FSYNC]; | |||||
1197 | ||||||
1198 | if (enable) | |||||
1199 | op_errno = error_gen (this, GF_FOP_FSYNC); | |||||
1200 | ||||||
1201 | if (op_errno) { | |||||
1202 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1202, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1203 | STACK_UNWIND_STRICT (fsync, frame, -1, op_errno, NULL, NULL, xdata)do { fop_fsync_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1203, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fsync_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
1204 | return 0; | |||||
1205 | } | |||||
1206 | ||||||
1207 | STACK_WIND (frame, error_gen_fsync_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1210, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsync_cbk) tmp_cbk = error_gen_fsync_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsync"; _new ->unwind_to = "error_gen_fsync_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsync); (this->children->xlator )->fops->fsync (_new, (this->children->xlator), fd , flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
1208 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1210, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsync_cbk) tmp_cbk = error_gen_fsync_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsync"; _new ->unwind_to = "error_gen_fsync_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsync); (this->children->xlator )->fops->fsync (_new, (this->children->xlator), fd , flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
1209 | FIRST_CHILD(this)->fops->fsync,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1210, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsync_cbk) tmp_cbk = error_gen_fsync_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsync"; _new ->unwind_to = "error_gen_fsync_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsync); (this->children->xlator )->fops->fsync (_new, (this->children->xlator), fd , flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
1210 | fd, flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1210, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsync_cbk) tmp_cbk = error_gen_fsync_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsync"; _new ->unwind_to = "error_gen_fsync_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsync); (this->children->xlator )->fops->fsync (_new, (this->children->xlator), fd , flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||||
1211 | return 0; | |||||
1212 | } | |||||
1213 | ||||||
1214 | ||||||
1215 | int | |||||
1216 | error_gen_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1217 | int32_t op_ret, int32_t op_errno, struct iatt *buf, dict_t *xdata) | |||||
1218 | { | |||||
1219 | STACK_UNWIND_STRICT (fstat, frame, op_ret, op_errno, buf, xdata)do { fop_fstat_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1219, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fstat_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, buf, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1220 | return 0; | |||||
1221 | } | |||||
1222 | ||||||
1223 | ||||||
1224 | int | |||||
1225 | error_gen_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) | |||||
1226 | { | |||||
1227 | int op_errno = 0; | |||||
1228 | eg_t *egp = NULL((void*)0); | |||||
1229 | int enable = 1; | |||||
1230 | ||||||
1231 | egp = this->private; | |||||
1232 | enable = egp->enable[GF_FOP_FSTAT]; | |||||
1233 | ||||||
1234 | if (enable) | |||||
1235 | op_errno = error_gen (this, GF_FOP_FSTAT); | |||||
1236 | ||||||
1237 | if (op_errno) { | |||||
1238 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1238, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1239 | STACK_UNWIND_STRICT (fstat, frame, -1, op_errno, NULL, xdata)do { fop_fstat_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1239, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fstat_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); | |||||
1240 | return 0; | |||||
1241 | } | |||||
1242 | ||||||
1243 | STACK_WIND (frame, error_gen_fstat_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1246, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fstat_cbk) tmp_cbk = error_gen_fstat_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fstat"; _new ->unwind_to = "error_gen_fstat_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fstat); (this->children->xlator )->fops->fstat (_new, (this->children->xlator), fd , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||||
1244 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1246, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fstat_cbk) tmp_cbk = error_gen_fstat_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fstat"; _new ->unwind_to = "error_gen_fstat_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fstat); (this->children->xlator )->fops->fstat (_new, (this->children->xlator), fd , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||||
1245 | FIRST_CHILD(this)->fops->fstat,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1246, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fstat_cbk) tmp_cbk = error_gen_fstat_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fstat"; _new ->unwind_to = "error_gen_fstat_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fstat); (this->children->xlator )->fops->fstat (_new, (this->children->xlator), fd , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||||
1246 | fd, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1246, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fstat_cbk) tmp_cbk = error_gen_fstat_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fstat"; _new ->unwind_to = "error_gen_fstat_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fstat); (this->children->xlator )->fops->fstat (_new, (this->children->xlator), fd , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0); | |||||
1247 | return 0; | |||||
1248 | } | |||||
1249 | ||||||
1250 | ||||||
1251 | int | |||||
1252 | error_gen_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1253 | int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) | |||||
1254 | { | |||||
1255 | STACK_UNWIND_STRICT (opendir, frame, op_ret, op_errno, fd, xdata)do { fop_opendir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1255, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_opendir_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, fd, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1256 | return 0; | |||||
1257 | } | |||||
1258 | ||||||
1259 | ||||||
1260 | int | |||||
1261 | error_gen_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, dict_t *xdata) | |||||
1262 | { | |||||
1263 | int op_errno = 0; | |||||
1264 | eg_t *egp = NULL((void*)0); | |||||
1265 | int enable = 1; | |||||
1266 | ||||||
1267 | egp = this->private; | |||||
1268 | enable = egp->enable[GF_FOP_OPENDIR]; | |||||
1269 | ||||||
1270 | if (enable) | |||||
1271 | op_errno = error_gen (this, GF_FOP_OPENDIR); | |||||
1272 | ||||||
1273 | if (op_errno) { | |||||
1274 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1274, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1275 | STACK_UNWIND_STRICT (opendir, frame, -1, op_errno, NULL, xdata)do { fop_opendir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1275, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_opendir_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); | |||||
1276 | return 0; | |||||
1277 | } | |||||
1278 | ||||||
1279 | STACK_WIND (frame, error_gen_opendir_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1282, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->opendir_cbk) tmp_cbk = error_gen_opendir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->opendir" ; _new->unwind_to = "error_gen_opendir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->opendir); (this->children->xlator )->fops->opendir (_new, (this->children->xlator), loc, fd, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
1280 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1282, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->opendir_cbk) tmp_cbk = error_gen_opendir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->opendir" ; _new->unwind_to = "error_gen_opendir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->opendir); (this->children->xlator )->fops->opendir (_new, (this->children->xlator), loc, fd, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
1281 | FIRST_CHILD(this)->fops->opendir,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1282, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->opendir_cbk) tmp_cbk = error_gen_opendir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->opendir" ; _new->unwind_to = "error_gen_opendir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->opendir); (this->children->xlator )->fops->opendir (_new, (this->children->xlator), loc, fd, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
1282 | loc, fd, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1282, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->opendir_cbk) tmp_cbk = error_gen_opendir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->opendir" ; _new->unwind_to = "error_gen_opendir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->opendir); (this->children->xlator )->fops->opendir (_new, (this->children->xlator), loc, fd, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||||
1283 | return 0; | |||||
1284 | } | |||||
1285 | ||||||
1286 | int | |||||
1287 | error_gen_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1288 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | |||||
1289 | { | |||||
1290 | STACK_UNWIND_STRICT (fsyncdir, frame, op_ret, op_errno, xdata)do { fop_fsyncdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1290, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fsyncdir_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1291 | return 0; | |||||
1292 | } | |||||
1293 | ||||||
1294 | ||||||
1295 | int | |||||
1296 | error_gen_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, | |||||
1297 | int32_t flags, dict_t *xdata) | |||||
1298 | { | |||||
1299 | int op_errno = 0; | |||||
1300 | eg_t *egp = NULL((void*)0); | |||||
1301 | int enable = 1; | |||||
1302 | ||||||
1303 | egp = this->private; | |||||
1304 | enable = egp->enable[GF_FOP_FSYNCDIR]; | |||||
1305 | ||||||
1306 | if (enable) | |||||
1307 | op_errno = error_gen (this, GF_FOP_FSYNCDIR); | |||||
1308 | ||||||
1309 | if (op_errno) { | |||||
1310 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1310, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1311 | STACK_UNWIND_STRICT (fsyncdir, frame, -1, op_errno, xdata)do { fop_fsyncdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1311, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fsyncdir_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1312 | return 0; | |||||
1313 | } | |||||
1314 | ||||||
1315 | STACK_WIND (frame, error_gen_fsyncdir_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1318, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsyncdir_cbk) tmp_cbk = error_gen_fsyncdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsyncdir" ; _new->unwind_to = "error_gen_fsyncdir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsyncdir); (this->children->xlator )->fops->fsyncdir (_new, (this->children->xlator) , fd, flags, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1316 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1318, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsyncdir_cbk) tmp_cbk = error_gen_fsyncdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsyncdir" ; _new->unwind_to = "error_gen_fsyncdir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsyncdir); (this->children->xlator )->fops->fsyncdir (_new, (this->children->xlator) , fd, flags, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1317 | FIRST_CHILD(this)->fops->fsyncdir,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1318, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsyncdir_cbk) tmp_cbk = error_gen_fsyncdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsyncdir" ; _new->unwind_to = "error_gen_fsyncdir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsyncdir); (this->children->xlator )->fops->fsyncdir (_new, (this->children->xlator) , fd, flags, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1318 | fd, flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1318, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsyncdir_cbk) tmp_cbk = error_gen_fsyncdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsyncdir" ; _new->unwind_to = "error_gen_fsyncdir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsyncdir); (this->children->xlator )->fops->fsyncdir (_new, (this->children->xlator) , fd, flags, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1319 | return 0; | |||||
1320 | } | |||||
1321 | ||||||
1322 | ||||||
1323 | int | |||||
1324 | error_gen_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1325 | int32_t op_ret, int32_t op_errno, struct statvfs *buf, dict_t *xdata) | |||||
1326 | { | |||||
1327 | STACK_UNWIND_STRICT (statfs, frame, op_ret, op_errno, buf, xdata)do { fop_statfs_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1327, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_statfs_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, buf, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1328 | return 0; | |||||
1329 | } | |||||
1330 | ||||||
1331 | ||||||
1332 | int | |||||
1333 | error_gen_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) | |||||
1334 | { | |||||
1335 | int op_errno = 0; | |||||
1336 | eg_t *egp = NULL((void*)0); | |||||
1337 | int enable = 1; | |||||
1338 | ||||||
1339 | egp = this->private; | |||||
1340 | enable = egp->enable[GF_FOP_STATFS]; | |||||
1341 | ||||||
1342 | if (enable) | |||||
1343 | op_errno = error_gen (this, GF_FOP_STATFS); | |||||
1344 | ||||||
1345 | if (op_errno) { | |||||
1346 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1346, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1347 | STACK_UNWIND_STRICT (statfs, frame, -1, op_errno, NULL, xdata)do { fop_statfs_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1347, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_statfs_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); | |||||
1348 | return 0; | |||||
1349 | } | |||||
1350 | ||||||
1351 | STACK_WIND (frame, error_gen_statfs_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1354, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->statfs_cbk) tmp_cbk = error_gen_statfs_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->statfs"; _new->unwind_to = "error_gen_statfs_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->statfs); (this->children->xlator )->fops->statfs (_new, (this->children->xlator), loc , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||||
1352 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1354, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->statfs_cbk) tmp_cbk = error_gen_statfs_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->statfs"; _new->unwind_to = "error_gen_statfs_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->statfs); (this->children->xlator )->fops->statfs (_new, (this->children->xlator), loc , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||||
1353 | FIRST_CHILD(this)->fops->statfs,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1354, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->statfs_cbk) tmp_cbk = error_gen_statfs_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->statfs"; _new->unwind_to = "error_gen_statfs_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->statfs); (this->children->xlator )->fops->statfs (_new, (this->children->xlator), loc , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||||
1354 | loc, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1354, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->statfs_cbk) tmp_cbk = error_gen_statfs_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->statfs"; _new->unwind_to = "error_gen_statfs_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->statfs); (this->children->xlator )->fops->statfs (_new, (this->children->xlator), loc , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0); | |||||
1355 | return 0; | |||||
1356 | } | |||||
1357 | ||||||
1358 | ||||||
1359 | int | |||||
1360 | error_gen_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1361 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | |||||
1362 | { | |||||
1363 | STACK_UNWIND_STRICT (setxattr, frame, op_ret, op_errno, xdata)do { fop_setxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1363, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_setxattr_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1364 | return 0; | |||||
1365 | } | |||||
1366 | ||||||
1367 | ||||||
1368 | int | |||||
1369 | error_gen_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, | |||||
1370 | dict_t *dict, int32_t flags, dict_t *xdata) | |||||
1371 | { | |||||
1372 | int op_errno = 0; | |||||
1373 | eg_t *egp = NULL((void*)0); | |||||
1374 | int enable = 1; | |||||
1375 | ||||||
1376 | egp = this->private; | |||||
1377 | enable = egp->enable[GF_FOP_SETXATTR]; | |||||
1378 | ||||||
1379 | if (enable) | |||||
1380 | op_errno = error_gen (this, GF_FOP_SETXATTR); | |||||
1381 | ||||||
1382 | if (op_errno) { | |||||
1383 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1383, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1384 | STACK_UNWIND_STRICT (setxattr, frame, -1, op_errno, xdata)do { fop_setxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1384, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_setxattr_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1385 | return 0; | |||||
1386 | } | |||||
1387 | ||||||
1388 | STACK_WIND (frame, error_gen_setxattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1391, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setxattr_cbk) tmp_cbk = error_gen_setxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->setxattr" ; _new->unwind_to = "error_gen_setxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->setxattr); (this->children->xlator )->fops->setxattr (_new, (this->children->xlator) , loc, dict, flags, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1389 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1391, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setxattr_cbk) tmp_cbk = error_gen_setxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->setxattr" ; _new->unwind_to = "error_gen_setxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->setxattr); (this->children->xlator )->fops->setxattr (_new, (this->children->xlator) , loc, dict, flags, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1390 | FIRST_CHILD(this)->fops->setxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1391, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setxattr_cbk) tmp_cbk = error_gen_setxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->setxattr" ; _new->unwind_to = "error_gen_setxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->setxattr); (this->children->xlator )->fops->setxattr (_new, (this->children->xlator) , loc, dict, flags, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1391 | loc, dict, flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1391, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setxattr_cbk) tmp_cbk = error_gen_setxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->setxattr" ; _new->unwind_to = "error_gen_setxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->setxattr); (this->children->xlator )->fops->setxattr (_new, (this->children->xlator) , loc, dict, flags, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1392 | return 0; | |||||
1393 | } | |||||
1394 | ||||||
1395 | ||||||
1396 | int | |||||
1397 | error_gen_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1398 | int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata) | |||||
1399 | { | |||||
1400 | STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict, xdata)do { fop_getxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1400, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_getxattr_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1401 | return 0; | |||||
1402 | } | |||||
1403 | ||||||
1404 | ||||||
1405 | int | |||||
1406 | error_gen_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, | |||||
1407 | const char *name, dict_t *xdata) | |||||
1408 | { | |||||
1409 | int op_errno = 0; | |||||
1410 | eg_t *egp = NULL((void*)0); | |||||
1411 | int enable = 1; | |||||
1412 | ||||||
1413 | egp = this->private; | |||||
1414 | enable = egp->enable[GF_FOP_GETXATTR]; | |||||
1415 | ||||||
1416 | if (enable) | |||||
1417 | op_errno = error_gen (this, GF_FOP_GETXATTR); | |||||
1418 | ||||||
1419 | if (op_errno) { | |||||
1420 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1420, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1421 | STACK_UNWIND_STRICT (getxattr, frame, -1, op_errno, NULL, xdata)do { fop_getxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1421, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_getxattr_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); | |||||
1422 | return 0; | |||||
1423 | } | |||||
1424 | ||||||
1425 | STACK_WIND (frame, error_gen_getxattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1428, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = error_gen_getxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->getxattr" ; _new->unwind_to = "error_gen_getxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->getxattr); (this->children->xlator )->fops->getxattr (_new, (this->children->xlator) , loc, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1426 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1428, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = error_gen_getxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->getxattr" ; _new->unwind_to = "error_gen_getxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->getxattr); (this->children->xlator )->fops->getxattr (_new, (this->children->xlator) , loc, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1427 | FIRST_CHILD(this)->fops->getxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1428, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = error_gen_getxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->getxattr" ; _new->unwind_to = "error_gen_getxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->getxattr); (this->children->xlator )->fops->getxattr (_new, (this->children->xlator) , loc, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1428 | loc, name, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1428, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = error_gen_getxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->getxattr" ; _new->unwind_to = "error_gen_getxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->getxattr); (this->children->xlator )->fops->getxattr (_new, (this->children->xlator) , loc, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1429 | return 0; | |||||
1430 | } | |||||
1431 | ||||||
1432 | int | |||||
1433 | error_gen_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1434 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | |||||
1435 | { | |||||
1436 | STACK_UNWIND_STRICT (fsetxattr, frame, op_ret, op_errno, xdata)do { fop_fsetxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1436, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fsetxattr_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1437 | return 0; | |||||
1438 | } | |||||
1439 | ||||||
1440 | ||||||
1441 | int | |||||
1442 | error_gen_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, | |||||
1443 | dict_t *dict, int32_t flags, dict_t *xdata) | |||||
1444 | { | |||||
1445 | int op_errno = 0; | |||||
1446 | eg_t *egp = NULL((void*)0); | |||||
1447 | int enable = 1; | |||||
1448 | ||||||
1449 | egp = this->private; | |||||
1450 | enable = egp->enable[GF_FOP_FSETXATTR]; | |||||
1451 | ||||||
1452 | if (enable) | |||||
1453 | op_errno = error_gen (this, GF_FOP_FSETXATTR); | |||||
1454 | ||||||
1455 | if (op_errno) { | |||||
1456 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1456, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1457 | STACK_UNWIND_STRICT (fsetxattr, frame, -1, op_errno, xdata)do { fop_fsetxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1457, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fsetxattr_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1458 | return 0; | |||||
1459 | } | |||||
1460 | ||||||
1461 | STACK_WIND (frame, error_gen_fsetxattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1464, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetxattr_cbk) tmp_cbk = error_gen_fsetxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsetxattr" ; _new->unwind_to = "error_gen_fsetxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsetxattr); (this->children-> xlator)->fops->fsetxattr (_new, (this->children-> xlator), fd, dict, flags, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
1462 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1464, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetxattr_cbk) tmp_cbk = error_gen_fsetxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsetxattr" ; _new->unwind_to = "error_gen_fsetxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsetxattr); (this->children-> xlator)->fops->fsetxattr (_new, (this->children-> xlator), fd, dict, flags, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
1463 | FIRST_CHILD(this)->fops->fsetxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1464, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetxattr_cbk) tmp_cbk = error_gen_fsetxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsetxattr" ; _new->unwind_to = "error_gen_fsetxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsetxattr); (this->children-> xlator)->fops->fsetxattr (_new, (this->children-> xlator), fd, dict, flags, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
1464 | fd, dict, flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1464, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetxattr_cbk) tmp_cbk = error_gen_fsetxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsetxattr" ; _new->unwind_to = "error_gen_fsetxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsetxattr); (this->children-> xlator)->fops->fsetxattr (_new, (this->children-> xlator), fd, dict, flags, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
1465 | return 0; | |||||
1466 | } | |||||
1467 | ||||||
1468 | ||||||
1469 | int | |||||
1470 | error_gen_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1471 | int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata) | |||||
1472 | { | |||||
1473 | STACK_UNWIND_STRICT (fgetxattr, frame, op_ret, op_errno, dict, xdata)do { fop_fgetxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1473, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fgetxattr_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1474 | return 0; | |||||
1475 | } | |||||
1476 | ||||||
1477 | ||||||
1478 | int | |||||
1479 | error_gen_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, | |||||
1480 | const char *name, dict_t *xdata) | |||||
1481 | { | |||||
1482 | int op_errno = 0; | |||||
1483 | eg_t *egp = NULL((void*)0); | |||||
1484 | int enable = 1; | |||||
1485 | ||||||
1486 | egp = this->private; | |||||
1487 | enable = egp->enable[GF_FOP_FGETXATTR]; | |||||
1488 | ||||||
1489 | if (enable) | |||||
1490 | op_errno = error_gen (this, GF_FOP_FGETXATTR); | |||||
1491 | ||||||
1492 | if (op_errno) { | |||||
1493 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1493, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1494 | STACK_UNWIND_STRICT (fgetxattr, frame, -1, op_errno, NULL, xdata)do { fop_fgetxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1494, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fgetxattr_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); | |||||
1495 | return 0; | |||||
1496 | } | |||||
1497 | ||||||
1498 | STACK_WIND (frame, error_gen_fgetxattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1501, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fgetxattr_cbk) tmp_cbk = error_gen_fgetxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fgetxattr" ; _new->unwind_to = "error_gen_fgetxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fgetxattr); (this->children-> xlator)->fops->fgetxattr (_new, (this->children-> xlator), fd, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1499 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1501, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fgetxattr_cbk) tmp_cbk = error_gen_fgetxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fgetxattr" ; _new->unwind_to = "error_gen_fgetxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fgetxattr); (this->children-> xlator)->fops->fgetxattr (_new, (this->children-> xlator), fd, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1500 | FIRST_CHILD(this)->fops->fgetxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1501, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fgetxattr_cbk) tmp_cbk = error_gen_fgetxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fgetxattr" ; _new->unwind_to = "error_gen_fgetxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fgetxattr); (this->children-> xlator)->fops->fgetxattr (_new, (this->children-> xlator), fd, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1501 | fd, name, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1501, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fgetxattr_cbk) tmp_cbk = error_gen_fgetxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fgetxattr" ; _new->unwind_to = "error_gen_fgetxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fgetxattr); (this->children-> xlator)->fops->fgetxattr (_new, (this->children-> xlator), fd, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1502 | return 0; | |||||
1503 | } | |||||
1504 | ||||||
1505 | ||||||
1506 | int | |||||
1507 | error_gen_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1508 | int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata) | |||||
1509 | { | |||||
1510 | STACK_UNWIND_STRICT (xattrop, frame, op_ret, op_errno, dict, xdata)do { fop_xattrop_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1510, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_xattrop_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1511 | return 0; | |||||
1512 | } | |||||
1513 | ||||||
1514 | ||||||
1515 | int | |||||
1516 | error_gen_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, | |||||
1517 | gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata) | |||||
1518 | { | |||||
1519 | int op_errno = 0; | |||||
1520 | eg_t *egp = NULL((void*)0); | |||||
1521 | int enable = 1; | |||||
1522 | ||||||
1523 | egp = this->private; | |||||
1524 | enable = egp->enable[GF_FOP_XATTROP]; | |||||
1525 | ||||||
1526 | if (enable) | |||||
1527 | op_errno = error_gen (this, GF_FOP_XATTROP); | |||||
1528 | ||||||
1529 | if (op_errno) { | |||||
1530 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1530, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1531 | STACK_UNWIND_STRICT (xattrop, frame, -1, op_errno, NULL, xdata)do { fop_xattrop_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1531, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_xattrop_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); | |||||
1532 | return 0; | |||||
1533 | } | |||||
1534 | ||||||
1535 | STACK_WIND (frame, error_gen_xattrop_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1538, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->xattrop_cbk) tmp_cbk = error_gen_xattrop_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->xattrop" ; _new->unwind_to = "error_gen_xattrop_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->xattrop); (this->children->xlator )->fops->xattrop (_new, (this->children->xlator), loc, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1536 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1538, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->xattrop_cbk) tmp_cbk = error_gen_xattrop_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->xattrop" ; _new->unwind_to = "error_gen_xattrop_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->xattrop); (this->children->xlator )->fops->xattrop (_new, (this->children->xlator), loc, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1537 | FIRST_CHILD(this)->fops->xattrop,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1538, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->xattrop_cbk) tmp_cbk = error_gen_xattrop_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->xattrop" ; _new->unwind_to = "error_gen_xattrop_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->xattrop); (this->children->xlator )->fops->xattrop (_new, (this->children->xlator), loc, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1538 | loc, flags, dict, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1538, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->xattrop_cbk) tmp_cbk = error_gen_xattrop_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->xattrop" ; _new->unwind_to = "error_gen_xattrop_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->xattrop); (this->children->xlator )->fops->xattrop (_new, (this->children->xlator), loc, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1539 | return 0; | |||||
1540 | } | |||||
1541 | ||||||
1542 | ||||||
1543 | int | |||||
1544 | error_gen_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1545 | int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata) | |||||
1546 | { | |||||
1547 | STACK_UNWIND_STRICT (fxattrop, frame, op_ret, op_errno, dict, xdata)do { fop_fxattrop_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1547, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fxattrop_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1548 | return 0; | |||||
1549 | } | |||||
1550 | ||||||
1551 | ||||||
1552 | int | |||||
1553 | error_gen_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd, | |||||
1554 | gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata) | |||||
1555 | { | |||||
1556 | int op_errno = 0; | |||||
1557 | eg_t *egp = NULL((void*)0); | |||||
1558 | int enable = 1; | |||||
1559 | ||||||
1560 | egp = this->private; | |||||
1561 | enable = egp->enable[GF_FOP_FXATTROP]; | |||||
1562 | ||||||
1563 | if (enable) | |||||
1564 | op_errno = error_gen (this, GF_FOP_FXATTROP); | |||||
1565 | ||||||
1566 | if (op_errno) { | |||||
1567 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1567, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1568 | STACK_UNWIND_STRICT (fxattrop, frame, -1, op_errno, NULL, xdata)do { fop_fxattrop_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1568, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fxattrop_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); | |||||
1569 | return 0; | |||||
1570 | } | |||||
1571 | ||||||
1572 | STACK_WIND (frame, error_gen_fxattrop_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1575, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fxattrop_cbk) tmp_cbk = error_gen_fxattrop_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fxattrop" ; _new->unwind_to = "error_gen_fxattrop_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fxattrop); (this->children->xlator )->fops->fxattrop (_new, (this->children->xlator) , fd, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1573 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1575, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fxattrop_cbk) tmp_cbk = error_gen_fxattrop_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fxattrop" ; _new->unwind_to = "error_gen_fxattrop_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fxattrop); (this->children->xlator )->fops->fxattrop (_new, (this->children->xlator) , fd, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1574 | FIRST_CHILD(this)->fops->fxattrop,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1575, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fxattrop_cbk) tmp_cbk = error_gen_fxattrop_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fxattrop" ; _new->unwind_to = "error_gen_fxattrop_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fxattrop); (this->children->xlator )->fops->fxattrop (_new, (this->children->xlator) , fd, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1575 | fd, flags, dict, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1575, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fxattrop_cbk) tmp_cbk = error_gen_fxattrop_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fxattrop" ; _new->unwind_to = "error_gen_fxattrop_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fxattrop); (this->children->xlator )->fops->fxattrop (_new, (this->children->xlator) , fd, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1576 | return 0; | |||||
1577 | } | |||||
1578 | ||||||
1579 | ||||||
1580 | int | |||||
1581 | error_gen_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1582 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | |||||
1583 | { | |||||
1584 | STACK_UNWIND_STRICT (removexattr, frame, op_ret, op_errno, xdata)do { fop_removexattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1584, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_removexattr_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1585 | return 0; | |||||
1586 | } | |||||
1587 | ||||||
1588 | ||||||
1589 | int | |||||
1590 | error_gen_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, | |||||
1591 | const char *name, dict_t *xdata) | |||||
1592 | { | |||||
1593 | int op_errno = 0; | |||||
1594 | eg_t *egp = NULL((void*)0); | |||||
1595 | int enable = 1; | |||||
1596 | ||||||
1597 | egp = this->private; | |||||
1598 | enable = egp->enable[GF_FOP_REMOVEXATTR]; | |||||
1599 | ||||||
1600 | if (enable) | |||||
1601 | op_errno = error_gen (this, GF_FOP_REMOVEXATTR); | |||||
1602 | ||||||
1603 | if (op_errno) { | |||||
1604 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1604, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1605 | STACK_UNWIND_STRICT (removexattr, frame, -1, op_errno, xdata)do { fop_removexattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1605, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_removexattr_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1606 | return 0; | |||||
1607 | } | |||||
1608 | ||||||
1609 | STACK_WIND (frame, error_gen_removexattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1612, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->removexattr_cbk) tmp_cbk = error_gen_removexattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr" ; _new->unwind_to = "error_gen_removexattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->removexattr); (this->children-> xlator)->fops->removexattr (_new, (this->children-> xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1610 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1612, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->removexattr_cbk) tmp_cbk = error_gen_removexattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr" ; _new->unwind_to = "error_gen_removexattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->removexattr); (this->children-> xlator)->fops->removexattr (_new, (this->children-> xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1611 | FIRST_CHILD(this)->fops->removexattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1612, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->removexattr_cbk) tmp_cbk = error_gen_removexattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr" ; _new->unwind_to = "error_gen_removexattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->removexattr); (this->children-> xlator)->fops->removexattr (_new, (this->children-> xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1612 | loc, name, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1612, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->removexattr_cbk) tmp_cbk = error_gen_removexattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr" ; _new->unwind_to = "error_gen_removexattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->removexattr); (this->children-> xlator)->fops->removexattr (_new, (this->children-> xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1613 | return 0; | |||||
1614 | } | |||||
1615 | ||||||
1616 | int | |||||
1617 | error_gen_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1618 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | |||||
1619 | { | |||||
1620 | STACK_UNWIND_STRICT (fremovexattr, frame, op_ret, op_errno, xdata)do { fop_fremovexattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1620, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fremovexattr_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1621 | return 0; | |||||
1622 | } | |||||
1623 | ||||||
1624 | ||||||
1625 | int | |||||
1626 | error_gen_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd, | |||||
1627 | const char *name, dict_t *xdata) | |||||
1628 | { | |||||
1629 | int op_errno = 0; | |||||
1630 | eg_t *egp = NULL((void*)0); | |||||
1631 | int enable = 1; | |||||
1632 | ||||||
1633 | egp = this->private; | |||||
1634 | enable = egp->enable[GF_FOP_FREMOVEXATTR]; | |||||
1635 | ||||||
1636 | if (enable) | |||||
1637 | op_errno = error_gen (this, GF_FOP_FREMOVEXATTR); | |||||
1638 | ||||||
1639 | if (op_errno) { | |||||
1640 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1640, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1641 | STACK_UNWIND_STRICT (fremovexattr, frame, -1, op_errno, xdata)do { fop_fremovexattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1641, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fremovexattr_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1642 | return 0; | |||||
1643 | } | |||||
1644 | ||||||
1645 | STACK_WIND (frame, error_gen_fremovexattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1648, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fremovexattr_cbk) tmp_cbk = error_gen_fremovexattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fremovexattr" ; _new->unwind_to = "error_gen_fremovexattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fremovexattr); (this->children-> xlator)->fops->fremovexattr (_new, (this->children-> xlator), fd, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1646 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1648, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fremovexattr_cbk) tmp_cbk = error_gen_fremovexattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fremovexattr" ; _new->unwind_to = "error_gen_fremovexattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fremovexattr); (this->children-> xlator)->fops->fremovexattr (_new, (this->children-> xlator), fd, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1647 | FIRST_CHILD(this)->fops->fremovexattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1648, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fremovexattr_cbk) tmp_cbk = error_gen_fremovexattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fremovexattr" ; _new->unwind_to = "error_gen_fremovexattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fremovexattr); (this->children-> xlator)->fops->fremovexattr (_new, (this->children-> xlator), fd, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1648 | fd, name, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1648, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fremovexattr_cbk) tmp_cbk = error_gen_fremovexattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fremovexattr" ; _new->unwind_to = "error_gen_fremovexattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fremovexattr); (this->children-> xlator)->fops->fremovexattr (_new, (this->children-> xlator), fd, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1649 | return 0; | |||||
1650 | } | |||||
1651 | ||||||
1652 | ||||||
1653 | int | |||||
1654 | error_gen_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1655 | int32_t op_ret, int32_t op_errno, struct gf_flock *lock, dict_t *xdata) | |||||
1656 | { | |||||
1657 | STACK_UNWIND_STRICT (lk, frame, op_ret, op_errno, lock, xdata)do { fop_lk_cbk_t fn = ((void*)0); call_frame_t *_parent = (( void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1657, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_lk_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, lock, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1658 | return 0; | |||||
1659 | } | |||||
1660 | ||||||
1661 | ||||||
1662 | int | |||||
1663 | error_gen_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, | |||||
1664 | struct gf_flock *lock, dict_t *xdata) | |||||
1665 | { | |||||
1666 | int op_errno = 0; | |||||
1667 | eg_t *egp = NULL((void*)0); | |||||
1668 | int enable = 1; | |||||
1669 | ||||||
1670 | egp = this->private; | |||||
1671 | enable = egp->enable[GF_FOP_LK]; | |||||
1672 | ||||||
1673 | if (enable) | |||||
1674 | op_errno = error_gen (this, GF_FOP_LK); | |||||
1675 | ||||||
1676 | if (op_errno) { | |||||
1677 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1677, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1678 | STACK_UNWIND_STRICT (lk, frame, -1, op_errno, NULL, xdata)do { fop_lk_cbk_t fn = ((void*)0); call_frame_t *_parent = (( void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1678, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_lk_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); | |||||
1679 | return 0; | |||||
1680 | } | |||||
1681 | ||||||
1682 | STACK_WIND (frame, error_gen_lk_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1685, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->lk_cbk) tmp_cbk = error_gen_lk_cbk; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->lk"; _new ->unwind_to = "error_gen_lk_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->lk); (this->children->xlator) ->fops->lk (_new, (this->children->xlator), fd, cmd , lock, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
1683 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1685, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->lk_cbk) tmp_cbk = error_gen_lk_cbk; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->lk"; _new ->unwind_to = "error_gen_lk_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->lk); (this->children->xlator) ->fops->lk (_new, (this->children->xlator), fd, cmd , lock, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
1684 | FIRST_CHILD(this)->fops->lk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1685, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->lk_cbk) tmp_cbk = error_gen_lk_cbk; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->lk"; _new ->unwind_to = "error_gen_lk_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->lk); (this->children->xlator) ->fops->lk (_new, (this->children->xlator), fd, cmd , lock, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
1685 | fd, cmd, lock, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1685, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->lk_cbk) tmp_cbk = error_gen_lk_cbk; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->lk"; _new ->unwind_to = "error_gen_lk_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->lk); (this->children->xlator) ->fops->lk (_new, (this->children->xlator), fd, cmd , lock, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||||
1686 | return 0; | |||||
1687 | } | |||||
1688 | ||||||
1689 | ||||||
1690 | int | |||||
1691 | error_gen_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1692 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | |||||
1693 | { | |||||
1694 | STACK_UNWIND_STRICT (inodelk, frame, op_ret, op_errno, xdata)do { fop_inodelk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1694, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_inodelk_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1695 | return 0; | |||||
1696 | } | |||||
1697 | ||||||
1698 | ||||||
1699 | int | |||||
1700 | error_gen_inodelk (call_frame_t *frame, xlator_t *this, | |||||
1701 | const char *volume, loc_t *loc, int32_t cmd, | |||||
1702 | struct gf_flock *lock, dict_t *xdata) | |||||
1703 | { | |||||
1704 | int op_errno = 0; | |||||
1705 | eg_t *egp = NULL((void*)0); | |||||
1706 | int enable = 1; | |||||
1707 | ||||||
1708 | egp = this->private; | |||||
1709 | enable = egp->enable[GF_FOP_INODELK]; | |||||
1710 | ||||||
1711 | if (enable) | |||||
1712 | op_errno = error_gen (this, GF_FOP_INODELK); | |||||
1713 | ||||||
1714 | if (op_errno) { | |||||
1715 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1715, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1716 | STACK_UNWIND_STRICT (inodelk, frame, -1, op_errno, xdata)do { fop_inodelk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1716, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_inodelk_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1717 | return 0; | |||||
1718 | } | |||||
1719 | ||||||
1720 | STACK_WIND (frame, error_gen_inodelk_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1723, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = error_gen_inodelk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "error_gen_inodelk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), volume, loc, cmd, lock, xdata); (*__glusterfs_this_location( )) = old_THIS; } while (0) | |||||
1721 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1723, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = error_gen_inodelk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "error_gen_inodelk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), volume, loc, cmd, lock, xdata); (*__glusterfs_this_location( )) = old_THIS; } while (0) | |||||
1722 | FIRST_CHILD(this)->fops->inodelk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1723, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = error_gen_inodelk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "error_gen_inodelk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), volume, loc, cmd, lock, xdata); (*__glusterfs_this_location( )) = old_THIS; } while (0) | |||||
1723 | volume, loc, cmd, lock, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1723, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = error_gen_inodelk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "error_gen_inodelk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), volume, loc, cmd, lock, xdata); (*__glusterfs_this_location( )) = old_THIS; } while (0); | |||||
1724 | return 0; | |||||
1725 | } | |||||
1726 | ||||||
1727 | ||||||
1728 | int | |||||
1729 | error_gen_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1730 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | |||||
1731 | { | |||||
1732 | STACK_UNWIND_STRICT (finodelk, frame, op_ret, op_errno, xdata)do { fop_finodelk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1732, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_finodelk_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1733 | return 0; | |||||
1734 | } | |||||
1735 | ||||||
1736 | ||||||
1737 | int | |||||
1738 | error_gen_finodelk (call_frame_t *frame, xlator_t *this, | |||||
1739 | const char *volume, fd_t *fd, int32_t cmd, | |||||
1740 | struct gf_flock *lock, dict_t *xdata) | |||||
1741 | { | |||||
1742 | int op_errno = 0; | |||||
1743 | eg_t *egp = NULL((void*)0); | |||||
1744 | int enable = 1; | |||||
1745 | ||||||
1746 | egp = this->private; | |||||
1747 | enable = egp->enable[GF_FOP_FINODELK]; | |||||
1748 | ||||||
1749 | if (enable) | |||||
1750 | op_errno = error_gen (this, GF_FOP_FINODELK); | |||||
1751 | ||||||
1752 | if (op_errno) { | |||||
1753 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1753, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1754 | STACK_UNWIND_STRICT (finodelk, frame, -1, op_errno, xdata)do { fop_finodelk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1754, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_finodelk_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1755 | return 0; | |||||
1756 | } | |||||
1757 | ||||||
1758 | STACK_WIND (frame, error_gen_finodelk_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1761, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->finodelk_cbk) tmp_cbk = error_gen_finodelk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->finodelk" ; _new->unwind_to = "error_gen_finodelk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->finodelk); (this->children->xlator )->fops->finodelk (_new, (this->children->xlator) , volume, fd, cmd, lock, xdata); (*__glusterfs_this_location( )) = old_THIS; } while (0) | |||||
1759 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1761, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->finodelk_cbk) tmp_cbk = error_gen_finodelk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->finodelk" ; _new->unwind_to = "error_gen_finodelk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->finodelk); (this->children->xlator )->fops->finodelk (_new, (this->children->xlator) , volume, fd, cmd, lock, xdata); (*__glusterfs_this_location( )) = old_THIS; } while (0) | |||||
1760 | FIRST_CHILD(this)->fops->finodelk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1761, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->finodelk_cbk) tmp_cbk = error_gen_finodelk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->finodelk" ; _new->unwind_to = "error_gen_finodelk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->finodelk); (this->children->xlator )->fops->finodelk (_new, (this->children->xlator) , volume, fd, cmd, lock, xdata); (*__glusterfs_this_location( )) = old_THIS; } while (0) | |||||
1761 | volume, fd, cmd, lock, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1761, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->finodelk_cbk) tmp_cbk = error_gen_finodelk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->finodelk" ; _new->unwind_to = "error_gen_finodelk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->finodelk); (this->children->xlator )->fops->finodelk (_new, (this->children->xlator) , volume, fd, cmd, lock, xdata); (*__glusterfs_this_location( )) = old_THIS; } while (0); | |||||
1762 | return 0; | |||||
1763 | } | |||||
1764 | ||||||
1765 | ||||||
1766 | int | |||||
1767 | error_gen_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1768 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | |||||
1769 | { | |||||
1770 | STACK_UNWIND_STRICT (entrylk, frame, op_ret, op_errno, xdata)do { fop_entrylk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1770, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_entrylk_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1771 | return 0; | |||||
1772 | } | |||||
1773 | ||||||
1774 | ||||||
1775 | int | |||||
1776 | error_gen_entrylk (call_frame_t *frame, xlator_t *this, | |||||
1777 | const char *volume, loc_t *loc, const char *basename, | |||||
1778 | entrylk_cmd cmd, entrylk_type type, dict_t *xdata) | |||||
1779 | { | |||||
1780 | int op_errno = 0; | |||||
1781 | eg_t *egp = NULL((void*)0); | |||||
1782 | int enable = 1; | |||||
1783 | ||||||
1784 | egp = this->private; | |||||
1785 | enable = egp->enable[GF_FOP_ENTRYLK]; | |||||
1786 | ||||||
1787 | if (enable) | |||||
1788 | op_errno = error_gen (this, GF_FOP_ENTRYLK); | |||||
1789 | ||||||
1790 | if (op_errno) { | |||||
1791 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1791, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1792 | STACK_UNWIND_STRICT (entrylk, frame, -1, op_errno, xdata)do { fop_entrylk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1792, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_entrylk_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1793 | return 0; | |||||
1794 | } | |||||
1795 | ||||||
1796 | STACK_WIND (frame, error_gen_entrylk_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1799, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->entrylk_cbk) tmp_cbk = error_gen_entrylk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->entrylk" ; _new->unwind_to = "error_gen_entrylk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->entrylk); (this->children->xlator )->fops->entrylk (_new, (this->children->xlator), volume, loc, basename, cmd, type, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
1797 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1799, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->entrylk_cbk) tmp_cbk = error_gen_entrylk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->entrylk" ; _new->unwind_to = "error_gen_entrylk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->entrylk); (this->children->xlator )->fops->entrylk (_new, (this->children->xlator), volume, loc, basename, cmd, type, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
1798 | FIRST_CHILD(this)->fops->entrylk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1799, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->entrylk_cbk) tmp_cbk = error_gen_entrylk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->entrylk" ; _new->unwind_to = "error_gen_entrylk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->entrylk); (this->children->xlator )->fops->entrylk (_new, (this->children->xlator), volume, loc, basename, cmd, type, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
1799 | volume, loc, basename, cmd, type, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1799, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->entrylk_cbk) tmp_cbk = error_gen_entrylk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->entrylk" ; _new->unwind_to = "error_gen_entrylk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->entrylk); (this->children->xlator )->fops->entrylk (_new, (this->children->xlator), volume, loc, basename, cmd, type, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
1800 | return 0; | |||||
1801 | } | |||||
1802 | ||||||
1803 | ||||||
1804 | int | |||||
1805 | error_gen_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1806 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | |||||
1807 | { | |||||
1808 | STACK_UNWIND_STRICT (fentrylk, frame, op_ret, op_errno, xdata)do { fop_fentrylk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1808, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fentrylk_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1809 | return 0; | |||||
1810 | } | |||||
1811 | ||||||
1812 | ||||||
1813 | int | |||||
1814 | error_gen_fentrylk (call_frame_t *frame, xlator_t *this, | |||||
1815 | const char *volume, fd_t *fd, const char *basename, | |||||
1816 | entrylk_cmd cmd, entrylk_type type, dict_t *xdata) | |||||
1817 | { | |||||
1818 | int op_errno = 0; | |||||
1819 | eg_t *egp = NULL((void*)0); | |||||
1820 | int enable = 1; | |||||
1821 | ||||||
1822 | egp = this->private; | |||||
1823 | enable = egp->enable[GF_FOP_FENTRYLK]; | |||||
1824 | ||||||
1825 | if (enable) | |||||
1826 | op_errno = error_gen (this, GF_FOP_FENTRYLK); | |||||
1827 | ||||||
1828 | if (op_errno) { | |||||
1829 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1829, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1830 | STACK_UNWIND_STRICT (fentrylk, frame, -1, op_errno, xdata)do { fop_fentrylk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1830, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fentrylk_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1831 | return 0; | |||||
1832 | } | |||||
1833 | ||||||
1834 | STACK_WIND (frame, error_gen_fentrylk_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1837, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fentrylk_cbk) tmp_cbk = error_gen_fentrylk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fentrylk" ; _new->unwind_to = "error_gen_fentrylk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fentrylk); (this->children->xlator )->fops->fentrylk (_new, (this->children->xlator) , volume, fd, basename, cmd, type, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
1835 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1837, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fentrylk_cbk) tmp_cbk = error_gen_fentrylk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fentrylk" ; _new->unwind_to = "error_gen_fentrylk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fentrylk); (this->children->xlator )->fops->fentrylk (_new, (this->children->xlator) , volume, fd, basename, cmd, type, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
1836 | FIRST_CHILD(this)->fops->fentrylk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1837, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fentrylk_cbk) tmp_cbk = error_gen_fentrylk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fentrylk" ; _new->unwind_to = "error_gen_fentrylk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fentrylk); (this->children->xlator )->fops->fentrylk (_new, (this->children->xlator) , volume, fd, basename, cmd, type, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||||
1837 | volume, fd, basename, cmd, type, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1837, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fentrylk_cbk) tmp_cbk = error_gen_fentrylk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fentrylk" ; _new->unwind_to = "error_gen_fentrylk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fentrylk); (this->children->xlator )->fops->fentrylk (_new, (this->children->xlator) , volume, fd, basename, cmd, type, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
1838 | return 0; | |||||
1839 | } | |||||
1840 | ||||||
1841 | ||||||
1842 | /* Management operations */ | |||||
1843 | ||||||
1844 | ||||||
1845 | int | |||||
1846 | error_gen_getspec_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1847 | int32_t op_ret, int32_t op_errno, char *spec_data) | |||||
1848 | { | |||||
1849 | STACK_UNWIND_STRICT (getspec, frame, op_ret, op_errno, spec_data)do { fop_getspec_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1849, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_getspec_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, spec_data); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1850 | return 0; | |||||
1851 | } | |||||
1852 | ||||||
1853 | ||||||
1854 | int | |||||
1855 | error_gen_getspec (call_frame_t *frame, xlator_t *this, const char *key, | |||||
1856 | int32_t flags) | |||||
1857 | { | |||||
1858 | int op_errno = 0; | |||||
1859 | eg_t *egp = NULL((void*)0); | |||||
1860 | int enable = 1; | |||||
1861 | ||||||
1862 | egp = this->private; | |||||
1863 | enable = egp->enable[GF_FOP_GETSPEC]; | |||||
1864 | ||||||
1865 | if (enable) | |||||
1866 | op_errno = error_gen (this, GF_FOP_GETSPEC); | |||||
1867 | ||||||
1868 | if (op_errno) { | |||||
1869 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1869, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1870 | STACK_UNWIND_STRICT (getspec, frame, -1, op_errno, NULL)do { fop_getspec_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1870, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_getspec_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1871 | return 0; | |||||
1872 | } | |||||
1873 | ||||||
1874 | STACK_WIND (frame, error_gen_getspec_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1877, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getspec_cbk) tmp_cbk = error_gen_getspec_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->getspec" ; _new->unwind_to = "error_gen_getspec_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->getspec); (this->children->xlator )->fops->getspec (_new, (this->children->xlator), key, flags); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
1875 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1877, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getspec_cbk) tmp_cbk = error_gen_getspec_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->getspec" ; _new->unwind_to = "error_gen_getspec_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->getspec); (this->children->xlator )->fops->getspec (_new, (this->children->xlator), key, flags); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
1876 | FIRST_CHILD(this)->fops->getspec,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1877, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getspec_cbk) tmp_cbk = error_gen_getspec_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->getspec" ; _new->unwind_to = "error_gen_getspec_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->getspec); (this->children->xlator )->fops->getspec (_new, (this->children->xlator), key, flags); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||||
1877 | key, flags)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1877, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getspec_cbk) tmp_cbk = error_gen_getspec_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->getspec" ; _new->unwind_to = "error_gen_getspec_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->getspec); (this->children->xlator )->fops->getspec (_new, (this->children->xlator), key, flags); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||||
1878 | return 0; | |||||
1879 | } | |||||
1880 | ||||||
1881 | ||||||
1882 | int | |||||
1883 | error_gen_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1884 | int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, | |||||
1885 | dict_t *xdata) | |||||
1886 | { | |||||
1887 | STACK_UNWIND_STRICT (readdir, frame, op_ret, op_errno, entries, xdata)do { fop_readdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1887, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_readdir_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, entries, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||||
1888 | return 0; | |||||
1889 | } | |||||
1890 | ||||||
1891 | ||||||
1892 | int | |||||
1893 | error_gen_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, | |||||
1894 | size_t size, off_t off, dict_t *xdata) | |||||
1895 | { | |||||
1896 | int op_errno = 0; | |||||
1897 | eg_t *egp = NULL((void*)0); | |||||
1898 | int enable = 1; | |||||
1899 | ||||||
1900 | egp = this->private; | |||||
1901 | enable = egp->enable[GF_FOP_READDIR]; | |||||
1902 | ||||||
1903 | if (enable) | |||||
1904 | op_errno = error_gen (this, GF_FOP_READDIR); | |||||
1905 | ||||||
1906 | if (op_errno) { | |||||
1907 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1907, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1908 | STACK_UNWIND_STRICT (readdir, frame, -1, op_errno, NULL, xdata)do { fop_readdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1908, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_readdir_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); | |||||
1909 | return 0; | |||||
1910 | } | |||||
1911 | ||||||
1912 | STACK_WIND (frame, error_gen_readdir_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1915, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readdir_cbk) tmp_cbk = error_gen_readdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->readdir" ; _new->unwind_to = "error_gen_readdir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->readdir); (this->children->xlator )->fops->readdir (_new, (this->children->xlator), fd, size, off, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1913 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1915, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readdir_cbk) tmp_cbk = error_gen_readdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->readdir" ; _new->unwind_to = "error_gen_readdir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->readdir); (this->children->xlator )->fops->readdir (_new, (this->children->xlator), fd, size, off, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1914 | FIRST_CHILD(this)->fops->readdir,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1915, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readdir_cbk) tmp_cbk = error_gen_readdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->readdir" ; _new->unwind_to = "error_gen_readdir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->readdir); (this->children->xlator )->fops->readdir (_new, (this->children->xlator), fd, size, off, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1915 | fd, size, off, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1915, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readdir_cbk) tmp_cbk = error_gen_readdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->readdir" ; _new->unwind_to = "error_gen_readdir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->readdir); (this->children->xlator )->fops->readdir (_new, (this->children->xlator), fd, size, off, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1916 | return 0; | |||||
1917 | } | |||||
1918 | ||||||
1919 | ||||||
1920 | int | |||||
1921 | error_gen_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||||
1922 | int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, | |||||
1923 | dict_t *xdata) | |||||
1924 | { | |||||
1925 | STACK_UNWIND_STRICT (readdirp, frame, op_ret, op_errno, entries, xdata)do { fop_readdirp_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1925, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_readdirp_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, entries, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||||
1926 | return 0; | |||||
1927 | } | |||||
1928 | ||||||
1929 | ||||||
1930 | int | |||||
1931 | error_gen_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, | |||||
1932 | off_t off, dict_t *dict) | |||||
1933 | { | |||||
1934 | int op_errno = 0; | |||||
1935 | eg_t *egp = NULL((void*)0); | |||||
1936 | int enable = 1; | |||||
1937 | ||||||
1938 | egp = this->private; | |||||
1939 | enable = egp->enable[GF_FOP_READDIRP]; | |||||
1940 | ||||||
1941 | if (enable) | |||||
1942 | op_errno = error_gen (this, GF_FOP_READDIRP); | |||||
1943 | ||||||
1944 | if (op_errno) { | |||||
1945 | GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno))do { do { if (0) printf ("unwind(-1, %s)", strerror (op_errno )); } while (0); _gf_log ((this)->name, "error-gen.c", __FUNCTION__ , 1945, GF_LOG_ERROR, "unwind(-1, %s)", strerror (op_errno)); } while (0); | |||||
1946 | STACK_UNWIND_STRICT (readdirp, frame, -1, op_errno, NULL, NULL)do { fop_readdirp_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "error-gen.c", __FUNCTION__, 1946, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_readdirp_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||||
1947 | return 0; | |||||
1948 | } | |||||
1949 | ||||||
1950 | STACK_WIND (frame, error_gen_readdirp_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1953, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readdirp_cbk) tmp_cbk = error_gen_readdirp_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->readdirp" ; _new->unwind_to = "error_gen_readdirp_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->readdirp); (this->children->xlator )->fops->readdirp (_new, (this->children->xlator) , fd, size, off, dict); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1951 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1953, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readdirp_cbk) tmp_cbk = error_gen_readdirp_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->readdirp" ; _new->unwind_to = "error_gen_readdirp_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->readdirp); (this->children->xlator )->fops->readdirp (_new, (this->children->xlator) , fd, size, off, dict); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1952 | FIRST_CHILD(this)->fops->readdirp,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1953, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readdirp_cbk) tmp_cbk = error_gen_readdirp_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->readdirp" ; _new->unwind_to = "error_gen_readdirp_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->readdirp); (this->children->xlator )->fops->readdirp (_new, (this->children->xlator) , fd, size, off, dict); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||||
1953 | fd, size, off, dict)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "error-gen.c", __FUNCTION__, 1953, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readdirp_cbk) tmp_cbk = error_gen_readdirp_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->readdirp" ; _new->unwind_to = "error_gen_readdirp_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->readdirp); (this->children->xlator )->fops->readdirp (_new, (this->children->xlator) , fd, size, off, dict); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||||
1954 | return 0; | |||||
1955 | } | |||||
1956 | ||||||
1957 | static void | |||||
1958 | error_gen_set_failure (eg_t *pvt, int percent) | |||||
1959 | { | |||||
1960 | GF_ASSERT (pvt)do { if (!(pvt)) { do { do { if (0) printf ("Assertion failed: " "pvt"); } while (0); _gf_log_callingfn ("", "error-gen.c", __FUNCTION__ , 1960, GF_LOG_ERROR, "Assertion failed: " "pvt"); } while (0 ); } } while (0); | |||||
1961 | ||||||
1962 | if (percent) | |||||
1963 | pvt->failure_iter_no = 100/percent; | |||||
1964 | else | |||||
1965 | pvt->failure_iter_no = 100/GF_FAILURE_DEFAULT10; | |||||
1966 | } | |||||
1967 | ||||||
1968 | static void | |||||
1969 | error_gen_parse_fill_fops (eg_t *pvt, char *enable_fops) | |||||
1970 | { | |||||
1971 | char *op_no_str = NULL((void*)0); | |||||
1972 | int op_no = -1; | |||||
1973 | int i = 0; | |||||
1974 | xlator_t *this = THIS(*__glusterfs_this_location()); | |||||
1975 | char *saveptr = NULL((void*)0); | |||||
1976 | ||||||
1977 | GF_ASSERT (pvt)do { if (!(pvt)) { do { do { if (0) printf ("Assertion failed: " "pvt"); } while (0); _gf_log_callingfn ("", "error-gen.c", __FUNCTION__ , 1977, GF_LOG_ERROR, "Assertion failed: " "pvt"); } while (0 ); } } while (0); | |||||
1978 | GF_ASSERT (this)do { if (!(this)) { do { do { if (0) printf ("Assertion failed: " "this"); } while (0); _gf_log_callingfn ("", "error-gen.c", __FUNCTION__ , 1978, GF_LOG_ERROR, "Assertion failed: " "this"); } while ( 0); } } while (0); | |||||
1979 | ||||||
1980 | for (i = 0; i < GF_FOP_MAXVALUE; i++) | |||||
1981 | pvt->enable[i] = 0; | |||||
1982 | ||||||
1983 | if (!enable_fops) { | |||||
1984 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("All fops are enabled."); } while (0 ); _gf_log (this->name, "error-gen.c", __FUNCTION__, 1985, GF_LOG_WARNING, "All fops are enabled."); } while (0) | |||||
1985 | "All fops are enabled.")do { do { if (0) printf ("All fops are enabled."); } while (0 ); _gf_log (this->name, "error-gen.c", __FUNCTION__, 1985, GF_LOG_WARNING, "All fops are enabled."); } while (0); | |||||
1986 | for (i = 0; i < GF_FOP_MAXVALUE; i++) | |||||
1987 | pvt->enable[i] = 1; | |||||
1988 | } else { | |||||
1989 | op_no_str = strtok_r (enable_fops, ",", &saveptr); | |||||
1990 | while (op_no_str) { | |||||
1991 | op_no = get_fop_int (&op_no_str); | |||||
1992 | if (op_no == -1) { | |||||
1993 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("Wrong option value %s", op_no_str); } while (0); _gf_log (this->name, "error-gen.c", __FUNCTION__ , 1994, GF_LOG_WARNING, "Wrong option value %s", op_no_str); } while (0) | |||||
1994 | "Wrong option value %s", op_no_str)do { do { if (0) printf ("Wrong option value %s", op_no_str); } while (0); _gf_log (this->name, "error-gen.c", __FUNCTION__ , 1994, GF_LOG_WARNING, "Wrong option value %s", op_no_str); } while (0); | |||||
1995 | } else | |||||
1996 | pvt->enable[op_no] = 1; | |||||
1997 | ||||||
1998 | op_no_str = strtok_r (NULL((void*)0), ",", &saveptr); | |||||
1999 | } | |||||
2000 | } | |||||
2001 | } | |||||
2002 | ||||||
2003 | int32_t | |||||
2004 | error_gen_priv_dump (xlator_t *this) | |||||
2005 | { | |||||
2006 | char key_prefix[GF_DUMP_MAX_BUF_LEN4096]; | |||||
2007 | int ret = -1; | |||||
2008 | eg_t *conf = NULL((void*)0); | |||||
2009 | ||||||
2010 | if (!this) | |||||
2011 | goto out; | |||||
2012 | ||||||
2013 | conf = this->private; | |||||
2014 | if (!conf) | |||||
2015 | goto out; | |||||
2016 | ||||||
2017 | ret = TRY_LOCK(&conf->lock)pthread_spin_trylock (&conf->lock); | |||||
2018 | if (ret != 0) { | |||||
2019 | return ret; | |||||
2020 | } | |||||
2021 | ||||||
2022 | gf_proc_dump_add_section("xlator.debug.error-gen.%s.priv", this->name); | |||||
2023 | gf_proc_dump_build_key(key_prefix,"xlator.debug.error-gen","%s.priv",{ _gf_proc_dump_build_key(key_prefix, "xlator.debug.error-gen" ,"%s.priv", this->name); } | |||||
2024 | this->name){ _gf_proc_dump_build_key(key_prefix, "xlator.debug.error-gen" ,"%s.priv", this->name); }; | |||||
2025 | ||||||
2026 | gf_proc_dump_write("op_count", "%d", conf->op_count); | |||||
2027 | gf_proc_dump_write("failure_iter_no", "%d", conf->failure_iter_no); | |||||
2028 | gf_proc_dump_write("error_no", "%s", conf->error_no); | |||||
2029 | gf_proc_dump_write("random_failure", "%d", conf->random_failure); | |||||
2030 | ||||||
2031 | UNLOCK(&conf->lock)pthread_spin_unlock (&conf->lock); | |||||
2032 | out: | |||||
2033 | return ret; | |||||
2034 | } | |||||
2035 | ||||||
2036 | int32_t | |||||
2037 | mem_acct_init (xlator_t *this) | |||||
2038 | { | |||||
2039 | int ret = -1; | |||||
2040 | ||||||
2041 | if (!this) | |||||
2042 | return ret; | |||||
2043 | ||||||
2044 | ret = xlator_mem_acct_init (this, gf_error_gen_mt_end + 1); | |||||
2045 | ||||||
2046 | if (ret != 0) { | |||||
2047 | gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"do { do { if (0) printf ("Memory accounting init" " failed"); } while (0); _gf_log (this->name, "error-gen.c", __FUNCTION__ , 2048, GF_LOG_ERROR, "Memory accounting init" " failed"); } while (0) | |||||
2048 | " failed")do { do { if (0) printf ("Memory accounting init" " failed"); } while (0); _gf_log (this->name, "error-gen.c", __FUNCTION__ , 2048, GF_LOG_ERROR, "Memory accounting init" " failed"); } while (0); | |||||
2049 | return ret; | |||||
2050 | } | |||||
2051 | ||||||
2052 | return ret; | |||||
2053 | } | |||||
2054 | ||||||
2055 | int | |||||
2056 | reconfigure (xlator_t *this, dict_t *options) | |||||
2057 | { | |||||
2058 | eg_t *pvt = NULL((void*)0); | |||||
2059 | int32_t ret = 0; | |||||
2060 | char *error_enable_fops = NULL((void*)0); | |||||
2061 | int32_t failure_percent_int = 0; | |||||
2062 | ||||||
2063 | if (!this || !this->private) | |||||
| ||||||
2064 | goto out; | |||||
2065 | ||||||
2066 | pvt = this->private; | |||||
2067 | ||||||
2068 | GF_OPTION_RECONF ("error-no", pvt->error_no, options, str, out)do { int val_ret = 0; val_ret = xlator_option_reconf_str ((*__glusterfs_this_location ()), options, "error-no", &(pvt->error_no)); if (val_ret ) goto out; } while (0); | |||||
2069 | ||||||
2070 | GF_OPTION_RECONF ("failure", failure_percent_int, options, int32,do { int val_ret = 0; val_ret = xlator_option_reconf_int32 (( *__glusterfs_this_location()), options, "failure", &(failure_percent_int )); if (val_ret) goto out; } while (0) | |||||
2071 | out)do { int val_ret = 0; val_ret = xlator_option_reconf_int32 (( *__glusterfs_this_location()), options, "failure", &(failure_percent_int )); if (val_ret) goto out; } while (0); | |||||
2072 | ||||||
2073 | GF_OPTION_RECONF ("enable", error_enable_fops, options, str, out)do { int val_ret = 0; val_ret = xlator_option_reconf_str ((*__glusterfs_this_location ()), options, "enable", &(error_enable_fops)); if (val_ret ) goto out; } while (0); | |||||
2074 | ||||||
2075 | GF_OPTION_RECONF ("random-failure", pvt->random_failure, options,do { int val_ret = 0; val_ret = xlator_option_reconf_bool ((* __glusterfs_this_location()), options, "random-failure", & (pvt->random_failure)); if (val_ret) goto out; } while (0) | |||||
2076 | bool, out)do { int val_ret = 0; val_ret = xlator_option_reconf_bool ((* __glusterfs_this_location()), options, "random-failure", & (pvt->random_failure)); if (val_ret) goto out; } while (0); | |||||
2077 | ||||||
2078 | error_gen_parse_fill_fops (pvt, error_enable_fops); | |||||
2079 | error_gen_set_failure (pvt, failure_percent_int); | |||||
2080 | ||||||
2081 | ret = 0; | |||||
2082 | out: | |||||
2083 | gf_log (this->name, GF_LOG_DEBUG, "reconfigure returning %d", ret)do { do { if (0) printf ("reconfigure returning %d", ret); } while (0); _gf_log (this->name, "error-gen.c", __FUNCTION__, 2083 , GF_LOG_DEBUG, "reconfigure returning %d", ret); } while (0); | |||||
| ||||||
2084 | return ret; | |||||
2085 | } | |||||
2086 | ||||||
2087 | int | |||||
2088 | init (xlator_t *this) | |||||
2089 | { | |||||
2090 | eg_t *pvt = NULL((void*)0); | |||||
2091 | int32_t ret = 0; | |||||
2092 | char *error_enable_fops = NULL((void*)0); | |||||
2093 | int32_t failure_percent_int = 0; | |||||
2094 | ||||||
2095 | if (!this->children || this->children->next) { | |||||
2096 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("error-gen not configured with one subvolume" ); } while (0); _gf_log (this->name, "error-gen.c", __FUNCTION__ , 2097, GF_LOG_ERROR, "error-gen not configured with one subvolume" ); } while (0) | |||||
2097 | "error-gen not configured with one subvolume")do { do { if (0) printf ("error-gen not configured with one subvolume" ); } while (0); _gf_log (this->name, "error-gen.c", __FUNCTION__ , 2097, GF_LOG_ERROR, "error-gen not configured with one subvolume" ); } while (0); | |||||
2098 | ret = -1; | |||||
2099 | goto out; | |||||
2100 | } | |||||
2101 | ||||||
2102 | if (!this->parents) { | |||||
2103 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("dangling volume. check volfile "); } while (0); _gf_log (this->name, "error-gen.c", __FUNCTION__ , 2104, GF_LOG_WARNING, "dangling volume. check volfile "); } while (0) | |||||
2104 | "dangling volume. check volfile ")do { do { if (0) printf ("dangling volume. check volfile "); } while (0); _gf_log (this->name, "error-gen.c", __FUNCTION__ , 2104, GF_LOG_WARNING, "dangling volume. check volfile "); } while (0); | |||||
2105 | } | |||||
2106 | ||||||
2107 | pvt = GF_CALLOC (1, sizeof (eg_t), gf_error_gen_mt_eg_t)__gf_calloc (1, sizeof (eg_t), gf_error_gen_mt_eg_t); | |||||
2108 | ||||||
2109 | if (!pvt) { | |||||
2110 | ret = -1; | |||||
2111 | goto out; | |||||
2112 | } | |||||
2113 | ||||||
2114 | LOCK_INIT (&pvt->lock)pthread_spin_init (&pvt->lock, 0); | |||||
2115 | ||||||
2116 | GF_OPTION_INIT ("error-no", pvt->error_no, str, out)do { int val_ret = 0; val_ret = xlator_option_init_str ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "error-no", & (pvt->error_no)); if (val_ret) goto out; } while (0); | |||||
2117 | ||||||
2118 | GF_OPTION_INIT ("failure", failure_percent_int, int32, out)do { int val_ret = 0; val_ret = xlator_option_init_int32 ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "failure", & (failure_percent_int)); if (val_ret) goto out; } while (0); | |||||
2119 | ||||||
2120 | GF_OPTION_INIT ("enable", error_enable_fops, str, out)do { int val_ret = 0; val_ret = xlator_option_init_str ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "enable", & (error_enable_fops)); if (val_ret) goto out; } while (0); | |||||
2121 | ||||||
2122 | GF_OPTION_INIT ("random-failure", pvt->random_failure, bool, out)do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "random-failure" , &(pvt->random_failure)); if (val_ret) goto out; } while (0); | |||||
2123 | ||||||
2124 | ||||||
2125 | error_gen_parse_fill_fops (pvt, error_enable_fops); | |||||
2126 | error_gen_set_failure (pvt, failure_percent_int); | |||||
2127 | ||||||
2128 | this->private = pvt; | |||||
2129 | ||||||
2130 | /* Give some seed value here */ | |||||
2131 | srand (time(NULL((void*)0))); | |||||
2132 | out: | |||||
2133 | if (ret) | |||||
2134 | GF_FREE (pvt)__gf_free (pvt); | |||||
2135 | return ret; | |||||
2136 | } | |||||
2137 | ||||||
2138 | ||||||
2139 | void | |||||
2140 | fini (xlator_t *this) | |||||
2141 | { | |||||
2142 | eg_t *pvt = NULL((void*)0); | |||||
2143 | ||||||
2144 | if (!this) | |||||
2145 | return; | |||||
2146 | pvt = this->private; | |||||
2147 | ||||||
2148 | if (pvt) { | |||||
2149 | LOCK_DESTROY (&pvt->lock)pthread_spin_destroy (&pvt->lock); | |||||
2150 | GF_FREE (pvt)__gf_free (pvt); | |||||
2151 | gf_log (this->name, GF_LOG_DEBUG, "fini called")do { do { if (0) printf ("fini called"); } while (0); _gf_log (this->name, "error-gen.c", __FUNCTION__, 2151, GF_LOG_DEBUG , "fini called"); } while (0); | |||||
2152 | } | |||||
2153 | return; | |||||
2154 | } | |||||
2155 | ||||||
2156 | struct xlator_dumpops dumpops = { | |||||
2157 | .priv = error_gen_priv_dump, | |||||
2158 | }; | |||||
2159 | ||||||
2160 | struct xlator_fops cbks; | |||||
2161 | ||||||
2162 | struct xlator_fops fops = { | |||||
2163 | .lookup = error_gen_lookup, | |||||
2164 | .stat = error_gen_stat, | |||||
2165 | .readlink = error_gen_readlink, | |||||
2166 | .mknod = error_gen_mknod, | |||||
2167 | .mkdir = error_gen_mkdir, | |||||
2168 | .unlink = error_gen_unlink, | |||||
2169 | .rmdir = error_gen_rmdir, | |||||
2170 | .symlink = error_gen_symlink, | |||||
2171 | .rename = error_gen_rename, | |||||
2172 | .link = error_gen_link, | |||||
2173 | .truncate = error_gen_truncate, | |||||
2174 | .create = error_gen_create, | |||||
2175 | .open = error_gen_open, | |||||
2176 | .readv = error_gen_readv, | |||||
2177 | .writev = error_gen_writev, | |||||
2178 | .statfs = error_gen_statfs, | |||||
2179 | .flush = error_gen_flush, | |||||
2180 | .fsync = error_gen_fsync, | |||||
2181 | .setxattr = error_gen_setxattr, | |||||
2182 | .getxattr = error_gen_getxattr, | |||||
2183 | .removexattr = error_gen_removexattr, | |||||
2184 | .fsetxattr = error_gen_fsetxattr, | |||||
2185 | .fgetxattr = error_gen_fgetxattr, | |||||
2186 | .fremovexattr = error_gen_fremovexattr, | |||||
2187 | .opendir = error_gen_opendir, | |||||
2188 | .readdir = error_gen_readdir, | |||||
2189 | .readdirp = error_gen_readdirp, | |||||
2190 | .fsyncdir = error_gen_fsyncdir, | |||||
2191 | .access = error_gen_access, | |||||
2192 | .ftruncate = error_gen_ftruncate, | |||||
2193 | .fstat = error_gen_fstat, | |||||
2194 | .lk = error_gen_lk, | |||||
2195 | .lookup_cbk = error_gen_lookup_cbk, | |||||
2196 | .xattrop = error_gen_xattrop, | |||||
2197 | .fxattrop = error_gen_fxattrop, | |||||
2198 | .inodelk = error_gen_inodelk, | |||||
2199 | .finodelk = error_gen_finodelk, | |||||
2200 | .entrylk = error_gen_entrylk, | |||||
2201 | .fentrylk = error_gen_fentrylk, | |||||
2202 | .setattr = error_gen_setattr, | |||||
2203 | .fsetattr = error_gen_fsetattr, | |||||
2204 | .getspec = error_gen_getspec, | |||||
2205 | }; | |||||
2206 | ||||||
2207 | struct volume_options options[] = { | |||||
2208 | { .key = {"failure"}, | |||||
2209 | .type = GF_OPTION_TYPE_INT, | |||||
2210 | .description = "Percentage failure of operations when enabled.", | |||||
2211 | }, | |||||
2212 | ||||||
2213 | { .key = {"error-no"}, | |||||
2214 | .value = {"ENOENT","ENOTDIR","ENAMETOOLONG","EACCES","EBADF", | |||||
2215 | "EFAULT","ENOMEM","EINVAL","EIO","EEXIST","ENOSPC", | |||||
2216 | "EPERM","EROFS","EBUSY","EISDIR","ENOTEMPTY","EMLINK" | |||||
2217 | "ENODEV","EXDEV","EMFILE","ENFILE","ENOSYS","EINTR", | |||||
2218 | "EFBIG","EAGAIN","GF_ERROR_SHORT_WRITE"}, | |||||
2219 | .type = GF_OPTION_TYPE_STR, | |||||
2220 | }, | |||||
2221 | ||||||
2222 | { .key = {"random-failure"}, | |||||
2223 | .type = GF_OPTION_TYPE_BOOL, | |||||
2224 | .default_value = "off", | |||||
2225 | }, | |||||
2226 | ||||||
2227 | { .key = {"enable"}, | |||||
2228 | .type = GF_OPTION_TYPE_STR, | |||||
2229 | }, | |||||
2230 | ||||||
2231 | { .key = {NULL((void*)0)} } | |||||
2232 | }; |