Bug Summary

File:xlators/cluster/afr/src/afr-self-heal-entry.c
Location:line 1644, column 17
Description:Access to field 'children' results in a dereference of a null pointer (loaded from variable 'priv')

Annotated Source Code

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
11#include <libgen.h>
12#include <unistd.h>
13#include <fnmatch.h>
14#include <sys/time.h>
15#include <stdlib.h>
16#include <signal.h>
17
18#ifndef _CONFIG_H
19#define _CONFIG_H
20#include "config.h"
21#endif
22
23#include "glusterfs.h"
24#include "inode.h"
25#include "afr.h"
26#include "dict.h"
27#include "xlator.h"
28#include "hashfn.h"
29#include "logging.h"
30#include "stack.h"
31#include "list.h"
32#include "call-stub.h"
33#include "defaults.h"
34#include "common-utils.h"
35#include "compat-errno.h"
36#include "compat.h"
37#include "byte-order.h"
38
39#include "afr-transaction.h"
40#include "afr-self-heal.h"
41#include "afr-self-heal-common.h"
42
43#define AFR_INIT_SH_FRAME_VALS(_frame, _local, _sh, _sh_frame, _sh_local, _sh_sh)do { _local = _frame->local; _sh = &_local->self_heal
; _sh_frame = _sh->sh_frame; _sh_local = _sh_frame->local
; _sh_sh = &_sh_local->self_heal; } while (0);
\
44 do {\
45 _local = _frame->local;\
46 _sh = &_local->self_heal;\
47 _sh_frame = _sh->sh_frame;\
48 _sh_local = _sh_frame->local;\
49 _sh_sh = &_sh_local->self_heal;\
50 } while (0);
51
52int
53afr_sh_entry_impunge_create_file (call_frame_t *impunge_frame, xlator_t *this,
54 int child_index);
55int
56afr_sh_entry_done (call_frame_t *frame, xlator_t *this)
57{
58 afr_local_t *local = NULL((void*)0);
59 afr_self_heal_t *sh = NULL((void*)0);
60
61 local = frame->local;
62 sh = &local->self_heal;
63
64 sh->completion_cbk (frame, this);
65
66 return 0;
67}
68
69
70int
71afr_sh_entry_unlock (call_frame_t *frame, xlator_t *this)
72{
73 afr_local_t *local = NULL((void*)0);
74 afr_internal_lock_t *int_lock = NULL((void*)0);
75
76 local = frame->local;
77 int_lock = &local->internal_lock;
78
79 int_lock->lock_cbk = afr_sh_entry_done;
80 afr_unlock (frame, this);
81
82 return 0;
83}
84
85
86int
87afr_sh_entry_finish (call_frame_t *frame, xlator_t *this)
88{
89 afr_local_t *local = NULL((void*)0);
90
91 local = frame->local;
92
93 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("finishing entry selfheal of %s", local
->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 94, GF_LOG_TRACE, "finishing entry selfheal of %s"
, local->loc.path); } while (0)
94 "finishing entry selfheal of %s", local->loc.path)do { do { if (0) printf ("finishing entry selfheal of %s", local
->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 94, GF_LOG_TRACE, "finishing entry selfheal of %s"
, local->loc.path); } while (0)
;
95
96 afr_sh_entry_unlock (frame, this);
97
98 return 0;
99}
100
101
102int
103afr_sh_entry_erase_pending_cbk (call_frame_t *frame, void *cookie,
104 xlator_t *this, int32_t op_ret,
105 int32_t op_errno, dict_t *xattr, dict_t *xdata)
106{
107 long i = 0;
108 int call_count = 0;
109 afr_local_t *local = NULL((void*)0);
110 afr_self_heal_t *sh = NULL((void*)0);
111 afr_local_t *orig_local = NULL((void*)0);
112 call_frame_t *orig_frame = NULL((void*)0);
113 afr_private_t *priv = NULL((void*)0);
114 int32_t read_child = -1;
115
116 local = frame->local;
117 priv = this->private;
118 sh = &local->self_heal;
119 i = (long)cookie;
120
121
122 afr_children_add_child (sh->fresh_children, i, priv->child_count);
123 if (op_ret == -1) {
124 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("%s: failed to erase pending xattrs on %s (%s)"
, local->loc.path, priv->children[i]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 127, GF_LOG_INFO, "%s: failed to erase pending xattrs on %s (%s)"
, local->loc.path, priv->children[i]->name, strerror
(op_errno)); } while (0)
125 "%s: failed to erase pending xattrs on %s (%s)",do { do { if (0) printf ("%s: failed to erase pending xattrs on %s (%s)"
, local->loc.path, priv->children[i]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 127, GF_LOG_INFO, "%s: failed to erase pending xattrs on %s (%s)"
, local->loc.path, priv->children[i]->name, strerror
(op_errno)); } while (0)
126 local->loc.path, priv->children[i]->name,do { do { if (0) printf ("%s: failed to erase pending xattrs on %s (%s)"
, local->loc.path, priv->children[i]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 127, GF_LOG_INFO, "%s: failed to erase pending xattrs on %s (%s)"
, local->loc.path, priv->children[i]->name, strerror
(op_errno)); } while (0)
127 strerror (op_errno))do { do { if (0) printf ("%s: failed to erase pending xattrs on %s (%s)"
, local->loc.path, priv->children[i]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 127, GF_LOG_INFO, "%s: failed to erase pending xattrs on %s (%s)"
, local->loc.path, priv->children[i]->name, strerror
(op_errno)); } while (0)
;
128 }
129
130 call_count = afr_frame_return (frame);
131
132 if (call_count == 0) {
133 if (sh->source == -1) {
134 //this happens if the forced merge option is set
135 read_child = sh->fresh_children[0];
136 } else {
137 read_child = sh->source;
138 }
139 afr_inode_set_read_ctx (this, sh->inode, read_child,
140 sh->fresh_children);
141 orig_frame = sh->orig_frame;
142 orig_local = orig_frame->local;
143
144 if (sh->source != -1) {
145 orig_local->cont.lookup.buf.ia_nlink = sh->buf[sh->source].ia_nlink;
146 }
147
148 afr_sh_entry_finish (frame, this);
149 }
150
151 return 0;
152}
153
154
155int
156afr_sh_entry_erase_pending (call_frame_t *frame, xlator_t *this)
157{
158 afr_local_t *local = NULL((void*)0);
159 afr_self_heal_t *sh = NULL((void*)0);
160
161 local = frame->local;
162 sh = &local->self_heal;
163
164 if (sh->entries_skipped) {
165 sh->op_failed = _gf_true;
166 goto out;
167 }
168 afr_sh_erase_pending (frame, this, AFR_ENTRY_TRANSACTION,
169 afr_sh_entry_erase_pending_cbk,
170 afr_sh_entry_finish);
171 return 0;
172out:
173 afr_sh_entry_finish (frame, this);
174 return 0;
175}
176
177
178
179static int
180next_active_source (call_frame_t *frame, xlator_t *this,
181 int current_active_source)
182{
183 afr_private_t *priv = NULL((void*)0);
184 afr_local_t *local = NULL((void*)0);
185 afr_self_heal_t *sh = NULL((void*)0);
186 int source = -1;
187 int next_active_source = -1;
188 int i = 0;
189
190 priv = this->private;
191 local = frame->local;
192 sh = &local->self_heal;
193
194 source = sh->source;
195
196 if (source != -1) {
197 if (current_active_source != source)
198 next_active_source = source;
199 goto out;
200 }
201
202 /*
203 the next active sink becomes the source for the
204 'conservative decision' of merging all entries
205 */
206
207 for (i = 0; i < priv->child_count; i++) {
208 if ((sh->sources[i] == 0)
209 && (local->child_up[i] == 1)
210 && (i > current_active_source)) {
211
212 next_active_source = i;
213 break;
214 }
215 }
216out:
217 return next_active_source;
218}
219
220
221
222static int
223next_active_sink (call_frame_t *frame, xlator_t *this,
224 int current_active_sink)
225{
226 afr_private_t *priv = NULL((void*)0);
227 afr_local_t *local = NULL((void*)0);
228 afr_self_heal_t *sh = NULL((void*)0);
229 int next_active_sink = -1;
230 int i = 0;
231
232 priv = this->private;
233 local = frame->local;
234 sh = &local->self_heal;
235
236 /*
237 the next active sink becomes the source for the
238 'conservative decision' of merging all entries
239 */
240
241 for (i = 0; i < priv->child_count; i++) {
242 if ((sh->sources[i] == 0)
243 && (local->child_up[i] == 1)
244 && (i > current_active_sink)) {
245
246 next_active_sink = i;
247 break;
248 }
249 }
250
251 return next_active_sink;
252}
253
254int
255afr_sh_entry_impunge_all (call_frame_t *frame, xlator_t *this);
256
257int
258afr_sh_entry_impunge_subvol (call_frame_t *frame, xlator_t *this);
259
260int
261afr_sh_entry_expunge_all (call_frame_t *frame, xlator_t *this);
262
263int
264afr_sh_entry_expunge_subvol (call_frame_t *frame, xlator_t *this,
265 int active_src);
266
267int
268afr_sh_entry_expunge_entry_done (call_frame_t *frame, xlator_t *this,
269 int active_src, int32_t op_ret,
270 int32_t op_errno)
271{
272 int call_count = 0;
273
274 call_count = afr_frame_return (frame);
275
276 if (call_count == 0)
277 afr_sh_entry_expunge_subvol (frame, this, active_src);
278
279 return 0;
280}
281
282int
283afr_sh_entry_expunge_parent_setattr_cbk (call_frame_t *expunge_frame,
284 void *cookie, xlator_t *this,
285 int32_t op_ret, int32_t op_errno,
286 struct iatt *preop, struct iatt *postop,
287 dict_t *xdata)
288{
289 afr_private_t *priv = NULL((void*)0);
290 afr_local_t *expunge_local = NULL((void*)0);
291 afr_self_heal_t *expunge_sh = NULL((void*)0);
292 call_frame_t *frame = NULL((void*)0);
293 int active_src = (long) cookie;
294 afr_self_heal_t *sh = NULL((void*)0);
295 afr_local_t *local = NULL((void*)0);
296
297 priv = this->private;
298 expunge_local = expunge_frame->local;
299 expunge_sh = &expunge_local->self_heal;
300 frame = expunge_sh->sh_frame;
301 local = frame->local;
302 sh = &local->self_heal;
303
304 if (op_ret != 0) {
305 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("setattr on parent directory of %s on subvolume %s failed: %s"
, expunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 308, GF_LOG_ERROR, "setattr on parent directory of %s on subvolume %s failed: %s"
, expunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
306 "setattr on parent directory of %s on subvolume %s failed: %s",do { do { if (0) printf ("setattr on parent directory of %s on subvolume %s failed: %s"
, expunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 308, GF_LOG_ERROR, "setattr on parent directory of %s on subvolume %s failed: %s"
, expunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
307 expunge_local->loc.path,do { do { if (0) printf ("setattr on parent directory of %s on subvolume %s failed: %s"
, expunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 308, GF_LOG_ERROR, "setattr on parent directory of %s on subvolume %s failed: %s"
, expunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
308 priv->children[active_src]->name, strerror (op_errno))do { do { if (0) printf ("setattr on parent directory of %s on subvolume %s failed: %s"
, expunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 308, GF_LOG_ERROR, "setattr on parent directory of %s on subvolume %s failed: %s"
, expunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
;
309 }
310
311 AFR_STACK_DESTROY (expunge_frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = expunge_frame->local; __this = expunge_frame
->this; expunge_frame->local = ((void*)0); STACK_DESTROY
(expunge_frame->root); if (__local) { afr_local_cleanup (
__local, __this); mem_put (__local); } } while (0);
;
312 sh->expunge_done (frame, this, active_src, op_ret, op_errno);
313
314 return 0;
315}
316
317
318int
319afr_sh_entry_expunge_remove_cbk (call_frame_t *expunge_frame, void *cookie,
320 xlator_t *this,
321 int32_t op_ret, int32_t op_errno,
322 struct iatt *preparent,
323 struct iatt *postparent, dict_t *xdata)
324{
325 afr_private_t *priv = NULL((void*)0);
326 afr_local_t *expunge_local = NULL((void*)0);
327 afr_self_heal_t *expunge_sh = NULL((void*)0);
328 int active_src = 0;
329 int32_t valid = 0;
330
331 priv = this->private;
332 expunge_local = expunge_frame->local;
333 expunge_sh = &expunge_local->self_heal;
334
335 active_src = (long) cookie;
336
337 if (op_ret == 0) {
338 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("removed %s on %s", expunge_local->
loc.path, priv->children[active_src]->name); } while (0
); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 341, GF_LOG_DEBUG, "removed %s on %s", expunge_local->loc
.path, priv->children[active_src]->name); } while (0)
339 "removed %s on %s",do { do { if (0) printf ("removed %s on %s", expunge_local->
loc.path, priv->children[active_src]->name); } while (0
); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 341, GF_LOG_DEBUG, "removed %s on %s", expunge_local->loc
.path, priv->children[active_src]->name); } while (0)
340 expunge_local->loc.path,do { do { if (0) printf ("removed %s on %s", expunge_local->
loc.path, priv->children[active_src]->name); } while (0
); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 341, GF_LOG_DEBUG, "removed %s on %s", expunge_local->loc
.path, priv->children[active_src]->name); } while (0)
341 priv->children[active_src]->name)do { do { if (0) printf ("removed %s on %s", expunge_local->
loc.path, priv->children[active_src]->name); } while (0
); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 341, GF_LOG_DEBUG, "removed %s on %s", expunge_local->loc
.path, priv->children[active_src]->name); } while (0)
;
342 } else {
343 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("removing %s on %s failed (%s)", expunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 347, GF_LOG_INFO, "removing %s on %s failed (%s)"
, expunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
344 "removing %s on %s failed (%s)",do { do { if (0) printf ("removing %s on %s failed (%s)", expunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 347, GF_LOG_INFO, "removing %s on %s failed (%s)"
, expunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
345 expunge_local->loc.path,do { do { if (0) printf ("removing %s on %s failed (%s)", expunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 347, GF_LOG_INFO, "removing %s on %s failed (%s)"
, expunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
346 priv->children[active_src]->name,do { do { if (0) printf ("removing %s on %s failed (%s)", expunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 347, GF_LOG_INFO, "removing %s on %s failed (%s)"
, expunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
347 strerror (op_errno))do { do { if (0) printf ("removing %s on %s failed (%s)", expunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 347, GF_LOG_INFO, "removing %s on %s failed (%s)"
, expunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
;
348 }
349
350 valid = GF_SET_ATTR_ATIME0x10 | GF_SET_ATTR_MTIME0x20;
351
352 STACK_WIND_COOKIE (expunge_frame, afr_sh_entry_expunge_parent_setattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 358, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->setattr_cbk) tmp_cbk
= afr_sh_entry_expunge_parent_setattr_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->setattr"
; _new->unwind_to = "afr_sh_entry_expunge_parent_setattr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&expunge_frame->root->stack_lock); { expunge_frame
->ref_count++; _new->next = expunge_frame->root->
frames.next; _new->prev = &expunge_frame->root->
frames; if (expunge_frame->root->frames.next) expunge_frame
->root->frames.next->prev = _new; expunge_frame->
root->frames.next = _new; } pthread_spin_unlock (&expunge_frame
->root->stack_lock); priv->children[active_src]->
fops->setattr_cbk = afr_sh_entry_expunge_parent_setattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[active_src]; if (priv->children[active_src
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[active_src]->fops->setattr); priv->children
[active_src]->fops->setattr (_new, priv->children[active_src
], &expunge_sh->parent_loc, &expunge_sh->parentbuf
, valid, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
353 (void *) (long) active_src,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 358, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->setattr_cbk) tmp_cbk
= afr_sh_entry_expunge_parent_setattr_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->setattr"
; _new->unwind_to = "afr_sh_entry_expunge_parent_setattr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&expunge_frame->root->stack_lock); { expunge_frame
->ref_count++; _new->next = expunge_frame->root->
frames.next; _new->prev = &expunge_frame->root->
frames; if (expunge_frame->root->frames.next) expunge_frame
->root->frames.next->prev = _new; expunge_frame->
root->frames.next = _new; } pthread_spin_unlock (&expunge_frame
->root->stack_lock); priv->children[active_src]->
fops->setattr_cbk = afr_sh_entry_expunge_parent_setattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[active_src]; if (priv->children[active_src
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[active_src]->fops->setattr); priv->children
[active_src]->fops->setattr (_new, priv->children[active_src
], &expunge_sh->parent_loc, &expunge_sh->parentbuf
, valid, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
354 priv->children[active_src],do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 358, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->setattr_cbk) tmp_cbk
= afr_sh_entry_expunge_parent_setattr_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->setattr"
; _new->unwind_to = "afr_sh_entry_expunge_parent_setattr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&expunge_frame->root->stack_lock); { expunge_frame
->ref_count++; _new->next = expunge_frame->root->
frames.next; _new->prev = &expunge_frame->root->
frames; if (expunge_frame->root->frames.next) expunge_frame
->root->frames.next->prev = _new; expunge_frame->
root->frames.next = _new; } pthread_spin_unlock (&expunge_frame
->root->stack_lock); priv->children[active_src]->
fops->setattr_cbk = afr_sh_entry_expunge_parent_setattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[active_src]; if (priv->children[active_src
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[active_src]->fops->setattr); priv->children
[active_src]->fops->setattr (_new, priv->children[active_src
], &expunge_sh->parent_loc, &expunge_sh->parentbuf
, valid, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
355 priv->children[active_src]->fops->setattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 358, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->setattr_cbk) tmp_cbk
= afr_sh_entry_expunge_parent_setattr_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->setattr"
; _new->unwind_to = "afr_sh_entry_expunge_parent_setattr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&expunge_frame->root->stack_lock); { expunge_frame
->ref_count++; _new->next = expunge_frame->root->
frames.next; _new->prev = &expunge_frame->root->
frames; if (expunge_frame->root->frames.next) expunge_frame
->root->frames.next->prev = _new; expunge_frame->
root->frames.next = _new; } pthread_spin_unlock (&expunge_frame
->root->stack_lock); priv->children[active_src]->
fops->setattr_cbk = afr_sh_entry_expunge_parent_setattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[active_src]; if (priv->children[active_src
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[active_src]->fops->setattr); priv->children
[active_src]->fops->setattr (_new, priv->children[active_src
], &expunge_sh->parent_loc, &expunge_sh->parentbuf
, valid, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
356 &expunge_sh->parent_loc,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 358, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->setattr_cbk) tmp_cbk
= afr_sh_entry_expunge_parent_setattr_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->setattr"
; _new->unwind_to = "afr_sh_entry_expunge_parent_setattr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&expunge_frame->root->stack_lock); { expunge_frame
->ref_count++; _new->next = expunge_frame->root->
frames.next; _new->prev = &expunge_frame->root->
frames; if (expunge_frame->root->frames.next) expunge_frame
->root->frames.next->prev = _new; expunge_frame->
root->frames.next = _new; } pthread_spin_unlock (&expunge_frame
->root->stack_lock); priv->children[active_src]->
fops->setattr_cbk = afr_sh_entry_expunge_parent_setattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[active_src]; if (priv->children[active_src
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[active_src]->fops->setattr); priv->children
[active_src]->fops->setattr (_new, priv->children[active_src
], &expunge_sh->parent_loc, &expunge_sh->parentbuf
, valid, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
357 &expunge_sh->parentbuf,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 358, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->setattr_cbk) tmp_cbk
= afr_sh_entry_expunge_parent_setattr_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->setattr"
; _new->unwind_to = "afr_sh_entry_expunge_parent_setattr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&expunge_frame->root->stack_lock); { expunge_frame
->ref_count++; _new->next = expunge_frame->root->
frames.next; _new->prev = &expunge_frame->root->
frames; if (expunge_frame->root->frames.next) expunge_frame
->root->frames.next->prev = _new; expunge_frame->
root->frames.next = _new; } pthread_spin_unlock (&expunge_frame
->root->stack_lock); priv->children[active_src]->
fops->setattr_cbk = afr_sh_entry_expunge_parent_setattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[active_src]; if (priv->children[active_src
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[active_src]->fops->setattr); priv->children
[active_src]->fops->setattr (_new, priv->children[active_src
], &expunge_sh->parent_loc, &expunge_sh->parentbuf
, valid, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
358 valid, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 358, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->setattr_cbk) tmp_cbk
= afr_sh_entry_expunge_parent_setattr_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->setattr"
; _new->unwind_to = "afr_sh_entry_expunge_parent_setattr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&expunge_frame->root->stack_lock); { expunge_frame
->ref_count++; _new->next = expunge_frame->root->
frames.next; _new->prev = &expunge_frame->root->
frames; if (expunge_frame->root->frames.next) expunge_frame
->root->frames.next->prev = _new; expunge_frame->
root->frames.next = _new; } pthread_spin_unlock (&expunge_frame
->root->stack_lock); priv->children[active_src]->
fops->setattr_cbk = afr_sh_entry_expunge_parent_setattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[active_src]; if (priv->children[active_src
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[active_src]->fops->setattr); priv->children
[active_src]->fops->setattr (_new, priv->children[active_src
], &expunge_sh->parent_loc, &expunge_sh->parentbuf
, valid, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
359
360 return 0;
361}
362
363
364int
365afr_sh_entry_expunge_unlink (call_frame_t *expunge_frame, xlator_t *this,
366 int active_src)
367{
368 afr_private_t *priv = NULL((void*)0);
369 afr_local_t *expunge_local = NULL((void*)0);
370
371 priv = this->private;
372 expunge_local = expunge_frame->local;
373
374 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("expunging file %s on %s", expunge_local
->loc.path, priv->children[active_src]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 376, GF_LOG_TRACE, "expunging file %s on %s", expunge_local
->loc.path, priv->children[active_src]->name); } while
(0)
375 "expunging file %s on %s",do { do { if (0) printf ("expunging file %s on %s", expunge_local
->loc.path, priv->children[active_src]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 376, GF_LOG_TRACE, "expunging file %s on %s", expunge_local
->loc.path, priv->children[active_src]->name); } while
(0)
376 expunge_local->loc.path, priv->children[active_src]->name)do { do { if (0) printf ("expunging file %s on %s", expunge_local
->loc.path, priv->children[active_src]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 376, GF_LOG_TRACE, "expunging file %s on %s", expunge_local
->loc.path, priv->children[active_src]->name); } while
(0)
;
377
378 STACK_WIND_COOKIE (expunge_frame, afr_sh_entry_expunge_remove_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 382, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->unlink_cbk) tmp_cbk
= afr_sh_entry_expunge_remove_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->unlink"
; _new->unwind_to = "afr_sh_entry_expunge_remove_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[active_src]->fops->unlink_cbk
= afr_sh_entry_expunge_remove_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->unlink); priv->children[active_src]->fops->unlink
(_new, priv->children[active_src], &expunge_local->
loc, 0, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
379 (void *) (long) active_src,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 382, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->unlink_cbk) tmp_cbk
= afr_sh_entry_expunge_remove_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->unlink"
; _new->unwind_to = "afr_sh_entry_expunge_remove_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[active_src]->fops->unlink_cbk
= afr_sh_entry_expunge_remove_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->unlink); priv->children[active_src]->fops->unlink
(_new, priv->children[active_src], &expunge_local->
loc, 0, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
380 priv->children[active_src],do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 382, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->unlink_cbk) tmp_cbk
= afr_sh_entry_expunge_remove_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->unlink"
; _new->unwind_to = "afr_sh_entry_expunge_remove_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[active_src]->fops->unlink_cbk
= afr_sh_entry_expunge_remove_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->unlink); priv->children[active_src]->fops->unlink
(_new, priv->children[active_src], &expunge_local->
loc, 0, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
381 priv->children[active_src]->fops->unlink,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 382, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->unlink_cbk) tmp_cbk
= afr_sh_entry_expunge_remove_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->unlink"
; _new->unwind_to = "afr_sh_entry_expunge_remove_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[active_src]->fops->unlink_cbk
= afr_sh_entry_expunge_remove_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->unlink); priv->children[active_src]->fops->unlink
(_new, priv->children[active_src], &expunge_local->
loc, 0, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
382 &expunge_local->loc, 0, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 382, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->unlink_cbk) tmp_cbk
= afr_sh_entry_expunge_remove_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->unlink"
; _new->unwind_to = "afr_sh_entry_expunge_remove_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[active_src]->fops->unlink_cbk
= afr_sh_entry_expunge_remove_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->unlink); priv->children[active_src]->fops->unlink
(_new, priv->children[active_src], &expunge_local->
loc, 0, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
383
384 return 0;
385}
386
387
388
389int
390afr_sh_entry_expunge_rmdir (call_frame_t *expunge_frame, xlator_t *this,
391 int active_src)
392{
393 afr_private_t *priv = NULL((void*)0);
394 afr_local_t *expunge_local = NULL((void*)0);
395
396 priv = this->private;
397 expunge_local = expunge_frame->local;
398
399 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("expunging directory %s on %s", expunge_local
->loc.path, priv->children[active_src]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 401, GF_LOG_DEBUG, "expunging directory %s on %s", expunge_local
->loc.path, priv->children[active_src]->name); } while
(0)
400 "expunging directory %s on %s",do { do { if (0) printf ("expunging directory %s on %s", expunge_local
->loc.path, priv->children[active_src]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 401, GF_LOG_DEBUG, "expunging directory %s on %s", expunge_local
->loc.path, priv->children[active_src]->name); } while
(0)
401 expunge_local->loc.path, priv->children[active_src]->name)do { do { if (0) printf ("expunging directory %s on %s", expunge_local
->loc.path, priv->children[active_src]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 401, GF_LOG_DEBUG, "expunging directory %s on %s", expunge_local
->loc.path, priv->children[active_src]->name); } while
(0)
;
402
403 STACK_WIND_COOKIE (expunge_frame, afr_sh_entry_expunge_remove_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 407, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->rmdir_cbk) tmp_cbk
= afr_sh_entry_expunge_remove_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->rmdir"
; _new->unwind_to = "afr_sh_entry_expunge_remove_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[active_src]->fops->rmdir_cbk
= afr_sh_entry_expunge_remove_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->rmdir); priv->children[active_src]->fops->rmdir
(_new, priv->children[active_src], &expunge_local->
loc, 1, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
404 (void *) (long) active_src,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 407, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->rmdir_cbk) tmp_cbk
= afr_sh_entry_expunge_remove_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->rmdir"
; _new->unwind_to = "afr_sh_entry_expunge_remove_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[active_src]->fops->rmdir_cbk
= afr_sh_entry_expunge_remove_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->rmdir); priv->children[active_src]->fops->rmdir
(_new, priv->children[active_src], &expunge_local->
loc, 1, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
405 priv->children[active_src],do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 407, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->rmdir_cbk) tmp_cbk
= afr_sh_entry_expunge_remove_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->rmdir"
; _new->unwind_to = "afr_sh_entry_expunge_remove_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[active_src]->fops->rmdir_cbk
= afr_sh_entry_expunge_remove_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->rmdir); priv->children[active_src]->fops->rmdir
(_new, priv->children[active_src], &expunge_local->
loc, 1, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
406 priv->children[active_src]->fops->rmdir,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 407, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->rmdir_cbk) tmp_cbk
= afr_sh_entry_expunge_remove_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->rmdir"
; _new->unwind_to = "afr_sh_entry_expunge_remove_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[active_src]->fops->rmdir_cbk
= afr_sh_entry_expunge_remove_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->rmdir); priv->children[active_src]->fops->rmdir
(_new, priv->children[active_src], &expunge_local->
loc, 1, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
407 &expunge_local->loc, 1, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 407, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->rmdir_cbk) tmp_cbk
= afr_sh_entry_expunge_remove_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->rmdir"
; _new->unwind_to = "afr_sh_entry_expunge_remove_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[active_src]->fops->rmdir_cbk
= afr_sh_entry_expunge_remove_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->rmdir); priv->children[active_src]->fops->rmdir
(_new, priv->children[active_src], &expunge_local->
loc, 1, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
408
409 return 0;
410}
411
412
413int
414afr_sh_entry_expunge_remove (call_frame_t *expunge_frame, xlator_t *this,
415 int active_src, struct iatt *buf,
416 struct iatt *parentbuf)
417{
418 afr_private_t *priv = NULL((void*)0);
419 afr_local_t *expunge_local = NULL((void*)0);
420 afr_self_heal_t *expunge_sh = NULL((void*)0);
421 call_frame_t *frame = NULL((void*)0);
422 int type = 0;
423 afr_self_heal_t *sh = NULL((void*)0);
424 afr_local_t *local = NULL((void*)0);
425 loc_t *loc = NULL((void*)0);
426
427 priv = this->private;
428 expunge_local = expunge_frame->local;
429 expunge_sh = &expunge_local->self_heal;
430 frame = expunge_sh->sh_frame;
431 local = frame->local;
432 sh = &local->self_heal;
433 loc = &expunge_local->loc;
434
435 type = buf->ia_type;
436 if (loc->parent && uuid_is_null (loc->parent->gfid))
437 uuid_copy (loc->pargfid, parentbuf->ia_gfid);
438
439 switch (type) {
440 case IA_IFSOCK:
441 case IA_IFREG:
442 case IA_IFBLK:
443 case IA_IFCHR:
444 case IA_IFIFO:
445 case IA_IFLNK:
446 afr_sh_entry_expunge_unlink (expunge_frame, this, active_src);
447 break;
448 case IA_IFDIR:
449 afr_sh_entry_expunge_rmdir (expunge_frame, this, active_src);
450 break;
451 default:
452 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("%s has unknown file type on %s: 0%o"
, expunge_local->loc.path, priv->children[active_src]->
name, type); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 455, GF_LOG_ERROR, "%s has unknown file type on %s: 0%o"
, expunge_local->loc.path, priv->children[active_src]->
name, type); } while (0)
453 "%s has unknown file type on %s: 0%o",do { do { if (0) printf ("%s has unknown file type on %s: 0%o"
, expunge_local->loc.path, priv->children[active_src]->
name, type); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 455, GF_LOG_ERROR, "%s has unknown file type on %s: 0%o"
, expunge_local->loc.path, priv->children[active_src]->
name, type); } while (0)
454 expunge_local->loc.path,do { do { if (0) printf ("%s has unknown file type on %s: 0%o"
, expunge_local->loc.path, priv->children[active_src]->
name, type); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 455, GF_LOG_ERROR, "%s has unknown file type on %s: 0%o"
, expunge_local->loc.path, priv->children[active_src]->
name, type); } while (0)
455 priv->children[active_src]->name, type)do { do { if (0) printf ("%s has unknown file type on %s: 0%o"
, expunge_local->loc.path, priv->children[active_src]->
name, type); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 455, GF_LOG_ERROR, "%s has unknown file type on %s: 0%o"
, expunge_local->loc.path, priv->children[active_src]->
name, type); } while (0)
;
456 goto out;
457 break;
458 }
459
460 return 0;
461out:
462 AFR_STACK_DESTROY (expunge_frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = expunge_frame->local; __this = expunge_frame
->this; expunge_frame->local = ((void*)0); STACK_DESTROY
(expunge_frame->root); if (__local) { afr_local_cleanup (
__local, __this); mem_put (__local); } } while (0);
;
463 sh->expunge_done (frame, this, active_src, -1, EINVAL22);
464
465 return 0;
466}
467
468
469int
470afr_sh_entry_expunge_lookup_cbk (call_frame_t *expunge_frame, void *cookie,
471 xlator_t *this,
472 int32_t op_ret, int32_t op_errno,
473 inode_t *inode, struct iatt *buf, dict_t *x,
474 struct iatt *postparent)
475{
476 afr_private_t *priv = NULL((void*)0);
477 afr_local_t *expunge_local = NULL((void*)0);
478 afr_self_heal_t *expunge_sh = NULL((void*)0);
479 call_frame_t *frame = NULL((void*)0);
480 int active_src = 0;
481 afr_self_heal_t *sh = NULL((void*)0);
482 afr_local_t *local = NULL((void*)0);
483
484 priv = this->private;
485 expunge_local = expunge_frame->local;
486 expunge_sh = &expunge_local->self_heal;
487 frame = expunge_sh->sh_frame;
488 active_src = (long) cookie;
489 local = frame->local;
490 sh = &local->self_heal;
491
492 if (op_ret == -1) {
493 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("lookup of %s on %s failed (%s)", expunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 497, GF_LOG_ERROR, "lookup of %s on %s failed (%s)"
, expunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
494 "lookup of %s on %s failed (%s)",do { do { if (0) printf ("lookup of %s on %s failed (%s)", expunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 497, GF_LOG_ERROR, "lookup of %s on %s failed (%s)"
, expunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
495 expunge_local->loc.path,do { do { if (0) printf ("lookup of %s on %s failed (%s)", expunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 497, GF_LOG_ERROR, "lookup of %s on %s failed (%s)"
, expunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
496 priv->children[active_src]->name,do { do { if (0) printf ("lookup of %s on %s failed (%s)", expunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 497, GF_LOG_ERROR, "lookup of %s on %s failed (%s)"
, expunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
497 strerror (op_errno))do { do { if (0) printf ("lookup of %s on %s failed (%s)", expunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 497, GF_LOG_ERROR, "lookup of %s on %s failed (%s)"
, expunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
;
498 goto out;
499 }
500
501 afr_sh_entry_expunge_remove (expunge_frame, this, active_src, buf,
502 postparent);
503
504 return 0;
505out:
506 AFR_STACK_DESTROY (expunge_frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = expunge_frame->local; __this = expunge_frame
->this; expunge_frame->local = ((void*)0); STACK_DESTROY
(expunge_frame->root); if (__local) { afr_local_cleanup (
__local, __this); mem_put (__local); } } while (0);
;
507 sh->expunge_done (frame, this, active_src, op_ret, op_errno);
508
509 return 0;
510}
511
512
513int
514afr_sh_entry_expunge_purge (call_frame_t *expunge_frame, xlator_t *this,
515 int active_src)
516{
517 afr_private_t *priv = NULL((void*)0);
518 afr_local_t *expunge_local = NULL((void*)0);
519
520 priv = this->private;
521 expunge_local = expunge_frame->local;
522
523 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("looking up %s on %s", expunge_local
->loc.path, priv->children[active_src]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 525, GF_LOG_TRACE, "looking up %s on %s", expunge_local->
loc.path, priv->children[active_src]->name); } while (0
)
524 "looking up %s on %s",do { do { if (0) printf ("looking up %s on %s", expunge_local
->loc.path, priv->children[active_src]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 525, GF_LOG_TRACE, "looking up %s on %s", expunge_local->
loc.path, priv->children[active_src]->name); } while (0
)
525 expunge_local->loc.path, priv->children[active_src]->name)do { do { if (0) printf ("looking up %s on %s", expunge_local
->loc.path, priv->children[active_src]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 525, GF_LOG_TRACE, "looking up %s on %s", expunge_local->
loc.path, priv->children[active_src]->name); } while (0
)
;
526
527 STACK_WIND_COOKIE (expunge_frame, afr_sh_entry_expunge_lookup_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 531, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->lookup_cbk) tmp_cbk
= afr_sh_entry_expunge_lookup_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->lookup"
; _new->unwind_to = "afr_sh_entry_expunge_lookup_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[active_src]->fops->lookup_cbk
= afr_sh_entry_expunge_lookup_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->lookup); priv->children[active_src]->fops->lookup
(_new, priv->children[active_src], &expunge_local->
loc, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; }
while (0)
528 (void *) (long) active_src,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 531, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->lookup_cbk) tmp_cbk
= afr_sh_entry_expunge_lookup_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->lookup"
; _new->unwind_to = "afr_sh_entry_expunge_lookup_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[active_src]->fops->lookup_cbk
= afr_sh_entry_expunge_lookup_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->lookup); priv->children[active_src]->fops->lookup
(_new, priv->children[active_src], &expunge_local->
loc, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; }
while (0)
529 priv->children[active_src],do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 531, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->lookup_cbk) tmp_cbk
= afr_sh_entry_expunge_lookup_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->lookup"
; _new->unwind_to = "afr_sh_entry_expunge_lookup_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[active_src]->fops->lookup_cbk
= afr_sh_entry_expunge_lookup_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->lookup); priv->children[active_src]->fops->lookup
(_new, priv->children[active_src], &expunge_local->
loc, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; }
while (0)
530 priv->children[active_src]->fops->lookup,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 531, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->lookup_cbk) tmp_cbk
= afr_sh_entry_expunge_lookup_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->lookup"
; _new->unwind_to = "afr_sh_entry_expunge_lookup_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[active_src]->fops->lookup_cbk
= afr_sh_entry_expunge_lookup_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->lookup); priv->children[active_src]->fops->lookup
(_new, priv->children[active_src], &expunge_local->
loc, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; }
while (0)
531 &expunge_local->loc, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 531, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->lookup_cbk) tmp_cbk
= afr_sh_entry_expunge_lookup_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->lookup"
; _new->unwind_to = "afr_sh_entry_expunge_lookup_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[active_src]->fops->lookup_cbk
= afr_sh_entry_expunge_lookup_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->lookup); priv->children[active_src]->fops->lookup
(_new, priv->children[active_src], &expunge_local->
loc, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; }
while (0)
;
532
533 return 0;
534}
535
536int
537afr_sh_entry_expunge_entry_cbk (call_frame_t *expunge_frame, void *cookie,
538 xlator_t *this,
539 int32_t op_ret, int32_t op_errno,
540 inode_t *inode, struct iatt *buf, dict_t *x,
541 struct iatt *postparent)
542{
543 afr_private_t *priv = NULL((void*)0);
544 afr_local_t *expunge_local = NULL((void*)0);
545 afr_self_heal_t *expunge_sh = NULL((void*)0);
546 int source = 0;
547 call_frame_t *frame = NULL((void*)0);
548 int active_src = 0;
549 int need_expunge = 0;
550 afr_self_heal_t *sh = NULL((void*)0);
551 afr_local_t *local = NULL((void*)0);
552
553 priv = this->private;
554 expunge_local = expunge_frame->local;
555 expunge_sh = &expunge_local->self_heal;
556 frame = expunge_sh->sh_frame;
557 active_src = expunge_sh->active_source;
558 source = (long) cookie;
559 local = frame->local;
560 sh = &local->self_heal;
561
562 if (op_ret == -1 && op_errno == ENOENT2)
563 need_expunge = 1;
564 else if (op_ret == -1)
565 goto out;
566
567 if (!uuid_is_null (expunge_sh->entrybuf.ia_gfid) &&
568 !uuid_is_null (buf->ia_gfid) &&
569 (uuid_compare (expunge_sh->entrybuf.ia_gfid, buf->ia_gfid) != 0)) {
570 char uuidbuf1[64];
571 char uuidbuf2[64];
572 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("entry %s found on %s with mismatching gfid (%s/%s)"
, expunge_local->loc.path, priv->children[source]->name
, uuid_utoa_r (expunge_sh->entrybuf.ia_gfid, uuidbuf1), uuid_utoa_r
(buf->ia_gfid, uuidbuf2)); } while (0); _gf_log (this->
name, "afr-self-heal-entry.c", __FUNCTION__, 577, GF_LOG_DEBUG
, "entry %s found on %s with mismatching gfid (%s/%s)", expunge_local
->loc.path, priv->children[source]->name, uuid_utoa_r
(expunge_sh->entrybuf.ia_gfid, uuidbuf1), uuid_utoa_r (buf
->ia_gfid, uuidbuf2)); } while (0)
573 "entry %s found on %s with mismatching gfid (%s/%s)",do { do { if (0) printf ("entry %s found on %s with mismatching gfid (%s/%s)"
, expunge_local->loc.path, priv->children[source]->name
, uuid_utoa_r (expunge_sh->entrybuf.ia_gfid, uuidbuf1), uuid_utoa_r
(buf->ia_gfid, uuidbuf2)); } while (0); _gf_log (this->
name, "afr-self-heal-entry.c", __FUNCTION__, 577, GF_LOG_DEBUG
, "entry %s found on %s with mismatching gfid (%s/%s)", expunge_local
->loc.path, priv->children[source]->name, uuid_utoa_r
(expunge_sh->entrybuf.ia_gfid, uuidbuf1), uuid_utoa_r (buf
->ia_gfid, uuidbuf2)); } while (0)
574 expunge_local->loc.path,do { do { if (0) printf ("entry %s found on %s with mismatching gfid (%s/%s)"
, expunge_local->loc.path, priv->children[source]->name
, uuid_utoa_r (expunge_sh->entrybuf.ia_gfid, uuidbuf1), uuid_utoa_r
(buf->ia_gfid, uuidbuf2)); } while (0); _gf_log (this->
name, "afr-self-heal-entry.c", __FUNCTION__, 577, GF_LOG_DEBUG
, "entry %s found on %s with mismatching gfid (%s/%s)", expunge_local
->loc.path, priv->children[source]->name, uuid_utoa_r
(expunge_sh->entrybuf.ia_gfid, uuidbuf1), uuid_utoa_r (buf
->ia_gfid, uuidbuf2)); } while (0)
575 priv->children[source]->name,do { do { if (0) printf ("entry %s found on %s with mismatching gfid (%s/%s)"
, expunge_local->loc.path, priv->children[source]->name
, uuid_utoa_r (expunge_sh->entrybuf.ia_gfid, uuidbuf1), uuid_utoa_r
(buf->ia_gfid, uuidbuf2)); } while (0); _gf_log (this->
name, "afr-self-heal-entry.c", __FUNCTION__, 577, GF_LOG_DEBUG
, "entry %s found on %s with mismatching gfid (%s/%s)", expunge_local
->loc.path, priv->children[source]->name, uuid_utoa_r
(expunge_sh->entrybuf.ia_gfid, uuidbuf1), uuid_utoa_r (buf
->ia_gfid, uuidbuf2)); } while (0)
576 uuid_utoa_r (expunge_sh->entrybuf.ia_gfid, uuidbuf1),do { do { if (0) printf ("entry %s found on %s with mismatching gfid (%s/%s)"
, expunge_local->loc.path, priv->children[source]->name
, uuid_utoa_r (expunge_sh->entrybuf.ia_gfid, uuidbuf1), uuid_utoa_r
(buf->ia_gfid, uuidbuf2)); } while (0); _gf_log (this->
name, "afr-self-heal-entry.c", __FUNCTION__, 577, GF_LOG_DEBUG
, "entry %s found on %s with mismatching gfid (%s/%s)", expunge_local
->loc.path, priv->children[source]->name, uuid_utoa_r
(expunge_sh->entrybuf.ia_gfid, uuidbuf1), uuid_utoa_r (buf
->ia_gfid, uuidbuf2)); } while (0)
577 uuid_utoa_r (buf->ia_gfid, uuidbuf2))do { do { if (0) printf ("entry %s found on %s with mismatching gfid (%s/%s)"
, expunge_local->loc.path, priv->children[source]->name
, uuid_utoa_r (expunge_sh->entrybuf.ia_gfid, uuidbuf1), uuid_utoa_r
(buf->ia_gfid, uuidbuf2)); } while (0); _gf_log (this->
name, "afr-self-heal-entry.c", __FUNCTION__, 577, GF_LOG_DEBUG
, "entry %s found on %s with mismatching gfid (%s/%s)", expunge_local
->loc.path, priv->children[source]->name, uuid_utoa_r
(expunge_sh->entrybuf.ia_gfid, uuidbuf1), uuid_utoa_r (buf
->ia_gfid, uuidbuf2)); } while (0)
;
578 need_expunge = 1;
579 }
580
581 if (need_expunge) {
582 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("Entry %s is missing on %s and deleting from "
"replica's other bricks", expunge_local->loc.path, priv->
children[source]->name); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 586, GF_LOG_INFO, "Entry %s is missing on %s and deleting from "
"replica's other bricks", expunge_local->loc.path, priv->
children[source]->name); } while (0)
583 "Entry %s is missing on %s and deleting from "do { do { if (0) printf ("Entry %s is missing on %s and deleting from "
"replica's other bricks", expunge_local->loc.path, priv->
children[source]->name); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 586, GF_LOG_INFO, "Entry %s is missing on %s and deleting from "
"replica's other bricks", expunge_local->loc.path, priv->
children[source]->name); } while (0)
584 "replica's other bricks",do { do { if (0) printf ("Entry %s is missing on %s and deleting from "
"replica's other bricks", expunge_local->loc.path, priv->
children[source]->name); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 586, GF_LOG_INFO, "Entry %s is missing on %s and deleting from "
"replica's other bricks", expunge_local->loc.path, priv->
children[source]->name); } while (0)
585 expunge_local->loc.path,do { do { if (0) printf ("Entry %s is missing on %s and deleting from "
"replica's other bricks", expunge_local->loc.path, priv->
children[source]->name); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 586, GF_LOG_INFO, "Entry %s is missing on %s and deleting from "
"replica's other bricks", expunge_local->loc.path, priv->
children[source]->name); } while (0)
586 priv->children[source]->name)do { do { if (0) printf ("Entry %s is missing on %s and deleting from "
"replica's other bricks", expunge_local->loc.path, priv->
children[source]->name); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 586, GF_LOG_INFO, "Entry %s is missing on %s and deleting from "
"replica's other bricks", expunge_local->loc.path, priv->
children[source]->name); } while (0)
;
587
588 if (postparent)
589 expunge_sh->parentbuf = *postparent;
590
591 afr_sh_entry_expunge_purge (expunge_frame, this, active_src);
592
593 return 0;
594 }
595
596out:
597 if (op_ret == 0) {
598 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("%s exists under %s", expunge_local->
loc.path, priv->children[source]->name); } while (0); _gf_log
(this->name, "afr-self-heal-entry.c", __FUNCTION__, 601, GF_LOG_TRACE
, "%s exists under %s", expunge_local->loc.path, priv->
children[source]->name); } while (0)
599 "%s exists under %s",do { do { if (0) printf ("%s exists under %s", expunge_local->
loc.path, priv->children[source]->name); } while (0); _gf_log
(this->name, "afr-self-heal-entry.c", __FUNCTION__, 601, GF_LOG_TRACE
, "%s exists under %s", expunge_local->loc.path, priv->
children[source]->name); } while (0)
600 expunge_local->loc.path,do { do { if (0) printf ("%s exists under %s", expunge_local->
loc.path, priv->children[source]->name); } while (0); _gf_log
(this->name, "afr-self-heal-entry.c", __FUNCTION__, 601, GF_LOG_TRACE
, "%s exists under %s", expunge_local->loc.path, priv->
children[source]->name); } while (0)
601 priv->children[source]->name)do { do { if (0) printf ("%s exists under %s", expunge_local->
loc.path, priv->children[source]->name); } while (0); _gf_log
(this->name, "afr-self-heal-entry.c", __FUNCTION__, 601, GF_LOG_TRACE
, "%s exists under %s", expunge_local->loc.path, priv->
children[source]->name); } while (0)
;
602 } else {
603 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("looking up %s under %s failed (%s)"
, expunge_local->loc.path, priv->children[source]->name
, strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 607, GF_LOG_INFO, "looking up %s under %s failed (%s)"
, expunge_local->loc.path, priv->children[source]->name
, strerror (op_errno)); } while (0)
604 "looking up %s under %s failed (%s)",do { do { if (0) printf ("looking up %s under %s failed (%s)"
, expunge_local->loc.path, priv->children[source]->name
, strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 607, GF_LOG_INFO, "looking up %s under %s failed (%s)"
, expunge_local->loc.path, priv->children[source]->name
, strerror (op_errno)); } while (0)
605 expunge_local->loc.path,do { do { if (0) printf ("looking up %s under %s failed (%s)"
, expunge_local->loc.path, priv->children[source]->name
, strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 607, GF_LOG_INFO, "looking up %s under %s failed (%s)"
, expunge_local->loc.path, priv->children[source]->name
, strerror (op_errno)); } while (0)
606 priv->children[source]->name,do { do { if (0) printf ("looking up %s under %s failed (%s)"
, expunge_local->loc.path, priv->children[source]->name
, strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 607, GF_LOG_INFO, "looking up %s under %s failed (%s)"
, expunge_local->loc.path, priv->children[source]->name
, strerror (op_errno)); } while (0)
607 strerror (op_errno))do { do { if (0) printf ("looking up %s under %s failed (%s)"
, expunge_local->loc.path, priv->children[source]->name
, strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 607, GF_LOG_INFO, "looking up %s under %s failed (%s)"
, expunge_local->loc.path, priv->children[source]->name
, strerror (op_errno)); } while (0)
;
608 }
609
610 AFR_STACK_DESTROY (expunge_frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = expunge_frame->local; __this = expunge_frame
->this; expunge_frame->local = ((void*)0); STACK_DESTROY
(expunge_frame->root); if (__local) { afr_local_cleanup (
__local, __this); mem_put (__local); } } while (0);
;
611 sh->expunge_done (frame, this, active_src, op_ret, op_errno);
612
613 return 0;
614}
615
616
617int
618afr_sh_entry_expunge_entry (call_frame_t *frame, xlator_t *this,
619 gf_dirent_t *entry)
620{
621 afr_private_t *priv = NULL((void*)0);
622 afr_local_t *local = NULL((void*)0);
623 afr_self_heal_t *sh = NULL((void*)0);
624 int ret = -1;
625 call_frame_t *expunge_frame = NULL((void*)0);
626 afr_local_t *expunge_local = NULL((void*)0);
627 afr_self_heal_t *expunge_sh = NULL((void*)0);
628 int active_src = 0;
629 int source = 0;
630 int op_errno = 0;
631 char *name = NULL((void*)0);
632 int op_ret = -1;
633
634 priv = this->private;
635 local = frame->local;
636 sh = &local->self_heal;
637
638 active_src = sh->active_source;
639 source = sh->source;
640 sh->expunge_done = afr_sh_entry_expunge_entry_done;
641
642 name = entry->d_name;
643
644 if ((strcmp (name, ".") == 0)
645 || (strcmp (name, "..") == 0)) {
646
647 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("skipping inspection of %s under %s"
, name, local->loc.path); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 649, GF_LOG_TRACE, "skipping inspection of %s under %s"
, name, local->loc.path); } while (0)
648 "skipping inspection of %s under %s",do { do { if (0) printf ("skipping inspection of %s under %s"
, name, local->loc.path); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 649, GF_LOG_TRACE, "skipping inspection of %s under %s"
, name, local->loc.path); } while (0)
649 name, local->loc.path)do { do { if (0) printf ("skipping inspection of %s under %s"
, name, local->loc.path); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 649, GF_LOG_TRACE, "skipping inspection of %s under %s"
, name, local->loc.path); } while (0)
;
650 op_ret = 0;
651 goto out;
652 }
653
654 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("inspecting existence of %s under %s"
, name, local->loc.path); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 656, GF_LOG_TRACE, "inspecting existence of %s under %s"
, name, local->loc.path); } while (0)
655 "inspecting existence of %s under %s",do { do { if (0) printf ("inspecting existence of %s under %s"
, name, local->loc.path); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 656, GF_LOG_TRACE, "inspecting existence of %s under %s"
, name, local->loc.path); } while (0)
656 name, local->loc.path)do { do { if (0) printf ("inspecting existence of %s under %s"
, name, local->loc.path); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 656, GF_LOG_TRACE, "inspecting existence of %s under %s"
, name, local->loc.path); } while (0)
;
657
658 expunge_frame = copy_frame (frame);
659 if (!expunge_frame) {
660 op_errno = ENOMEM12;
661 goto out;
662 }
663
664 AFR_LOCAL_ALLOC_OR_GOTO (expunge_local, out)do { expunge_local = mem_get0 ((*__glusterfs_this_location())
->local_pool); if (!expunge_local) { do { do { if (0) printf
("out of memory :("); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 664, GF_LOG_ERROR, "out of memory :("); } while
(0); op_errno = 12; goto out; } } while (0);
;
665
666 expunge_frame->local = expunge_local;
667 expunge_sh = &expunge_local->self_heal;
668 expunge_sh->sh_frame = frame;
669 expunge_sh->active_source = active_src;
670 expunge_sh->entrybuf = entry->d_stat;
671 loc_copy (&expunge_sh->parent_loc, &local->loc);
672
673 ret = afr_build_child_loc (this, &expunge_local->loc, &local->loc,
674 name);
675 if (ret != 0) {
676 op_errno = EINVAL22;
677 goto out;
678 }
679
680 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("looking up %s on %s", expunge_local
->loc.path, priv->children[source]->name); } while (
0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 682, GF_LOG_TRACE, "looking up %s on %s", expunge_local->
loc.path, priv->children[source]->name); } while (0)
681 "looking up %s on %s", expunge_local->loc.path,do { do { if (0) printf ("looking up %s on %s", expunge_local
->loc.path, priv->children[source]->name); } while (
0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 682, GF_LOG_TRACE, "looking up %s on %s", expunge_local->
loc.path, priv->children[source]->name); } while (0)
682 priv->children[source]->name)do { do { if (0) printf ("looking up %s on %s", expunge_local
->loc.path, priv->children[source]->name); } while (
0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 682, GF_LOG_TRACE, "looking up %s on %s", expunge_local->
loc.path, priv->children[source]->name); } while (0)
;
683
684 STACK_WIND_COOKIE (expunge_frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 689, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[source]->fops->lookup_cbk) tmp_cbk =
afr_sh_entry_expunge_entry_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[source]; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame; _new
->cookie = (void *) (long) source; _new->wind_from = __FUNCTION__
; _new->wind_to = "priv->children[source]->fops->lookup"
; _new->unwind_to = "afr_sh_entry_expunge_entry_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[source]->fops->lookup_cbk
= afr_sh_entry_expunge_entry_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[source
]; if (priv->children[source]->ctx->measure_latency)
gf_latency_begin (_new, priv->children[source]->fops->
lookup); priv->children[source]->fops->lookup (_new,
priv->children[source], &expunge_local->loc, ((void
*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
685 afr_sh_entry_expunge_entry_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 689, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[source]->fops->lookup_cbk) tmp_cbk =
afr_sh_entry_expunge_entry_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[source]; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame; _new
->cookie = (void *) (long) source; _new->wind_from = __FUNCTION__
; _new->wind_to = "priv->children[source]->fops->lookup"
; _new->unwind_to = "afr_sh_entry_expunge_entry_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[source]->fops->lookup_cbk
= afr_sh_entry_expunge_entry_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[source
]; if (priv->children[source]->ctx->measure_latency)
gf_latency_begin (_new, priv->children[source]->fops->
lookup); priv->children[source]->fops->lookup (_new,
priv->children[source], &expunge_local->loc, ((void
*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
686 (void *) (long) source,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 689, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[source]->fops->lookup_cbk) tmp_cbk =
afr_sh_entry_expunge_entry_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[source]; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame; _new
->cookie = (void *) (long) source; _new->wind_from = __FUNCTION__
; _new->wind_to = "priv->children[source]->fops->lookup"
; _new->unwind_to = "afr_sh_entry_expunge_entry_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[source]->fops->lookup_cbk
= afr_sh_entry_expunge_entry_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[source
]; if (priv->children[source]->ctx->measure_latency)
gf_latency_begin (_new, priv->children[source]->fops->
lookup); priv->children[source]->fops->lookup (_new,
priv->children[source], &expunge_local->loc, ((void
*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
687 priv->children[source],do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 689, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[source]->fops->lookup_cbk) tmp_cbk =
afr_sh_entry_expunge_entry_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[source]; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame; _new
->cookie = (void *) (long) source; _new->wind_from = __FUNCTION__
; _new->wind_to = "priv->children[source]->fops->lookup"
; _new->unwind_to = "afr_sh_entry_expunge_entry_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[source]->fops->lookup_cbk
= afr_sh_entry_expunge_entry_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[source
]; if (priv->children[source]->ctx->measure_latency)
gf_latency_begin (_new, priv->children[source]->fops->
lookup); priv->children[source]->fops->lookup (_new,
priv->children[source], &expunge_local->loc, ((void
*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
688 priv->children[source]->fops->lookup,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 689, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[source]->fops->lookup_cbk) tmp_cbk =
afr_sh_entry_expunge_entry_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[source]; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame; _new
->cookie = (void *) (long) source; _new->wind_from = __FUNCTION__
; _new->wind_to = "priv->children[source]->fops->lookup"
; _new->unwind_to = "afr_sh_entry_expunge_entry_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[source]->fops->lookup_cbk
= afr_sh_entry_expunge_entry_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[source
]; if (priv->children[source]->ctx->measure_latency)
gf_latency_begin (_new, priv->children[source]->fops->
lookup); priv->children[source]->fops->lookup (_new,
priv->children[source], &expunge_local->loc, ((void
*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
689 &expunge_local->loc, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (expunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 689, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[source]->fops->lookup_cbk) tmp_cbk =
afr_sh_entry_expunge_entry_cbk; _new->root = expunge_frame
->root; _new->this = priv->children[source]; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = expunge_frame; _new
->cookie = (void *) (long) source; _new->wind_from = __FUNCTION__
; _new->wind_to = "priv->children[source]->fops->lookup"
; _new->unwind_to = "afr_sh_entry_expunge_entry_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&expunge_frame
->root->stack_lock); { expunge_frame->ref_count++; _new
->next = expunge_frame->root->frames.next; _new->
prev = &expunge_frame->root->frames; if (expunge_frame
->root->frames.next) expunge_frame->root->frames.
next->prev = _new; expunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&expunge_frame->root->
stack_lock); priv->children[source]->fops->lookup_cbk
= afr_sh_entry_expunge_entry_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[source
]; if (priv->children[source]->ctx->measure_latency)
gf_latency_begin (_new, priv->children[source]->fops->
lookup); priv->children[source]->fops->lookup (_new,
priv->children[source], &expunge_local->loc, ((void
*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
;
690
691 ret = 0;
692out:
693 if (ret == -1)
694 sh->expunge_done (frame, this, active_src, op_ret, op_errno);
695
696 return 0;
697}
698
699
700int
701afr_sh_entry_expunge_readdir_cbk (call_frame_t *frame, void *cookie,
702 xlator_t *this,
703 int32_t op_ret, int32_t op_errno,
704 gf_dirent_t *entries, dict_t *xdata)
705{
706 afr_private_t *priv = NULL((void*)0);
707 afr_local_t *local = NULL((void*)0);
708 afr_self_heal_t *sh = NULL((void*)0);
709 gf_dirent_t *entry = NULL((void*)0);
710 off_t last_offset = 0;
711 int active_src = 0;
712 int entry_count = 0;
713
714 priv = this->private;
715 local = frame->local;
716 sh = &local->self_heal;
717
718 active_src = sh->active_source;
719
720 if (op_ret <= 0) {
721 if (op_ret < 0) {
722 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 726, GF_LOG_INFO, "readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0)
723 "readdir of %s on subvolume %s failed (%s)",do { do { if (0) printf ("readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 726, GF_LOG_INFO, "readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0)
724 local->loc.path,do { do { if (0) printf ("readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 726, GF_LOG_INFO, "readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0)
725 priv->children[active_src]->name,do { do { if (0) printf ("readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 726, GF_LOG_INFO, "readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0)
726 strerror (op_errno))do { do { if (0) printf ("readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 726, GF_LOG_INFO, "readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0)
;
727 } else {
728 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("readdir of %s on subvolume %s complete"
, local->loc.path, priv->children[active_src]->name)
; } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 731, GF_LOG_TRACE, "readdir of %s on subvolume %s complete"
, local->loc.path, priv->children[active_src]->name)
; } while (0)
729 "readdir of %s on subvolume %s complete",do { do { if (0) printf ("readdir of %s on subvolume %s complete"
, local->loc.path, priv->children[active_src]->name)
; } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 731, GF_LOG_TRACE, "readdir of %s on subvolume %s complete"
, local->loc.path, priv->children[active_src]->name)
; } while (0)
730 local->loc.path,do { do { if (0) printf ("readdir of %s on subvolume %s complete"
, local->loc.path, priv->children[active_src]->name)
; } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 731, GF_LOG_TRACE, "readdir of %s on subvolume %s complete"
, local->loc.path, priv->children[active_src]->name)
; } while (0)
731 priv->children[active_src]->name)do { do { if (0) printf ("readdir of %s on subvolume %s complete"
, local->loc.path, priv->children[active_src]->name)
; } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 731, GF_LOG_TRACE, "readdir of %s on subvolume %s complete"
, local->loc.path, priv->children[active_src]->name)
; } while (0)
;
732 }
733
734 afr_sh_entry_expunge_all (frame, this);
735 return 0;
736 }
737
738 list_for_each_entry (entry, &entries->list, list)for (entry = ((typeof(*entry) *)((char *)((&entries->list
)->next)-(unsigned long)(&((typeof(*entry) *)0)->list
))); &entry->list != (&entries->list); entry = (
(typeof(*entry) *)((char *)(entry->list.next)-(unsigned long
)(&((typeof(*entry) *)0)->list))))
{
739 last_offset = entry->d_off;
740 entry_count++;
741 }
742
743 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("readdir'ed %d entries from %s", entry_count
, priv->children[active_src]->name); } while (0); _gf_log
(this->name, "afr-self-heal-entry.c", __FUNCTION__, 745, GF_LOG_TRACE
, "readdir'ed %d entries from %s", entry_count, priv->children
[active_src]->name); } while (0)
744 "readdir'ed %d entries from %s",do { do { if (0) printf ("readdir'ed %d entries from %s", entry_count
, priv->children[active_src]->name); } while (0); _gf_log
(this->name, "afr-self-heal-entry.c", __FUNCTION__, 745, GF_LOG_TRACE
, "readdir'ed %d entries from %s", entry_count, priv->children
[active_src]->name); } while (0)
745 entry_count, priv->children[active_src]->name)do { do { if (0) printf ("readdir'ed %d entries from %s", entry_count
, priv->children[active_src]->name); } while (0); _gf_log
(this->name, "afr-self-heal-entry.c", __FUNCTION__, 745, GF_LOG_TRACE
, "readdir'ed %d entries from %s", entry_count, priv->children
[active_src]->name); } while (0)
;
746
747 sh->offset = last_offset;
748 local->call_count = entry_count;
749
750 list_for_each_entry (entry, &entries->list, list)for (entry = ((typeof(*entry) *)((char *)((&entries->list
)->next)-(unsigned long)(&((typeof(*entry) *)0)->list
))); &entry->list != (&entries->list); entry = (
(typeof(*entry) *)((char *)(entry->list.next)-(unsigned long
)(&((typeof(*entry) *)0)->list))))
{
751 afr_sh_entry_expunge_entry (frame, this, entry);
752 }
753
754 return 0;
755}
756
757int
758afr_sh_entry_expunge_subvol (call_frame_t *frame, xlator_t *this,
759 int active_src)
760{
761 afr_private_t *priv = NULL((void*)0);
762 afr_local_t *local = NULL((void*)0);
763 afr_self_heal_t *sh = NULL((void*)0);
764
765 priv = this->private;
766 local = frame->local;
767 sh = &local->self_heal;
768
769 STACK_WIND (frame, afr_sh_entry_expunge_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", "afr-self-heal-entry.c", __FUNCTION__
, 772, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->readdirp_cbk) tmp_cbk
= afr_sh_entry_expunge_readdir_cbk; _new->root = frame->
root; _new->this = priv->children[active_src]; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"priv->children[active_src]->fops->readdirp"; _new->
unwind_to = "afr_sh_entry_expunge_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
()) = priv->children[active_src]; if (frame->this->ctx
->measure_latency) gf_latency_begin (_new, priv->children
[active_src]->fops->readdirp); priv->children[active_src
]->fops->readdirp (_new, priv->children[active_src],
sh->healing_fd, sh->block_size, sh->offset, ((void*
)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
770 priv->children[active_src],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", "afr-self-heal-entry.c", __FUNCTION__
, 772, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->readdirp_cbk) tmp_cbk
= afr_sh_entry_expunge_readdir_cbk; _new->root = frame->
root; _new->this = priv->children[active_src]; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"priv->children[active_src]->fops->readdirp"; _new->
unwind_to = "afr_sh_entry_expunge_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
()) = priv->children[active_src]; if (frame->this->ctx
->measure_latency) gf_latency_begin (_new, priv->children
[active_src]->fops->readdirp); priv->children[active_src
]->fops->readdirp (_new, priv->children[active_src],
sh->healing_fd, sh->block_size, sh->offset, ((void*
)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
771 priv->children[active_src]->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", "afr-self-heal-entry.c", __FUNCTION__
, 772, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->readdirp_cbk) tmp_cbk
= afr_sh_entry_expunge_readdir_cbk; _new->root = frame->
root; _new->this = priv->children[active_src]; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"priv->children[active_src]->fops->readdirp"; _new->
unwind_to = "afr_sh_entry_expunge_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
()) = priv->children[active_src]; if (frame->this->ctx
->measure_latency) gf_latency_begin (_new, priv->children
[active_src]->fops->readdirp); priv->children[active_src
]->fops->readdirp (_new, priv->children[active_src],
sh->healing_fd, sh->block_size, sh->offset, ((void*
)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
772 sh->healing_fd, sh->block_size, sh->offset, NULL)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", "afr-self-heal-entry.c", __FUNCTION__
, 772, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->readdirp_cbk) tmp_cbk
= afr_sh_entry_expunge_readdir_cbk; _new->root = frame->
root; _new->this = priv->children[active_src]; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"priv->children[active_src]->fops->readdirp"; _new->
unwind_to = "afr_sh_entry_expunge_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
()) = priv->children[active_src]; if (frame->this->ctx
->measure_latency) gf_latency_begin (_new, priv->children
[active_src]->fops->readdirp); priv->children[active_src
]->fops->readdirp (_new, priv->children[active_src],
sh->healing_fd, sh->block_size, sh->offset, ((void*
)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
;
773
774 return 0;
775}
776
777
778int
779afr_sh_entry_expunge_all (call_frame_t *frame, xlator_t *this)
780{
781 afr_private_t *priv = NULL((void*)0);
782 afr_local_t *local = NULL((void*)0);
783 afr_self_heal_t *sh = NULL((void*)0);
784 int active_src = -1;
785
786 priv = this->private;
787 local = frame->local;
788 sh = &local->self_heal;
789
790 sh->offset = 0;
791
792 if (sh->source == -1) {
793 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("no active sources for %s to expunge entries"
, local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 795, GF_LOG_DEBUG, "no active sources for %s to expunge entries"
, local->loc.path); } while (0)
794 "no active sources for %s to expunge entries",do { do { if (0) printf ("no active sources for %s to expunge entries"
, local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 795, GF_LOG_DEBUG, "no active sources for %s to expunge entries"
, local->loc.path); } while (0)
795 local->loc.path)do { do { if (0) printf ("no active sources for %s to expunge entries"
, local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 795, GF_LOG_DEBUG, "no active sources for %s to expunge entries"
, local->loc.path); } while (0)
;
796 goto out;
797 }
798
799 active_src = next_active_sink (frame, this, sh->active_source);
800 sh->active_source = active_src;
801
802 if (sh->op_failed) {
803 goto out;
804 }
805
806 if (active_src == -1) {
807 /* completed creating missing files on all subvolumes */
808 goto out;
809 }
810
811 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("expunging entries of %s on %s to other sinks"
, local->loc.path, priv->children[active_src]->name)
; } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 813, GF_LOG_TRACE, "expunging entries of %s on %s to other sinks"
, local->loc.path, priv->children[active_src]->name)
; } while (0)
812 "expunging entries of %s on %s to other sinks",do { do { if (0) printf ("expunging entries of %s on %s to other sinks"
, local->loc.path, priv->children[active_src]->name)
; } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 813, GF_LOG_TRACE, "expunging entries of %s on %s to other sinks"
, local->loc.path, priv->children[active_src]->name)
; } while (0)
813 local->loc.path, priv->children[active_src]->name)do { do { if (0) printf ("expunging entries of %s on %s to other sinks"
, local->loc.path, priv->children[active_src]->name)
; } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 813, GF_LOG_TRACE, "expunging entries of %s on %s to other sinks"
, local->loc.path, priv->children[active_src]->name)
; } while (0)
;
814
815 afr_sh_entry_expunge_subvol (frame, this, active_src);
816
817 return 0;
818out:
819 afr_sh_entry_impunge_all (frame, this);
820 return 0;
821
822}
823
824
825int
826afr_sh_entry_impunge_entry_done (call_frame_t *frame, xlator_t *this,
827 int32_t op_ret, int32_t op_errno)
828{
829 int call_count = 0;
830 afr_local_t *local = NULL((void*)0);
831 afr_self_heal_t *sh = NULL((void*)0);
832
833 local = frame->local;
834 sh = &local->self_heal;
835 if (op_ret < 0)
836 sh->entries_skipped = _gf_true;
837 call_count = afr_frame_return (frame);
838 if (call_count == 0)
839 afr_sh_entry_impunge_subvol (frame, this);
840
841 return 0;
842}
843
844void
845afr_sh_entry_call_impunge_done (call_frame_t *impunge_frame, xlator_t *this,
846 int32_t op_ret, int32_t op_errno)
847{
848 afr_local_t *impunge_local = NULL((void*)0);
849 afr_local_t *local = NULL((void*)0);
850 afr_self_heal_t *sh = NULL((void*)0);
851 afr_self_heal_t *impunge_sh = NULL((void*)0);
852 call_frame_t *frame = NULL((void*)0);
853
854 AFR_INIT_SH_FRAME_VALS (impunge_frame, impunge_local, impunge_sh,do { impunge_local = impunge_frame->local; impunge_sh = &
impunge_local->self_heal; frame = impunge_sh->sh_frame;
local = frame->local; sh = &local->self_heal; } while
(0);
855 frame, local, sh)do { impunge_local = impunge_frame->local; impunge_sh = &
impunge_local->self_heal; frame = impunge_sh->sh_frame;
local = frame->local; sh = &local->self_heal; } while
(0);
;
856
857 AFR_STACK_DESTROY (impunge_frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = impunge_frame->local; __this = impunge_frame
->this; impunge_frame->local = ((void*)0); STACK_DESTROY
(impunge_frame->root); if (__local) { afr_local_cleanup (
__local, __this); mem_put (__local); } } while (0);
;
858 sh->impunge_done (frame, this, op_ret, op_errno);
859}
860
861int
862afr_sh_entry_impunge_setattr_cbk (call_frame_t *impunge_frame, void *cookie,
863 xlator_t *this,
864 int32_t op_ret, int32_t op_errno,
865 struct iatt *preop, struct iatt *postop,
866 dict_t *xdata)
867{
868 int call_count = 0;
869 afr_private_t *priv = NULL((void*)0);
870 afr_local_t *impunge_local = NULL((void*)0);
871 int child_index = 0;
872
873 priv = this->private;
874 impunge_local = impunge_frame->local;
875 child_index = (long) cookie;
876
877 if (op_ret == 0) {
878 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("setattr done for %s on %s", impunge_local
->loc.path, priv->children[child_index]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 881, GF_LOG_DEBUG, "setattr done for %s on %s", impunge_local
->loc.path, priv->children[child_index]->name); } while
(0)
879 "setattr done for %s on %s",do { do { if (0) printf ("setattr done for %s on %s", impunge_local
->loc.path, priv->children[child_index]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 881, GF_LOG_DEBUG, "setattr done for %s on %s", impunge_local
->loc.path, priv->children[child_index]->name); } while
(0)
880 impunge_local->loc.path,do { do { if (0) printf ("setattr done for %s on %s", impunge_local
->loc.path, priv->children[child_index]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 881, GF_LOG_DEBUG, "setattr done for %s on %s", impunge_local
->loc.path, priv->children[child_index]->name); } while
(0)
881 priv->children[child_index]->name)do { do { if (0) printf ("setattr done for %s on %s", impunge_local
->loc.path, priv->children[child_index]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 881, GF_LOG_DEBUG, "setattr done for %s on %s", impunge_local
->loc.path, priv->children[child_index]->name); } while
(0)
;
882 } else {
883 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("setattr (%s) on %s failed (%s)", impunge_local
->loc.path, priv->children[child_index]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 887, GF_LOG_INFO, "setattr (%s) on %s failed (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
884 "setattr (%s) on %s failed (%s)",do { do { if (0) printf ("setattr (%s) on %s failed (%s)", impunge_local
->loc.path, priv->children[child_index]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 887, GF_LOG_INFO, "setattr (%s) on %s failed (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
885 impunge_local->loc.path,do { do { if (0) printf ("setattr (%s) on %s failed (%s)", impunge_local
->loc.path, priv->children[child_index]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 887, GF_LOG_INFO, "setattr (%s) on %s failed (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
886 priv->children[child_index]->name,do { do { if (0) printf ("setattr (%s) on %s failed (%s)", impunge_local
->loc.path, priv->children[child_index]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 887, GF_LOG_INFO, "setattr (%s) on %s failed (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
887 strerror (op_errno))do { do { if (0) printf ("setattr (%s) on %s failed (%s)", impunge_local
->loc.path, priv->children[child_index]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 887, GF_LOG_INFO, "setattr (%s) on %s failed (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
;
888 }
889
890 call_count = afr_frame_return (impunge_frame);
891 if (call_count == 0) {
892 afr_sh_entry_call_impunge_done (impunge_frame, this,
893 0, op_errno);
894 }
895
896 return 0;
897}
898
899int
900afr_sh_entry_impunge_parent_setattr_cbk (call_frame_t *setattr_frame,
901 void *cookie, xlator_t *this,
902 int32_t op_ret, int32_t op_errno,
903 struct iatt *preop, struct iatt *postop,
904 dict_t *xdata)
905{
906 int call_count = 0;
907 afr_local_t *setattr_local = NULL((void*)0);
908
909 setattr_local = setattr_frame->local;
910 if (op_ret != 0) {
911 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("setattr on parent directory (%s) failed: %s"
, setattr_local->loc.path, strerror (op_errno)); } while (
0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 913, GF_LOG_INFO, "setattr on parent directory (%s) failed: %s"
, setattr_local->loc.path, strerror (op_errno)); } while (
0)
912 "setattr on parent directory (%s) failed: %s",do { do { if (0) printf ("setattr on parent directory (%s) failed: %s"
, setattr_local->loc.path, strerror (op_errno)); } while (
0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 913, GF_LOG_INFO, "setattr on parent directory (%s) failed: %s"
, setattr_local->loc.path, strerror (op_errno)); } while (
0)
913 setattr_local->loc.path, strerror (op_errno))do { do { if (0) printf ("setattr on parent directory (%s) failed: %s"
, setattr_local->loc.path, strerror (op_errno)); } while (
0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 913, GF_LOG_INFO, "setattr on parent directory (%s) failed: %s"
, setattr_local->loc.path, strerror (op_errno)); } while (
0)
;
914 }
915
916 call_count = afr_frame_return (setattr_frame);
917 if (call_count == 0)
918 AFR_STACK_DESTROY (setattr_frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = setattr_frame->local; __this = setattr_frame
->this; setattr_frame->local = ((void*)0); STACK_DESTROY
(setattr_frame->root); if (__local) { afr_local_cleanup (
__local, __this); mem_put (__local); } } while (0);
;
919 return 0;
920}
921
922int
923afr_sh_entry_impunge_setattr (call_frame_t *impunge_frame, xlator_t *this)
924{
925 afr_private_t *priv = NULL((void*)0);
926 afr_local_t *impunge_local = NULL((void*)0);
927 afr_local_t *setattr_local = NULL((void*)0);
928 afr_self_heal_t *impunge_sh = NULL((void*)0);
929 call_frame_t *setattr_frame = NULL((void*)0);
930 int32_t valid = 0;
931 int32_t op_errno = 0;
932 int child_index = 0;
933 int call_count = 0;
934 int i = 0;
935
936 priv = this->private;
937 impunge_local = impunge_frame->local;
938 impunge_sh = &impunge_local->self_heal;
939
940 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("setting ownership of %s on %s to %d/%d"
, impunge_local->loc.path, priv->children[child_index]->
name, impunge_sh->entrybuf.ia_uid, impunge_sh->entrybuf
.ia_gid); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 945, GF_LOG_DEBUG, "setting ownership of %s on %s to %d/%d"
, impunge_local->loc.path, priv->children[child_index]->
name, impunge_sh->entrybuf.ia_uid, impunge_sh->entrybuf
.ia_gid); } while (0)
941 "setting ownership of %s on %s to %d/%d",do { do { if (0) printf ("setting ownership of %s on %s to %d/%d"
, impunge_local->loc.path, priv->children[child_index]->
name, impunge_sh->entrybuf.ia_uid, impunge_sh->entrybuf
.ia_gid); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 945, GF_LOG_DEBUG, "setting ownership of %s on %s to %d/%d"
, impunge_local->loc.path, priv->children[child_index]->
name, impunge_sh->entrybuf.ia_uid, impunge_sh->entrybuf
.ia_gid); } while (0)
942 impunge_local->loc.path,do { do { if (0) printf ("setting ownership of %s on %s to %d/%d"
, impunge_local->loc.path, priv->children[child_index]->
name, impunge_sh->entrybuf.ia_uid, impunge_sh->entrybuf
.ia_gid); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 945, GF_LOG_DEBUG, "setting ownership of %s on %s to %d/%d"
, impunge_local->loc.path, priv->children[child_index]->
name, impunge_sh->entrybuf.ia_uid, impunge_sh->entrybuf
.ia_gid); } while (0)
943 priv->children[child_index]->name,do { do { if (0) printf ("setting ownership of %s on %s to %d/%d"
, impunge_local->loc.path, priv->children[child_index]->
name, impunge_sh->entrybuf.ia_uid, impunge_sh->entrybuf
.ia_gid); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 945, GF_LOG_DEBUG, "setting ownership of %s on %s to %d/%d"
, impunge_local->loc.path, priv->children[child_index]->
name, impunge_sh->entrybuf.ia_uid, impunge_sh->entrybuf
.ia_gid); } while (0)
944 impunge_sh->entrybuf.ia_uid,do { do { if (0) printf ("setting ownership of %s on %s to %d/%d"
, impunge_local->loc.path, priv->children[child_index]->
name, impunge_sh->entrybuf.ia_uid, impunge_sh->entrybuf
.ia_gid); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 945, GF_LOG_DEBUG, "setting ownership of %s on %s to %d/%d"
, impunge_local->loc.path, priv->children[child_index]->
name, impunge_sh->entrybuf.ia_uid, impunge_sh->entrybuf
.ia_gid); } while (0)
945 impunge_sh->entrybuf.ia_gid)do { do { if (0) printf ("setting ownership of %s on %s to %d/%d"
, impunge_local->loc.path, priv->children[child_index]->
name, impunge_sh->entrybuf.ia_uid, impunge_sh->entrybuf
.ia_gid); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 945, GF_LOG_DEBUG, "setting ownership of %s on %s to %d/%d"
, impunge_local->loc.path, priv->children[child_index]->
name, impunge_sh->entrybuf.ia_uid, impunge_sh->entrybuf
.ia_gid); } while (0)
;
946
947 setattr_frame = copy_frame (impunge_frame);
948 if (!setattr_frame) {
949 op_errno = ENOMEM12;
950 goto out;
951 }
952 AFR_LOCAL_ALLOC_OR_GOTO (setattr_frame->local, out)do { setattr_frame->local = mem_get0 ((*__glusterfs_this_location
())->local_pool); if (!setattr_frame->local) { do { do {
if (0) printf ("out of memory :("); } while (0); _gf_log (this
->name, "afr-self-heal-entry.c", __FUNCTION__, 952, GF_LOG_ERROR
, "out of memory :("); } while (0); op_errno = 12; goto out; }
} while (0);
;
953 setattr_local = setattr_frame->local;
954 call_count = afr_errno_count (NULL((void*)0), impunge_sh->child_errno,
955 priv->child_count, 0);
956 loc_copy (&setattr_local->loc, &impunge_sh->parent_loc);
957 impunge_local->call_count = call_count;
958 setattr_local->call_count = call_count;
959 for (i = 0; i < priv->child_count; i++) {
960 if (impunge_sh->child_errno[i])
961 continue;
962 valid = GF_SET_ATTR_ATIME0x10 | GF_SET_ATTR_MTIME0x20;
963 STACK_WIND_COOKIE (setattr_frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (setattr_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 968, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_sh_entry_impunge_parent_setattr_cbk
; _new->root = setattr_frame->root; _new->this = priv
->children[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->
parent = setattr_frame; _new->cookie = (void *) (long) i; _new
->wind_from = __FUNCTION__; _new->wind_to = "priv->children[i]->fops->setattr"
; _new->unwind_to = "afr_sh_entry_impunge_parent_setattr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&setattr_frame->root->stack_lock); { setattr_frame
->ref_count++; _new->next = setattr_frame->root->
frames.next; _new->prev = &setattr_frame->root->
frames; if (setattr_frame->root->frames.next) setattr_frame
->root->frames.next->prev = _new; setattr_frame->
root->frames.next = _new; } pthread_spin_unlock (&setattr_frame
->root->stack_lock); priv->children[i]->fops->
setattr_cbk = afr_sh_entry_impunge_parent_setattr_cbk; old_THIS
= (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->setattr); priv->children[i]->fops->setattr
(_new, priv->children[i], &setattr_local->loc, &
impunge_sh->parentbuf, valid, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
964 afr_sh_entry_impunge_parent_setattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (setattr_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 968, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_sh_entry_impunge_parent_setattr_cbk
; _new->root = setattr_frame->root; _new->this = priv
->children[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->
parent = setattr_frame; _new->cookie = (void *) (long) i; _new
->wind_from = __FUNCTION__; _new->wind_to = "priv->children[i]->fops->setattr"
; _new->unwind_to = "afr_sh_entry_impunge_parent_setattr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&setattr_frame->root->stack_lock); { setattr_frame
->ref_count++; _new->next = setattr_frame->root->
frames.next; _new->prev = &setattr_frame->root->
frames; if (setattr_frame->root->frames.next) setattr_frame
->root->frames.next->prev = _new; setattr_frame->
root->frames.next = _new; } pthread_spin_unlock (&setattr_frame
->root->stack_lock); priv->children[i]->fops->
setattr_cbk = afr_sh_entry_impunge_parent_setattr_cbk; old_THIS
= (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->setattr); priv->children[i]->fops->setattr
(_new, priv->children[i], &setattr_local->loc, &
impunge_sh->parentbuf, valid, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
965 (void *) (long) i, priv->children[i],do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (setattr_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 968, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_sh_entry_impunge_parent_setattr_cbk
; _new->root = setattr_frame->root; _new->this = priv
->children[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->
parent = setattr_frame; _new->cookie = (void *) (long) i; _new
->wind_from = __FUNCTION__; _new->wind_to = "priv->children[i]->fops->setattr"
; _new->unwind_to = "afr_sh_entry_impunge_parent_setattr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&setattr_frame->root->stack_lock); { setattr_frame
->ref_count++; _new->next = setattr_frame->root->
frames.next; _new->prev = &setattr_frame->root->
frames; if (setattr_frame->root->frames.next) setattr_frame
->root->frames.next->prev = _new; setattr_frame->
root->frames.next = _new; } pthread_spin_unlock (&setattr_frame
->root->stack_lock); priv->children[i]->fops->
setattr_cbk = afr_sh_entry_impunge_parent_setattr_cbk; old_THIS
= (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->setattr); priv->children[i]->fops->setattr
(_new, priv->children[i], &setattr_local->loc, &
impunge_sh->parentbuf, valid, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
966 priv->children[i]->fops->setattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (setattr_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 968, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_sh_entry_impunge_parent_setattr_cbk
; _new->root = setattr_frame->root; _new->this = priv
->children[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->
parent = setattr_frame; _new->cookie = (void *) (long) i; _new
->wind_from = __FUNCTION__; _new->wind_to = "priv->children[i]->fops->setattr"
; _new->unwind_to = "afr_sh_entry_impunge_parent_setattr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&setattr_frame->root->stack_lock); { setattr_frame
->ref_count++; _new->next = setattr_frame->root->
frames.next; _new->prev = &setattr_frame->root->
frames; if (setattr_frame->root->frames.next) setattr_frame
->root->frames.next->prev = _new; setattr_frame->
root->frames.next = _new; } pthread_spin_unlock (&setattr_frame
->root->stack_lock); priv->children[i]->fops->
setattr_cbk = afr_sh_entry_impunge_parent_setattr_cbk; old_THIS
= (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->setattr); priv->children[i]->fops->setattr
(_new, priv->children[i], &setattr_local->loc, &
impunge_sh->parentbuf, valid, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
967 &setattr_local->loc,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (setattr_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 968, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_sh_entry_impunge_parent_setattr_cbk
; _new->root = setattr_frame->root; _new->this = priv
->children[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->
parent = setattr_frame; _new->cookie = (void *) (long) i; _new
->wind_from = __FUNCTION__; _new->wind_to = "priv->children[i]->fops->setattr"
; _new->unwind_to = "afr_sh_entry_impunge_parent_setattr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&setattr_frame->root->stack_lock); { setattr_frame
->ref_count++; _new->next = setattr_frame->root->
frames.next; _new->prev = &setattr_frame->root->
frames; if (setattr_frame->root->frames.next) setattr_frame
->root->frames.next->prev = _new; setattr_frame->
root->frames.next = _new; } pthread_spin_unlock (&setattr_frame
->root->stack_lock); priv->children[i]->fops->
setattr_cbk = afr_sh_entry_impunge_parent_setattr_cbk; old_THIS
= (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->setattr); priv->children[i]->fops->setattr
(_new, priv->children[i], &setattr_local->loc, &
impunge_sh->parentbuf, valid, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
968 &impunge_sh->parentbuf, valid, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (setattr_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 968, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_sh_entry_impunge_parent_setattr_cbk
; _new->root = setattr_frame->root; _new->this = priv
->children[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->
parent = setattr_frame; _new->cookie = (void *) (long) i; _new
->wind_from = __FUNCTION__; _new->wind_to = "priv->children[i]->fops->setattr"
; _new->unwind_to = "afr_sh_entry_impunge_parent_setattr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&setattr_frame->root->stack_lock); { setattr_frame
->ref_count++; _new->next = setattr_frame->root->
frames.next; _new->prev = &setattr_frame->root->
frames; if (setattr_frame->root->frames.next) setattr_frame
->root->frames.next->prev = _new; setattr_frame->
root->frames.next = _new; } pthread_spin_unlock (&setattr_frame
->root->stack_lock); priv->children[i]->fops->
setattr_cbk = afr_sh_entry_impunge_parent_setattr_cbk; old_THIS
= (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->setattr); priv->children[i]->fops->setattr
(_new, priv->children[i], &setattr_local->loc, &
impunge_sh->parentbuf, valid, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
969
970 valid = GF_SET_ATTR_UID0x2 | GF_SET_ATTR_GID0x4 |
971 GF_SET_ATTR_ATIME0x10 | GF_SET_ATTR_MTIME0x20;
972 STACK_WIND_COOKIE (impunge_frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 977, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_sh_entry_impunge_setattr_cbk
; _new->root = impunge_frame->root; _new->this = priv
->children[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->
parent = impunge_frame; _new->cookie = (void *) (long) i; _new
->wind_from = __FUNCTION__; _new->wind_to = "priv->children[i]->fops->setattr"
; _new->unwind_to = "afr_sh_entry_impunge_setattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[i]->fops->setattr_cbk = afr_sh_entry_impunge_setattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->setattr); priv->children[i]->fops->setattr
(_new, priv->children[i], &impunge_local->loc, &
impunge_sh->entrybuf, valid, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
973 afr_sh_entry_impunge_setattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 977, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_sh_entry_impunge_setattr_cbk
; _new->root = impunge_frame->root; _new->this = priv
->children[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->
parent = impunge_frame; _new->cookie = (void *) (long) i; _new
->wind_from = __FUNCTION__; _new->wind_to = "priv->children[i]->fops->setattr"
; _new->unwind_to = "afr_sh_entry_impunge_setattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[i]->fops->setattr_cbk = afr_sh_entry_impunge_setattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->setattr); priv->children[i]->fops->setattr
(_new, priv->children[i], &impunge_local->loc, &
impunge_sh->entrybuf, valid, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
974 (void *) (long) i, priv->children[i],do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 977, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_sh_entry_impunge_setattr_cbk
; _new->root = impunge_frame->root; _new->this = priv
->children[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->
parent = impunge_frame; _new->cookie = (void *) (long) i; _new
->wind_from = __FUNCTION__; _new->wind_to = "priv->children[i]->fops->setattr"
; _new->unwind_to = "afr_sh_entry_impunge_setattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[i]->fops->setattr_cbk = afr_sh_entry_impunge_setattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->setattr); priv->children[i]->fops->setattr
(_new, priv->children[i], &impunge_local->loc, &
impunge_sh->entrybuf, valid, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
975 priv->children[i]->fops->setattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 977, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_sh_entry_impunge_setattr_cbk
; _new->root = impunge_frame->root; _new->this = priv
->children[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->
parent = impunge_frame; _new->cookie = (void *) (long) i; _new
->wind_from = __FUNCTION__; _new->wind_to = "priv->children[i]->fops->setattr"
; _new->unwind_to = "afr_sh_entry_impunge_setattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[i]->fops->setattr_cbk = afr_sh_entry_impunge_setattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->setattr); priv->children[i]->fops->setattr
(_new, priv->children[i], &impunge_local->loc, &
impunge_sh->entrybuf, valid, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
976 &impunge_local->loc,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 977, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_sh_entry_impunge_setattr_cbk
; _new->root = impunge_frame->root; _new->this = priv
->children[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->
parent = impunge_frame; _new->cookie = (void *) (long) i; _new
->wind_from = __FUNCTION__; _new->wind_to = "priv->children[i]->fops->setattr"
; _new->unwind_to = "afr_sh_entry_impunge_setattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[i]->fops->setattr_cbk = afr_sh_entry_impunge_setattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->setattr); priv->children[i]->fops->setattr
(_new, priv->children[i], &impunge_local->loc, &
impunge_sh->entrybuf, valid, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
977 &impunge_sh->entrybuf, valid, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 977, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_sh_entry_impunge_setattr_cbk
; _new->root = impunge_frame->root; _new->this = priv
->children[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->
parent = impunge_frame; _new->cookie = (void *) (long) i; _new
->wind_from = __FUNCTION__; _new->wind_to = "priv->children[i]->fops->setattr"
; _new->unwind_to = "afr_sh_entry_impunge_setattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[i]->fops->setattr_cbk = afr_sh_entry_impunge_setattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->setattr); priv->children[i]->fops->setattr
(_new, priv->children[i], &impunge_local->loc, &
impunge_sh->entrybuf, valid, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
978 call_count--;
979 }
980 GF_ASSERT (!call_count)do { if (!(!call_count)) { do { do { if (0) printf ("Assertion failed: "
"!call_count"); } while (0); _gf_log_callingfn ("", "afr-self-heal-entry.c"
, __FUNCTION__, 980, GF_LOG_ERROR, "Assertion failed: " "!call_count"
); } while (0); } } while (0)
;
981 return 0;
982out:
983 if (setattr_frame)
984 AFR_STACK_DESTROY (setattr_frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = setattr_frame->local; __this = setattr_frame
->this; setattr_frame->local = ((void*)0); STACK_DESTROY
(setattr_frame->root); if (__local) { afr_local_cleanup (
__local, __this); mem_put (__local); } } while (0);
;
985 afr_sh_entry_call_impunge_done (impunge_frame, this, 0, op_errno);
986 return 0;
987}
988
989int
990afr_sh_entry_impunge_xattrop_cbk (call_frame_t *impunge_frame, void *cookie,
991 xlator_t *this,
992 int32_t op_ret, int32_t op_errno,
993 dict_t *xattr, dict_t *xdata)
994{
995 afr_private_t *priv = NULL((void*)0);
996 afr_local_t *impunge_local = NULL((void*)0);
997 int child_index = 0;
998
999 priv = this->private;
1000 impunge_local = impunge_frame->local;
1001
1002 child_index = (long) cookie;
1003
1004 if (op_ret == -1) {
1005 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("%s: failed to perform xattrop on %s (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 1009, GF_LOG_INFO, "%s: failed to perform xattrop on %s (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
1006 "%s: failed to perform xattrop on %s (%s)",do { do { if (0) printf ("%s: failed to perform xattrop on %s (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 1009, GF_LOG_INFO, "%s: failed to perform xattrop on %s (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
1007 impunge_local->loc.path,do { do { if (0) printf ("%s: failed to perform xattrop on %s (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 1009, GF_LOG_INFO, "%s: failed to perform xattrop on %s (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
1008 priv->children[child_index]->name,do { do { if (0) printf ("%s: failed to perform xattrop on %s (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 1009, GF_LOG_INFO, "%s: failed to perform xattrop on %s (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
1009 strerror (op_errno))do { do { if (0) printf ("%s: failed to perform xattrop on %s (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 1009, GF_LOG_INFO, "%s: failed to perform xattrop on %s (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
;
1010 goto out;
1011 }
1012
1013 afr_sh_entry_impunge_setattr (impunge_frame, this);
1014 return 0;
1015out:
1016 afr_sh_entry_call_impunge_done (impunge_frame, this,
1017 -1, op_errno);
1018 return 0;
1019}
1020
1021int
1022afr_sh_entry_impunge_perform_xattrop (call_frame_t *impunge_frame,
1023 xlator_t *this)
1024{
1025 int active_src = 0;
1026 dict_t *xattr = NULL((void*)0);
1027 afr_private_t *priv = NULL((void*)0);
1028 afr_local_t *impunge_local = NULL((void*)0);
1029 afr_self_heal_t *impunge_sh = NULL((void*)0);
1030 int32_t op_errno = 0;
1031
1032 priv = this->private;
1033 impunge_local = impunge_frame->local;
1034 impunge_sh = &impunge_local->self_heal;
1035 active_src = impunge_sh->active_source;
1036
1037 afr_prepare_new_entry_pending_matrix (impunge_local->pending,
1038 afr_is_errno_unset,
1039 impunge_sh->child_errno,
1040 &impunge_sh->entrybuf,
1041 priv->child_count);
1042 xattr = dict_new ();
1043 if (!xattr) {
1044 op_errno = ENOMEM12;
1045 goto out;
1046 }
1047
1048 afr_set_pending_dict (priv, xattr, impunge_local->pending, active_src,
1049 LOCAL_LAST);
1050
1051 STACK_WIND_COOKIE (impunge_frame, afr_sh_entry_impunge_xattrop_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1055, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->xattrop_cbk) tmp_cbk
= afr_sh_entry_impunge_xattrop_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->xattrop"
; _new->unwind_to = "afr_sh_entry_impunge_xattrop_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[active_src]->fops->xattrop_cbk
= afr_sh_entry_impunge_xattrop_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->xattrop); priv->children[active_src]->fops->xattrop
(_new, priv->children[active_src], &impunge_local->
loc, GF_XATTROP_ADD_ARRAY, xattr, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1052 (void *) (long) active_src,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1055, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->xattrop_cbk) tmp_cbk
= afr_sh_entry_impunge_xattrop_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->xattrop"
; _new->unwind_to = "afr_sh_entry_impunge_xattrop_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[active_src]->fops->xattrop_cbk
= afr_sh_entry_impunge_xattrop_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->xattrop); priv->children[active_src]->fops->xattrop
(_new, priv->children[active_src], &impunge_local->
loc, GF_XATTROP_ADD_ARRAY, xattr, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1053 priv->children[active_src],do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1055, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->xattrop_cbk) tmp_cbk
= afr_sh_entry_impunge_xattrop_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->xattrop"
; _new->unwind_to = "afr_sh_entry_impunge_xattrop_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[active_src]->fops->xattrop_cbk
= afr_sh_entry_impunge_xattrop_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->xattrop); priv->children[active_src]->fops->xattrop
(_new, priv->children[active_src], &impunge_local->
loc, GF_XATTROP_ADD_ARRAY, xattr, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1054 priv->children[active_src]->fops->xattrop,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1055, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->xattrop_cbk) tmp_cbk
= afr_sh_entry_impunge_xattrop_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->xattrop"
; _new->unwind_to = "afr_sh_entry_impunge_xattrop_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[active_src]->fops->xattrop_cbk
= afr_sh_entry_impunge_xattrop_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->xattrop); priv->children[active_src]->fops->xattrop
(_new, priv->children[active_src], &impunge_local->
loc, GF_XATTROP_ADD_ARRAY, xattr, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1055 &impunge_local->loc, GF_XATTROP_ADD_ARRAY, xattr, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1055, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->xattrop_cbk) tmp_cbk
= afr_sh_entry_impunge_xattrop_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) active_src; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->xattrop"
; _new->unwind_to = "afr_sh_entry_impunge_xattrop_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[active_src]->fops->xattrop_cbk
= afr_sh_entry_impunge_xattrop_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->xattrop); priv->children[active_src]->fops->xattrop
(_new, priv->children[active_src], &impunge_local->
loc, GF_XATTROP_ADD_ARRAY, xattr, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
1056
1057 if (xattr)
1058 dict_unref (xattr);
1059 return 0;
1060out:
1061 afr_sh_entry_call_impunge_done (impunge_frame, this,
1062 -1, op_errno);
1063 return 0;
1064}
1065
1066int
1067afr_sh_entry_impunge_newfile_cbk (call_frame_t *impunge_frame, void *cookie,
1068 xlator_t *this,
1069 int32_t op_ret, int32_t op_errno,
1070 inode_t *inode, struct iatt *stbuf,
1071 struct iatt *preparent,
1072 struct iatt *postparent, dict_t *xdata)
1073{
1074 int call_count = 0;
1075 afr_private_t *priv = NULL((void*)0);
1076 afr_local_t *impunge_local = NULL((void*)0);
1077 afr_self_heal_t *impunge_sh = NULL((void*)0);
1078 int child_index = 0;
1079
1080 priv = this->private;
1081 impunge_local = impunge_frame->local;
1082 impunge_sh = &impunge_local->self_heal;
1083
1084 child_index = (long) cookie;
1085
1086 if (op_ret == -1) {
1087 impunge_sh->child_errno[child_index] = op_errno;
1088 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("creation of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[child_index]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1092, GF_LOG_ERROR, "creation of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
1089 "creation of %s on %s failed (%s)",do { do { if (0) printf ("creation of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[child_index]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1092, GF_LOG_ERROR, "creation of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
1090 impunge_local->loc.path,do { do { if (0) printf ("creation of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[child_index]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1092, GF_LOG_ERROR, "creation of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
1091 priv->children[child_index]->name,do { do { if (0) printf ("creation of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[child_index]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1092, GF_LOG_ERROR, "creation of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
1092 strerror (op_errno))do { do { if (0) printf ("creation of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[child_index]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1092, GF_LOG_ERROR, "creation of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
;
1093 } else {
1094 impunge_sh->child_errno[child_index] = 0;
1095 }
1096
1097 call_count = afr_frame_return (impunge_frame);
1098 if (call_count == 0) {
1099 if (!afr_errno_count (NULL((void*)0), impunge_sh->child_errno,
1100 priv->child_count, 0)) {
1101 // new_file creation failed every where
1102 afr_sh_entry_call_impunge_done (impunge_frame, this,
1103 -1, op_errno);
1104 goto out;
1105 }
1106 afr_sh_entry_impunge_perform_xattrop (impunge_frame, this);
1107 }
1108out:
1109 return 0;
1110}
1111
1112int
1113afr_sh_entry_impunge_hardlink_cbk (call_frame_t *impunge_frame, void *cookie,
1114 xlator_t *this, int32_t op_ret,
1115 int32_t op_errno, inode_t *inode,
1116 struct iatt *buf, struct iatt *preparent,
1117 struct iatt *postparent, dict_t *xdata)
1118{
1119 int call_count = 0;
1120 afr_local_t *impunge_local = NULL((void*)0);
1121 afr_self_heal_t *impunge_sh = NULL((void*)0);
1122
1123 impunge_local = impunge_frame->local;
1124 impunge_sh = &impunge_local->self_heal;
1125
1126 if (IA_IFLNK == impunge_sh->entrybuf.ia_type) {
1127 //For symlinks impunge is attempted un-conditionally
1128 //So the file can already exist.
1129 if ((op_ret < 0) && (op_errno == EEXIST17))
1130 op_ret = 0;
1131 }
1132
1133 call_count = afr_frame_return (impunge_frame);
1134 if (call_count == 0)
1135 afr_sh_entry_call_impunge_done (impunge_frame, this,
1136 op_ret, op_errno);
1137
1138 return 0;
1139}
1140
1141int
1142afr_sh_entry_impunge_hardlink (call_frame_t *impunge_frame, xlator_t *this,
1143 int child_index)
1144{
1145 afr_private_t *priv = NULL((void*)0);
1146 afr_local_t *impunge_local = NULL((void*)0);
1147 afr_self_heal_t *impunge_sh = NULL((void*)0);
1148 loc_t *loc = NULL((void*)0);
1149 struct iatt *buf = NULL((void*)0);
1150 loc_t oldloc = {0};
1151
1152 priv = this->private;
1153 impunge_local = impunge_frame->local;
1154 impunge_sh = &impunge_local->self_heal;
1155 loc = &impunge_local->loc;
1156 buf = &impunge_sh->entrybuf;
1157
1158 oldloc.inode = inode_ref (loc->inode);
1159 uuid_copy (oldloc.gfid, buf->ia_gfid);
1160 gf_log (this->name, GF_LOG_DEBUG, "linking missing file %s on %s",do { do { if (0) printf ("linking missing file %s on %s", loc
->path, priv->children[child_index]->name); } while (
0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 1161, GF_LOG_DEBUG, "linking missing file %s on %s", loc->
path, priv->children[child_index]->name); } while (0)
1161 loc->path, priv->children[child_index]->name)do { do { if (0) printf ("linking missing file %s on %s", loc
->path, priv->children[child_index]->name); } while (
0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 1161, GF_LOG_DEBUG, "linking missing file %s on %s", loc->
path, priv->children[child_index]->name); } while (0)
;
1162
1163 STACK_WIND_COOKIE (impunge_frame, afr_sh_entry_impunge_hardlink_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1167, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->link_cbk) tmp_cbk
= afr_sh_entry_impunge_hardlink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->link"
; _new->unwind_to = "afr_sh_entry_impunge_hardlink_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->link_cbk
= afr_sh_entry_impunge_hardlink_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->link); priv->children[child_index]->fops->link
(_new, priv->children[child_index], &oldloc, loc, ((void
*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
1164 (void *) (long) child_index,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1167, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->link_cbk) tmp_cbk
= afr_sh_entry_impunge_hardlink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->link"
; _new->unwind_to = "afr_sh_entry_impunge_hardlink_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->link_cbk
= afr_sh_entry_impunge_hardlink_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->link); priv->children[child_index]->fops->link
(_new, priv->children[child_index], &oldloc, loc, ((void
*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
1165 priv->children[child_index],do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1167, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->link_cbk) tmp_cbk
= afr_sh_entry_impunge_hardlink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->link"
; _new->unwind_to = "afr_sh_entry_impunge_hardlink_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->link_cbk
= afr_sh_entry_impunge_hardlink_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->link); priv->children[child_index]->fops->link
(_new, priv->children[child_index], &oldloc, loc, ((void
*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
1166 priv->children[child_index]->fops->link,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1167, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->link_cbk) tmp_cbk
= afr_sh_entry_impunge_hardlink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->link"
; _new->unwind_to = "afr_sh_entry_impunge_hardlink_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->link_cbk
= afr_sh_entry_impunge_hardlink_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->link); priv->children[child_index]->fops->link
(_new, priv->children[child_index], &oldloc, loc, ((void
*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
1167 &oldloc, loc, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1167, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->link_cbk) tmp_cbk
= afr_sh_entry_impunge_hardlink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->link"
; _new->unwind_to = "afr_sh_entry_impunge_hardlink_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->link_cbk
= afr_sh_entry_impunge_hardlink_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->link); priv->children[child_index]->fops->link
(_new, priv->children[child_index], &oldloc, loc, ((void
*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
;
1168 loc_wipe (&oldloc);
1169
1170 return 0;
1171}
1172
1173int
1174afr_sh_nameless_lookup_cbk (call_frame_t *impunge_frame, void *cookie,
1175 xlator_t *this,
1176 int32_t op_ret, int32_t op_errno, inode_t *inode,
1177 struct iatt *buf, dict_t *xattr,
1178 struct iatt *postparent)
1179{
1180 if (op_ret < 0) {
1181 afr_sh_entry_impunge_create_file (impunge_frame, this,
1182 (long)cookie);
1183 } else {
1184 afr_sh_entry_impunge_hardlink (impunge_frame, this,
1185 (long)cookie);
1186 }
1187 return 0;
1188}
1189
1190int
1191afr_sh_entry_impunge_check_hardlink (call_frame_t *impunge_frame,
1192 xlator_t *this,
1193 int child_index, struct iatt *stbuf)
1194{
1195 afr_private_t *priv = NULL((void*)0);
1196 call_frame_t *frame = NULL((void*)0);
1197 afr_local_t *impunge_local = NULL((void*)0);
1198 afr_local_t *local = NULL((void*)0);
1199 afr_self_heal_t *impunge_sh = NULL((void*)0);
1200 afr_self_heal_t *sh = NULL((void*)0);
1201 loc_t *loc = NULL((void*)0);
1202 dict_t *xattr_req = NULL((void*)0);
1203 loc_t oldloc = {0};
1204 int ret = -1;
1205
1206 priv = this->private;
1207 AFR_INIT_SH_FRAME_VALS (impunge_frame, impunge_local, impunge_sh,do { impunge_local = impunge_frame->local; impunge_sh = &
impunge_local->self_heal; frame = impunge_sh->sh_frame;
local = frame->local; sh = &local->self_heal; } while
(0);
1208 frame, local, sh)do { impunge_local = impunge_frame->local; impunge_sh = &
impunge_local->self_heal; frame = impunge_sh->sh_frame;
local = frame->local; sh = &local->self_heal; } while
(0);
;
1209 loc = &impunge_local->loc;
1210
1211 xattr_req = dict_new ();
1212 if (!xattr_req)
1213 goto out;
1214 oldloc.inode = inode_ref (loc->inode);
1215 uuid_copy (oldloc.gfid, stbuf->ia_gfid);
1216
1217 STACK_WIND_COOKIE (impunge_frame, afr_sh_nameless_lookup_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1221, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->lookup_cbk) tmp_cbk
= afr_sh_nameless_lookup_cbk; _new->root = impunge_frame->
root; _new->this = priv->children[child_index]; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame; _new
->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->lookup"
; _new->unwind_to = "afr_sh_nameless_lookup_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->lookup_cbk
= afr_sh_nameless_lookup_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->lookup); priv->children[child_index]->fops->
lookup (_new, priv->children[child_index], &oldloc, xattr_req
); (*__glusterfs_this_location()) = old_THIS; } while (0)
1218 (void *) (long) child_index,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1221, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->lookup_cbk) tmp_cbk
= afr_sh_nameless_lookup_cbk; _new->root = impunge_frame->
root; _new->this = priv->children[child_index]; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame; _new
->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->lookup"
; _new->unwind_to = "afr_sh_nameless_lookup_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->lookup_cbk
= afr_sh_nameless_lookup_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->lookup); priv->children[child_index]->fops->
lookup (_new, priv->children[child_index], &oldloc, xattr_req
); (*__glusterfs_this_location()) = old_THIS; } while (0)
1219 priv->children[child_index],do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1221, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->lookup_cbk) tmp_cbk
= afr_sh_nameless_lookup_cbk; _new->root = impunge_frame->
root; _new->this = priv->children[child_index]; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame; _new
->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->lookup"
; _new->unwind_to = "afr_sh_nameless_lookup_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->lookup_cbk
= afr_sh_nameless_lookup_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->lookup); priv->children[child_index]->fops->
lookup (_new, priv->children[child_index], &oldloc, xattr_req
); (*__glusterfs_this_location()) = old_THIS; } while (0)
1220 priv->children[child_index]->fops->lookup,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1221, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->lookup_cbk) tmp_cbk
= afr_sh_nameless_lookup_cbk; _new->root = impunge_frame->
root; _new->this = priv->children[child_index]; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame; _new
->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->lookup"
; _new->unwind_to = "afr_sh_nameless_lookup_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->lookup_cbk
= afr_sh_nameless_lookup_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->lookup); priv->children[child_index]->fops->
lookup (_new, priv->children[child_index], &oldloc, xattr_req
); (*__glusterfs_this_location()) = old_THIS; } while (0)
1221 &oldloc, xattr_req)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1221, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->lookup_cbk) tmp_cbk
= afr_sh_nameless_lookup_cbk; _new->root = impunge_frame->
root; _new->this = priv->children[child_index]; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame; _new
->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->lookup"
; _new->unwind_to = "afr_sh_nameless_lookup_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->lookup_cbk
= afr_sh_nameless_lookup_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->lookup); priv->children[child_index]->fops->
lookup (_new, priv->children[child_index], &oldloc, xattr_req
); (*__glusterfs_this_location()) = old_THIS; } while (0)
;
1222 ret = 0;
1223out:
1224 if (xattr_req)
1225 dict_unref (xattr_req);
1226 loc_wipe (&oldloc);
1227 if (ret)
1228 sh->impunge_done (frame, this, -1, ENOMEM12);
1229 return 0;
1230}
1231
1232int
1233afr_sh_entry_impunge_mknod (call_frame_t *impunge_frame, xlator_t *this,
1234 int child_index, struct iatt *stbuf)
1235{
1236 afr_private_t *priv = NULL((void*)0);
1237 afr_local_t *impunge_local = NULL((void*)0);
1238 dict_t *dict = NULL((void*)0);
1239 int ret = 0;
1240
1241 priv = this->private;
1242 impunge_local = impunge_frame->local;
1243
1244 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("creating missing file %s on %s", impunge_local
->loc.path, priv->children[child_index]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 1247, GF_LOG_DEBUG, "creating missing file %s on %s", impunge_local
->loc.path, priv->children[child_index]->name); } while
(0)
1245 "creating missing file %s on %s",do { do { if (0) printf ("creating missing file %s on %s", impunge_local
->loc.path, priv->children[child_index]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 1247, GF_LOG_DEBUG, "creating missing file %s on %s", impunge_local
->loc.path, priv->children[child_index]->name); } while
(0)
1246 impunge_local->loc.path,do { do { if (0) printf ("creating missing file %s on %s", impunge_local
->loc.path, priv->children[child_index]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 1247, GF_LOG_DEBUG, "creating missing file %s on %s", impunge_local
->loc.path, priv->children[child_index]->name); } while
(0)
1247 priv->children[child_index]->name)do { do { if (0) printf ("creating missing file %s on %s", impunge_local
->loc.path, priv->children[child_index]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 1247, GF_LOG_DEBUG, "creating missing file %s on %s", impunge_local
->loc.path, priv->children[child_index]->name); } while
(0)
;
1248
1249 dict = dict_new ();
1250 if (!dict)
1251 gf_log (this->name, GF_LOG_ERROR, "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log
(this->name, "afr-self-heal-entry.c", __FUNCTION__, 1251,
GF_LOG_ERROR, "Out of memory"); } while (0)
;
1252
1253 GF_ASSERT (!uuid_is_null (stbuf->ia_gfid))do { if (!(!uuid_is_null (stbuf->ia_gfid))) { do { do { if
(0) printf ("Assertion failed: " "!uuid_is_null (stbuf->ia_gfid)"
); } while (0); _gf_log_callingfn ("", "afr-self-heal-entry.c"
, __FUNCTION__, 1253, GF_LOG_ERROR, "Assertion failed: " "!uuid_is_null (stbuf->ia_gfid)"
); } while (0); } } while (0)
;
1254 ret = afr_set_dict_gfid (dict, stbuf->ia_gfid);
1255 if (ret)
1256 gf_log (this->name, GF_LOG_INFO, "%s: gfid set failed",do { do { if (0) printf ("%s: gfid set failed", impunge_local
->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1257, GF_LOG_INFO, "%s: gfid set failed", impunge_local
->loc.path); } while (0)
1257 impunge_local->loc.path)do { do { if (0) printf ("%s: gfid set failed", impunge_local
->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1257, GF_LOG_INFO, "%s: gfid set failed", impunge_local
->loc.path); } while (0)
;
1258
1259 STACK_WIND_COOKIE (impunge_frame, afr_sh_entry_impunge_newfile_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1266, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->mknod_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->mknod"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->mknod_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->mknod); priv->children[child_index]->fops->
mknod (_new, priv->children[child_index], &impunge_local
->loc, st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type
), gnu_dev_makedev (ia_major (stbuf->ia_rdev), ia_minor (stbuf
->ia_rdev)), 0, dict); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1260 (void *) (long) child_index,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1266, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->mknod_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->mknod"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->mknod_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->mknod); priv->children[child_index]->fops->
mknod (_new, priv->children[child_index], &impunge_local
->loc, st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type
), gnu_dev_makedev (ia_major (stbuf->ia_rdev), ia_minor (stbuf
->ia_rdev)), 0, dict); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1261 priv->children[child_index],do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1266, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->mknod_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->mknod"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->mknod_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->mknod); priv->children[child_index]->fops->
mknod (_new, priv->children[child_index], &impunge_local
->loc, st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type
), gnu_dev_makedev (ia_major (stbuf->ia_rdev), ia_minor (stbuf
->ia_rdev)), 0, dict); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1262 priv->children[child_index]->fops->mknod,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1266, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->mknod_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->mknod"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->mknod_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->mknod); priv->children[child_index]->fops->
mknod (_new, priv->children[child_index], &impunge_local
->loc, st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type
), gnu_dev_makedev (ia_major (stbuf->ia_rdev), ia_minor (stbuf
->ia_rdev)), 0, dict); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1263 &impunge_local->loc,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1266, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->mknod_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->mknod"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->mknod_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->mknod); priv->children[child_index]->fops->
mknod (_new, priv->children[child_index], &impunge_local
->loc, st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type
), gnu_dev_makedev (ia_major (stbuf->ia_rdev), ia_minor (stbuf
->ia_rdev)), 0, dict); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1264 st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1266, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->mknod_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->mknod"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->mknod_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->mknod); priv->children[child_index]->fops->
mknod (_new, priv->children[child_index], &impunge_local
->loc, st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type
), gnu_dev_makedev (ia_major (stbuf->ia_rdev), ia_minor (stbuf
->ia_rdev)), 0, dict); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1265 makedev (ia_major (stbuf->ia_rdev),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1266, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->mknod_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->mknod"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->mknod_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->mknod); priv->children[child_index]->fops->
mknod (_new, priv->children[child_index], &impunge_local
->loc, st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type
), gnu_dev_makedev (ia_major (stbuf->ia_rdev), ia_minor (stbuf
->ia_rdev)), 0, dict); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1266 ia_minor (stbuf->ia_rdev)), 0, dict)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1266, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->mknod_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->mknod"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->mknod_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->mknod); priv->children[child_index]->fops->
mknod (_new, priv->children[child_index], &impunge_local
->loc, st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type
), gnu_dev_makedev (ia_major (stbuf->ia_rdev), ia_minor (stbuf
->ia_rdev)), 0, dict); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
1267
1268 if (dict)
1269 dict_unref (dict);
1270
1271 return 0;
1272}
1273
1274
1275
1276int
1277afr_sh_entry_impunge_mkdir (call_frame_t *impunge_frame, xlator_t *this,
1278 int child_index, struct iatt *stbuf)
1279{
1280 afr_private_t *priv = NULL((void*)0);
1281 afr_local_t *impunge_local = NULL((void*)0);
1282 dict_t *dict = NULL((void*)0);
1283
1284 int ret = 0;
1285
1286 priv = this->private;
1287 impunge_local = impunge_frame->local;
1288
1289 dict = dict_new ();
1290 if (!dict) {
1291 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Out of memory"); } while (0); _gf_log
(this->name, "afr-self-heal-entry.c", __FUNCTION__, 1292,
GF_LOG_ERROR, "Out of memory"); } while (0)
1292 "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log
(this->name, "afr-self-heal-entry.c", __FUNCTION__, 1292,
GF_LOG_ERROR, "Out of memory"); } while (0)
;
1293 return 0;
1294 }
1295
1296 GF_ASSERT (!uuid_is_null (stbuf->ia_gfid))do { if (!(!uuid_is_null (stbuf->ia_gfid))) { do { do { if
(0) printf ("Assertion failed: " "!uuid_is_null (stbuf->ia_gfid)"
); } while (0); _gf_log_callingfn ("", "afr-self-heal-entry.c"
, __FUNCTION__, 1296, GF_LOG_ERROR, "Assertion failed: " "!uuid_is_null (stbuf->ia_gfid)"
); } while (0); } } while (0)
;
1297 ret = afr_set_dict_gfid (dict, stbuf->ia_gfid);
1298 if (ret)
1299 gf_log (this->name, GF_LOG_INFO, "%s: gfid set failed",do { do { if (0) printf ("%s: gfid set failed", impunge_local
->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1300, GF_LOG_INFO, "%s: gfid set failed", impunge_local
->loc.path); } while (0)
1300 impunge_local->loc.path)do { do { if (0) printf ("%s: gfid set failed", impunge_local
->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1300, GF_LOG_INFO, "%s: gfid set failed", impunge_local
->loc.path); } while (0)
;
1301
1302 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("creating missing directory %s on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1305, GF_LOG_DEBUG, "creating missing directory %s on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0)
1303 "creating missing directory %s on %s",do { do { if (0) printf ("creating missing directory %s on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1305, GF_LOG_DEBUG, "creating missing directory %s on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0)
1304 impunge_local->loc.path,do { do { if (0) printf ("creating missing directory %s on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1305, GF_LOG_DEBUG, "creating missing directory %s on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0)
1305 priv->children[child_index]->name)do { do { if (0) printf ("creating missing directory %s on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1305, GF_LOG_DEBUG, "creating missing directory %s on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0)
;
1306
1307 STACK_WIND_COOKIE (impunge_frame, afr_sh_entry_impunge_newfile_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1313, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->mkdir_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->mkdir"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->mkdir_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->mkdir); priv->children[child_index]->fops->
mkdir (_new, priv->children[child_index], &impunge_local
->loc, st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type
), 0, dict); (*__glusterfs_this_location()) = old_THIS; } while
(0)
1308 (void *) (long) child_index,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1313, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->mkdir_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->mkdir"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->mkdir_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->mkdir); priv->children[child_index]->fops->
mkdir (_new, priv->children[child_index], &impunge_local
->loc, st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type
), 0, dict); (*__glusterfs_this_location()) = old_THIS; } while
(0)
1309 priv->children[child_index],do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1313, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->mkdir_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->mkdir"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->mkdir_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->mkdir); priv->children[child_index]->fops->
mkdir (_new, priv->children[child_index], &impunge_local
->loc, st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type
), 0, dict); (*__glusterfs_this_location()) = old_THIS; } while
(0)
1310 priv->children[child_index]->fops->mkdir,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1313, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->mkdir_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->mkdir"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->mkdir_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->mkdir); priv->children[child_index]->fops->
mkdir (_new, priv->children[child_index], &impunge_local
->loc, st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type
), 0, dict); (*__glusterfs_this_location()) = old_THIS; } while
(0)
1311 &impunge_local->loc,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1313, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->mkdir_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->mkdir"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->mkdir_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->mkdir); priv->children[child_index]->fops->
mkdir (_new, priv->children[child_index], &impunge_local
->loc, st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type
), 0, dict); (*__glusterfs_this_location()) = old_THIS; } while
(0)
1312 st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1313, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->mkdir_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->mkdir"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->mkdir_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->mkdir); priv->children[child_index]->fops->
mkdir (_new, priv->children[child_index], &impunge_local
->loc, st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type
), 0, dict); (*__glusterfs_this_location()) = old_THIS; } while
(0)
1313 0, dict)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1313, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->mkdir_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->mkdir"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->mkdir_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->mkdir); priv->children[child_index]->fops->
mkdir (_new, priv->children[child_index], &impunge_local
->loc, st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type
), 0, dict); (*__glusterfs_this_location()) = old_THIS; } while
(0)
;
1314
1315 if (dict)
1316 dict_unref (dict);
1317
1318 return 0;
1319}
1320
1321
1322int
1323afr_sh_entry_impunge_symlink (call_frame_t *impunge_frame, xlator_t *this,
1324 int child_index, const char *linkname)
1325{
1326 afr_private_t *priv = NULL((void*)0);
1327 afr_local_t *impunge_local = NULL((void*)0);
1328 dict_t *dict = NULL((void*)0);
1329 struct iatt *buf = NULL((void*)0);
1330 int ret = 0;
1331
1332 priv = this->private;
1333 impunge_local = impunge_frame->local;
1334
1335 buf = &impunge_local->cont.dir_fop.buf;
1336
1337 dict = dict_new ();
1338 if (!dict) {
1339 afr_sh_entry_call_impunge_done (impunge_frame, this,
1340 -1, ENOMEM12);
1341 goto out;
1342 }
1343
1344 GF_ASSERT (!uuid_is_null (buf->ia_gfid))do { if (!(!uuid_is_null (buf->ia_gfid))) { do { do { if (
0) printf ("Assertion failed: " "!uuid_is_null (buf->ia_gfid)"
); } while (0); _gf_log_callingfn ("", "afr-self-heal-entry.c"
, __FUNCTION__, 1344, GF_LOG_ERROR, "Assertion failed: " "!uuid_is_null (buf->ia_gfid)"
); } while (0); } } while (0)
;
1345 ret = afr_set_dict_gfid (dict, buf->ia_gfid);
1346 if (ret)
1347 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("%s: dict set gfid failed", impunge_local
->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1349, GF_LOG_INFO, "%s: dict set gfid failed"
, impunge_local->loc.path); } while (0)
1348 "%s: dict set gfid failed",do { do { if (0) printf ("%s: dict set gfid failed", impunge_local
->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1349, GF_LOG_INFO, "%s: dict set gfid failed"
, impunge_local->loc.path); } while (0)
1349 impunge_local->loc.path)do { do { if (0) printf ("%s: dict set gfid failed", impunge_local
->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1349, GF_LOG_INFO, "%s: dict set gfid failed"
, impunge_local->loc.path); } while (0)
;
1350
1351 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("creating missing symlink %s -> %s on %s"
, impunge_local->loc.path, linkname, priv->children[child_index
]->name); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1354, GF_LOG_DEBUG, "creating missing symlink %s -> %s on %s"
, impunge_local->loc.path, linkname, priv->children[child_index
]->name); } while (0)
1352 "creating missing symlink %s -> %s on %s",do { do { if (0) printf ("creating missing symlink %s -> %s on %s"
, impunge_local->loc.path, linkname, priv->children[child_index
]->name); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1354, GF_LOG_DEBUG, "creating missing symlink %s -> %s on %s"
, impunge_local->loc.path, linkname, priv->children[child_index
]->name); } while (0)
1353 impunge_local->loc.path, linkname,do { do { if (0) printf ("creating missing symlink %s -> %s on %s"
, impunge_local->loc.path, linkname, priv->children[child_index
]->name); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1354, GF_LOG_DEBUG, "creating missing symlink %s -> %s on %s"
, impunge_local->loc.path, linkname, priv->children[child_index
]->name); } while (0)
1354 priv->children[child_index]->name)do { do { if (0) printf ("creating missing symlink %s -> %s on %s"
, impunge_local->loc.path, linkname, priv->children[child_index
]->name); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1354, GF_LOG_DEBUG, "creating missing symlink %s -> %s on %s"
, impunge_local->loc.path, linkname, priv->children[child_index
]->name); } while (0)
;
1355
1356 STACK_WIND_COOKIE (impunge_frame, afr_sh_entry_impunge_newfile_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1360, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->symlink_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->symlink"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->symlink_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->symlink); priv->children[child_index]->fops->
symlink (_new, priv->children[child_index], linkname, &
impunge_local->loc, 0, dict); (*__glusterfs_this_location(
)) = old_THIS; } while (0)
1357 (void *) (long) child_index,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1360, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->symlink_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->symlink"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->symlink_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->symlink); priv->children[child_index]->fops->
symlink (_new, priv->children[child_index], linkname, &
impunge_local->loc, 0, dict); (*__glusterfs_this_location(
)) = old_THIS; } while (0)
1358 priv->children[child_index],do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1360, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->symlink_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->symlink"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->symlink_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->symlink); priv->children[child_index]->fops->
symlink (_new, priv->children[child_index], linkname, &
impunge_local->loc, 0, dict); (*__glusterfs_this_location(
)) = old_THIS; } while (0)
1359 priv->children[child_index]->fops->symlink,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1360, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->symlink_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->symlink"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->symlink_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->symlink); priv->children[child_index]->fops->
symlink (_new, priv->children[child_index], linkname, &
impunge_local->loc, 0, dict); (*__glusterfs_this_location(
)) = old_THIS; } while (0)
1360 linkname, &impunge_local->loc, 0, dict)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1360, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->symlink_cbk) tmp_cbk
= afr_sh_entry_impunge_newfile_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->symlink"
; _new->unwind_to = "afr_sh_entry_impunge_newfile_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[child_index]->fops->symlink_cbk
= afr_sh_entry_impunge_newfile_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[child_index
]; if (priv->children[child_index]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[child_index]->
fops->symlink); priv->children[child_index]->fops->
symlink (_new, priv->children[child_index], linkname, &
impunge_local->loc, 0, dict); (*__glusterfs_this_location(
)) = old_THIS; } while (0)
;
1361
1362 if (dict)
1363 dict_unref (dict);
1364out:
1365 return 0;
1366}
1367
1368
1369int
1370afr_sh_entry_impunge_symlink_unlink_cbk (call_frame_t *impunge_frame,
1371 void *cookie, xlator_t *this,
1372 int32_t op_ret, int32_t op_errno,
1373 struct iatt *preparent,
1374 struct iatt *postparent, dict_t *xdata)
1375{
1376 afr_private_t *priv = NULL((void*)0);
1377 afr_local_t *impunge_local = NULL((void*)0);
1378 afr_self_heal_t *impunge_sh = NULL((void*)0);
1379 int child_index = -1;
1380 int call_count = -1;
1381
1382 priv = this->private;
1383 impunge_local = impunge_frame->local;
1384 impunge_sh = &impunge_local->self_heal;
1385
1386 child_index = (long) cookie;
1387
1388 if (op_ret == -1) {
1389 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("unlink of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[child_index]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1393, GF_LOG_INFO, "unlink of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
1390 "unlink of %s on %s failed (%s)",do { do { if (0) printf ("unlink of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[child_index]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1393, GF_LOG_INFO, "unlink of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
1391 impunge_local->loc.path,do { do { if (0) printf ("unlink of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[child_index]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1393, GF_LOG_INFO, "unlink of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
1392 priv->children[child_index]->name,do { do { if (0) printf ("unlink of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[child_index]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1393, GF_LOG_INFO, "unlink of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
1393 strerror (op_errno))do { do { if (0) printf ("unlink of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[child_index]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1393, GF_LOG_INFO, "unlink of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[child_index]->
name, strerror (op_errno)); } while (0)
;
1394 goto out;
1395 }
1396
1397 afr_sh_entry_impunge_symlink (impunge_frame, this, child_index,
1398 impunge_sh->linkname);
1399
1400 return 0;
1401out:
1402 LOCK (&impunge_frame->lock)pthread_spin_lock (&impunge_frame->lock);
1403 {
1404 call_count = --impunge_local->call_count;
1405 }
1406 UNLOCK (&impunge_frame->lock)pthread_spin_unlock (&impunge_frame->lock);
1407
1408 if (call_count == 0)
1409 afr_sh_entry_call_impunge_done (impunge_frame, this,
1410 op_ret, op_errno);
1411
1412 return 0;
1413}
1414
1415
1416int
1417afr_sh_entry_impunge_symlink_unlink (call_frame_t *impunge_frame, xlator_t *this,
1418 int child_index)
1419{
1420 afr_private_t *priv = NULL((void*)0);
1421 afr_local_t *impunge_local = NULL((void*)0);
1422
1423 priv = this->private;
1424 impunge_local = impunge_frame->local;
1425
1426 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("unlinking symlink %s with wrong target on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1429, GF_LOG_DEBUG, "unlinking symlink %s with wrong target on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0)
1427 "unlinking symlink %s with wrong target on %s",do { do { if (0) printf ("unlinking symlink %s with wrong target on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1429, GF_LOG_DEBUG, "unlinking symlink %s with wrong target on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0)
1428 impunge_local->loc.path,do { do { if (0) printf ("unlinking symlink %s with wrong target on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1429, GF_LOG_DEBUG, "unlinking symlink %s with wrong target on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0)
1429 priv->children[child_index]->name)do { do { if (0) printf ("unlinking symlink %s with wrong target on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1429, GF_LOG_DEBUG, "unlinking symlink %s with wrong target on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0)
;
1430
1431 STACK_WIND_COOKIE (impunge_frame, afr_sh_entry_impunge_symlink_unlink_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1435, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->unlink_cbk) tmp_cbk
= afr_sh_entry_impunge_symlink_unlink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->unlink"
; _new->unwind_to = "afr_sh_entry_impunge_symlink_unlink_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&impunge_frame->root->stack_lock); { impunge_frame
->ref_count++; _new->next = impunge_frame->root->
frames.next; _new->prev = &impunge_frame->root->
frames; if (impunge_frame->root->frames.next) impunge_frame
->root->frames.next->prev = _new; impunge_frame->
root->frames.next = _new; } pthread_spin_unlock (&impunge_frame
->root->stack_lock); priv->children[child_index]->
fops->unlink_cbk = afr_sh_entry_impunge_symlink_unlink_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[child_index]; if (priv->children[child_index
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[child_index]->fops->unlink); priv->children
[child_index]->fops->unlink (_new, priv->children[child_index
], &impunge_local->loc, 0, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1432 (void *) (long) child_index,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1435, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->unlink_cbk) tmp_cbk
= afr_sh_entry_impunge_symlink_unlink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->unlink"
; _new->unwind_to = "afr_sh_entry_impunge_symlink_unlink_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&impunge_frame->root->stack_lock); { impunge_frame
->ref_count++; _new->next = impunge_frame->root->
frames.next; _new->prev = &impunge_frame->root->
frames; if (impunge_frame->root->frames.next) impunge_frame
->root->frames.next->prev = _new; impunge_frame->
root->frames.next = _new; } pthread_spin_unlock (&impunge_frame
->root->stack_lock); priv->children[child_index]->
fops->unlink_cbk = afr_sh_entry_impunge_symlink_unlink_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[child_index]; if (priv->children[child_index
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[child_index]->fops->unlink); priv->children
[child_index]->fops->unlink (_new, priv->children[child_index
], &impunge_local->loc, 0, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1433 priv->children[child_index],do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1435, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->unlink_cbk) tmp_cbk
= afr_sh_entry_impunge_symlink_unlink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->unlink"
; _new->unwind_to = "afr_sh_entry_impunge_symlink_unlink_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&impunge_frame->root->stack_lock); { impunge_frame
->ref_count++; _new->next = impunge_frame->root->
frames.next; _new->prev = &impunge_frame->root->
frames; if (impunge_frame->root->frames.next) impunge_frame
->root->frames.next->prev = _new; impunge_frame->
root->frames.next = _new; } pthread_spin_unlock (&impunge_frame
->root->stack_lock); priv->children[child_index]->
fops->unlink_cbk = afr_sh_entry_impunge_symlink_unlink_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[child_index]; if (priv->children[child_index
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[child_index]->fops->unlink); priv->children
[child_index]->fops->unlink (_new, priv->children[child_index
], &impunge_local->loc, 0, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1434 priv->children[child_index]->fops->unlink,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1435, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->unlink_cbk) tmp_cbk
= afr_sh_entry_impunge_symlink_unlink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->unlink"
; _new->unwind_to = "afr_sh_entry_impunge_symlink_unlink_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&impunge_frame->root->stack_lock); { impunge_frame
->ref_count++; _new->next = impunge_frame->root->
frames.next; _new->prev = &impunge_frame->root->
frames; if (impunge_frame->root->frames.next) impunge_frame
->root->frames.next->prev = _new; impunge_frame->
root->frames.next = _new; } pthread_spin_unlock (&impunge_frame
->root->stack_lock); priv->children[child_index]->
fops->unlink_cbk = afr_sh_entry_impunge_symlink_unlink_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[child_index]; if (priv->children[child_index
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[child_index]->fops->unlink); priv->children
[child_index]->fops->unlink (_new, priv->children[child_index
], &impunge_local->loc, 0, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1435 &impunge_local->loc, 0, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1435, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->unlink_cbk) tmp_cbk
= afr_sh_entry_impunge_symlink_unlink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->unlink"
; _new->unwind_to = "afr_sh_entry_impunge_symlink_unlink_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&impunge_frame->root->stack_lock); { impunge_frame
->ref_count++; _new->next = impunge_frame->root->
frames.next; _new->prev = &impunge_frame->root->
frames; if (impunge_frame->root->frames.next) impunge_frame
->root->frames.next->prev = _new; impunge_frame->
root->frames.next = _new; } pthread_spin_unlock (&impunge_frame
->root->stack_lock); priv->children[child_index]->
fops->unlink_cbk = afr_sh_entry_impunge_symlink_unlink_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[child_index]; if (priv->children[child_index
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[child_index]->fops->unlink); priv->children
[child_index]->fops->unlink (_new, priv->children[child_index
], &impunge_local->loc, 0, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
1436
1437 return 0;
1438}
1439
1440
1441int
1442afr_sh_entry_impunge_readlink_sink_cbk (call_frame_t *impunge_frame, void *cookie,
1443 xlator_t *this,
1444 int32_t op_ret, int32_t op_errno,
1445 const char *linkname, struct iatt *sbuf, dict_t *xdata)
1446{
1447 afr_private_t *priv = NULL((void*)0);
1448 afr_local_t *impunge_local = NULL((void*)0);
1449 afr_self_heal_t *impunge_sh = NULL((void*)0);
1450 int child_index = -1;
1451 int call_count = -1;
1452 int active_src = -1;
1453
1454 priv = this->private;
1455 impunge_local = impunge_frame->local;
1456 impunge_sh = &impunge_local->self_heal;
1457 active_src = impunge_sh->active_source;
1458
1459 child_index = (long) cookie;
1460
1461 if ((op_ret == -1) && (op_errno != ENOENT2)) {
1462 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("readlink of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1466, GF_LOG_INFO, "readlink of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
1463 "readlink of %s on %s failed (%s)",do { do { if (0) printf ("readlink of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1466, GF_LOG_INFO, "readlink of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
1464 impunge_local->loc.path,do { do { if (0) printf ("readlink of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1466, GF_LOG_INFO, "readlink of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
1465 priv->children[active_src]->name,do { do { if (0) printf ("readlink of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1466, GF_LOG_INFO, "readlink of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
1466 strerror (op_errno))do { do { if (0) printf ("readlink of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1466, GF_LOG_INFO, "readlink of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
;
1467 goto out;
1468 }
1469
1470 /* symlink doesn't exist on the sink */
1471
1472 if ((op_ret == -1) && (op_errno == ENOENT2)) {
1473 afr_sh_entry_impunge_symlink (impunge_frame, this,
1474 child_index, impunge_sh->linkname);
1475 return 0;
1476 }
1477
1478
1479 /* symlink exists on the sink, so check if targets match */
1480
1481 if (strcmp (linkname, impunge_sh->linkname) == 0) {
1482 /* targets match, nothing to do */
1483
1484 goto out;
1485 } else {
1486 /*
1487 * Hah! Sneaky wolf in sheep's clothing!
1488 */
1489 afr_sh_entry_impunge_symlink_unlink (impunge_frame, this,
1490 child_index);
1491 return 0;
1492 }
1493
1494out:
1495 LOCK (&impunge_frame->lock)pthread_spin_lock (&impunge_frame->lock);
1496 {
1497 call_count = --impunge_local->call_count;
1498 }
1499 UNLOCK (&impunge_frame->lock)pthread_spin_unlock (&impunge_frame->lock);
1500
1501 if (call_count == 0)
1502 afr_sh_entry_call_impunge_done (impunge_frame, this,
1503 op_ret, op_errno);
1504
1505 return 0;
1506}
1507
1508
1509int
1510afr_sh_entry_impunge_readlink_sink (call_frame_t *impunge_frame, xlator_t *this,
1511 int child_index)
1512{
1513 afr_private_t *priv = NULL((void*)0);
1514 afr_local_t *impunge_local = NULL((void*)0);
1515
1516 priv = this->private;
1517 impunge_local = impunge_frame->local;
1518
1519 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("checking symlink target of %s on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1521, GF_LOG_DEBUG, "checking symlink target of %s on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0)
1520 "checking symlink target of %s on %s",do { do { if (0) printf ("checking symlink target of %s on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1521, GF_LOG_DEBUG, "checking symlink target of %s on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0)
1521 impunge_local->loc.path, priv->children[child_index]->name)do { do { if (0) printf ("checking symlink target of %s on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1521, GF_LOG_DEBUG, "checking symlink target of %s on %s"
, impunge_local->loc.path, priv->children[child_index]->
name); } while (0)
;
1522
1523 STACK_WIND_COOKIE (impunge_frame, afr_sh_entry_impunge_readlink_sink_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1527, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->readlink_cbk) tmp_cbk
= afr_sh_entry_impunge_readlink_sink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->readlink"
; _new->unwind_to = "afr_sh_entry_impunge_readlink_sink_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&impunge_frame->root->stack_lock); { impunge_frame
->ref_count++; _new->next = impunge_frame->root->
frames.next; _new->prev = &impunge_frame->root->
frames; if (impunge_frame->root->frames.next) impunge_frame
->root->frames.next->prev = _new; impunge_frame->
root->frames.next = _new; } pthread_spin_unlock (&impunge_frame
->root->stack_lock); priv->children[child_index]->
fops->readlink_cbk = afr_sh_entry_impunge_readlink_sink_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[child_index]; if (priv->children[child_index
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[child_index]->fops->readlink); priv->children
[child_index]->fops->readlink (_new, priv->children[
child_index], &impunge_local->loc, 4096, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1524 (void *) (long) child_index,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1527, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->readlink_cbk) tmp_cbk
= afr_sh_entry_impunge_readlink_sink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->readlink"
; _new->unwind_to = "afr_sh_entry_impunge_readlink_sink_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&impunge_frame->root->stack_lock); { impunge_frame
->ref_count++; _new->next = impunge_frame->root->
frames.next; _new->prev = &impunge_frame->root->
frames; if (impunge_frame->root->frames.next) impunge_frame
->root->frames.next->prev = _new; impunge_frame->
root->frames.next = _new; } pthread_spin_unlock (&impunge_frame
->root->stack_lock); priv->children[child_index]->
fops->readlink_cbk = afr_sh_entry_impunge_readlink_sink_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[child_index]; if (priv->children[child_index
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[child_index]->fops->readlink); priv->children
[child_index]->fops->readlink (_new, priv->children[
child_index], &impunge_local->loc, 4096, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1525 priv->children[child_index],do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1527, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->readlink_cbk) tmp_cbk
= afr_sh_entry_impunge_readlink_sink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->readlink"
; _new->unwind_to = "afr_sh_entry_impunge_readlink_sink_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&impunge_frame->root->stack_lock); { impunge_frame
->ref_count++; _new->next = impunge_frame->root->
frames.next; _new->prev = &impunge_frame->root->
frames; if (impunge_frame->root->frames.next) impunge_frame
->root->frames.next->prev = _new; impunge_frame->
root->frames.next = _new; } pthread_spin_unlock (&impunge_frame
->root->stack_lock); priv->children[child_index]->
fops->readlink_cbk = afr_sh_entry_impunge_readlink_sink_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[child_index]; if (priv->children[child_index
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[child_index]->fops->readlink); priv->children
[child_index]->fops->readlink (_new, priv->children[
child_index], &impunge_local->loc, 4096, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1526 priv->children[child_index]->fops->readlink,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1527, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->readlink_cbk) tmp_cbk
= afr_sh_entry_impunge_readlink_sink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->readlink"
; _new->unwind_to = "afr_sh_entry_impunge_readlink_sink_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&impunge_frame->root->stack_lock); { impunge_frame
->ref_count++; _new->next = impunge_frame->root->
frames.next; _new->prev = &impunge_frame->root->
frames; if (impunge_frame->root->frames.next) impunge_frame
->root->frames.next->prev = _new; impunge_frame->
root->frames.next = _new; } pthread_spin_unlock (&impunge_frame
->root->stack_lock); priv->children[child_index]->
fops->readlink_cbk = afr_sh_entry_impunge_readlink_sink_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[child_index]; if (priv->children[child_index
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[child_index]->fops->readlink); priv->children
[child_index]->fops->readlink (_new, priv->children[
child_index], &impunge_local->loc, 4096, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1527 &impunge_local->loc, 4096, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1527, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[child_index]->fops->readlink_cbk) tmp_cbk
= afr_sh_entry_impunge_readlink_sink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[child_index]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[child_index]->fops->readlink"
; _new->unwind_to = "afr_sh_entry_impunge_readlink_sink_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&impunge_frame->root->stack_lock); { impunge_frame
->ref_count++; _new->next = impunge_frame->root->
frames.next; _new->prev = &impunge_frame->root->
frames; if (impunge_frame->root->frames.next) impunge_frame
->root->frames.next->prev = _new; impunge_frame->
root->frames.next = _new; } pthread_spin_unlock (&impunge_frame
->root->stack_lock); priv->children[child_index]->
fops->readlink_cbk = afr_sh_entry_impunge_readlink_sink_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[child_index]; if (priv->children[child_index
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[child_index]->fops->readlink); priv->children
[child_index]->fops->readlink (_new, priv->children[
child_index], &impunge_local->loc, 4096, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
;
1528
1529 return 0;
1530}
1531
1532
1533int
1534afr_sh_entry_impunge_readlink_cbk (call_frame_t *impunge_frame, void *cookie,
1535 xlator_t *this,
1536 int32_t op_ret, int32_t op_errno,
1537 const char *linkname, struct iatt *sbuf, dict_t *xdata)
1538{
1539 afr_private_t *priv = NULL((void*)0);
1540 afr_local_t *impunge_local = NULL((void*)0);
1541 afr_self_heal_t *impunge_sh = NULL((void*)0);
1542 int child_index = -1;
1543 int call_count = -1;
1544 int active_src = -1;
1545
1546 priv = this->private;
1547 impunge_local = impunge_frame->local;
1548 impunge_sh = &impunge_local->self_heal;
1549 active_src = impunge_sh->active_source;
1550
1551 child_index = (long) cookie;
1552
1553 if (op_ret == -1) {
1554 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("readlink of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1558, GF_LOG_INFO, "readlink of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
1555 "readlink of %s on %s failed (%s)",do { do { if (0) printf ("readlink of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1558, GF_LOG_INFO, "readlink of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
1556 impunge_local->loc.path,do { do { if (0) printf ("readlink of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1558, GF_LOG_INFO, "readlink of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
1557 priv->children[active_src]->name,do { do { if (0) printf ("readlink of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1558, GF_LOG_INFO, "readlink of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
1558 strerror (op_errno))do { do { if (0) printf ("readlink of %s on %s failed (%s)", impunge_local
->loc.path, priv->children[active_src]->name, strerror
(op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1558, GF_LOG_INFO, "readlink of %s on %s failed (%s)"
, impunge_local->loc.path, priv->children[active_src]->
name, strerror (op_errno)); } while (0)
;
1559 goto out;
1560 }
1561
1562 impunge_sh->linkname = gf_strdup (linkname);
1563 afr_sh_entry_impunge_readlink_sink (impunge_frame, this, child_index);
1564
1565 return 0;
1566
1567out:
1568 LOCK (&impunge_frame->lock)pthread_spin_lock (&impunge_frame->lock);
1569 {
1570 call_count = --impunge_local->call_count;
1571 }
1572 UNLOCK (&impunge_frame->lock)pthread_spin_unlock (&impunge_frame->lock);
1573
1574 if (call_count == 0)
1575 afr_sh_entry_call_impunge_done (impunge_frame, this,
1576 op_ret, op_errno);
1577
1578 return 0;
1579}
1580
1581
1582int
1583afr_sh_entry_impunge_readlink (call_frame_t *impunge_frame, xlator_t *this,
1584 int child_index, struct iatt *stbuf)
1585{
1586 afr_private_t *priv = NULL((void*)0);
1587 afr_local_t *impunge_local = NULL((void*)0);
1588 afr_self_heal_t *impunge_sh = NULL((void*)0);
1589 int active_src = -1;
1590
1591 priv = this->private;
1592 impunge_local = impunge_frame->local;
1593 impunge_sh = &impunge_local->self_heal;
1594 active_src = impunge_sh->active_source;
1595 impunge_local->cont.dir_fop.buf = *stbuf;
1596
1597 STACK_WIND_COOKIE (impunge_frame, afr_sh_entry_impunge_readlink_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1601, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->readlink_cbk) tmp_cbk
= afr_sh_entry_impunge_readlink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->readlink"
; _new->unwind_to = "afr_sh_entry_impunge_readlink_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[active_src]->fops->readlink_cbk
= afr_sh_entry_impunge_readlink_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->readlink); priv->children[active_src]->fops->readlink
(_new, priv->children[active_src], &impunge_local->
loc, 4096, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1598 (void *) (long) child_index,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1601, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->readlink_cbk) tmp_cbk
= afr_sh_entry_impunge_readlink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->readlink"
; _new->unwind_to = "afr_sh_entry_impunge_readlink_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[active_src]->fops->readlink_cbk
= afr_sh_entry_impunge_readlink_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->readlink); priv->children[active_src]->fops->readlink
(_new, priv->children[active_src], &impunge_local->
loc, 4096, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1599 priv->children[active_src],do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1601, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->readlink_cbk) tmp_cbk
= afr_sh_entry_impunge_readlink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->readlink"
; _new->unwind_to = "afr_sh_entry_impunge_readlink_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[active_src]->fops->readlink_cbk
= afr_sh_entry_impunge_readlink_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->readlink); priv->children[active_src]->fops->readlink
(_new, priv->children[active_src], &impunge_local->
loc, 4096, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1600 priv->children[active_src]->fops->readlink,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1601, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->readlink_cbk) tmp_cbk
= afr_sh_entry_impunge_readlink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->readlink"
; _new->unwind_to = "afr_sh_entry_impunge_readlink_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[active_src]->fops->readlink_cbk
= afr_sh_entry_impunge_readlink_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->readlink); priv->children[active_src]->fops->readlink
(_new, priv->children[active_src], &impunge_local->
loc, 4096, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1601 &impunge_local->loc, 4096, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (impunge_frame->root->pool->
frame_mem_pool); if (!_new) { do { do { if (0) printf ("alloc failed"
); } while (0); _gf_log ("stack", "afr-self-heal-entry.c", __FUNCTION__
, 1601, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->readlink_cbk) tmp_cbk
= afr_sh_entry_impunge_readlink_cbk; _new->root = impunge_frame
->root; _new->this = priv->children[active_src]; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = impunge_frame
; _new->cookie = (void *) (long) child_index; _new->wind_from
= __FUNCTION__; _new->wind_to = "priv->children[active_src]->fops->readlink"
; _new->unwind_to = "afr_sh_entry_impunge_readlink_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&impunge_frame
->root->stack_lock); { impunge_frame->ref_count++; _new
->next = impunge_frame->root->frames.next; _new->
prev = &impunge_frame->root->frames; if (impunge_frame
->root->frames.next) impunge_frame->root->frames.
next->prev = _new; impunge_frame->root->frames.next =
_new; } pthread_spin_unlock (&impunge_frame->root->
stack_lock); priv->children[active_src]->fops->readlink_cbk
= afr_sh_entry_impunge_readlink_cbk; old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = priv->children[active_src
]; if (priv->children[active_src]->ctx->measure_latency
) gf_latency_begin (_new, priv->children[active_src]->fops
->readlink); priv->children[active_src]->fops->readlink
(_new, priv->children[active_src], &impunge_local->
loc, 4096, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
1602
1603 return 0;
1604}
1605
1606int
1607afr_sh_entry_impunge_create (call_frame_t *impunge_frame, xlator_t *this,
1608 int child_index)
1609{
1610 call_frame_t *frame = NULL((void*)0);
1611 afr_local_t *impunge_local = NULL((void*)0);
1612 afr_local_t *local = NULL((void*)0);
1613 afr_self_heal_t *impunge_sh = NULL((void*)0);
1614 afr_self_heal_t *sh = NULL((void*)0);
1615 afr_private_t *priv = NULL((void*)0);
24
'priv' initialized to a null pointer value
1616 ia_type_t type = IA_INVAL;
1617 int active_src = 0;
1618 struct iatt *buf = NULL((void*)0);
1619
1620 AFR_INIT_SH_FRAME_VALS (impunge_frame, impunge_local, impunge_sh,do { impunge_local = impunge_frame->local; impunge_sh = &
impunge_local->self_heal; frame = impunge_sh->sh_frame;
local = frame->local; sh = &local->self_heal; } while
(0);
1621 frame, local, sh)do { impunge_local = impunge_frame->local; impunge_sh = &
impunge_local->self_heal; frame = impunge_sh->sh_frame;
local = frame->local; sh = &local->self_heal; } while
(0);
;
1622 active_src = impunge_sh->active_source;
1623 afr_update_loc_gfids (&impunge_local->loc, &impunge_sh->entrybuf,
1624 &impunge_sh->parentbuf);
1625
1626 buf = &impunge_sh->entrybuf;
1627 type = buf->ia_type;
1628
1629 switch (type) {
25
Control jumps to the 'default' case at line 1643
1630 case IA_IFSOCK:
1631 case IA_IFREG:
1632 case IA_IFBLK:
1633 case IA_IFCHR:
1634 case IA_IFIFO:
1635 case IA_IFLNK:
1636 afr_sh_entry_impunge_check_hardlink (impunge_frame, this,
1637 child_index, buf);
1638 break;
1639 case IA_IFDIR:
1640 afr_sh_entry_impunge_mkdir (impunge_frame, this,
1641 child_index, buf);
1642 break;
1643 default:
1644 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("%s has unknown file type on %s: 0%o"
, impunge_local->loc.path, priv->children[active_src]->
name, type); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1647, GF_LOG_ERROR, "%s has unknown file type on %s: 0%o"
, impunge_local->loc.path, priv->children[active_src]->
name, type); } while (0)
26
Within the expansion of the macro 'gf_log':
a
Access to field 'children' results in a dereference of a null pointer (loaded from variable 'priv')
1645 "%s has unknown file type on %s: 0%o",do { do { if (0) printf ("%s has unknown file type on %s: 0%o"
, impunge_local->loc.path, priv->children[active_src]->
name, type); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1647, GF_LOG_ERROR, "%s has unknown file type on %s: 0%o"
, impunge_local->loc.path, priv->children[active_src]->
name, type); } while (0)
1646 impunge_local->loc.path,do { do { if (0) printf ("%s has unknown file type on %s: 0%o"
, impunge_local->loc.path, priv->children[active_src]->
name, type); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1647, GF_LOG_ERROR, "%s has unknown file type on %s: 0%o"
, impunge_local->loc.path, priv->children[active_src]->
name, type); } while (0)
1647 priv->children[active_src]->name, type)do { do { if (0) printf ("%s has unknown file type on %s: 0%o"
, impunge_local->loc.path, priv->children[active_src]->
name, type); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1647, GF_LOG_ERROR, "%s has unknown file type on %s: 0%o"
, impunge_local->loc.path, priv->children[active_src]->
name, type); } while (0)
;
1648 sh->impunge_done (frame, this, -1, EINVAL22);
1649 break;
1650 }
1651
1652 return 0;
1653}
1654
1655int
1656afr_sh_entry_impunge_create_file (call_frame_t *impunge_frame, xlator_t *this,
1657 int child_index)
1658{
1659 call_frame_t *frame = NULL((void*)0);
1660 afr_local_t *impunge_local = NULL((void*)0);
1661 afr_local_t *local = NULL((void*)0);
1662 afr_self_heal_t *impunge_sh = NULL((void*)0);
1663 afr_self_heal_t *sh = NULL((void*)0);
1664 afr_private_t *priv = NULL((void*)0);
1665 ia_type_t type = IA_INVAL;
1666 int active_src = 0;
1667 struct iatt *buf = NULL((void*)0);
1668
1669 AFR_INIT_SH_FRAME_VALS (impunge_frame, impunge_local, impunge_sh,do { impunge_local = impunge_frame->local; impunge_sh = &
impunge_local->self_heal; frame = impunge_sh->sh_frame;
local = frame->local; sh = &local->self_heal; } while
(0);
1670 frame, local, sh)do { impunge_local = impunge_frame->local; impunge_sh = &
impunge_local->self_heal; frame = impunge_sh->sh_frame;
local = frame->local; sh = &local->self_heal; } while
(0);
;
1671 active_src = impunge_sh->active_source;
1672 buf = &impunge_sh->entrybuf;
1673 type = buf->ia_type;
1674
1675 switch (type) {
1676 case IA_IFSOCK:
1677 case IA_IFREG:
1678 case IA_IFBLK:
1679 case IA_IFCHR:
1680 case IA_IFIFO:
1681 afr_sh_entry_impunge_mknod (impunge_frame, this,
1682 child_index, buf);
1683 break;
1684 case IA_IFLNK:
1685 afr_sh_entry_impunge_readlink (impunge_frame, this,
1686 child_index, buf);
1687 break;
1688 default:
1689 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("%s has unknown file type on %s: 0%o"
, impunge_local->loc.path, priv->children[active_src]->
name, type); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1692, GF_LOG_ERROR, "%s has unknown file type on %s: 0%o"
, impunge_local->loc.path, priv->children[active_src]->
name, type); } while (0)
1690 "%s has unknown file type on %s: 0%o",do { do { if (0) printf ("%s has unknown file type on %s: 0%o"
, impunge_local->loc.path, priv->children[active_src]->
name, type); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1692, GF_LOG_ERROR, "%s has unknown file type on %s: 0%o"
, impunge_local->loc.path, priv->children[active_src]->
name, type); } while (0)
1691 impunge_local->loc.path,do { do { if (0) printf ("%s has unknown file type on %s: 0%o"
, impunge_local->loc.path, priv->children[active_src]->
name, type); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1692, GF_LOG_ERROR, "%s has unknown file type on %s: 0%o"
, impunge_local->loc.path, priv->children[active_src]->
name, type); } while (0)
1692 priv->children[active_src]->name, type)do { do { if (0) printf ("%s has unknown file type on %s: 0%o"
, impunge_local->loc.path, priv->children[active_src]->
name, type); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1692, GF_LOG_ERROR, "%s has unknown file type on %s: 0%o"
, impunge_local->loc.path, priv->children[active_src]->
name, type); } while (0)
;
1693 sh->impunge_done (frame, this, -1, EINVAL22);
1694 break;
1695 }
1696
1697 return 0;
1698}
1699
1700gf_boolean_t
1701afr_sh_need_recreate (afr_self_heal_t *impunge_sh, unsigned int child,
1702 unsigned int child_count)
1703{
1704 gf_boolean_t recreate = _gf_false;
1705
1706 GF_ASSERT (impunge_sh->child_errno)do { if (!(impunge_sh->child_errno)) { do { do { if (0) printf
("Assertion failed: " "impunge_sh->child_errno"); } while
(0); _gf_log_callingfn ("", "afr-self-heal-entry.c", __FUNCTION__
, 1706, GF_LOG_ERROR, "Assertion failed: " "impunge_sh->child_errno"
); } while (0); } } while (0)
;
1707
1708 if (child == impunge_sh->active_source)
1709 goto out;
1710
1711 if (IA_IFLNK == impunge_sh->entrybuf.ia_type) {
1712 recreate = _gf_true;
1713 goto out;
1714 }
1715
1716 if (impunge_sh->child_errno[child] == ENOENT2)
1717 recreate = _gf_true;
1718out:
1719 return recreate;
1720}
1721
1722unsigned int
1723afr_sh_recreate_count (afr_self_heal_t *impunge_sh, int *sources,
1724 unsigned int child_count)
1725{
1726 int count = 0;
1727 int i = 0;
1728
1729 for (i = 0; i < child_count; i++) {
1730 if (afr_sh_need_recreate (impunge_sh, i, child_count))
1731 count++;
1732 }
1733
1734 return count;
1735}
1736
1737int
1738afr_sh_entry_call_impunge_recreate (call_frame_t *impunge_frame,
1739 xlator_t *this)
1740{
1741 afr_private_t *priv = NULL((void*)0);
1742 afr_local_t *impunge_local = NULL((void*)0);
1743 afr_self_heal_t *impunge_sh = NULL((void*)0);
1744 call_frame_t *frame = NULL((void*)0);
1745 afr_local_t *local = NULL((void*)0);
1746 afr_self_heal_t *sh = NULL((void*)0);
1747 unsigned int recreate_count = 0;
1748 int i = 0;
1749 int active_src = 0;
1750
1751 priv = this->private;
1752 AFR_INIT_SH_FRAME_VALS (impunge_frame, impunge_local, impunge_sh,do { impunge_local = impunge_frame->local; impunge_sh = &
impunge_local->self_heal; frame = impunge_sh->sh_frame;
local = frame->local; sh = &local->self_heal; } while
(0);
1753 frame, local, sh)do { impunge_local = impunge_frame->local; impunge_sh = &
impunge_local->self_heal; frame = impunge_sh->sh_frame;
local = frame->local; sh = &local->self_heal; } while
(0);
;
1754 active_src = impunge_sh->active_source;
1755 impunge_sh->entrybuf = impunge_sh->buf[active_src];
1756 impunge_sh->parentbuf = impunge_sh->parentbufs[active_src];
1757 recreate_count = afr_sh_recreate_count (impunge_sh, sh->sources,
1758 priv->child_count);
1759 if (!recreate_count) {
1
Assuming 'recreate_count' is not equal to 0
2
Taking false branch
1760 afr_sh_entry_call_impunge_done (impunge_frame, this, 0, 0);
1761 goto out;
1762 }
1763 impunge_local->call_count = recreate_count;
1764 for (i = 0; i < priv->child_count; i++) {
3
Loop condition is true. Entering loop body
7
Loop condition is true. Entering loop body
11
Loop condition is true. Entering loop body
14
Loop condition is false. Execution continues on line 1774
1765 if (!impunge_local->child_up[i]) {
4
Taking false branch
8
Taking false branch
12
Taking false branch
1766 impunge_sh->child_errno[i] = ENOTCONN107;
1767 continue;
1768 }
1769 if (!afr_sh_need_recreate (impunge_sh, i, priv->child_count)) {
5
Taking true branch
9
Taking true branch
13
Taking false branch
1770 impunge_sh->child_errno[i] = EEXIST17;
1771 continue;
6
Execution continues on line 1764
10
Execution continues on line 1764
1772 }
1773 }
1774 for (i = 0; i < priv->child_count; i++) {
15
Loop condition is true. Entering loop body
18
Loop condition is true. Entering loop body
21
Loop condition is true. Entering loop body
1775 if (!afr_sh_need_recreate (impunge_sh, i, priv->child_count))
16
Taking true branch
19
Taking true branch
22
Taking false branch
1776 continue;
17
Execution continues on line 1774
20
Execution continues on line 1774
1777 (void)afr_sh_entry_impunge_create (impunge_frame, this, i);
23
Calling 'afr_sh_entry_impunge_create'
1778 recreate_count--;
1779 }
1780 GF_ASSERT (!recreate_count)do { if (!(!recreate_count)) { do { do { if (0) printf ("Assertion failed: "
"!recreate_count"); } while (0); _gf_log_callingfn ("", "afr-self-heal-entry.c"
, __FUNCTION__, 1780, GF_LOG_ERROR, "Assertion failed: " "!recreate_count"
); } while (0); } } while (0)
;
1781out:
1782 return 0;
1783}
1784
1785void
1786afr_sh_entry_common_lookup_done (call_frame_t *impunge_frame, xlator_t *this,
1787 int32_t op_ret, int32_t op_errno)
1788{
1789 afr_private_t *priv = NULL((void*)0);
1790 afr_local_t *impunge_local = NULL((void*)0);
1791 afr_self_heal_t *impunge_sh = NULL((void*)0);
1792 call_frame_t *frame = NULL((void*)0);
1793 afr_local_t *local = NULL((void*)0);
1794 afr_self_heal_t *sh = NULL((void*)0);
1795 unsigned int gfid_miss_count = 0;
1796 unsigned int children_up_count = 0;
1797 uuid_t gfid = {0};
1798 int active_src = 0;
1799
1800 priv = this->private;
1801 AFR_INIT_SH_FRAME_VALS (impunge_frame, impunge_local, impunge_sh,do { impunge_local = impunge_frame->local; impunge_sh = &
impunge_local->self_heal; frame = impunge_sh->sh_frame;
local = frame->local; sh = &local->self_heal; } while
(0);
1802 frame, local, sh)do { impunge_local = impunge_frame->local; impunge_sh = &
impunge_local->self_heal; frame = impunge_sh->sh_frame;
local = frame->local; sh = &local->self_heal; } while
(0);
;
1803 active_src = impunge_sh->active_source;
1804
1805 if (op_ret < 0)
1806 goto done;
1807 if (impunge_sh->child_errno[active_src]) {
1808 op_ret = -1;
1809 op_errno = impunge_sh->child_errno[active_src];
1810 goto done;
1811 }
1812
1813 gfid_miss_count = afr_gfid_missing_count (this->name,
1814 impunge_sh->success_children,
1815 impunge_sh->buf, priv->child_count,
1816 impunge_local->loc.path);
1817 children_up_count = afr_up_children_count (impunge_local->child_up,
1818 priv->child_count);
1819 if ((gfid_miss_count == children_up_count) &&
1820 (children_up_count < priv->child_count)) {
1821 op_ret = -1;
1822 op_errno = ENODATA61;
1823 gf_log (this->name, GF_LOG_ERROR, "Not all children are up, "do { do { if (0) printf ("Not all children are up, " "gfid should not be assigned in this state for %s"
, impunge_local->loc.path); } while (0); _gf_log (this->
name, "afr-self-heal-entry.c", __FUNCTION__, 1825, GF_LOG_ERROR
, "Not all children are up, " "gfid should not be assigned in this state for %s"
, impunge_local->loc.path); } while (0)
1824 "gfid should not be assigned in this state for %s",do { do { if (0) printf ("Not all children are up, " "gfid should not be assigned in this state for %s"
, impunge_local->loc.path); } while (0); _gf_log (this->
name, "afr-self-heal-entry.c", __FUNCTION__, 1825, GF_LOG_ERROR
, "Not all children are up, " "gfid should not be assigned in this state for %s"
, impunge_local->loc.path); } while (0)
1825 impunge_local->loc.path)do { do { if (0) printf ("Not all children are up, " "gfid should not be assigned in this state for %s"
, impunge_local->loc.path); } while (0); _gf_log (this->
name, "afr-self-heal-entry.c", __FUNCTION__, 1825, GF_LOG_ERROR
, "Not all children are up, " "gfid should not be assigned in this state for %s"
, impunge_local->loc.path); } while (0)
;
1826 goto done;
1827 }
1828
1829 if (gfid_miss_count) {
1830 afr_update_gfid_from_iatts (gfid, impunge_sh->buf,
1831 impunge_sh->success_children,
1832 priv->child_count);
1833 if (uuid_is_null (gfid)) {
1834 sh->entries_skipped = _gf_true;
1835 gf_log (this->name, GF_LOG_INFO, "%s: Skipping entry "do { do { if (0) printf ("%s: Skipping entry " "self-heal because of gfid absence"
, impunge_local->loc.path); } while (0); _gf_log (this->
name, "afr-self-heal-entry.c", __FUNCTION__, 1837, GF_LOG_INFO
, "%s: Skipping entry " "self-heal because of gfid absence", impunge_local
->loc.path); } while (0)
1836 "self-heal because of gfid absence",do { do { if (0) printf ("%s: Skipping entry " "self-heal because of gfid absence"
, impunge_local->loc.path); } while (0); _gf_log (this->
name, "afr-self-heal-entry.c", __FUNCTION__, 1837, GF_LOG_INFO
, "%s: Skipping entry " "self-heal because of gfid absence", impunge_local
->loc.path); } while (0)
1837 impunge_local->loc.path)do { do { if (0) printf ("%s: Skipping entry " "self-heal because of gfid absence"
, impunge_local->loc.path); } while (0); _gf_log (this->
name, "afr-self-heal-entry.c", __FUNCTION__, 1837, GF_LOG_INFO
, "%s: Skipping entry " "self-heal because of gfid absence", impunge_local
->loc.path); } while (0)
;
1838 goto done;
1839 }
1840 afr_sh_common_lookup (impunge_frame, this, &impunge_local->loc,
1841 afr_sh_entry_common_lookup_done, gfid,
1842 AFR_LOOKUP_FAIL_CONFLICTS |
1843 AFR_LOOKUP_FAIL_MISSING_GFIDS,
1844 NULL((void*)0));
1845 } else {
1846 afr_sh_entry_call_impunge_recreate (impunge_frame, this);
1847 }
1848 return;
1849done:
1850 afr_sh_entry_call_impunge_done (impunge_frame, this,
1851 op_ret, op_errno);
1852 return;
1853}
1854
1855int
1856afr_sh_entry_impunge_entry (call_frame_t *frame, xlator_t *this,
1857 gf_dirent_t *entry)
1858{
1859 afr_local_t *local = NULL((void*)0);
1860 afr_self_heal_t *sh = NULL((void*)0);
1861 afr_self_heal_t *impunge_sh = NULL((void*)0);
1862 int ret = -1;
1863 call_frame_t *impunge_frame = NULL((void*)0);
1864 afr_local_t *impunge_local = NULL((void*)0);
1865 int active_src = 0;
1866 int op_errno = 0;
1867 int op_ret = -1;
1868
1869 local = frame->local;
1870 sh = &local->self_heal;
1871
1872 active_src = sh->active_source;
1873 sh->impunge_done = afr_sh_entry_impunge_entry_done;
1874
1875 if ((strcmp (entry->d_name, ".") == 0)
1876 || (strcmp (entry->d_name, "..") == 0)) {
1877
1878 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("skipping inspection of %s under %s"
, entry->d_name, local->loc.path); } while (0); _gf_log
(this->name, "afr-self-heal-entry.c", __FUNCTION__, 1880,
GF_LOG_TRACE, "skipping inspection of %s under %s", entry->
d_name, local->loc.path); } while (0)
1879 "skipping inspection of %s under %s",do { do { if (0) printf ("skipping inspection of %s under %s"
, entry->d_name, local->loc.path); } while (0); _gf_log
(this->name, "afr-self-heal-entry.c", __FUNCTION__, 1880,
GF_LOG_TRACE, "skipping inspection of %s under %s", entry->
d_name, local->loc.path); } while (0)
1880 entry->d_name, local->loc.path)do { do { if (0) printf ("skipping inspection of %s under %s"
, entry->d_name, local->loc.path); } while (0); _gf_log
(this->name, "afr-self-heal-entry.c", __FUNCTION__, 1880,
GF_LOG_TRACE, "skipping inspection of %s under %s", entry->
d_name, local->loc.path); } while (0)
;
1881 op_ret = 0;
1882 goto out;
1883 }
1884
1885 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("inspecting existence of %s under %s"
, entry->d_name, local->loc.path); } while (0); _gf_log
(this->name, "afr-self-heal-entry.c", __FUNCTION__, 1887,
GF_LOG_TRACE, "inspecting existence of %s under %s", entry->
d_name, local->loc.path); } while (0)
1886 "inspecting existence of %s under %s",do { do { if (0) printf ("inspecting existence of %s under %s"
, entry->d_name, local->loc.path); } while (0); _gf_log
(this->name, "afr-self-heal-entry.c", __FUNCTION__, 1887,
GF_LOG_TRACE, "inspecting existence of %s under %s", entry->
d_name, local->loc.path); } while (0)
1887 entry->d_name, local->loc.path)do { do { if (0) printf ("inspecting existence of %s under %s"
, entry->d_name, local->loc.path); } while (0); _gf_log
(this->name, "afr-self-heal-entry.c", __FUNCTION__, 1887,
GF_LOG_TRACE, "inspecting existence of %s under %s", entry->
d_name, local->loc.path); } while (0)
;
1888
1889 ret = afr_impunge_frame_create (frame, this, active_src,
1890 &impunge_frame);
1891 if (ret) {
1892 op_errno = -ret;
1893 goto out;
1894 }
1895
1896 impunge_local = impunge_frame->local;
1897 impunge_sh = &impunge_local->self_heal;
1898 ret = afr_build_child_loc (this, &impunge_local->loc, &local->loc,
1899 entry->d_name);
1900 loc_copy (&impunge_sh->parent_loc, &local->loc);
1901 if (ret != 0) {
1902 op_errno = ENOMEM12;
1903 goto out;
1904 }
1905
1906 afr_sh_common_lookup (impunge_frame, this, &impunge_local->loc,
1907 afr_sh_entry_common_lookup_done, NULL((void*)0),
1908 AFR_LOOKUP_FAIL_CONFLICTS, NULL((void*)0));
1909
1910 op_ret = 0;
1911out:
1912 if (ret) {
1913 if (impunge_frame)
1914 AFR_STACK_DESTROY (impunge_frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = impunge_frame->local; __this = impunge_frame
->this; impunge_frame->local = ((void*)0); STACK_DESTROY
(impunge_frame->root); if (__local) { afr_local_cleanup (
__local, __this); mem_put (__local); } } while (0);
;
1915 sh->impunge_done (frame, this, op_ret, op_errno);
1916 }
1917
1918 return 0;
1919}
1920
1921
1922int
1923afr_sh_entry_impunge_readdir_cbk (call_frame_t *frame, void *cookie,
1924 xlator_t *this,
1925 int32_t op_ret, int32_t op_errno,
1926 gf_dirent_t *entries, dict_t *xdata)
1927{
1928 afr_private_t *priv = NULL((void*)0);
1929 afr_local_t *local = NULL((void*)0);
1930 afr_self_heal_t *sh = NULL((void*)0);
1931 gf_dirent_t *entry = NULL((void*)0);
1932 off_t last_offset = 0;
1933 int active_src = 0;
1934 int entry_count = 0;
1935
1936 priv = this->private;
1937 local = frame->local;
1938 sh = &local->self_heal;
1939
1940 active_src = sh->active_source;
1941
1942 if (op_ret <= 0) {
1943 if (op_ret < 0) {
1944 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1948, GF_LOG_INFO, "readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0)
1945 "readdir of %s on subvolume %s failed (%s)",do { do { if (0) printf ("readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1948, GF_LOG_INFO, "readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0)
1946 local->loc.path,do { do { if (0) printf ("readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1948, GF_LOG_INFO, "readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0)
1947 priv->children[active_src]->name,do { do { if (0) printf ("readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1948, GF_LOG_INFO, "readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0)
1948 strerror (op_errno))do { do { if (0) printf ("readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1948, GF_LOG_INFO, "readdir of %s on subvolume %s failed (%s)"
, local->loc.path, priv->children[active_src]->name,
strerror (op_errno)); } while (0)
;
1949 sh->op_failed = 1;
1950 } else {
1951 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("readdir of %s on subvolume %s complete"
, local->loc.path, priv->children[active_src]->name)
; } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1954, GF_LOG_TRACE, "readdir of %s on subvolume %s complete"
, local->loc.path, priv->children[active_src]->name)
; } while (0)
1952 "readdir of %s on subvolume %s complete",do { do { if (0) printf ("readdir of %s on subvolume %s complete"
, local->loc.path, priv->children[active_src]->name)
; } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1954, GF_LOG_TRACE, "readdir of %s on subvolume %s complete"
, local->loc.path, priv->children[active_src]->name)
; } while (0)
1953 local->loc.path,do { do { if (0) printf ("readdir of %s on subvolume %s complete"
, local->loc.path, priv->children[active_src]->name)
; } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1954, GF_LOG_TRACE, "readdir of %s on subvolume %s complete"
, local->loc.path, priv->children[active_src]->name)
; } while (0)
1954 priv->children[active_src]->name)do { do { if (0) printf ("readdir of %s on subvolume %s complete"
, local->loc.path, priv->children[active_src]->name)
; } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 1954, GF_LOG_TRACE, "readdir of %s on subvolume %s complete"
, local->loc.path, priv->children[active_src]->name)
; } while (0)
;
1955 }
1956
1957 afr_sh_entry_impunge_all (frame, this);
1958 return 0;
1959 }
1960
1961 list_for_each_entry (entry, &entries->list, list)for (entry = ((typeof(*entry) *)((char *)((&entries->list
)->next)-(unsigned long)(&((typeof(*entry) *)0)->list
))); &entry->list != (&entries->list); entry = (
(typeof(*entry) *)((char *)(entry->list.next)-(unsigned long
)(&((typeof(*entry) *)0)->list))))
{
1962 last_offset = entry->d_off;
1963 entry_count++;
1964 }
1965
1966 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("readdir'ed %d entries from %s", entry_count
, priv->children[active_src]->name); } while (0); _gf_log
(this->name, "afr-self-heal-entry.c", __FUNCTION__, 1968,
GF_LOG_DEBUG, "readdir'ed %d entries from %s", entry_count, priv
->children[active_src]->name); } while (0)
1967 "readdir'ed %d entries from %s",do { do { if (0) printf ("readdir'ed %d entries from %s", entry_count
, priv->children[active_src]->name); } while (0); _gf_log
(this->name, "afr-self-heal-entry.c", __FUNCTION__, 1968,
GF_LOG_DEBUG, "readdir'ed %d entries from %s", entry_count, priv
->children[active_src]->name); } while (0)
1968 entry_count, priv->children[active_src]->name)do { do { if (0) printf ("readdir'ed %d entries from %s", entry_count
, priv->children[active_src]->name); } while (0); _gf_log
(this->name, "afr-self-heal-entry.c", __FUNCTION__, 1968,
GF_LOG_DEBUG, "readdir'ed %d entries from %s", entry_count, priv
->children[active_src]->name); } while (0)
;
1969
1970 sh->offset = last_offset;
1971 local->call_count = entry_count;
1972
1973 list_for_each_entry (entry, &entries->list, list)for (entry = ((typeof(*entry) *)((char *)((&entries->list
)->next)-(unsigned long)(&((typeof(*entry) *)0)->list
))); &entry->list != (&entries->list); entry = (
(typeof(*entry) *)((char *)(entry->list.next)-(unsigned long
)(&((typeof(*entry) *)0)->list))))
{
1974 afr_sh_entry_impunge_entry (frame, this, entry);
1975 }
1976
1977 return 0;
1978}
1979
1980
1981int
1982afr_sh_entry_impunge_subvol (call_frame_t *frame, xlator_t *this)
1983{
1984 afr_private_t *priv = NULL((void*)0);
1985 afr_local_t *local = NULL((void*)0);
1986 afr_self_heal_t *sh = NULL((void*)0);
1987 int32_t active_src = 0;
1988
1989 priv = this->private;
1990 local = frame->local;
1991 sh = &local->self_heal;
1992 active_src = sh->active_source;
1993 gf_log (this->name, GF_LOG_DEBUG, "%s: readdir from offset %zd",do { do { if (0) printf ("%s: readdir from offset %zd", local
->loc.path, sh->offset); } while (0); _gf_log (this->
name, "afr-self-heal-entry.c", __FUNCTION__, 1994, GF_LOG_DEBUG
, "%s: readdir from offset %zd", local->loc.path, sh->offset
); } while (0)
1994 local->loc.path, sh->offset)do { do { if (0) printf ("%s: readdir from offset %zd", local
->loc.path, sh->offset); } while (0); _gf_log (this->
name, "afr-self-heal-entry.c", __FUNCTION__, 1994, GF_LOG_DEBUG
, "%s: readdir from offset %zd", local->loc.path, sh->offset
); } while (0)
;
1995
1996 STACK_WIND (frame, afr_sh_entry_impunge_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", "afr-self-heal-entry.c", __FUNCTION__
, 1999, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->readdirp_cbk) tmp_cbk
= afr_sh_entry_impunge_readdir_cbk; _new->root = frame->
root; _new->this = priv->children[active_src]; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"priv->children[active_src]->fops->readdirp"; _new->
unwind_to = "afr_sh_entry_impunge_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
()) = priv->children[active_src]; if (frame->this->ctx
->measure_latency) gf_latency_begin (_new, priv->children
[active_src]->fops->readdirp); priv->children[active_src
]->fops->readdirp (_new, priv->children[active_src],
sh->healing_fd, sh->block_size, sh->offset, ((void*
)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
1997 priv->children[active_src],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", "afr-self-heal-entry.c", __FUNCTION__
, 1999, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->readdirp_cbk) tmp_cbk
= afr_sh_entry_impunge_readdir_cbk; _new->root = frame->
root; _new->this = priv->children[active_src]; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"priv->children[active_src]->fops->readdirp"; _new->
unwind_to = "afr_sh_entry_impunge_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
()) = priv->children[active_src]; if (frame->this->ctx
->measure_latency) gf_latency_begin (_new, priv->children
[active_src]->fops->readdirp); priv->children[active_src
]->fops->readdirp (_new, priv->children[active_src],
sh->healing_fd, sh->block_size, sh->offset, ((void*
)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
1998 priv->children[active_src]->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", "afr-self-heal-entry.c", __FUNCTION__
, 1999, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->readdirp_cbk) tmp_cbk
= afr_sh_entry_impunge_readdir_cbk; _new->root = frame->
root; _new->this = priv->children[active_src]; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"priv->children[active_src]->fops->readdirp"; _new->
unwind_to = "afr_sh_entry_impunge_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
()) = priv->children[active_src]; if (frame->this->ctx
->measure_latency) gf_latency_begin (_new, priv->children
[active_src]->fops->readdirp); priv->children[active_src
]->fops->readdirp (_new, priv->children[active_src],
sh->healing_fd, sh->block_size, sh->offset, ((void*
)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
1999 sh->healing_fd, sh->block_size, sh->offset, NULL)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", "afr-self-heal-entry.c", __FUNCTION__
, 1999, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[active_src]->fops->readdirp_cbk) tmp_cbk
= afr_sh_entry_impunge_readdir_cbk; _new->root = frame->
root; _new->this = priv->children[active_src]; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"priv->children[active_src]->fops->readdirp"; _new->
unwind_to = "afr_sh_entry_impunge_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
()) = priv->children[active_src]; if (frame->this->ctx
->measure_latency) gf_latency_begin (_new, priv->children
[active_src]->fops->readdirp); priv->children[active_src
]->fops->readdirp (_new, priv->children[active_src],
sh->healing_fd, sh->block_size, sh->offset, ((void*
)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
;
2000
2001 return 0;
2002}
2003
2004
2005int
2006afr_sh_entry_impunge_all (call_frame_t *frame, xlator_t *this)
2007{
2008 afr_private_t *priv = NULL((void*)0);
2009 afr_local_t *local = NULL((void*)0);
2010 afr_self_heal_t *sh = NULL((void*)0);
2011 int active_src = -1;
2012
2013 priv = this->private;
2014 local = frame->local;
2015 sh = &local->self_heal;
2016
2017 sh->offset = 0;
2018
2019 active_src = next_active_source (frame, this, sh->active_source);
2020 sh->active_source = active_src;
2021
2022 if (sh->op_failed) {
2023 afr_sh_entry_finish (frame, this);
2024 return 0;
2025 }
2026
2027 if (active_src == -1) {
2028 /* completed creating missing files on all subvolumes */
2029 afr_sh_entry_erase_pending (frame, this);
2030 return 0;
2031 }
2032
2033 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("impunging entries of %s on %s to other sinks"
, local->loc.path, priv->children[active_src]->name)
; } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2035, GF_LOG_TRACE, "impunging entries of %s on %s to other sinks"
, local->loc.path, priv->children[active_src]->name)
; } while (0)
2034 "impunging entries of %s on %s to other sinks",do { do { if (0) printf ("impunging entries of %s on %s to other sinks"
, local->loc.path, priv->children[active_src]->name)
; } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2035, GF_LOG_TRACE, "impunging entries of %s on %s to other sinks"
, local->loc.path, priv->children[active_src]->name)
; } while (0)
2035 local->loc.path, priv->children[active_src]->name)do { do { if (0) printf ("impunging entries of %s on %s to other sinks"
, local->loc.path, priv->children[active_src]->name)
; } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2035, GF_LOG_TRACE, "impunging entries of %s on %s to other sinks"
, local->loc.path, priv->children[active_src]->name)
; } while (0)
;
2036
2037 afr_sh_entry_impunge_subvol (frame, this);
2038
2039 return 0;
2040}
2041
2042
2043int
2044afr_sh_entry_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
2045 int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata)
2046{
2047 afr_local_t *local = NULL((void*)0);
2048 afr_self_heal_t *sh = NULL((void*)0);
2049 afr_private_t *priv = NULL((void*)0);
2050 int call_count = 0;
2051 int child_index = 0;
2052
2053 local = frame->local;
2054 sh = &local->self_heal;
2055 priv = this->private;
2056
2057 child_index = (long) cookie;
2058
2059 /* TODO: some of the open's might fail.
2060 In that case, modify cleanup fn to send flush on those
2061 fd's which are already open */
2062
2063 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
2064 {
2065 if (op_ret == -1) {
2066 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("opendir of %s failed on child %s (%s)"
, local->loc.path, priv->children[child_index]->name
, strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2070, GF_LOG_ERROR, "opendir of %s failed on child %s (%s)"
, local->loc.path, priv->children[child_index]->name
, strerror (op_errno)); } while (0)
2067 "opendir of %s failed on child %s (%s)",do { do { if (0) printf ("opendir of %s failed on child %s (%s)"
, local->loc.path, priv->children[child_index]->name
, strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2070, GF_LOG_ERROR, "opendir of %s failed on child %s (%s)"
, local->loc.path, priv->children[child_index]->name
, strerror (op_errno)); } while (0)
2068 local->loc.path,do { do { if (0) printf ("opendir of %s failed on child %s (%s)"
, local->loc.path, priv->children[child_index]->name
, strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2070, GF_LOG_ERROR, "opendir of %s failed on child %s (%s)"
, local->loc.path, priv->children[child_index]->name
, strerror (op_errno)); } while (0)
2069 priv->children[child_index]->name,do { do { if (0) printf ("opendir of %s failed on child %s (%s)"
, local->loc.path, priv->children[child_index]->name
, strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2070, GF_LOG_ERROR, "opendir of %s failed on child %s (%s)"
, local->loc.path, priv->children[child_index]->name
, strerror (op_errno)); } while (0)
2070 strerror (op_errno))do { do { if (0) printf ("opendir of %s failed on child %s (%s)"
, local->loc.path, priv->children[child_index]->name
, strerror (op_errno)); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2070, GF_LOG_ERROR, "opendir of %s failed on child %s (%s)"
, local->loc.path, priv->children[child_index]->name
, strerror (op_errno)); } while (0)
;
2071 sh->op_failed = 1;
2072 }
2073 }
2074 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
2075
2076 call_count = afr_frame_return (frame);
2077
2078 if (call_count == 0) {
2079 if (sh->op_failed) {
2080 afr_sh_entry_finish (frame, this);
2081 return 0;
2082 }
2083 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("fd for %s opened, commencing sync",
local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2085, GF_LOG_TRACE, "fd for %s opened, commencing sync"
, local->loc.path); } while (0)
2084 "fd for %s opened, commencing sync",do { do { if (0) printf ("fd for %s opened, commencing sync",
local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2085, GF_LOG_TRACE, "fd for %s opened, commencing sync"
, local->loc.path); } while (0)
2085 local->loc.path)do { do { if (0) printf ("fd for %s opened, commencing sync",
local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2085, GF_LOG_TRACE, "fd for %s opened, commencing sync"
, local->loc.path); } while (0)
;
2086
2087 sh->active_source = -1;
2088 afr_sh_entry_expunge_all (frame, this);
2089 }
2090
2091 return 0;
2092}
2093
2094
2095int
2096afr_sh_entry_open (call_frame_t *frame, xlator_t *this)
2097{
2098 int i = 0;
2099 int call_count = 0;
2100
2101 int source = -1;
2102 int *sources = NULL((void*)0);
2103
2104 fd_t *fd = NULL((void*)0);
2105
2106 afr_local_t * local = NULL((void*)0);
2107 afr_private_t * priv = NULL((void*)0);
2108 afr_self_heal_t *sh = NULL((void*)0);
2109
2110 local = frame->local;
2111 sh = &local->self_heal;
2112 priv = this->private;
2113
2114 source = local->self_heal.source;
2115 sources = local->self_heal.sources;
2116
2117 sh->block_size = priv->sh_readdir_size;
2118 sh->offset = 0;
2119
2120 call_count = sh->active_sinks;
2121 if (source != -1)
2122 call_count++;
2123
2124 local->call_count = call_count;
2125
2126 fd = fd_create (local->loc.inode, frame->root->pid);
2127 sh->healing_fd = fd;
2128
2129 if (source != -1) {
2130 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("opening directory %s on subvolume %s (source)"
, local->loc.path, priv->children[source]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 2132, GF_LOG_TRACE, "opening directory %s on subvolume %s (source)"
, local->loc.path, priv->children[source]->name); } while
(0)
2131 "opening directory %s on subvolume %s (source)",do { do { if (0) printf ("opening directory %s on subvolume %s (source)"
, local->loc.path, priv->children[source]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 2132, GF_LOG_TRACE, "opening directory %s on subvolume %s (source)"
, local->loc.path, priv->children[source]->name); } while
(0)
2132 local->loc.path, priv->children[source]->name)do { do { if (0) printf ("opening directory %s on subvolume %s (source)"
, local->loc.path, priv->children[source]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 2132, GF_LOG_TRACE, "opening directory %s on subvolume %s (source)"
, local->loc.path, priv->children[source]->name); } while
(0)
;
2133
2134 /* open source */
2135 STACK_WIND_COOKIE (frame, afr_sh_entry_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", "afr-self-heal-entry.c", __FUNCTION__
, 2139, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[source]->fops->opendir_cbk) tmp_cbk
= afr_sh_entry_opendir_cbk; _new->root = frame->root; _new
->this = priv->children[source]; _new->ret = (ret_fn_t
) tmp_cbk; _new->parent = frame; _new->cookie = (void *
) (long) source; _new->wind_from = __FUNCTION__; _new->
wind_to = "priv->children[source]->fops->opendir"; _new
->unwind_to = "afr_sh_entry_opendir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _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; } pthread_spin_unlock (&frame->root->stack_lock
); priv->children[source]->fops->opendir_cbk = afr_sh_entry_opendir_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[source]; if (priv->children[source
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[source]->fops->opendir); priv->children[source
]->fops->opendir (_new, priv->children[source], &
local->loc, fd, ((void*)0)); (*__glusterfs_this_location()
) = old_THIS; } while (0)
2136 (void *) (long) source,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", "afr-self-heal-entry.c", __FUNCTION__
, 2139, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[source]->fops->opendir_cbk) tmp_cbk
= afr_sh_entry_opendir_cbk; _new->root = frame->root; _new
->this = priv->children[source]; _new->ret = (ret_fn_t
) tmp_cbk; _new->parent = frame; _new->cookie = (void *
) (long) source; _new->wind_from = __FUNCTION__; _new->
wind_to = "priv->children[source]->fops->opendir"; _new
->unwind_to = "afr_sh_entry_opendir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _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; } pthread_spin_unlock (&frame->root->stack_lock
); priv->children[source]->fops->opendir_cbk = afr_sh_entry_opendir_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[source]; if (priv->children[source
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[source]->fops->opendir); priv->children[source
]->fops->opendir (_new, priv->children[source], &
local->loc, fd, ((void*)0)); (*__glusterfs_this_location()
) = old_THIS; } while (0)
2137 priv->children[source],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", "afr-self-heal-entry.c", __FUNCTION__
, 2139, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[source]->fops->opendir_cbk) tmp_cbk
= afr_sh_entry_opendir_cbk; _new->root = frame->root; _new
->this = priv->children[source]; _new->ret = (ret_fn_t
) tmp_cbk; _new->parent = frame; _new->cookie = (void *
) (long) source; _new->wind_from = __FUNCTION__; _new->
wind_to = "priv->children[source]->fops->opendir"; _new
->unwind_to = "afr_sh_entry_opendir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _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; } pthread_spin_unlock (&frame->root->stack_lock
); priv->children[source]->fops->opendir_cbk = afr_sh_entry_opendir_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[source]; if (priv->children[source
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[source]->fops->opendir); priv->children[source
]->fops->opendir (_new, priv->children[source], &
local->loc, fd, ((void*)0)); (*__glusterfs_this_location()
) = old_THIS; } while (0)
2138 priv->children[source]->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", "afr-self-heal-entry.c", __FUNCTION__
, 2139, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[source]->fops->opendir_cbk) tmp_cbk
= afr_sh_entry_opendir_cbk; _new->root = frame->root; _new
->this = priv->children[source]; _new->ret = (ret_fn_t
) tmp_cbk; _new->parent = frame; _new->cookie = (void *
) (long) source; _new->wind_from = __FUNCTION__; _new->
wind_to = "priv->children[source]->fops->opendir"; _new
->unwind_to = "afr_sh_entry_opendir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _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; } pthread_spin_unlock (&frame->root->stack_lock
); priv->children[source]->fops->opendir_cbk = afr_sh_entry_opendir_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[source]; if (priv->children[source
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[source]->fops->opendir); priv->children[source
]->fops->opendir (_new, priv->children[source], &
local->loc, fd, ((void*)0)); (*__glusterfs_this_location()
) = old_THIS; } while (0)
2139 &local->loc, fd, NULL)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", "afr-self-heal-entry.c", __FUNCTION__
, 2139, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[source]->fops->opendir_cbk) tmp_cbk
= afr_sh_entry_opendir_cbk; _new->root = frame->root; _new
->this = priv->children[source]; _new->ret = (ret_fn_t
) tmp_cbk; _new->parent = frame; _new->cookie = (void *
) (long) source; _new->wind_from = __FUNCTION__; _new->
wind_to = "priv->children[source]->fops->opendir"; _new
->unwind_to = "afr_sh_entry_opendir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _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; } pthread_spin_unlock (&frame->root->stack_lock
); priv->children[source]->fops->opendir_cbk = afr_sh_entry_opendir_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[source]; if (priv->children[source
]->ctx->measure_latency) gf_latency_begin (_new, priv->
children[source]->fops->opendir); priv->children[source
]->fops->opendir (_new, priv->children[source], &
local->loc, fd, ((void*)0)); (*__glusterfs_this_location()
) = old_THIS; } while (0)
;
2140 call_count--;
2141 }
2142
2143 /* open sinks */
2144 for (i = 0; i < priv->child_count; i++) {
2145 if (sources[i] || !local->child_up[i])
2146 continue;
2147
2148 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("opening directory %s on subvolume %s (sink)"
, local->loc.path, priv->children[i]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 2150, GF_LOG_TRACE, "opening directory %s on subvolume %s (sink)"
, local->loc.path, priv->children[i]->name); } while
(0)
2149 "opening directory %s on subvolume %s (sink)",do { do { if (0) printf ("opening directory %s on subvolume %s (sink)"
, local->loc.path, priv->children[i]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 2150, GF_LOG_TRACE, "opening directory %s on subvolume %s (sink)"
, local->loc.path, priv->children[i]->name); } while
(0)
2150 local->loc.path, priv->children[i]->name)do { do { if (0) printf ("opening directory %s on subvolume %s (sink)"
, local->loc.path, priv->children[i]->name); } while
(0); _gf_log (this->name, "afr-self-heal-entry.c", __FUNCTION__
, 2150, GF_LOG_TRACE, "opening directory %s on subvolume %s (sink)"
, local->loc.path, priv->children[i]->name); } while
(0)
;
2151
2152 STACK_WIND_COOKIE (frame, afr_sh_entry_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", "afr-self-heal-entry.c", __FUNCTION__
, 2156, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->opendir_cbk) tmp_cbk = afr_sh_entry_opendir_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) i; _new->wind_from = __FUNCTION__
; _new->wind_to = "priv->children[i]->fops->opendir"
; _new->unwind_to = "afr_sh_entry_opendir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _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; } pthread_spin_unlock (&frame->root->stack_lock
); priv->children[i]->fops->opendir_cbk = afr_sh_entry_opendir_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->opendir); priv->children[i]->fops->opendir
(_new, priv->children[i], &local->loc, fd, ((void*
)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
2153 (void *) (long) i,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", "afr-self-heal-entry.c", __FUNCTION__
, 2156, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->opendir_cbk) tmp_cbk = afr_sh_entry_opendir_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) i; _new->wind_from = __FUNCTION__
; _new->wind_to = "priv->children[i]->fops->opendir"
; _new->unwind_to = "afr_sh_entry_opendir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _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; } pthread_spin_unlock (&frame->root->stack_lock
); priv->children[i]->fops->opendir_cbk = afr_sh_entry_opendir_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->opendir); priv->children[i]->fops->opendir
(_new, priv->children[i], &local->loc, fd, ((void*
)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
2154 priv->children[i],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", "afr-self-heal-entry.c", __FUNCTION__
, 2156, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->opendir_cbk) tmp_cbk = afr_sh_entry_opendir_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) i; _new->wind_from = __FUNCTION__
; _new->wind_to = "priv->children[i]->fops->opendir"
; _new->unwind_to = "afr_sh_entry_opendir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _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; } pthread_spin_unlock (&frame->root->stack_lock
); priv->children[i]->fops->opendir_cbk = afr_sh_entry_opendir_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->opendir); priv->children[i]->fops->opendir
(_new, priv->children[i], &local->loc, fd, ((void*
)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
2155 priv->children[i]->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", "afr-self-heal-entry.c", __FUNCTION__
, 2156, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->opendir_cbk) tmp_cbk = afr_sh_entry_opendir_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) i; _new->wind_from = __FUNCTION__
; _new->wind_to = "priv->children[i]->fops->opendir"
; _new->unwind_to = "afr_sh_entry_opendir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _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; } pthread_spin_unlock (&frame->root->stack_lock
); priv->children[i]->fops->opendir_cbk = afr_sh_entry_opendir_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->opendir); priv->children[i]->fops->opendir
(_new, priv->children[i], &local->loc, fd, ((void*
)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
2156 &local->loc, fd, NULL)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", "afr-self-heal-entry.c", __FUNCTION__
, 2156, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->opendir_cbk) tmp_cbk = afr_sh_entry_opendir_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) i; _new->wind_from = __FUNCTION__
; _new->wind_to = "priv->children[i]->fops->opendir"
; _new->unwind_to = "afr_sh_entry_opendir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _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; } pthread_spin_unlock (&frame->root->stack_lock
); priv->children[i]->fops->opendir_cbk = afr_sh_entry_opendir_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->opendir); priv->children[i]->fops->opendir
(_new, priv->children[i], &local->loc, fd, ((void*
)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
;
2157
2158 if (!--call_count)
2159 break;
2160 }
2161
2162 return 0;
2163}
2164
2165
2166int
2167afr_sh_entry_sync_prepare (call_frame_t *frame, xlator_t *this)
2168{
2169 afr_local_t *local = NULL((void*)0);
2170 afr_self_heal_t *sh = NULL((void*)0);
2171 afr_private_t *priv = NULL((void*)0);
2172 int source = 0;
2173
2174 local = frame->local;
2175 sh = &local->self_heal;
2176 priv = this->private;
2177
2178 source = sh->source;
2179
2180 afr_sh_mark_source_sinks (frame, this);
2181 if (source != -1)
2182 sh->success[source] = 1;
2183
2184 if (sh->active_sinks == 0) {
2185 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("no active sinks for self-heal on dir %s"
, local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2187, GF_LOG_TRACE, "no active sinks for self-heal on dir %s"
, local->loc.path); } while (0)
2186 "no active sinks for self-heal on dir %s",do { do { if (0) printf ("no active sinks for self-heal on dir %s"
, local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2187, GF_LOG_TRACE, "no active sinks for self-heal on dir %s"
, local->loc.path); } while (0)
2187 local->loc.path)do { do { if (0) printf ("no active sinks for self-heal on dir %s"
, local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2187, GF_LOG_TRACE, "no active sinks for self-heal on dir %s"
, local->loc.path); } while (0)
;
2188 afr_sh_entry_finish (frame, this);
2189 return 0;
2190 }
2191 if (source == -1 && sh->active_sinks < 2) {
2192 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("cannot sync with 0 sources and 1 sink on dir %s"
, local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2194, GF_LOG_TRACE, "cannot sync with 0 sources and 1 sink on dir %s"
, local->loc.path); } while (0)
2193 "cannot sync with 0 sources and 1 sink on dir %s",do { do { if (0) printf ("cannot sync with 0 sources and 1 sink on dir %s"
, local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2194, GF_LOG_TRACE, "cannot sync with 0 sources and 1 sink on dir %s"
, local->loc.path); } while (0)
2194 local->loc.path)do { do { if (0) printf ("cannot sync with 0 sources and 1 sink on dir %s"
, local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2194, GF_LOG_TRACE, "cannot sync with 0 sources and 1 sink on dir %s"
, local->loc.path); } while (0)
;
2195 afr_sh_entry_finish (frame, this);
2196 return 0;
2197 }
2198
2199 if (source != -1)
2200 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("self-healing directory %s from subvolume %s to "
"%d other", local->loc.path, priv->children[source]->
name, sh->active_sinks); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 2204, GF_LOG_DEBUG, "self-healing directory %s from subvolume %s to "
"%d other", local->loc.path, priv->children[source]->
name, sh->active_sinks); } while (0)
2201 "self-healing directory %s from subvolume %s to "do { do { if (0) printf ("self-healing directory %s from subvolume %s to "
"%d other", local->loc.path, priv->children[source]->
name, sh->active_sinks); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 2204, GF_LOG_DEBUG, "self-healing directory %s from subvolume %s to "
"%d other", local->loc.path, priv->children[source]->
name, sh->active_sinks); } while (0)
2202 "%d other",do { do { if (0) printf ("self-healing directory %s from subvolume %s to "
"%d other", local->loc.path, priv->children[source]->
name, sh->active_sinks); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 2204, GF_LOG_DEBUG, "self-healing directory %s from subvolume %s to "
"%d other", local->loc.path, priv->children[source]->
name, sh->active_sinks); } while (0)
2203 local->loc.path, priv->children[source]->name,do { do { if (0) printf ("self-healing directory %s from subvolume %s to "
"%d other", local->loc.path, priv->children[source]->
name, sh->active_sinks); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 2204, GF_LOG_DEBUG, "self-healing directory %s from subvolume %s to "
"%d other", local->loc.path, priv->children[source]->
name, sh->active_sinks); } while (0)
2204 sh->active_sinks)do { do { if (0) printf ("self-healing directory %s from subvolume %s to "
"%d other", local->loc.path, priv->children[source]->
name, sh->active_sinks); } while (0); _gf_log (this->name
, "afr-self-heal-entry.c", __FUNCTION__, 2204, GF_LOG_DEBUG, "self-healing directory %s from subvolume %s to "
"%d other", local->loc.path, priv->children[source]->
name, sh->active_sinks); } while (0)
;
2205 else
2206 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("no active sources for %s found. " "merging all entries as a conservative decision"
, local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2209, GF_LOG_DEBUG, "no active sources for %s found. "
"merging all entries as a conservative decision", local->
loc.path); } while (0)
2207 "no active sources for %s found. "do { do { if (0) printf ("no active sources for %s found. " "merging all entries as a conservative decision"
, local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2209, GF_LOG_DEBUG, "no active sources for %s found. "
"merging all entries as a conservative decision", local->
loc.path); } while (0)
2208 "merging all entries as a conservative decision",do { do { if (0) printf ("no active sources for %s found. " "merging all entries as a conservative decision"
, local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2209, GF_LOG_DEBUG, "no active sources for %s found. "
"merging all entries as a conservative decision", local->
loc.path); } while (0)
2209 local->loc.path)do { do { if (0) printf ("no active sources for %s found. " "merging all entries as a conservative decision"
, local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2209, GF_LOG_DEBUG, "no active sources for %s found. "
"merging all entries as a conservative decision", local->
loc.path); } while (0)
;
2210
2211 sh->actual_sh_started = _gf_true;
2212 afr_sh_entry_open (frame, this);
2213
2214 return 0;
2215}
2216
2217
2218void
2219afr_sh_entry_fix (call_frame_t *frame, xlator_t *this,
2220 int32_t op_ret, int32_t op_errno)
2221{
2222 afr_local_t *local = NULL((void*)0);
2223 afr_self_heal_t *sh = NULL((void*)0);
2224 afr_private_t *priv = NULL((void*)0);
2225 int source = 0;
2226 int nsources = 0;
2227 int32_t subvol_status = 0;
2228
2229 local = frame->local;
2230 sh = &local->self_heal;
2231 priv = this->private;
2232
2233 if (op_ret < 0) {
2234 sh->op_failed = 1;
2235 afr_sh_set_error (sh, op_errno);
2236 afr_sh_entry_finish (frame, this);
2237 goto out;
2238 }
2239
2240 if (sh->forced_merge) {
2241 sh->source = -1;
2242 goto heal;
2243 }
2244
2245 nsources = afr_build_sources (this, sh->xattr, sh->buf,
2246 sh->pending_matrix, sh->sources,
2247 sh->success_children,
2248 AFR_ENTRY_TRANSACTION, &subvol_status,
2249 _gf_true);
2250 if ((subvol_status & ALL_FOOLS) ||
2251 (subvol_status & SPLIT_BRAIN)) {
2252 gf_log (this->name, GF_LOG_INFO, "%s: Performing conservative "do { do { if (0) printf ("%s: Performing conservative " "merge"
, local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2253, GF_LOG_INFO, "%s: Performing conservative "
"merge", local->loc.path); } while (0)
2253 "merge", local->loc.path)do { do { if (0) printf ("%s: Performing conservative " "merge"
, local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2253, GF_LOG_INFO, "%s: Performing conservative "
"merge", local->loc.path); } while (0)
;
2254 source = -1;
2255 memset (sh->sources, 0,
2256 sizeof (*sh->sources) * priv->child_count);
2257 } else if (nsources == 0) {
2258 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("No self-heal needed for %s", local->
loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2260, GF_LOG_TRACE, "No self-heal needed for %s"
, local->loc.path); } while (0)
2259 "No self-heal needed for %s",do { do { if (0) printf ("No self-heal needed for %s", local->
loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2260, GF_LOG_TRACE, "No self-heal needed for %s"
, local->loc.path); } while (0)
2260 local->loc.path)do { do { if (0) printf ("No self-heal needed for %s", local->
loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2260, GF_LOG_TRACE, "No self-heal needed for %s"
, local->loc.path); } while (0)
;
2261
2262 afr_sh_entry_finish (frame, this);
2263 return;
2264 } else {
2265 source = afr_sh_select_source (sh->sources, priv->child_count);
2266 }
2267
2268 sh->source = source;
2269
2270 afr_reset_children (sh->fresh_children, priv->child_count);
2271 afr_get_fresh_children (sh->success_children, sh->sources,
2272 sh->fresh_children, priv->child_count);
2273 if (sh->source >= 0)
2274 afr_inode_set_read_ctx (this, sh->inode, sh->source,
2275 sh->fresh_children);
2276
2277heal:
2278 afr_sh_entry_sync_prepare (frame, this);
2279out:
2280 return;
2281}
2282
2283int
2284afr_sh_post_nonblocking_entry_cbk (call_frame_t *frame, xlator_t *this)
2285{
2286 afr_internal_lock_t *int_lock = NULL((void*)0);
2287 afr_local_t *local = NULL((void*)0);
2288 afr_self_heal_t *sh = NULL((void*)0);
2289
2290 local = frame->local;
2291 int_lock = &local->internal_lock;
2292 sh = &local->self_heal;
2293
2294 if (int_lock->lock_op_ret < 0) {
2295 gf_log (this->name, GF_LOG_ERROR, "Non Blocking entrylks "do { do { if (0) printf ("Non Blocking entrylks " "failed for %s."
, local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2296, GF_LOG_ERROR, "Non Blocking entrylks " "failed for %s."
, local->loc.path); } while (0)
2296 "failed for %s.", local->loc.path)do { do { if (0) printf ("Non Blocking entrylks " "failed for %s."
, local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2296, GF_LOG_ERROR, "Non Blocking entrylks " "failed for %s."
, local->loc.path); } while (0)
;
2297 sh->op_failed = 1;
2298 afr_sh_entry_done (frame, this);
2299 } else {
2300
2301 gf_log (this->name, GF_LOG_DEBUG, "Non Blocking entrylks done "do { do { if (0) printf ("Non Blocking entrylks done " "for %s. Proceeding to FOP"
, local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2302, GF_LOG_DEBUG, "Non Blocking entrylks done "
"for %s. Proceeding to FOP", local->loc.path); } while (0
)
2302 "for %s. Proceeding to FOP", local->loc.path)do { do { if (0) printf ("Non Blocking entrylks done " "for %s. Proceeding to FOP"
, local->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2302, GF_LOG_DEBUG, "Non Blocking entrylks done "
"for %s. Proceeding to FOP", local->loc.path); } while (0
)
;
2303 afr_sh_common_lookup (frame, this, &local->loc,
2304 afr_sh_entry_fix, NULL((void*)0),
2305 AFR_LOOKUP_FAIL_CONFLICTS |
2306 AFR_LOOKUP_FAIL_MISSING_GFIDS,
2307 NULL((void*)0));
2308 }
2309
2310 return 0;
2311}
2312
2313int
2314afr_self_heal_entry (call_frame_t *frame, xlator_t *this)
2315{
2316 afr_local_t *local = NULL((void*)0);
2317 afr_private_t *priv = NULL((void*)0);
2318
2319
2320 priv = this->private;
2321 local = frame->local;
2322
2323 if (local->self_heal.do_entry_self_heal && priv->entry_self_heal) {
2324 afr_sh_entrylk (frame, this, &local->loc, NULL((void*)0),
2325 afr_sh_post_nonblocking_entry_cbk);
2326 } else {
2327 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("proceeding to completion on %s", local
->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2329, GF_LOG_TRACE, "proceeding to completion on %s"
, local->loc.path); } while (0)
2328 "proceeding to completion on %s",do { do { if (0) printf ("proceeding to completion on %s", local
->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2329, GF_LOG_TRACE, "proceeding to completion on %s"
, local->loc.path); } while (0)
2329 local->loc.path)do { do { if (0) printf ("proceeding to completion on %s", local
->loc.path); } while (0); _gf_log (this->name, "afr-self-heal-entry.c"
, __FUNCTION__, 2329, GF_LOG_TRACE, "proceeding to completion on %s"
, local->loc.path); } while (0)
;
2330 afr_sh_entry_done (frame, this);
2331 }
2332
2333 return 0;
2334}