Bug Summary

File:xlators/cluster/afr/src/afr-inode-write.c
Location:line 378, column 9
Description:Access to field 'local' results in a dereference of a null pointer (loaded from variable 'frame')

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
12#include <libgen.h>
13#include <unistd.h>
14#include <fnmatch.h>
15#include <sys/time.h>
16#include <stdlib.h>
17#include <signal.h>
18
19#ifndef _CONFIG_H
20#define _CONFIG_H
21#include "config.h"
22#endif
23
24#include "glusterfs.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
38#include "afr.h"
39#include "afr-transaction.h"
40#include "afr-self-heal-common.h"
41
42/* {{{ writev */
43
44void
45afr_writev_copy_outvars (call_frame_t *src_frame, call_frame_t *dst_frame)
46{
47 afr_local_t *src_local = NULL((void*)0);
48 afr_local_t *dst_local = NULL((void*)0);
49
50 src_local = src_frame->local;
51 dst_local = dst_frame->local;
52
53 dst_local->op_ret = src_local->op_ret;
54 dst_local->op_errno = src_local->op_errno;
55 dst_local->cont.writev.prebuf = src_local->cont.writev.prebuf;
56 dst_local->cont.writev.postbuf = src_local->cont.writev.postbuf;
57}
58
59void
60afr_writev_unwind (call_frame_t *frame, xlator_t *this)
61{
62 afr_local_t * local = NULL((void*)0);
63 local = frame->local;
64
65 AFR_STACK_UNWIND (writev, frame,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_writev_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "afr-inode-write.c"
, __FUNCTION__, 69, GF_LOG_CRITICAL, "!frame"); } while (0); break
; } fn = (fop_writev_cbk_t )frame->ret; _parent = frame->
parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, local
->op_ret, local->op_errno, &local->cont.writev.prebuf
, &local->cont.writev.postbuf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
66 local->op_ret, local->op_errno,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_writev_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "afr-inode-write.c"
, __FUNCTION__, 69, GF_LOG_CRITICAL, "!frame"); } while (0); break
; } fn = (fop_writev_cbk_t )frame->ret; _parent = frame->
parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, local
->op_ret, local->op_errno, &local->cont.writev.prebuf
, &local->cont.writev.postbuf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
67 &local->cont.writev.prebuf,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_writev_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "afr-inode-write.c"
, __FUNCTION__, 69, GF_LOG_CRITICAL, "!frame"); } while (0); break
; } fn = (fop_writev_cbk_t )frame->ret; _parent = frame->
parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, local
->op_ret, local->op_errno, &local->cont.writev.prebuf
, &local->cont.writev.postbuf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
68 &local->cont.writev.postbuf,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_writev_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "afr-inode-write.c"
, __FUNCTION__, 69, GF_LOG_CRITICAL, "!frame"); } while (0); break
; } fn = (fop_writev_cbk_t )frame->ret; _parent = frame->
parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, local
->op_ret, local->op_errno, &local->cont.writev.prebuf
, &local->cont.writev.postbuf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
69 NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_writev_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "afr-inode-write.c"
, __FUNCTION__, 69, GF_LOG_CRITICAL, "!frame"); } while (0); break
; } fn = (fop_writev_cbk_t )frame->ret; _parent = frame->
parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, local
->op_ret, local->op_errno, &local->cont.writev.prebuf
, &local->cont.writev.postbuf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
;
70}
71
72call_frame_t*
73afr_transaction_detach_fop_frame (call_frame_t *frame)
74{
75 afr_local_t * local = NULL((void*)0);
76 call_frame_t *fop_frame = NULL((void*)0);
77
78 local = frame->local;
79
80 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
81 {
82 fop_frame = local->transaction.main_frame;
83 local->transaction.main_frame = NULL((void*)0);
84 }
85 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
86
87 return fop_frame;
88}
89
90int
91afr_transaction_writev_unwind (call_frame_t *frame, xlator_t *this)
92{
93 call_frame_t *fop_frame = NULL((void*)0);
94
95 fop_frame = afr_transaction_detach_fop_frame (frame);
96
97 if (fop_frame) {
98 afr_writev_copy_outvars (frame, fop_frame);
99 afr_writev_unwind (fop_frame, this);
100 }
101 return 0;
102}
103
104static void
105afr_writev_handle_short_writes (call_frame_t *frame, xlator_t *this)
106{
107 afr_local_t *local = NULL((void*)0);
108 afr_private_t *priv = NULL((void*)0);
109 int i = 0;
110
111 local = frame->local;
112 priv = this->private;
113 /*
114 * We already have the best case result of the writev calls staged
115 * as the return value. Any writev that returns some value less
116 * than the best case is now out of sync, so mark the fop as
117 * failed. Note that fops that have returned with errors have
118 * already been marked as failed.
119 */
120 for (i = 0; i < priv->child_count; i++) {
121 if ((!local->replies[i].valid) ||
122 (local->replies[i].op_ret == -1))
123 continue;
124
125 if (local->replies[i].op_ret < local->op_ret)
126 afr_transaction_fop_failed(frame, this, i);
127 }
128}
129
130int
131afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
132 int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
133 struct iatt *postbuf, dict_t *xdata)
134{
135 afr_local_t * local = NULL((void*)0);
136 call_frame_t *fop_frame = NULL((void*)0);
137 int child_index = (long) cookie;
138 int call_count = -1;
139 int read_child = 0;
140
141 local = frame->local;
142
143 read_child = afr_inode_get_read_ctx (this, local->fd->inode, NULL((void*)0));
144
145 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
146 {
147 if (child_index == read_child) {
148 local->read_child_returned = _gf_true;
149 }
150
151 local->replies[child_index].valid = 1;
152 local->replies[child_index].op_ret = op_ret;
153 local->replies[child_index].op_errno = op_errno;
154
155 if (afr_fop_failed (op_ret, op_errno)((op_ret) == -1))
156 afr_transaction_fop_failed (frame, this, child_index);
157
158 /* stage the best case return value for unwind */
159 if ((local->success_count == 0) || (op_ret > local->op_ret)) {
160 local->op_ret = op_ret;
161 local->op_errno = op_errno;
162 }
163
164 if (op_ret != -1) {
165 if ((local->success_count == 0) ||
166 (child_index == read_child)) {
167 local->cont.writev.prebuf = *prebuf;
168 local->cont.writev.postbuf = *postbuf;
169 }
170 local->success_count++;
171 }
172 }
173 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
174
175 call_count = afr_frame_return (frame);
176
177 if (call_count == 0) {
178
179 if (!local->stable_write)
180 afr_fd_report_unstable_write (this, local->fd);
181
182 afr_writev_handle_short_writes (frame, this);
183 /*
184 * Generally inode-write fops do transaction.unwind then
185 * transaction.resume, but writev needs to make sure that
186 * delayed post-op frame is placed in fdctx before unwind
187 * happens. This prevents the race of flush doing the
188 * changelog wakeup first in fuse thread and then this
189 * writev placing its delayed post-op frame in fdctx.
190 * This helps flush make sure all the delayed post-ops are
191 * completed.
192 */
193
194 fop_frame = afr_transaction_detach_fop_frame (frame);
195 afr_writev_copy_outvars (frame, fop_frame);
196 local->transaction.resume (frame, this);
197 afr_writev_unwind (fop_frame, this);
198 }
199 return 0;
200}
201
202int
203afr_writev_wind (call_frame_t *frame, xlator_t *this)
204{
205 afr_local_t *local = NULL((void*)0);
206 afr_private_t *priv = NULL((void*)0);
207 int i = 0;
208 int call_count = -1;
209
210 local = frame->local;
211 priv = this->private;
212
213 call_count = afr_pre_op_done_children_count (local->transaction.pre_op,
214 priv->child_count);
215
216 if (call_count == 0) {
217 local->transaction.resume (frame, this);
218 return 0;
219 }
220
221 local->call_count = call_count;
222 local->replies = GF_CALLOC(priv->child_count, sizeof(*local->replies),__gf_calloc (priv->child_count, sizeof(*local->replies)
, gf_afr_mt_reply_t)
223 gf_afr_mt_reply_t)__gf_calloc (priv->child_count, sizeof(*local->replies)
, gf_afr_mt_reply_t)
;
224 if (!local->replies) {
225 local->op_ret = -1;
226 local->op_errno = ENOMEM12;
227 local->transaction.unwind(frame, this);
228 local->transaction.resume(frame, this);
229 return 0;
230 }
231
232 for (i = 0; i < priv->child_count; i++) {
233 if (local->transaction.pre_op[i]) {
234 STACK_WIND_COOKIE (frame, afr_writev_wind_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-inode-write.c", __FUNCTION__, 244
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->writev_cbk) tmp_cbk = afr_writev_wind_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->writev"
; _new->unwind_to = "afr_writev_wind_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->writev_cbk = afr_writev_wind_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->writev); priv->children[i]->fops->writev
(_new, priv->children[i], local->fd, local->cont.writev
.vector, local->cont.writev.count, local->cont.writev.offset
, local->cont.writev.flags, local->cont.writev.iobref, (
(void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
235 (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-inode-write.c", __FUNCTION__, 244
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->writev_cbk) tmp_cbk = afr_writev_wind_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->writev"
; _new->unwind_to = "afr_writev_wind_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->writev_cbk = afr_writev_wind_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->writev); priv->children[i]->fops->writev
(_new, priv->children[i], local->fd, local->cont.writev
.vector, local->cont.writev.count, local->cont.writev.offset
, local->cont.writev.flags, local->cont.writev.iobref, (
(void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
236 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-inode-write.c", __FUNCTION__, 244
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->writev_cbk) tmp_cbk = afr_writev_wind_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->writev"
; _new->unwind_to = "afr_writev_wind_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->writev_cbk = afr_writev_wind_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->writev); priv->children[i]->fops->writev
(_new, priv->children[i], local->fd, local->cont.writev
.vector, local->cont.writev.count, local->cont.writev.offset
, local->cont.writev.flags, local->cont.writev.iobref, (
(void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
237 priv->children[i]->fops->writev,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "afr-inode-write.c", __FUNCTION__, 244
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->writev_cbk) tmp_cbk = afr_writev_wind_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->writev"
; _new->unwind_to = "afr_writev_wind_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->writev_cbk = afr_writev_wind_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->writev); priv->children[i]->fops->writev
(_new, priv->children[i], local->fd, local->cont.writev
.vector, local->cont.writev.count, local->cont.writev.offset
, local->cont.writev.flags, local->cont.writev.iobref, (
(void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
238 local->fd,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-inode-write.c", __FUNCTION__, 244
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->writev_cbk) tmp_cbk = afr_writev_wind_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->writev"
; _new->unwind_to = "afr_writev_wind_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->writev_cbk = afr_writev_wind_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->writev); priv->children[i]->fops->writev
(_new, priv->children[i], local->fd, local->cont.writev
.vector, local->cont.writev.count, local->cont.writev.offset
, local->cont.writev.flags, local->cont.writev.iobref, (
(void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
239 local->cont.writev.vector,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-inode-write.c", __FUNCTION__, 244
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->writev_cbk) tmp_cbk = afr_writev_wind_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->writev"
; _new->unwind_to = "afr_writev_wind_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->writev_cbk = afr_writev_wind_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->writev); priv->children[i]->fops->writev
(_new, priv->children[i], local->fd, local->cont.writev
.vector, local->cont.writev.count, local->cont.writev.offset
, local->cont.writev.flags, local->cont.writev.iobref, (
(void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
240 local->cont.writev.count,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "afr-inode-write.c", __FUNCTION__, 244
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->writev_cbk) tmp_cbk = afr_writev_wind_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->writev"
; _new->unwind_to = "afr_writev_wind_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->writev_cbk = afr_writev_wind_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->writev); priv->children[i]->fops->writev
(_new, priv->children[i], local->fd, local->cont.writev
.vector, local->cont.writev.count, local->cont.writev.offset
, local->cont.writev.flags, local->cont.writev.iobref, (
(void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
241 local->cont.writev.offset,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-inode-write.c", __FUNCTION__, 244
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->writev_cbk) tmp_cbk = afr_writev_wind_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->writev"
; _new->unwind_to = "afr_writev_wind_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->writev_cbk = afr_writev_wind_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->writev); priv->children[i]->fops->writev
(_new, priv->children[i], local->fd, local->cont.writev
.vector, local->cont.writev.count, local->cont.writev.offset
, local->cont.writev.flags, local->cont.writev.iobref, (
(void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
242 local->cont.writev.flags,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "afr-inode-write.c", __FUNCTION__, 244
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->writev_cbk) tmp_cbk = afr_writev_wind_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->writev"
; _new->unwind_to = "afr_writev_wind_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->writev_cbk = afr_writev_wind_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->writev); priv->children[i]->fops->writev
(_new, priv->children[i], local->fd, local->cont.writev
.vector, local->cont.writev.count, local->cont.writev.offset
, local->cont.writev.flags, local->cont.writev.iobref, (
(void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
243 local->cont.writev.iobref,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-inode-write.c", __FUNCTION__, 244
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->writev_cbk) tmp_cbk = afr_writev_wind_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->writev"
; _new->unwind_to = "afr_writev_wind_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->writev_cbk = afr_writev_wind_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->writev); priv->children[i]->fops->writev
(_new, priv->children[i], local->fd, local->cont.writev
.vector, local->cont.writev.count, local->cont.writev.offset
, local->cont.writev.flags, local->cont.writev.iobref, (
(void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
244 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-inode-write.c", __FUNCTION__, 244
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->writev_cbk) tmp_cbk = afr_writev_wind_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->writev"
; _new->unwind_to = "afr_writev_wind_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->writev_cbk = afr_writev_wind_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->writev); priv->children[i]->fops->writev
(_new, priv->children[i], local->fd, local->cont.writev
.vector, local->cont.writev.count, local->cont.writev.offset
, local->cont.writev.flags, local->cont.writev.iobref, (
(void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
;
245
246 if (!--call_count)
247 break;
248 }
249 }
250
251 return 0;
252}
253
254
255int
256afr_writev_done (call_frame_t *frame, xlator_t *this)
257{
258 afr_local_t *local = NULL((void*)0);
259
260 local = frame->local;
261
262 iobref_unref (local->cont.writev.iobref);
263 local->cont.writev.iobref = NULL((void*)0);
264
265 local->transaction.unwind (frame, this);
266
267 AFR_STACK_DESTROY (frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = frame->local; __this = frame->this;
frame->local = ((void*)0); STACK_DESTROY (frame->root)
; if (__local) { afr_local_cleanup (__local, __this); mem_put
(__local); } } while (0);
;
268
269 return 0;
270}
271
272
273int
274afr_do_writev (call_frame_t *frame, xlator_t *this)
275{
276 call_frame_t *transaction_frame = NULL((void*)0);
277 afr_local_t *local = NULL((void*)0);
278 int op_ret = -1;
279 int op_errno = 0;
280
281 local = frame->local;
282
283 transaction_frame = copy_frame (frame);
284 if (!transaction_frame) {
285 op_errno = ENOMEM12;
286 goto out;
287 }
288
289 transaction_frame->local = local;
290 AFR_LOCAL_ALLOC_OR_GOTO (frame->local, out)do { frame->local = mem_get0 ((*__glusterfs_this_location(
))->local_pool); if (!frame->local) { do { do { if (0) printf
("out of memory :("); } while (0); _gf_log (this->name, "afr-inode-write.c"
, __FUNCTION__, 290, GF_LOG_ERROR, "out of memory :("); } while
(0); op_errno = 12; goto out; } } while (0);
;
291
292 local->op = GF_FOP_WRITE;
293
294 local->success_count = 0;
295
296 local->transaction.fop = afr_writev_wind;
297 local->transaction.done = afr_writev_done;
298 local->transaction.unwind = afr_transaction_writev_unwind;
299
300 local->transaction.main_frame = frame;
301 if (local->fd->flags & O_APPEND02000) {
302 /*
303 * Backend vfs ignores the 'offset' for append mode fd so
304 * locking just the region provided for the writev does not
305 * give consistency gurantee. The actual write may happen at a
306 * completely different range than the one provided by the
307 * offset, len in the fop. So lock the entire file.
308 */
309 local->transaction.start = 0;
310 local->transaction.len = 0;
311 } else {
312 local->transaction.start = local->cont.writev.offset;
313 local->transaction.len = iov_length (local->cont.writev.vector,
314 local->cont.writev.count);
315 }
316
317 op_ret = afr_transaction (transaction_frame, this, AFR_DATA_TRANSACTION);
318 if (op_ret < 0) {
319 op_errno = -op_ret;
320 goto out;
321 }
322
323 op_ret = 0;
324out:
325 if (op_ret < 0) {
326 if (transaction_frame)
327 AFR_STACK_DESTROY (transaction_frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = transaction_frame->local; __this = transaction_frame
->this; transaction_frame->local = ((void*)0); STACK_DESTROY
(transaction_frame->root); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0);
;
328 AFR_STACK_UNWIND (writev, frame, op_ret, op_errno, NULL, NULL, NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_writev_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "afr-inode-write.c"
, __FUNCTION__, 328, GF_LOG_CRITICAL, "!frame"); } while (0);
break; } fn = (fop_writev_cbk_t )frame->ret; _parent = frame
->parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, op_ret
, op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
;
329 }
330
331 return 0;
332}
333
334static void
335afr_trigger_open_fd_self_heal (fd_t *fd, xlator_t *this)
336{
337 call_frame_t *frame = NULL((void*)0);
14
'frame' initialized to a null pointer value
338 afr_local_t *local = NULL((void*)0);
339 afr_self_heal_t *sh = NULL((void*)0);
340 char *reason = NULL((void*)0);
341 int32_t op_errno = 0;
342 int ret = 0;
343
344 if (!fd || !fd->inode || uuid_is_null (fd->inode->gfid)) {
345 gf_log_callingfn (this->name, GF_LOG_ERROR, "Invalid args: "do { do { if (0) printf ("Invalid args: " "fd: %p, inode: %p"
, fd, fd ? fd->inode : ((void*)0)); } while (0); _gf_log_callingfn
(this->name, "afr-inode-write.c", __FUNCTION__, 347, GF_LOG_ERROR
, "Invalid args: " "fd: %p, inode: %p", fd, fd ? fd->inode
: ((void*)0)); } while (0)
346 "fd: %p, inode: %p", fd,do { do { if (0) printf ("Invalid args: " "fd: %p, inode: %p"
, fd, fd ? fd->inode : ((void*)0)); } while (0); _gf_log_callingfn
(this->name, "afr-inode-write.c", __FUNCTION__, 347, GF_LOG_ERROR
, "Invalid args: " "fd: %p, inode: %p", fd, fd ? fd->inode
: ((void*)0)); } while (0)
347 fd ? fd->inode : NULL)do { do { if (0) printf ("Invalid args: " "fd: %p, inode: %p"
, fd, fd ? fd->inode : ((void*)0)); } while (0); _gf_log_callingfn
(this->name, "afr-inode-write.c", __FUNCTION__, 347, GF_LOG_ERROR
, "Invalid args: " "fd: %p, inode: %p", fd, fd ? fd->inode
: ((void*)0)); } while (0)
;
348 goto out;
15
Control jumps to line 378
349 }
350
351 frame = create_frame (this, this->ctx->pool);
352 if (!frame)
353 goto out;
354
355 AFR_LOCAL_ALLOC_OR_GOTO (frame->local, out)do { frame->local = mem_get0 ((*__glusterfs_this_location(
))->local_pool); if (!frame->local) { do { do { if (0) printf
("out of memory :("); } while (0); _gf_log (this->name, "afr-inode-write.c"
, __FUNCTION__, 355, GF_LOG_ERROR, "out of memory :("); } while
(0); op_errno = 12; goto out; } } while (0);
;
356 local = frame->local;
357 ret = afr_local_init (local, this->private, &op_errno);
358 if (ret < 0)
359 goto out;
360
361 local->loc.inode = inode_ref (fd->inode);
362 ret = loc_path (&local->loc, NULL((void*)0));
363 if (ret < 0)
364 goto out;
365
366 sh = &local->self_heal;
367 sh->do_metadata_self_heal = _gf_true;
368 if (fd->inode->ia_type == IA_IFREG)
369 sh->do_data_self_heal = _gf_true;
370 else if (fd->inode->ia_type == IA_IFDIR)
371 sh->do_entry_self_heal = _gf_true;
372
373 reason = "subvolume came online";
374 afr_launch_self_heal (frame, this, fd->inode, _gf_true,
375 fd->inode->ia_type, reason, NULL((void*)0), NULL((void*)0));
376 return;
377out:
378 AFR_STACK_DESTROY (frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = frame->local; __this = frame->this;
frame->local = ((void*)0); STACK_DESTROY (frame->root)
; if (__local) { afr_local_cleanup (__local, __this); mem_put
(__local); } } while (0);
;
16
Within the expansion of the macro 'AFR_STACK_DESTROY':
a
Access to field 'local' results in a dereference of a null pointer (loaded from variable 'frame')
379}
380
381void
382afr_open_fd_fix (fd_t *fd, xlator_t *this)
383{
384 int ret = 0;
385 int i = 0;
386 afr_fd_ctx_t *fd_ctx = NULL((void*)0);
387 gf_boolean_t need_self_heal = _gf_false;
388 int *need_open = NULL((void*)0);
389 size_t need_open_count = 0;
390 afr_private_t *priv = NULL((void*)0);
391
392 priv = this->private;
393
394 if (!afr_is_fd_fixable (fd))
6
Taking false branch
395 goto out;
396
397 fd_ctx = afr_fd_ctx_get (fd, this);
398 if (!fd_ctx)
7
Assuming 'fd_ctx' is non-null
8
Taking false branch
399 goto out;
400
401 LOCK (&fd->lock)pthread_spin_lock (&fd->lock);
402 {
403 if (fd_ctx->up_count < priv->up_count) {
9
Taking true branch
404 need_self_heal = _gf_true;
405 fd_ctx->up_count = priv->up_count;
406 fd_ctx->down_count = priv->down_count;
407 }
408
409 need_open = alloca (priv->child_count * sizeof (*need_open))__builtin_alloca (priv->child_count * sizeof (*need_open));
410 for (i = 0; i < priv->child_count; i++) {
10
Loop condition is false. Execution continues on line 424
411 need_open[i] = 0;
412 if (fd_ctx->opened_on[i] != AFR_FD_NOT_OPENED)
413 continue;
414
415 if (!priv->child_up[i])
416 continue;
417
418 fd_ctx->opened_on[i] = AFR_FD_OPENING;
419
420 need_open[i] = 1;
421 need_open_count++;
422 }
423 }
424 UNLOCK (&fd->lock)pthread_spin_unlock (&fd->lock);
425 if (ret)
11
Taking false branch
426 goto out;
427
428 if (need_self_heal)
12
Taking true branch
429 afr_trigger_open_fd_self_heal (fd, this);
13
Calling 'afr_trigger_open_fd_self_heal'
430
431 if (!need_open_count)
432 goto out;
433
434 afr_fix_open (this, fd, need_open_count, need_open);
435out:
436 return;
437}
438
439int
440afr_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
441 struct iovec *vector, int32_t count, off_t offset,
442 uint32_t flags, struct iobref *iobref, dict_t *xdata)
443{
444 afr_private_t * priv = NULL((void*)0);
445 afr_local_t * local = NULL((void*)0);
446 int ret = -1;
447 int op_errno = 0;
448
449 VALIDATE_OR_GOTO (frame, out)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "afr-inode-write.c"
, __FUNCTION__, 449, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto out; } } while (0)
;
450 VALIDATE_OR_GOTO (this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "afr-inode-write.c"
, __FUNCTION__, 450, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto out; } } while (0)
;
451 VALIDATE_OR_GOTO (this->private, out)do { if (!this->private) { (*__errno_location ()) = 22; do
{ do { if (0) printf ("invalid argument: " "this->private"
); } while (0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "afr-inode-write.c", __FUNCTION__, 451, GF_LOG_WARNING, "invalid argument: "
"this->private"); } while (0); goto out; } } while (0)
;
452
453 priv = this->private;
454
455 if (afr_is_split_brain (this, fd->inode)) {
456 op_errno = EIO5;
457 goto out;
458 }
459
460 QUORUM_CHECK(writev,out)do { if (priv->quorum_count && !afr_have_quorum(this
->name,priv)) { do { do { if (0) printf ("failing ""writev"
" due to lack of quorum"); } while (0); _gf_log (this->name
, "afr-inode-write.c", __FUNCTION__, 460, GF_LOG_WARNING, "failing "
"writev"" due to lack of quorum"); } while (0); op_errno = 30
; goto out; } } while (0);
;
461
462 AFR_LOCAL_ALLOC_OR_GOTO (frame->local, out)do { frame->local = mem_get0 ((*__glusterfs_this_location(
))->local_pool); if (!frame->local) { do { do { if (0) printf
("out of memory :("); } while (0); _gf_log (this->name, "afr-inode-write.c"
, __FUNCTION__, 462, GF_LOG_ERROR, "out of memory :("); } while
(0); op_errno = 12; goto out; } } while (0);
;
463 local = frame->local;
464
465 ret = afr_local_init (local, priv, &op_errno);
466 if (ret < 0)
467 goto out;
468
469 local->cont.writev.vector = iov_dup (vector, count);
470 local->cont.writev.count = count;
471 local->cont.writev.offset = offset;
472 local->cont.writev.flags = flags;
473 local->cont.writev.iobref = iobref_ref (iobref);
474
475 local->fd = fd_ref (fd);
476
477 /* detect here, but set it in writev_wind_cbk *after* the unstable
478 write is performed
479 */
480 local->stable_write = !!((fd->flags|flags)&(O_SYNC04010000|O_DSYNC010000));
481
482 afr_open_fd_fix (fd, this);
483
484 afr_do_writev (frame, this);
485
486 ret = 0;
487out:
488 if (ret < 0)
489 AFR_STACK_UNWIND (writev, frame, -1, op_errno, NULL, NULL, NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_writev_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "afr-inode-write.c"
, __FUNCTION__, 489, GF_LOG_CRITICAL, "!frame"); } while (0);
break; } fn = (fop_writev_cbk_t )frame->ret; _parent = frame
->parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
;
490
491 return 0;
492}
493
494
495/* }}} */
496
497/* {{{ truncate */
498
499int
500afr_truncate_unwind (call_frame_t *frame, xlator_t *this)
501{
502 afr_local_t * local = NULL((void*)0);
503 call_frame_t *main_frame = NULL((void*)0);
504
505 local = frame->local;
506
507 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
508 {
509 if (local->transaction.main_frame)
510 main_frame = local->transaction.main_frame;
511 local->transaction.main_frame = NULL((void*)0);
512 }
513 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
514
515 if (main_frame) {
516 AFR_STACK_UNWIND (truncate, main_frame, local->op_ret,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_truncate_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 520, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_truncate_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.truncate.prebuf, &local
->cont.truncate.postbuf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
517 local->op_errno,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_truncate_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 520, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_truncate_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.truncate.prebuf, &local
->cont.truncate.postbuf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
518 &local->cont.truncate.prebuf,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_truncate_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 520, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_truncate_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.truncate.prebuf, &local
->cont.truncate.postbuf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
519 &local->cont.truncate.postbuf,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_truncate_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 520, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_truncate_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.truncate.prebuf, &local
->cont.truncate.postbuf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
520 NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_truncate_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 520, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_truncate_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.truncate.prebuf, &local
->cont.truncate.postbuf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
;
521 }
522
523 return 0;
524}
525
526
527int
528afr_truncate_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
529 int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
530 struct iatt *postbuf, dict_t *xdata)
531{
532 afr_local_t * local = NULL((void*)0);
533 afr_private_t * priv = NULL((void*)0);
534 int child_index = (long) cookie;
535 int read_child = 0;
536 int call_count = -1;
537 int need_unwind = 0;
538
539 local = frame->local;
540 priv = this->private;
541
542 read_child = afr_inode_get_read_ctx (this, local->loc.inode, NULL((void*)0));
543
544 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
545 {
546 if (child_index == read_child) {
547 local->read_child_returned = _gf_true;
548 }
549
550 if (afr_fop_failed (op_ret, op_errno)((op_ret) == -1) && op_errno != EFBIG27)
551 afr_transaction_fop_failed (frame, this, child_index);
552
553 if (op_ret != -1) {
554 if (local->success_count == 0) {
555 local->op_ret = op_ret;
556 local->cont.truncate.prebuf = *prebuf;
557 local->cont.truncate.postbuf = *postbuf;
558 }
559
560 if (child_index == read_child) {
561 local->cont.truncate.prebuf = *prebuf;
562 local->cont.truncate.postbuf = *postbuf;
563 }
564
565 local->success_count++;
566
567 if ((local->success_count >= priv->wait_count)
568 && local->read_child_returned) {
569 need_unwind = 1;
570 }
571 }
572 local->op_errno = op_errno;
573 }
574 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
575
576 if (need_unwind)
577 local->transaction.unwind (frame, this);
578
579 call_count = afr_frame_return (frame);
580
581 if (call_count == 0) {
582 local->transaction.resume (frame, this);
583 }
584
585 return 0;
586}
587
588
589int32_t
590afr_truncate_wind (call_frame_t *frame, xlator_t *this)
591{
592 afr_local_t *local = NULL((void*)0);
593 afr_private_t *priv = NULL((void*)0);
594 int call_count = -1;
595 int i = 0;
596
597 local = frame->local;
598 priv = this->private;
599
600 call_count = afr_pre_op_done_children_count (local->transaction.pre_op,
601 priv->child_count);
602
603 if (call_count == 0) {
604 local->transaction.resume (frame, this);
605 return 0;
606 }
607
608 local->call_count = call_count;
609
610 for (i = 0; i < priv->child_count; i++) {
611 if (local->transaction.pre_op[i]) {
612 STACK_WIND_COOKIE (frame, afr_truncate_wind_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-inode-write.c", __FUNCTION__, 618
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->truncate_cbk) tmp_cbk = afr_truncate_wind_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->truncate"
; _new->unwind_to = "afr_truncate_wind_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->truncate_cbk = afr_truncate_wind_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->truncate); priv->children[i]->fops->truncate
(_new, priv->children[i], &local->loc, local->cont
.truncate.offset, ((void*)0)); (*__glusterfs_this_location())
= old_THIS; } while (0)
613 (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-inode-write.c", __FUNCTION__, 618
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->truncate_cbk) tmp_cbk = afr_truncate_wind_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->truncate"
; _new->unwind_to = "afr_truncate_wind_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->truncate_cbk = afr_truncate_wind_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->truncate); priv->children[i]->fops->truncate
(_new, priv->children[i], &local->loc, local->cont
.truncate.offset, ((void*)0)); (*__glusterfs_this_location())
= old_THIS; } while (0)
614 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-inode-write.c", __FUNCTION__, 618
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->truncate_cbk) tmp_cbk = afr_truncate_wind_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->truncate"
; _new->unwind_to = "afr_truncate_wind_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->truncate_cbk = afr_truncate_wind_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->truncate); priv->children[i]->fops->truncate
(_new, priv->children[i], &local->loc, local->cont
.truncate.offset, ((void*)0)); (*__glusterfs_this_location())
= old_THIS; } while (0)
615 priv->children[i]->fops->truncate,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "afr-inode-write.c", __FUNCTION__, 618
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->truncate_cbk) tmp_cbk = afr_truncate_wind_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->truncate"
; _new->unwind_to = "afr_truncate_wind_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->truncate_cbk = afr_truncate_wind_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->truncate); priv->children[i]->fops->truncate
(_new, priv->children[i], &local->loc, local->cont
.truncate.offset, ((void*)0)); (*__glusterfs_this_location())
= old_THIS; } while (0)
616 &local->loc,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-inode-write.c", __FUNCTION__, 618
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->truncate_cbk) tmp_cbk = afr_truncate_wind_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->truncate"
; _new->unwind_to = "afr_truncate_wind_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->truncate_cbk = afr_truncate_wind_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->truncate); priv->children[i]->fops->truncate
(_new, priv->children[i], &local->loc, local->cont
.truncate.offset, ((void*)0)); (*__glusterfs_this_location())
= old_THIS; } while (0)
617 local->cont.truncate.offset,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-inode-write.c", __FUNCTION__, 618
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->truncate_cbk) tmp_cbk = afr_truncate_wind_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->truncate"
; _new->unwind_to = "afr_truncate_wind_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->truncate_cbk = afr_truncate_wind_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->truncate); priv->children[i]->fops->truncate
(_new, priv->children[i], &local->loc, local->cont
.truncate.offset, ((void*)0)); (*__glusterfs_this_location())
= old_THIS; } while (0)
618 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-inode-write.c", __FUNCTION__, 618
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->truncate_cbk) tmp_cbk = afr_truncate_wind_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->truncate"
; _new->unwind_to = "afr_truncate_wind_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->truncate_cbk = afr_truncate_wind_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->truncate); priv->children[i]->fops->truncate
(_new, priv->children[i], &local->loc, local->cont
.truncate.offset, ((void*)0)); (*__glusterfs_this_location())
= old_THIS; } while (0)
;
619
620 if (!--call_count)
621 break;
622 }
623 }
624
625 return 0;
626}
627
628
629int
630afr_truncate_done (call_frame_t *frame, xlator_t *this)
631{
632 afr_local_t *local = NULL((void*)0);
633
634 local = frame->local;
635
636 local->transaction.unwind (frame, this);
637
638 AFR_STACK_DESTROY (frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = frame->local; __this = frame->this;
frame->local = ((void*)0); STACK_DESTROY (frame->root)
; if (__local) { afr_local_cleanup (__local, __this); mem_put
(__local); } } while (0);
;
639
640 return 0;
641}
642
643
644int
645afr_truncate (call_frame_t *frame, xlator_t *this,
646 loc_t *loc, off_t offset, dict_t *xdata)
647{
648 afr_private_t * priv = NULL((void*)0);
649 afr_local_t * local = NULL((void*)0);
650 call_frame_t *transaction_frame = NULL((void*)0);
651 int ret = -1;
652 int op_errno = 0;
653
654 VALIDATE_OR_GOTO (frame, out)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "afr-inode-write.c"
, __FUNCTION__, 654, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto out; } } while (0)
;
655 VALIDATE_OR_GOTO (this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "afr-inode-write.c"
, __FUNCTION__, 655, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto out; } } while (0)
;
656 VALIDATE_OR_GOTO (this->private, out)do { if (!this->private) { (*__errno_location ()) = 22; do
{ do { if (0) printf ("invalid argument: " "this->private"
); } while (0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "afr-inode-write.c", __FUNCTION__, 656, GF_LOG_WARNING, "invalid argument: "
"this->private"); } while (0); goto out; } } while (0)
;
657
658 priv = this->private;
659
660 QUORUM_CHECK(truncate,out)do { if (priv->quorum_count && !afr_have_quorum(this
->name,priv)) { do { do { if (0) printf ("failing ""truncate"
" due to lack of quorum"); } while (0); _gf_log (this->name
, "afr-inode-write.c", __FUNCTION__, 660, GF_LOG_WARNING, "failing "
"truncate"" due to lack of quorum"); } while (0); op_errno = 30
; goto out; } } while (0);
;
661
662 transaction_frame = copy_frame (frame);
663 if (!transaction_frame) {
664 op_errno = ENOMEM12;
665 goto out;
666 }
667
668 AFR_LOCAL_ALLOC_OR_GOTO (transaction_frame->local, out)do { transaction_frame->local = mem_get0 ((*__glusterfs_this_location
())->local_pool); if (!transaction_frame->local) { do {
do { if (0) printf ("out of memory :("); } while (0); _gf_log
(this->name, "afr-inode-write.c", __FUNCTION__, 668, GF_LOG_ERROR
, "out of memory :("); } while (0); op_errno = 12; goto out; }
} while (0);
;
669 local = transaction_frame->local;
670
671 ret = afr_local_init (local, priv, &op_errno);
672 if (ret < 0)
673 goto out;
674
675 local->cont.truncate.offset = offset;
676
677 local->transaction.fop = afr_truncate_wind;
678 local->transaction.done = afr_truncate_done;
679 local->transaction.unwind = afr_truncate_unwind;
680
681 loc_copy (&local->loc, loc);
682
683 local->transaction.main_frame = frame;
684 local->transaction.start = offset;
685 local->transaction.len = 0;
686
687 ret = afr_transaction (transaction_frame, this, AFR_DATA_TRANSACTION);
688 if (ret < 0) {
689 op_errno = -ret;
690 goto out;
691 }
692
693 ret = 0;
694out:
695 if (ret < 0) {
696 if (transaction_frame)
697 AFR_STACK_DESTROY (transaction_frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = transaction_frame->local; __this = transaction_frame
->this; transaction_frame->local = ((void*)0); STACK_DESTROY
(transaction_frame->root); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0);
;
698 AFR_STACK_UNWIND (truncate, frame, -1, op_errno, NULL, NULL, NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_truncate_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "afr-inode-write.c"
, __FUNCTION__, 698, GF_LOG_CRITICAL, "!frame"); } while (0);
break; } fn = (fop_truncate_cbk_t )frame->ret; _parent = frame
->parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
;
699 }
700
701 return 0;
702}
703
704
705/* }}} */
706
707/* {{{ ftruncate */
708
709
710int
711afr_ftruncate_unwind (call_frame_t *frame, xlator_t *this)
712{
713 afr_local_t * local = NULL((void*)0);
714 call_frame_t *main_frame = NULL((void*)0);
715
716 local = frame->local;
717
718 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
719 {
720 if (local->transaction.main_frame)
721 main_frame = local->transaction.main_frame;
722 local->transaction.main_frame = NULL((void*)0);
723 }
724 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
725
726 if (main_frame) {
727 AFR_STACK_UNWIND (ftruncate, main_frame, local->op_ret,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_ftruncate_cbk_t fn = ((void*)0); call_frame_t *_parent
= ((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 731, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_ftruncate_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.ftruncate.prebuf, &local
->cont.ftruncate.postbuf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
728 local->op_errno,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_ftruncate_cbk_t fn = ((void*)0); call_frame_t *_parent
= ((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 731, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_ftruncate_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.ftruncate.prebuf, &local
->cont.ftruncate.postbuf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
729 &local->cont.ftruncate.prebuf,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_ftruncate_cbk_t fn = ((void*)0); call_frame_t *_parent
= ((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 731, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_ftruncate_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.ftruncate.prebuf, &local
->cont.ftruncate.postbuf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
730 &local->cont.ftruncate.postbuf,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_ftruncate_cbk_t fn = ((void*)0); call_frame_t *_parent
= ((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 731, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_ftruncate_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.ftruncate.prebuf, &local
->cont.ftruncate.postbuf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
731 NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_ftruncate_cbk_t fn = ((void*)0); call_frame_t *_parent
= ((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 731, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_ftruncate_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.ftruncate.prebuf, &local
->cont.ftruncate.postbuf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
;
732 }
733 return 0;
734}
735
736
737int
738afr_ftruncate_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
739 int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
740 struct iatt *postbuf, dict_t *xdata)
741{
742 afr_local_t * local = NULL((void*)0);
743 afr_private_t * priv = NULL((void*)0);
744 int child_index = (long) cookie;
745 int call_count = -1;
746 int need_unwind = 0;
747 int read_child = 0;
748
749 local = frame->local;
750 priv = this->private;
751
752 read_child = afr_inode_get_read_ctx (this, local->fd->inode, NULL((void*)0));
753
754 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
755 {
756 if (child_index == read_child) {
757 local->read_child_returned = _gf_true;
758 }
759
760 if (afr_fop_failed (op_ret, op_errno)((op_ret) == -1))
761 afr_transaction_fop_failed (frame, this, child_index);
762
763 if (op_ret != -1) {
764 if (local->success_count == 0) {
765 local->op_ret = op_ret;
766 local->cont.ftruncate.prebuf = *prebuf;
767 local->cont.ftruncate.postbuf = *postbuf;
768 }
769
770 if (child_index == read_child) {
771 local->cont.ftruncate.prebuf = *prebuf;
772 local->cont.ftruncate.postbuf = *postbuf;
773 }
774
775 local->success_count++;
776
777 if ((local->success_count >= priv->wait_count)
778 && local->read_child_returned) {
779 need_unwind = 1;
780 }
781 }
782 local->op_errno = op_errno;
783 }
784 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
785
786 if (need_unwind)
787 local->transaction.unwind (frame, this);
788
789 call_count = afr_frame_return (frame);
790
791 if (call_count == 0) {
792 local->transaction.resume (frame, this);
793 }
794
795 return 0;
796}
797
798
799int
800afr_ftruncate_wind (call_frame_t *frame, xlator_t *this)
801{
802 afr_local_t *local = NULL((void*)0);
803 afr_private_t *priv = NULL((void*)0);
804 int call_count = -1;
805 int i = 0;
806
807 local = frame->local;
808 priv = this->private;
809
810 call_count = afr_pre_op_done_children_count (local->transaction.pre_op,
811 priv->child_count);
812
813 if (call_count == 0) {
814 local->transaction.resume (frame, this);
815 return 0;
816 }
817
818 local->call_count = call_count;
819
820 for (i = 0; i < priv->child_count; i++) {
821 if (local->transaction.pre_op[i]) {
822 STACK_WIND_COOKIE (frame, afr_ftruncate_wind_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-inode-write.c", __FUNCTION__, 828
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->ftruncate_cbk) tmp_cbk = afr_ftruncate_wind_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->ftruncate"
; _new->unwind_to = "afr_ftruncate_wind_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->ftruncate_cbk = afr_ftruncate_wind_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->ftruncate); priv->children[i]->fops->ftruncate
(_new, priv->children[i], local->fd, local->cont.ftruncate
.offset, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
823 (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-inode-write.c", __FUNCTION__, 828
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->ftruncate_cbk) tmp_cbk = afr_ftruncate_wind_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->ftruncate"
; _new->unwind_to = "afr_ftruncate_wind_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->ftruncate_cbk = afr_ftruncate_wind_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->ftruncate); priv->children[i]->fops->ftruncate
(_new, priv->children[i], local->fd, local->cont.ftruncate
.offset, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
824 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-inode-write.c", __FUNCTION__, 828
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->ftruncate_cbk) tmp_cbk = afr_ftruncate_wind_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->ftruncate"
; _new->unwind_to = "afr_ftruncate_wind_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->ftruncate_cbk = afr_ftruncate_wind_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->ftruncate); priv->children[i]->fops->ftruncate
(_new, priv->children[i], local->fd, local->cont.ftruncate
.offset, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
825 priv->children[i]->fops->ftruncate,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "afr-inode-write.c", __FUNCTION__, 828
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->ftruncate_cbk) tmp_cbk = afr_ftruncate_wind_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->ftruncate"
; _new->unwind_to = "afr_ftruncate_wind_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->ftruncate_cbk = afr_ftruncate_wind_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->ftruncate); priv->children[i]->fops->ftruncate
(_new, priv->children[i], local->fd, local->cont.ftruncate
.offset, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
826 local->fd,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-inode-write.c", __FUNCTION__, 828
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->ftruncate_cbk) tmp_cbk = afr_ftruncate_wind_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->ftruncate"
; _new->unwind_to = "afr_ftruncate_wind_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->ftruncate_cbk = afr_ftruncate_wind_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->ftruncate); priv->children[i]->fops->ftruncate
(_new, priv->children[i], local->fd, local->cont.ftruncate
.offset, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
827 local->cont.ftruncate.offset,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-inode-write.c", __FUNCTION__, 828
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->ftruncate_cbk) tmp_cbk = afr_ftruncate_wind_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->ftruncate"
; _new->unwind_to = "afr_ftruncate_wind_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->ftruncate_cbk = afr_ftruncate_wind_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->ftruncate); priv->children[i]->fops->ftruncate
(_new, priv->children[i], local->fd, local->cont.ftruncate
.offset, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
828 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-inode-write.c", __FUNCTION__, 828
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->ftruncate_cbk) tmp_cbk = afr_ftruncate_wind_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->ftruncate"
; _new->unwind_to = "afr_ftruncate_wind_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->ftruncate_cbk = afr_ftruncate_wind_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->ftruncate); priv->children[i]->fops->ftruncate
(_new, priv->children[i], local->fd, local->cont.ftruncate
.offset, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
829
830 if (!--call_count)
831 break;
832 }
833 }
834
835 return 0;
836}
837
838
839int
840afr_ftruncate_done (call_frame_t *frame, xlator_t *this)
841{
842 afr_local_t *local = NULL((void*)0);
843
844 local = frame->local;
845
846 local->transaction.unwind (frame, this);
847
848 AFR_STACK_DESTROY (frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = frame->local; __this = frame->this;
frame->local = ((void*)0); STACK_DESTROY (frame->root)
; if (__local) { afr_local_cleanup (__local, __this); mem_put
(__local); } } while (0);
;
849
850 return 0;
851}
852
853
854int
855afr_do_ftruncate (call_frame_t *frame, xlator_t *this)
856{
857 call_frame_t * transaction_frame = NULL((void*)0);
858 afr_local_t * local = NULL((void*)0);
859 int op_ret = -1;
860 int op_errno = 0;
861
862 local = frame->local;
863
864 transaction_frame = copy_frame (frame);
865 if (!transaction_frame) {
866 goto out;
867 }
868
869 transaction_frame->local = local;
870 frame->local = NULL((void*)0);
871
872 local->op = GF_FOP_FTRUNCATE;
873
874 local->transaction.fop = afr_ftruncate_wind;
875 local->transaction.done = afr_ftruncate_done;
876 local->transaction.unwind = afr_ftruncate_unwind;
877
878 local->transaction.main_frame = frame;
879
880 local->transaction.start = local->cont.ftruncate.offset;
881 local->transaction.len = 0;
882
883 op_ret = afr_transaction (transaction_frame, this, AFR_DATA_TRANSACTION);
884 if (op_ret < 0) {
885 op_errno = -op_ret;
886 goto out;
887 }
888
889 op_ret = 0;
890out:
891 if (op_ret < 0) {
892 if (transaction_frame)
893 AFR_STACK_DESTROY (transaction_frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = transaction_frame->local; __this = transaction_frame
->this; transaction_frame->local = ((void*)0); STACK_DESTROY
(transaction_frame->root); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0);
;
894 AFR_STACK_UNWIND (ftruncate, frame, op_ret, op_errno, NULL,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_ftruncate_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "afr-inode-write.c"
, __FUNCTION__, 895, GF_LOG_CRITICAL, "!frame"); } while (0);
break; } fn = (fop_ftruncate_cbk_t )frame->ret; _parent =
frame->parent; pthread_spin_lock (&frame->root->
stack_lock); { _parent->ref_count--; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, op_ret
, op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
895 NULL, NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_ftruncate_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "afr-inode-write.c"
, __FUNCTION__, 895, GF_LOG_CRITICAL, "!frame"); } while (0);
break; } fn = (fop_ftruncate_cbk_t )frame->ret; _parent =
frame->parent; pthread_spin_lock (&frame->root->
stack_lock); { _parent->ref_count--; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, op_ret
, op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
;
896 }
897
898 return 0;
899}
900
901
902int
903afr_ftruncate (call_frame_t *frame, xlator_t *this,
904 fd_t *fd, off_t offset, dict_t *xdata)
905{
906 afr_private_t * priv = NULL((void*)0);
907 afr_local_t * local = NULL((void*)0);
908 call_frame_t *transaction_frame = NULL((void*)0);
909 int ret = -1;
910 int op_errno = 0;
911
912 VALIDATE_OR_GOTO (frame, out)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "afr-inode-write.c"
, __FUNCTION__, 912, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto out; } } while (0)
;
913 VALIDATE_OR_GOTO (this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "afr-inode-write.c"
, __FUNCTION__, 913, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto out; } } while (0)
;
914 VALIDATE_OR_GOTO (this->private, out)do { if (!this->private) { (*__errno_location ()) = 22; do
{ do { if (0) printf ("invalid argument: " "this->private"
); } while (0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "afr-inode-write.c", __FUNCTION__, 914, GF_LOG_WARNING, "invalid argument: "
"this->private"); } while (0); goto out; } } while (0)
;
915
916 priv = this->private;
917
918 if (afr_is_split_brain (this, fd->inode)) {
919 op_errno = EIO5;
920 goto out;
921 }
922 QUORUM_CHECK(ftruncate,out)do { if (priv->quorum_count && !afr_have_quorum(this
->name,priv)) { do { do { if (0) printf ("failing ""ftruncate"
" due to lack of quorum"); } while (0); _gf_log (this->name
, "afr-inode-write.c", __FUNCTION__, 922, GF_LOG_WARNING, "failing "
"ftruncate"" due to lack of quorum"); } while (0); op_errno =
30; goto out; } } while (0);
;
923
924 AFR_LOCAL_ALLOC_OR_GOTO (frame->local, out)do { frame->local = mem_get0 ((*__glusterfs_this_location(
))->local_pool); if (!frame->local) { do { do { if (0) printf
("out of memory :("); } while (0); _gf_log (this->name, "afr-inode-write.c"
, __FUNCTION__, 924, GF_LOG_ERROR, "out of memory :("); } while
(0); op_errno = 12; goto out; } } while (0);
;
925 local = frame->local;
926
927 ret = afr_local_init (local, priv, &op_errno);
928 if (ret < 0)
929 goto out;
930
931 local->cont.ftruncate.offset = offset;
932
933 local->fd = fd_ref (fd);
934
935 afr_open_fd_fix (fd, this);
936
937 afr_do_ftruncate (frame, this);
938
939 ret = 0;
940out:
941 if (ret < 0) {
942 if (transaction_frame)
943 AFR_STACK_DESTROY (transaction_frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = transaction_frame->local; __this = transaction_frame
->this; transaction_frame->local = ((void*)0); STACK_DESTROY
(transaction_frame->root); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0);
;
944 AFR_STACK_UNWIND (ftruncate, frame, -1, op_errno, NULL, NULL, NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_ftruncate_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "afr-inode-write.c"
, __FUNCTION__, 944, GF_LOG_CRITICAL, "!frame"); } while (0);
break; } fn = (fop_ftruncate_cbk_t )frame->ret; _parent =
frame->parent; pthread_spin_lock (&frame->root->
stack_lock); { _parent->ref_count--; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
;
945 }
946
947 return 0;
948}
949
950/* }}} */
951
952/* {{{ setattr */
953
954int
955afr_setattr_unwind (call_frame_t *frame, xlator_t *this)
956{
957 afr_local_t * local = NULL((void*)0);
958 call_frame_t *main_frame = NULL((void*)0);
959
960 local = frame->local;
961
962 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
963 {
964 if (local->transaction.main_frame)
965 main_frame = local->transaction.main_frame;
966 local->transaction.main_frame = NULL((void*)0);
967 }
968 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
969
970 if (main_frame) {
971 AFR_STACK_UNWIND (setattr, main_frame, local->op_ret,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_setattr_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 975, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_setattr_cbk_t )main_frame
->ret; _parent = main_frame->parent; pthread_spin_lock (
&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.setattr.preop_buf, &local
->cont.setattr.postop_buf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
972 local->op_errno,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_setattr_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 975, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_setattr_cbk_t )main_frame
->ret; _parent = main_frame->parent; pthread_spin_lock (
&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.setattr.preop_buf, &local
->cont.setattr.postop_buf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
973 &local->cont.setattr.preop_buf,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_setattr_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 975, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_setattr_cbk_t )main_frame
->ret; _parent = main_frame->parent; pthread_spin_lock (
&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.setattr.preop_buf, &local
->cont.setattr.postop_buf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
974 &local->cont.setattr.postop_buf,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_setattr_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 975, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_setattr_cbk_t )main_frame
->ret; _parent = main_frame->parent; pthread_spin_lock (
&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.setattr.preop_buf, &local
->cont.setattr.postop_buf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
975 NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_setattr_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 975, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_setattr_cbk_t )main_frame
->ret; _parent = main_frame->parent; pthread_spin_lock (
&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.setattr.preop_buf, &local
->cont.setattr.postop_buf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
;
976 }
977
978 return 0;
979}
980
981
982int
983afr_setattr_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
984 int32_t op_ret, int32_t op_errno,
985 struct iatt *preop, struct iatt *postop, dict_t *xdata)
986{
987 afr_local_t * local = NULL((void*)0);
988 afr_private_t * priv = NULL((void*)0);
989 int child_index = (long) cookie;
990 int read_child = 0;
991 int call_count = -1;
992 int need_unwind = 0;
993
994 local = frame->local;
995 priv = this->private;
996
997 read_child = afr_inode_get_read_ctx (this, local->loc.inode, NULL((void*)0));
998
999 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
1000 {
1001 if (child_index == read_child) {
1002 local->read_child_returned = _gf_true;
1003 }
1004
1005 if (afr_fop_failed (op_ret, op_errno)((op_ret) == -1))
1006 afr_transaction_fop_failed (frame, this, child_index);
1007
1008 if (op_ret != -1) {
1009 if (local->success_count == 0) {
1010 local->op_ret = op_ret;
1011 local->cont.setattr.preop_buf = *preop;
1012 local->cont.setattr.postop_buf = *postop;
1013 }
1014
1015 if (child_index == read_child) {
1016 local->cont.setattr.preop_buf = *preop;
1017 local->cont.setattr.postop_buf = *postop;
1018 }
1019
1020 local->success_count++;
1021
1022 if ((local->success_count >= priv->wait_count)
1023 && local->read_child_returned) {
1024 need_unwind = 1;
1025 }
1026 }
1027 local->op_errno = op_errno;
1028 }
1029 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
1030
1031 if (need_unwind)
1032 local->transaction.unwind (frame, this);
1033
1034 call_count = afr_frame_return (frame);
1035
1036 if (call_count == 0) {
1037 local->transaction.resume (frame, this);
1038 }
1039
1040 return 0;
1041}
1042
1043
1044int32_t
1045afr_setattr_wind (call_frame_t *frame, xlator_t *this)
1046{
1047 afr_local_t *local = NULL((void*)0);
1048 afr_private_t *priv = NULL((void*)0);
1049 int call_count = -1;
1050 int i = 0;
1051
1052 local = frame->local;
1053 priv = this->private;
1054
1055 call_count = afr_pre_op_done_children_count (local->transaction.pre_op,
1056 priv->child_count);
1057
1058 if (call_count == 0) {
1059 local->transaction.resume (frame, this);
1060 return 0;
1061 }
1062
1063 local->call_count = call_count;
1064
1065 for (i = 0; i < priv->child_count; i++) {
1066 if (local->transaction.pre_op[i]) {
1067 STACK_WIND_COOKIE (frame, afr_setattr_wind_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-inode-write.c", __FUNCTION__, 1074
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_setattr_wind_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->setattr"
; _new->unwind_to = "afr_setattr_wind_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->setattr_cbk = afr_setattr_wind_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], &local->loc, &local->
cont.setattr.in_buf, local->cont.setattr.valid, ((void*)0)
); (*__glusterfs_this_location()) = old_THIS; } while (0)
1068 (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-inode-write.c", __FUNCTION__, 1074
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_setattr_wind_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->setattr"
; _new->unwind_to = "afr_setattr_wind_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->setattr_cbk = afr_setattr_wind_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], &local->loc, &local->
cont.setattr.in_buf, local->cont.setattr.valid, ((void*)0)
); (*__glusterfs_this_location()) = old_THIS; } while (0)
1069 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-inode-write.c", __FUNCTION__, 1074
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_setattr_wind_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->setattr"
; _new->unwind_to = "afr_setattr_wind_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->setattr_cbk = afr_setattr_wind_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], &local->loc, &local->
cont.setattr.in_buf, local->cont.setattr.valid, ((void*)0)
); (*__glusterfs_this_location()) = old_THIS; } while (0)
1070 priv->children[i]->fops->setattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "afr-inode-write.c", __FUNCTION__, 1074
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_setattr_wind_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->setattr"
; _new->unwind_to = "afr_setattr_wind_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->setattr_cbk = afr_setattr_wind_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], &local->loc, &local->
cont.setattr.in_buf, local->cont.setattr.valid, ((void*)0)
); (*__glusterfs_this_location()) = old_THIS; } while (0)
1071 &local->loc,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-inode-write.c", __FUNCTION__, 1074
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_setattr_wind_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->setattr"
; _new->unwind_to = "afr_setattr_wind_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->setattr_cbk = afr_setattr_wind_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], &local->loc, &local->
cont.setattr.in_buf, local->cont.setattr.valid, ((void*)0)
); (*__glusterfs_this_location()) = old_THIS; } while (0)
1072 &local->cont.setattr.in_buf,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-inode-write.c", __FUNCTION__, 1074
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_setattr_wind_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->setattr"
; _new->unwind_to = "afr_setattr_wind_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->setattr_cbk = afr_setattr_wind_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], &local->loc, &local->
cont.setattr.in_buf, local->cont.setattr.valid, ((void*)0)
); (*__glusterfs_this_location()) = old_THIS; } while (0)
1073 local->cont.setattr.valid,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-inode-write.c", __FUNCTION__, 1074
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_setattr_wind_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->setattr"
; _new->unwind_to = "afr_setattr_wind_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->setattr_cbk = afr_setattr_wind_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], &local->loc, &local->
cont.setattr.in_buf, local->cont.setattr.valid, ((void*)0)
); (*__glusterfs_this_location()) = old_THIS; } while (0)
1074 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-inode-write.c", __FUNCTION__, 1074
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setattr_cbk) tmp_cbk = afr_setattr_wind_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->setattr"
; _new->unwind_to = "afr_setattr_wind_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->setattr_cbk = afr_setattr_wind_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], &local->loc, &local->
cont.setattr.in_buf, local->cont.setattr.valid, ((void*)0)
); (*__glusterfs_this_location()) = old_THIS; } while (0)
;
1075
1076 if (!--call_count)
1077 break;
1078 }
1079 }
1080
1081 return 0;
1082}
1083
1084
1085int
1086afr_setattr_done (call_frame_t *frame, xlator_t *this)
1087{
1088 afr_local_t *local = NULL((void*)0);
1089
1090 local = frame->local;
1091
1092 local->transaction.unwind (frame, this);
1093
1094 AFR_STACK_DESTROY (frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = frame->local; __this = frame->this;
frame->local = ((void*)0); STACK_DESTROY (frame->root)
; if (__local) { afr_local_cleanup (__local, __this); mem_put
(__local); } } while (0);
;
1095
1096 return 0;
1097}
1098
1099
1100int
1101afr_setattr (call_frame_t *frame, xlator_t *this,
1102 loc_t *loc, struct iatt *buf, int32_t valid, dict_t *xdata)
1103{
1104 afr_private_t * priv = NULL((void*)0);
1105 afr_local_t * local = NULL((void*)0);
1106 call_frame_t *transaction_frame = NULL((void*)0);
1107 int ret = -1;
1108 int op_errno = 0;
1109
1110 VALIDATE_OR_GOTO (frame, out)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "afr-inode-write.c"
, __FUNCTION__, 1110, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto out; } } while (0)
;
1111 VALIDATE_OR_GOTO (this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "afr-inode-write.c"
, __FUNCTION__, 1111, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto out; } } while (0)
;
1112 VALIDATE_OR_GOTO (this->private, out)do { if (!this->private) { (*__errno_location ()) = 22; do
{ do { if (0) printf ("invalid argument: " "this->private"
); } while (0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "afr-inode-write.c", __FUNCTION__, 1112, GF_LOG_WARNING, "invalid argument: "
"this->private"); } while (0); goto out; } } while (0)
;
1113
1114 priv = this->private;
1115
1116 QUORUM_CHECK(setattr,out)do { if (priv->quorum_count && !afr_have_quorum(this
->name,priv)) { do { do { if (0) printf ("failing ""setattr"
" due to lack of quorum"); } while (0); _gf_log (this->name
, "afr-inode-write.c", __FUNCTION__, 1116, GF_LOG_WARNING, "failing "
"setattr"" due to lack of quorum"); } while (0); op_errno = 30
; goto out; } } while (0);
;
1117
1118 transaction_frame = copy_frame (frame);
1119 if (!transaction_frame) {
1120 op_errno = ENOMEM12;
1121 goto out;
1122 }
1123
1124 AFR_LOCAL_ALLOC_OR_GOTO (transaction_frame->local, out)do { transaction_frame->local = mem_get0 ((*__glusterfs_this_location
())->local_pool); if (!transaction_frame->local) { do {
do { if (0) printf ("out of memory :("); } while (0); _gf_log
(this->name, "afr-inode-write.c", __FUNCTION__, 1124, GF_LOG_ERROR
, "out of memory :("); } while (0); op_errno = 12; goto out; }
} while (0);
;
1125 local = transaction_frame->local;
1126
1127 ret = afr_local_init (local, priv, &op_errno);
1128 if (ret < 0)
1129 goto out;
1130
1131 local->cont.setattr.in_buf = *buf;
1132 local->cont.setattr.valid = valid;
1133
1134 local->transaction.fop = afr_setattr_wind;
1135 local->transaction.done = afr_setattr_done;
1136 local->transaction.unwind = afr_setattr_unwind;
1137
1138 loc_copy (&local->loc, loc);
1139
1140 local->transaction.main_frame = frame;
1141 local->transaction.start = LLONG_MAX9223372036854775807LL - 1;
1142 local->transaction.len = 0;
1143
1144 ret = afr_transaction (transaction_frame, this, AFR_METADATA_TRANSACTION);
1145 if (ret < 0) {
1146 op_errno = -ret;
1147 goto out;
1148 }
1149
1150 ret = 0;
1151out:
1152 if (ret < 0) {
1153 if (transaction_frame)
1154 AFR_STACK_DESTROY (transaction_frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = transaction_frame->local; __this = transaction_frame
->this; transaction_frame->local = ((void*)0); STACK_DESTROY
(transaction_frame->root); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0);
;
1155 AFR_STACK_UNWIND (setattr, frame, -1, op_errno, NULL, NULL, NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_setattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "afr-inode-write.c"
, __FUNCTION__, 1155, GF_LOG_CRITICAL, "!frame"); } while (0)
; break; } fn = (fop_setattr_cbk_t )frame->ret; _parent = frame
->parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
;
1156 }
1157
1158 return 0;
1159}
1160
1161/* {{{ fsetattr */
1162
1163int
1164afr_fsetattr_unwind (call_frame_t *frame, xlator_t *this)
1165{
1166 afr_local_t * local = NULL((void*)0);
1167 call_frame_t *main_frame = NULL((void*)0);
1168
1169 local = frame->local;
1170
1171 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
1172 {
1173 if (local->transaction.main_frame)
1174 main_frame = local->transaction.main_frame;
1175 local->transaction.main_frame = NULL((void*)0);
1176 }
1177 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
1178
1179 if (main_frame) {
1180 AFR_STACK_UNWIND (fsetattr, main_frame, local->op_ret,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_fsetattr_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 1184, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_fsetattr_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.fsetattr.preop_buf, &local
->cont.fsetattr.postop_buf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
1181 local->op_errno,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_fsetattr_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 1184, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_fsetattr_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.fsetattr.preop_buf, &local
->cont.fsetattr.postop_buf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
1182 &local->cont.fsetattr.preop_buf,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_fsetattr_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 1184, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_fsetattr_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.fsetattr.preop_buf, &local
->cont.fsetattr.postop_buf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
1183 &local->cont.fsetattr.postop_buf,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_fsetattr_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 1184, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_fsetattr_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.fsetattr.preop_buf, &local
->cont.fsetattr.postop_buf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
1184 NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_fsetattr_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 1184, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_fsetattr_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, &local->cont.fsetattr.preop_buf, &local
->cont.fsetattr.postop_buf, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
;
1185 }
1186
1187 return 0;
1188}
1189
1190
1191int
1192afr_fsetattr_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1193 int32_t op_ret, int32_t op_errno,
1194 struct iatt *preop, struct iatt *postop, dict_t *xdata)
1195{
1196 afr_local_t * local = NULL((void*)0);
1197 afr_private_t * priv = NULL((void*)0);
1198 int child_index = (long) cookie;
1199 int read_child = 0;
1200 int call_count = -1;
1201 int need_unwind = 0;
1202
1203 local = frame->local;
1204 priv = this->private;
1205
1206 read_child = afr_inode_get_read_ctx (this, local->fd->inode, NULL((void*)0));
1207
1208 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
1209 {
1210 if (child_index == read_child) {
1211 local->read_child_returned = _gf_true;
1212 }
1213
1214 if (afr_fop_failed (op_ret, op_errno)((op_ret) == -1))
1215 afr_transaction_fop_failed (frame, this, child_index);
1216
1217 if (op_ret != -1) {
1218 if (local->success_count == 0) {
1219 local->op_ret = op_ret;
1220 local->cont.fsetattr.preop_buf = *preop;
1221 local->cont.fsetattr.postop_buf = *postop;
1222 }
1223
1224 if (child_index == read_child) {
1225 local->cont.fsetattr.preop_buf = *preop;
1226 local->cont.fsetattr.postop_buf = *postop;
1227 }
1228
1229 local->success_count++;
1230
1231 if ((local->success_count >= priv->wait_count)
1232 && local->read_child_returned) {
1233 need_unwind = 1;
1234 }
1235 }
1236 local->op_errno = op_errno;
1237 }
1238 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
1239
1240 if (need_unwind)
1241 local->transaction.unwind (frame, this);
1242
1243 call_count = afr_frame_return (frame);
1244
1245 if (call_count == 0) {
1246 local->transaction.resume (frame, this);
1247 }
1248
1249 return 0;
1250}
1251
1252
1253int32_t
1254afr_fsetattr_wind (call_frame_t *frame, xlator_t *this)
1255{
1256 afr_local_t *local = NULL((void*)0);
1257 afr_private_t *priv = NULL((void*)0);
1258 int call_count = -1;
1259 int i = 0;
1260
1261 local = frame->local;
1262 priv = this->private;
1263
1264 call_count = afr_pre_op_done_children_count (local->transaction.pre_op,
1265 priv->child_count);
1266
1267 if (call_count == 0) {
1268 local->transaction.resume (frame, this);
1269 return 0;
1270 }
1271
1272 local->call_count = call_count;
1273
1274 for (i = 0; i < priv->child_count; i++) {
1275 if (local->transaction.pre_op[i]) {
1276 STACK_WIND_COOKIE (frame, afr_fsetattr_wind_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-inode-write.c", __FUNCTION__, 1283
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsetattr_cbk) tmp_cbk = afr_fsetattr_wind_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->fsetattr"
; _new->unwind_to = "afr_fsetattr_wind_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->fsetattr_cbk = afr_fsetattr_wind_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->fsetattr); priv->children[i]->fops->fsetattr
(_new, priv->children[i], local->fd, &local->cont
.fsetattr.in_buf, local->cont.fsetattr.valid, ((void*)0));
(*__glusterfs_this_location()) = old_THIS; } while (0)
1277 (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-inode-write.c", __FUNCTION__, 1283
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsetattr_cbk) tmp_cbk = afr_fsetattr_wind_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->fsetattr"
; _new->unwind_to = "afr_fsetattr_wind_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->fsetattr_cbk = afr_fsetattr_wind_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->fsetattr); priv->children[i]->fops->fsetattr
(_new, priv->children[i], local->fd, &local->cont
.fsetattr.in_buf, local->cont.fsetattr.valid, ((void*)0));
(*__glusterfs_this_location()) = old_THIS; } while (0)
1278 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-inode-write.c", __FUNCTION__, 1283
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsetattr_cbk) tmp_cbk = afr_fsetattr_wind_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->fsetattr"
; _new->unwind_to = "afr_fsetattr_wind_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->fsetattr_cbk = afr_fsetattr_wind_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->fsetattr); priv->children[i]->fops->fsetattr
(_new, priv->children[i], local->fd, &local->cont
.fsetattr.in_buf, local->cont.fsetattr.valid, ((void*)0));
(*__glusterfs_this_location()) = old_THIS; } while (0)
1279 priv->children[i]->fops->fsetattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "afr-inode-write.c", __FUNCTION__, 1283
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsetattr_cbk) tmp_cbk = afr_fsetattr_wind_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->fsetattr"
; _new->unwind_to = "afr_fsetattr_wind_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->fsetattr_cbk = afr_fsetattr_wind_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->fsetattr); priv->children[i]->fops->fsetattr
(_new, priv->children[i], local->fd, &local->cont
.fsetattr.in_buf, local->cont.fsetattr.valid, ((void*)0));
(*__glusterfs_this_location()) = old_THIS; } while (0)
1280 local->fd,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-inode-write.c", __FUNCTION__, 1283
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsetattr_cbk) tmp_cbk = afr_fsetattr_wind_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->fsetattr"
; _new->unwind_to = "afr_fsetattr_wind_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->fsetattr_cbk = afr_fsetattr_wind_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->fsetattr); priv->children[i]->fops->fsetattr
(_new, priv->children[i], local->fd, &local->cont
.fsetattr.in_buf, local->cont.fsetattr.valid, ((void*)0));
(*__glusterfs_this_location()) = old_THIS; } while (0)
1281 &local->cont.fsetattr.in_buf,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-inode-write.c", __FUNCTION__, 1283
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsetattr_cbk) tmp_cbk = afr_fsetattr_wind_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->fsetattr"
; _new->unwind_to = "afr_fsetattr_wind_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->fsetattr_cbk = afr_fsetattr_wind_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->fsetattr); priv->children[i]->fops->fsetattr
(_new, priv->children[i], local->fd, &local->cont
.fsetattr.in_buf, local->cont.fsetattr.valid, ((void*)0));
(*__glusterfs_this_location()) = old_THIS; } while (0)
1282 local->cont.fsetattr.valid,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-inode-write.c", __FUNCTION__, 1283
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsetattr_cbk) tmp_cbk = afr_fsetattr_wind_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->fsetattr"
; _new->unwind_to = "afr_fsetattr_wind_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->fsetattr_cbk = afr_fsetattr_wind_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->fsetattr); priv->children[i]->fops->fsetattr
(_new, priv->children[i], local->fd, &local->cont
.fsetattr.in_buf, local->cont.fsetattr.valid, ((void*)0));
(*__glusterfs_this_location()) = old_THIS; } while (0)
1283 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-inode-write.c", __FUNCTION__, 1283
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsetattr_cbk) tmp_cbk = afr_fsetattr_wind_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->fsetattr"
; _new->unwind_to = "afr_fsetattr_wind_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->fsetattr_cbk = afr_fsetattr_wind_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->fsetattr); priv->children[i]->fops->fsetattr
(_new, priv->children[i], local->fd, &local->cont
.fsetattr.in_buf, local->cont.fsetattr.valid, ((void*)0));
(*__glusterfs_this_location()) = old_THIS; } while (0)
;
1284
1285 if (!--call_count)
1286 break;
1287 }
1288 }
1289
1290 return 0;
1291}
1292
1293
1294int
1295afr_fsetattr_done (call_frame_t *frame, xlator_t *this)
1296{
1297 afr_local_t *local = NULL((void*)0);
1298
1299 local = frame->local;
1300
1301 local->transaction.unwind (frame, this);
1302
1303 AFR_STACK_DESTROY (frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = frame->local; __this = frame->this;
frame->local = ((void*)0); STACK_DESTROY (frame->root)
; if (__local) { afr_local_cleanup (__local, __this); mem_put
(__local); } } while (0);
;
1304
1305 return 0;
1306}
1307
1308int
1309afr_fsetattr (call_frame_t *frame, xlator_t *this,
1310 fd_t *fd, struct iatt *buf, int32_t valid, dict_t *xdata)
1311{
1312 afr_private_t * priv = NULL((void*)0);
1313 afr_local_t * local = NULL((void*)0);
1314 call_frame_t *transaction_frame = NULL((void*)0);
1315 int ret = -1;
1316 int op_errno = 0;
1317
1318 VALIDATE_OR_GOTO (frame, out)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "afr-inode-write.c"
, __FUNCTION__, 1318, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto out; } } while (0)
;
1319 VALIDATE_OR_GOTO (this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "afr-inode-write.c"
, __FUNCTION__, 1319, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto out; } } while (0)
;
1320 VALIDATE_OR_GOTO (this->private, out)do { if (!this->private) { (*__errno_location ()) = 22; do
{ do { if (0) printf ("invalid argument: " "this->private"
); } while (0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "afr-inode-write.c", __FUNCTION__, 1320, GF_LOG_WARNING, "invalid argument: "
"this->private"); } while (0); goto out; } } while (0)
;
1321
1322 priv = this->private;
1323
1324 if (afr_is_split_brain (this, fd->inode)) {
1
Taking false branch
1325 op_errno = EIO5;
1326 goto out;
1327 }
1328
1329 QUORUM_CHECK(fsetattr,out)do { if (priv->quorum_count && !afr_have_quorum(this
->name,priv)) { do { do { if (0) printf ("failing ""fsetattr"
" due to lack of quorum"); } while (0); _gf_log (this->name
, "afr-inode-write.c", __FUNCTION__, 1329, GF_LOG_WARNING, "failing "
"fsetattr"" due to lack of quorum"); } while (0); op_errno = 30
; goto out; } } while (0);
;
1330
1331 transaction_frame = copy_frame (frame);
1332 if (!transaction_frame) {
2
Taking false branch
1333 op_errno = ENOMEM12;
1334 goto out;
1335 }
1336
1337 AFR_LOCAL_ALLOC_OR_GOTO (transaction_frame->local, out)do { transaction_frame->local = mem_get0 ((*__glusterfs_this_location
())->local_pool); if (!transaction_frame->local) { do {
do { if (0) printf ("out of memory :("); } while (0); _gf_log
(this->name, "afr-inode-write.c", __FUNCTION__, 1337, GF_LOG_ERROR
, "out of memory :("); } while (0); op_errno = 12; goto out; }
} while (0);
;
1338 local = transaction_frame->local;
1339
1340 ret = afr_local_init (local, priv, &op_errno);
1341 if (ret < 0)
3
Assuming 'ret' is >= 0
4
Taking false branch
1342 goto out;
1343
1344 local->cont.fsetattr.in_buf = *buf;
1345 local->cont.fsetattr.valid = valid;
1346
1347 local->transaction.fop = afr_fsetattr_wind;
1348 local->transaction.done = afr_fsetattr_done;
1349 local->transaction.unwind = afr_fsetattr_unwind;
1350
1351 local->fd = fd_ref (fd);
1352
1353 afr_open_fd_fix (fd, this);
5
Calling 'afr_open_fd_fix'
1354
1355 local->transaction.main_frame = frame;
1356 local->transaction.start = LLONG_MAX9223372036854775807LL - 1;
1357 local->transaction.len = 0;
1358
1359 ret = afr_transaction (transaction_frame, this, AFR_METADATA_TRANSACTION);
1360 if (ret < 0) {
1361 op_errno = -ret;
1362 goto out;
1363 }
1364
1365 ret = 0;
1366out:
1367 if (ret < 0) {
1368 if (transaction_frame)
1369 AFR_STACK_DESTROY (transaction_frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = transaction_frame->local; __this = transaction_frame
->this; transaction_frame->local = ((void*)0); STACK_DESTROY
(transaction_frame->root); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0);
;
1370 AFR_STACK_UNWIND (fsetattr, frame, -1, op_errno, NULL, NULL, NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_fsetattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "afr-inode-write.c"
, __FUNCTION__, 1370, GF_LOG_CRITICAL, "!frame"); } while (0)
; break; } fn = (fop_fsetattr_cbk_t )frame->ret; _parent =
frame->parent; pthread_spin_lock (&frame->root->
stack_lock); { _parent->ref_count--; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
;
1371 }
1372
1373 return 0;
1374}
1375
1376
1377/* {{{ setxattr */
1378
1379
1380int
1381afr_setxattr_unwind (call_frame_t *frame, xlator_t *this)
1382{
1383 afr_local_t * local = NULL((void*)0);
1384 call_frame_t *main_frame = NULL((void*)0);
1385
1386 local = frame->local;
1387
1388 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
1389 {
1390 if (local->transaction.main_frame)
1391 main_frame = local->transaction.main_frame;
1392 local->transaction.main_frame = NULL((void*)0);
1393 }
1394 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
1395
1396 if (main_frame) {
1397 AFR_STACK_UNWIND (setxattr, main_frame,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_setxattr_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 1399, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_setxattr_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); if (__local) { afr_local_cleanup (__local, __this
); mem_put (__local); } } while (0)
1398 local->op_ret, local->op_errno,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_setxattr_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 1399, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_setxattr_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); if (__local) { afr_local_cleanup (__local, __this
); mem_put (__local); } } while (0)
1399 NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_setxattr_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 1399, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_setxattr_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); if (__local) { afr_local_cleanup (__local, __this
); mem_put (__local); } } while (0)
;
1400 }
1401 return 0;
1402}
1403
1404
1405int
1406afr_setxattr_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1407 int32_t op_ret, int32_t op_errno, dict_t *xdata)
1408{
1409 afr_local_t *local = NULL((void*)0);
1410 afr_private_t *priv = NULL((void*)0);
1411 int call_count = -1;
1412 int need_unwind = 0;
1413
1414 local = frame->local;
1415 priv = this->private;
1416
1417 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
1418 {
1419 if (op_ret != -1) {
1420 if (local->success_count == 0) {
1421 local->op_ret = op_ret;
1422 }
1423 local->success_count++;
1424
1425 if (local->success_count == priv->child_count) {
1426 need_unwind = 1;
1427 }
1428 }
1429
1430 local->op_errno = op_errno;
1431 }
1432 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
1433
1434 if (need_unwind)
1435 local->transaction.unwind (frame, this);
1436
1437 call_count = afr_frame_return (frame);
1438
1439 if (call_count == 0) {
1440 local->transaction.resume (frame, this);
1441 }
1442
1443 return 0;
1444}
1445
1446
1447int
1448afr_setxattr_wind (call_frame_t *frame, xlator_t *this)
1449{
1450 afr_local_t *local = NULL((void*)0);
1451 afr_private_t *priv = NULL((void*)0);
1452 int call_count = -1;
1453 int i = 0;
1454
1455 local = frame->local;
1456 priv = this->private;
1457
1458 call_count = afr_pre_op_done_children_count (local->transaction.pre_op,
1459 priv->child_count);
1460
1461 if (call_count == 0) {
1462 local->transaction.resume (frame, this);
1463 return 0;
1464 }
1465
1466 local->call_count = call_count;
1467
1468 for (i = 0; i < priv->child_count; i++) {
1469 if (local->transaction.pre_op[i]) {
1470 STACK_WIND_COOKIE (frame, afr_setxattr_wind_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-inode-write.c", __FUNCTION__, 1477
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setxattr_cbk) tmp_cbk = afr_setxattr_wind_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->setxattr"
; _new->unwind_to = "afr_setxattr_wind_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->setxattr_cbk = afr_setxattr_wind_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->setxattr); priv->children[i]->fops->setxattr
(_new, priv->children[i], &local->loc, local->cont
.setxattr.dict, local->cont.setxattr.flags, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1471 (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-inode-write.c", __FUNCTION__, 1477
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setxattr_cbk) tmp_cbk = afr_setxattr_wind_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->setxattr"
; _new->unwind_to = "afr_setxattr_wind_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->setxattr_cbk = afr_setxattr_wind_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->setxattr); priv->children[i]->fops->setxattr
(_new, priv->children[i], &local->loc, local->cont
.setxattr.dict, local->cont.setxattr.flags, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1472 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-inode-write.c", __FUNCTION__, 1477
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setxattr_cbk) tmp_cbk = afr_setxattr_wind_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->setxattr"
; _new->unwind_to = "afr_setxattr_wind_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->setxattr_cbk = afr_setxattr_wind_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->setxattr); priv->children[i]->fops->setxattr
(_new, priv->children[i], &local->loc, local->cont
.setxattr.dict, local->cont.setxattr.flags, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1473 priv->children[i]->fops->setxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "afr-inode-write.c", __FUNCTION__, 1477
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setxattr_cbk) tmp_cbk = afr_setxattr_wind_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->setxattr"
; _new->unwind_to = "afr_setxattr_wind_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->setxattr_cbk = afr_setxattr_wind_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->setxattr); priv->children[i]->fops->setxattr
(_new, priv->children[i], &local->loc, local->cont
.setxattr.dict, local->cont.setxattr.flags, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1474 &local->loc,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-inode-write.c", __FUNCTION__, 1477
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setxattr_cbk) tmp_cbk = afr_setxattr_wind_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->setxattr"
; _new->unwind_to = "afr_setxattr_wind_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->setxattr_cbk = afr_setxattr_wind_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->setxattr); priv->children[i]->fops->setxattr
(_new, priv->children[i], &local->loc, local->cont
.setxattr.dict, local->cont.setxattr.flags, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1475 local->cont.setxattr.dict,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "afr-inode-write.c", __FUNCTION__, 1477
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setxattr_cbk) tmp_cbk = afr_setxattr_wind_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->setxattr"
; _new->unwind_to = "afr_setxattr_wind_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->setxattr_cbk = afr_setxattr_wind_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->setxattr); priv->children[i]->fops->setxattr
(_new, priv->children[i], &local->loc, local->cont
.setxattr.dict, local->cont.setxattr.flags, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1476 local->cont.setxattr.flags,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "afr-inode-write.c", __FUNCTION__, 1477
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setxattr_cbk) tmp_cbk = afr_setxattr_wind_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->setxattr"
; _new->unwind_to = "afr_setxattr_wind_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->setxattr_cbk = afr_setxattr_wind_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->setxattr); priv->children[i]->fops->setxattr
(_new, priv->children[i], &local->loc, local->cont
.setxattr.dict, local->cont.setxattr.flags, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1477 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-inode-write.c", __FUNCTION__, 1477
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->setxattr_cbk) tmp_cbk = afr_setxattr_wind_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->setxattr"
; _new->unwind_to = "afr_setxattr_wind_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->setxattr_cbk = afr_setxattr_wind_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->setxattr); priv->children[i]->fops->setxattr
(_new, priv->children[i], &local->loc, local->cont
.setxattr.dict, local->cont.setxattr.flags, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
;
1478
1479 if (!--call_count)
1480 break;
1481 }
1482 }
1483
1484 return 0;
1485}
1486
1487
1488int
1489afr_setxattr_done (call_frame_t *frame, xlator_t *this)
1490{
1491 afr_local_t *local = frame->local;
1492
1493 local->transaction.unwind (frame, this);
1494
1495 AFR_STACK_DESTROY (frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = frame->local; __this = frame->this;
frame->local = ((void*)0); STACK_DESTROY (frame->root)
; if (__local) { afr_local_cleanup (__local, __this); mem_put
(__local); } } while (0);
;
1496
1497 return 0;
1498}
1499
1500int
1501afr_setxattr (call_frame_t *frame, xlator_t *this,
1502 loc_t *loc, dict_t *dict, int32_t flags, dict_t *xdata)
1503{
1504 afr_private_t *priv = NULL((void*)0);
1505 afr_local_t *local = NULL((void*)0);
1506 call_frame_t *transaction_frame = NULL((void*)0);
1507 int ret = -1;
1508 int op_errno = EINVAL22;
1509
1510 VALIDATE_OR_GOTO (this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "afr-inode-write.c"
, __FUNCTION__, 1510, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto out; } } while (0)
;
1511
1512 GF_IF_INTERNAL_XATTR_GOTO ("trusted.afr.*", dict,do { if (!dict) { do { do { if (0) printf ("setxattr dict is null"
); } while (0); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__
, 1513, GF_LOG_ERROR, "setxattr dict is null"); } while (0); goto
out; } if (dict_foreach_fnmatch (dict, "trusted.afr.*", dict_null_foreach_fn
, ((void*)0)) > 0) { op_errno = 1; do { do { if (0) printf
("attempt to set internal" " xattr: %s: %s", "trusted.afr.*"
, strerror (op_errno)); } while (0); _gf_log (this->name, "afr-inode-write.c"
, __FUNCTION__, 1513, GF_LOG_ERROR, "attempt to set internal"
" xattr: %s: %s", "trusted.afr.*", strerror (op_errno)); } while
(0); goto out; } } while (0)
1513 op_errno, out)do { if (!dict) { do { do { if (0) printf ("setxattr dict is null"
); } while (0); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__
, 1513, GF_LOG_ERROR, "setxattr dict is null"); } while (0); goto
out; } if (dict_foreach_fnmatch (dict, "trusted.afr.*", dict_null_foreach_fn
, ((void*)0)) > 0) { op_errno = 1; do { do { if (0) printf
("attempt to set internal" " xattr: %s: %s", "trusted.afr.*"
, strerror (op_errno)); } while (0); _gf_log (this->name, "afr-inode-write.c"
, __FUNCTION__, 1513, GF_LOG_ERROR, "attempt to set internal"
" xattr: %s: %s", "trusted.afr.*", strerror (op_errno)); } while
(0); goto out; } } while (0)
;
1514
1515 GF_IF_INTERNAL_XATTR_GOTO ("trusted.glusterfs.afr.*", dict,do { if (!dict) { do { do { if (0) printf ("setxattr dict is null"
); } while (0); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__
, 1516, GF_LOG_ERROR, "setxattr dict is null"); } while (0); goto
out; } if (dict_foreach_fnmatch (dict, "trusted.glusterfs.afr.*"
, dict_null_foreach_fn, ((void*)0)) > 0) { op_errno = 1; do
{ do { if (0) printf ("attempt to set internal" " xattr: %s: %s"
, "trusted.glusterfs.afr.*", strerror (op_errno)); } while (0
); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__,
1516, GF_LOG_ERROR, "attempt to set internal" " xattr: %s: %s"
, "trusted.glusterfs.afr.*", strerror (op_errno)); } while (0
); goto out; } } while (0)
1516 op_errno, out)do { if (!dict) { do { do { if (0) printf ("setxattr dict is null"
); } while (0); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__
, 1516, GF_LOG_ERROR, "setxattr dict is null"); } while (0); goto
out; } if (dict_foreach_fnmatch (dict, "trusted.glusterfs.afr.*"
, dict_null_foreach_fn, ((void*)0)) > 0) { op_errno = 1; do
{ do { if (0) printf ("attempt to set internal" " xattr: %s: %s"
, "trusted.glusterfs.afr.*", strerror (op_errno)); } while (0
); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__,
1516, GF_LOG_ERROR, "attempt to set internal" " xattr: %s: %s"
, "trusted.glusterfs.afr.*", strerror (op_errno)); } while (0
); goto out; } } while (0)
;
1517
1518 VALIDATE_OR_GOTO (frame, out)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "afr-inode-write.c"
, __FUNCTION__, 1518, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto out; } } while (0)
;
1519 VALIDATE_OR_GOTO (this->private, out)do { if (!this->private) { (*__errno_location ()) = 22; do
{ do { if (0) printf ("invalid argument: " "this->private"
); } while (0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "afr-inode-write.c", __FUNCTION__, 1519, GF_LOG_WARNING, "invalid argument: "
"this->private"); } while (0); goto out; } } while (0)
;
1520
1521 priv = this->private;
1522
1523 QUORUM_CHECK(setxattr,out)do { if (priv->quorum_count && !afr_have_quorum(this
->name,priv)) { do { do { if (0) printf ("failing ""setxattr"
" due to lack of quorum"); } while (0); _gf_log (this->name
, "afr-inode-write.c", __FUNCTION__, 1523, GF_LOG_WARNING, "failing "
"setxattr"" due to lack of quorum"); } while (0); op_errno = 30
; goto out; } } while (0);
;
1524 transaction_frame = copy_frame (frame);
1525 if (!transaction_frame) {
1526 op_errno = ENOMEM12;
1527 goto out;
1528 }
1529
1530 AFR_LOCAL_ALLOC_OR_GOTO (transaction_frame->local, out)do { transaction_frame->local = mem_get0 ((*__glusterfs_this_location
())->local_pool); if (!transaction_frame->local) { do {
do { if (0) printf ("out of memory :("); } while (0); _gf_log
(this->name, "afr-inode-write.c", __FUNCTION__, 1530, GF_LOG_ERROR
, "out of memory :("); } while (0); op_errno = 12; goto out; }
} while (0);
;
1531 local = transaction_frame->local;
1532
1533 ret = afr_local_init (local, priv, &op_errno);
1534 if (ret < 0)
1535 goto out;
1536
1537 local->cont.setxattr.dict = dict_ref (dict);
1538 local->cont.setxattr.flags = flags;
1539
1540 local->transaction.fop = afr_setxattr_wind;
1541 local->transaction.done = afr_setxattr_done;
1542 local->transaction.unwind = afr_setxattr_unwind;
1543
1544 loc_copy (&local->loc, loc);
1545
1546 local->transaction.main_frame = frame;
1547 local->transaction.start = LLONG_MAX9223372036854775807LL - 1;
1548 local->transaction.len = 0;
1549
1550 ret = afr_transaction (transaction_frame, this, AFR_METADATA_TRANSACTION);
1551 if (ret < 0) {
1552 op_errno = -ret;
1553 goto out;
1554 }
1555
1556 ret = 0;
1557out:
1558 if (ret < 0) {
1559 if (transaction_frame)
1560 AFR_STACK_DESTROY (transaction_frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = transaction_frame->local; __this = transaction_frame
->this; transaction_frame->local = ((void*)0); STACK_DESTROY
(transaction_frame->root); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0);
;
1561 AFR_STACK_UNWIND (setxattr, frame, -1, op_errno, NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_setxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "afr-inode-write.c"
, __FUNCTION__, 1561, GF_LOG_CRITICAL, "!frame"); } while (0)
; break; } fn = (fop_setxattr_cbk_t )frame->ret; _parent =
frame->parent; pthread_spin_lock (&frame->root->
stack_lock); { _parent->ref_count--; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); if (__local) { afr_local_cleanup (__local, __this
); mem_put (__local); } } while (0)
;
1562 }
1563
1564 return 0;
1565}
1566
1567/* {{{ fsetxattr */
1568
1569
1570int
1571afr_fsetxattr_unwind (call_frame_t *frame, xlator_t *this)
1572{
1573 afr_local_t *local = NULL((void*)0);
1574 call_frame_t *main_frame = NULL((void*)0);
1575
1576 local = frame->local;
1577
1578 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
1579 {
1580 if (local->transaction.main_frame)
1581 main_frame = local->transaction.main_frame;
1582 local->transaction.main_frame = NULL((void*)0);
1583 }
1584 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
1585
1586 if (main_frame) {
1587 AFR_STACK_UNWIND (fsetxattr, main_frame,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_fsetxattr_cbk_t fn = ((void*)0); call_frame_t *_parent
= ((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 1589, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_fsetxattr_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); if (__local) { afr_local_cleanup (__local, __this
); mem_put (__local); } } while (0)
1588 local->op_ret, local->op_errno,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_fsetxattr_cbk_t fn = ((void*)0); call_frame_t *_parent
= ((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 1589, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_fsetxattr_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); if (__local) { afr_local_cleanup (__local, __this
); mem_put (__local); } } while (0)
1589 NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_fsetxattr_cbk_t fn = ((void*)0); call_frame_t *_parent
= ((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 1589, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_fsetxattr_cbk_t )
main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); if (__local) { afr_local_cleanup (__local, __this
); mem_put (__local); } } while (0)
;
1590 }
1591 return 0;
1592}
1593
1594
1595int
1596afr_fsetxattr_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1597 int32_t op_ret, int32_t op_errno, dict_t *xdata)
1598{
1599 afr_local_t *local = NULL((void*)0);
1600 afr_private_t *priv = NULL((void*)0);
1601 int call_count = -1;
1602 int need_unwind = 0;
1603
1604 local = frame->local;
1605 priv = this->private;
1606
1607 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
1608 {
1609 if (op_ret != -1) {
1610 if (local->success_count == 0) {
1611 local->op_ret = op_ret;
1612 }
1613 local->success_count++;
1614
1615 if (local->success_count == priv->child_count) {
1616 need_unwind = 1;
1617 }
1618 }
1619
1620 local->op_errno = op_errno;
1621 }
1622 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
1623
1624 if (need_unwind)
1625 local->transaction.unwind (frame, this);
1626
1627 call_count = afr_frame_return (frame);
1628
1629 if (call_count == 0) {
1630 local->transaction.resume (frame, this);
1631 }
1632
1633 return 0;
1634}
1635
1636
1637int
1638afr_fsetxattr_wind (call_frame_t *frame, xlator_t *this)
1639{
1640 afr_local_t *local = NULL((void*)0);
1641 afr_private_t *priv = NULL((void*)0);
1642 int call_count = -1;
1643 int i = 0;
1644
1645 local = frame->local;
1646 priv = this->private;
1647
1648 call_count = afr_pre_op_done_children_count (local->transaction.pre_op,
1649 priv->child_count);
1650
1651 if (call_count == 0) {
1652 local->transaction.resume (frame, this);
1653 return 0;
1654 }
1655
1656 local->call_count = call_count;
1657
1658 for (i = 0; i < priv->child_count; i++) {
1659 if (local->transaction.pre_op[i]) {
1660 STACK_WIND_COOKIE (frame, afr_fsetxattr_wind_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-inode-write.c", __FUNCTION__, 1667
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsetxattr_cbk) tmp_cbk = afr_fsetxattr_wind_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->fsetxattr"
; _new->unwind_to = "afr_fsetxattr_wind_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->fsetxattr_cbk = afr_fsetxattr_wind_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->fsetxattr); priv->children[i]->fops->fsetxattr
(_new, priv->children[i], local->fd, local->cont.fsetxattr
.dict, local->cont.fsetxattr.flags, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1661 (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-inode-write.c", __FUNCTION__, 1667
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsetxattr_cbk) tmp_cbk = afr_fsetxattr_wind_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->fsetxattr"
; _new->unwind_to = "afr_fsetxattr_wind_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->fsetxattr_cbk = afr_fsetxattr_wind_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->fsetxattr); priv->children[i]->fops->fsetxattr
(_new, priv->children[i], local->fd, local->cont.fsetxattr
.dict, local->cont.fsetxattr.flags, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1662 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-inode-write.c", __FUNCTION__, 1667
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsetxattr_cbk) tmp_cbk = afr_fsetxattr_wind_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->fsetxattr"
; _new->unwind_to = "afr_fsetxattr_wind_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->fsetxattr_cbk = afr_fsetxattr_wind_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->fsetxattr); priv->children[i]->fops->fsetxattr
(_new, priv->children[i], local->fd, local->cont.fsetxattr
.dict, local->cont.fsetxattr.flags, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1663 priv->children[i]->fops->fsetxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "afr-inode-write.c", __FUNCTION__, 1667
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsetxattr_cbk) tmp_cbk = afr_fsetxattr_wind_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->fsetxattr"
; _new->unwind_to = "afr_fsetxattr_wind_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->fsetxattr_cbk = afr_fsetxattr_wind_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->fsetxattr); priv->children[i]->fops->fsetxattr
(_new, priv->children[i], local->fd, local->cont.fsetxattr
.dict, local->cont.fsetxattr.flags, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1664 local->fd,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-inode-write.c", __FUNCTION__, 1667
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsetxattr_cbk) tmp_cbk = afr_fsetxattr_wind_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->fsetxattr"
; _new->unwind_to = "afr_fsetxattr_wind_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->fsetxattr_cbk = afr_fsetxattr_wind_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->fsetxattr); priv->children[i]->fops->fsetxattr
(_new, priv->children[i], local->fd, local->cont.fsetxattr
.dict, local->cont.fsetxattr.flags, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1665 local->cont.fsetxattr.dict,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "afr-inode-write.c", __FUNCTION__, 1667
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsetxattr_cbk) tmp_cbk = afr_fsetxattr_wind_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->fsetxattr"
; _new->unwind_to = "afr_fsetxattr_wind_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->fsetxattr_cbk = afr_fsetxattr_wind_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->fsetxattr); priv->children[i]->fops->fsetxattr
(_new, priv->children[i], local->fd, local->cont.fsetxattr
.dict, local->cont.fsetxattr.flags, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1666 local->cont.fsetxattr.flags,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "afr-inode-write.c", __FUNCTION__, 1667
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsetxattr_cbk) tmp_cbk = afr_fsetxattr_wind_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->fsetxattr"
; _new->unwind_to = "afr_fsetxattr_wind_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->fsetxattr_cbk = afr_fsetxattr_wind_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->fsetxattr); priv->children[i]->fops->fsetxattr
(_new, priv->children[i], local->fd, local->cont.fsetxattr
.dict, local->cont.fsetxattr.flags, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1667 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-inode-write.c", __FUNCTION__, 1667
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsetxattr_cbk) tmp_cbk = afr_fsetxattr_wind_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->fsetxattr"
; _new->unwind_to = "afr_fsetxattr_wind_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->fsetxattr_cbk = afr_fsetxattr_wind_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->fsetxattr); priv->children[i]->fops->fsetxattr
(_new, priv->children[i], local->fd, local->cont.fsetxattr
.dict, local->cont.fsetxattr.flags, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
1668
1669 if (!--call_count)
1670 break;
1671 }
1672 }
1673
1674 return 0;
1675}
1676
1677
1678int
1679afr_fsetxattr_done (call_frame_t *frame, xlator_t *this)
1680{
1681 afr_local_t *local = frame->local;
1682
1683 local->transaction.unwind (frame, this);
1684
1685 AFR_STACK_DESTROY (frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = frame->local; __this = frame->this;
frame->local = ((void*)0); STACK_DESTROY (frame->root)
; if (__local) { afr_local_cleanup (__local, __this); mem_put
(__local); } } while (0);
;
1686
1687 return 0;
1688}
1689
1690int
1691afr_fsetxattr (call_frame_t *frame, xlator_t *this,
1692 fd_t *fd, dict_t *dict, int32_t flags, dict_t *xdata)
1693{
1694 afr_private_t *priv = NULL((void*)0);
1695 afr_local_t *local = NULL((void*)0);
1696 call_frame_t *transaction_frame = NULL((void*)0);
1697 int ret = -1;
1698 int op_errno = EINVAL22;
1699
1700 VALIDATE_OR_GOTO (frame, out)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "afr-inode-write.c"
, __FUNCTION__, 1700, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto out; } } while (0)
;
1701 VALIDATE_OR_GOTO (this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "afr-inode-write.c"
, __FUNCTION__, 1701, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto out; } } while (0)
;
1702 VALIDATE_OR_GOTO (this->private, out)do { if (!this->private) { (*__errno_location ()) = 22; do
{ do { if (0) printf ("invalid argument: " "this->private"
); } while (0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "afr-inode-write.c", __FUNCTION__, 1702, GF_LOG_WARNING, "invalid argument: "
"this->private"); } while (0); goto out; } } while (0)
;
1703
1704 GF_IF_INTERNAL_XATTR_GOTO ("trusted.afr.*", dict,do { if (!dict) { do { do { if (0) printf ("setxattr dict is null"
); } while (0); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__
, 1705, GF_LOG_ERROR, "setxattr dict is null"); } while (0); goto
out; } if (dict_foreach_fnmatch (dict, "trusted.afr.*", dict_null_foreach_fn
, ((void*)0)) > 0) { op_errno = 1; do { do { if (0) printf
("attempt to set internal" " xattr: %s: %s", "trusted.afr.*"
, strerror (op_errno)); } while (0); _gf_log (this->name, "afr-inode-write.c"
, __FUNCTION__, 1705, GF_LOG_ERROR, "attempt to set internal"
" xattr: %s: %s", "trusted.afr.*", strerror (op_errno)); } while
(0); goto out; } } while (0)
1705 op_errno, out)do { if (!dict) { do { do { if (0) printf ("setxattr dict is null"
); } while (0); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__
, 1705, GF_LOG_ERROR, "setxattr dict is null"); } while (0); goto
out; } if (dict_foreach_fnmatch (dict, "trusted.afr.*", dict_null_foreach_fn
, ((void*)0)) > 0) { op_errno = 1; do { do { if (0) printf
("attempt to set internal" " xattr: %s: %s", "trusted.afr.*"
, strerror (op_errno)); } while (0); _gf_log (this->name, "afr-inode-write.c"
, __FUNCTION__, 1705, GF_LOG_ERROR, "attempt to set internal"
" xattr: %s: %s", "trusted.afr.*", strerror (op_errno)); } while
(0); goto out; } } while (0)
;
1706
1707 GF_IF_INTERNAL_XATTR_GOTO ("trusted.glusterfs.afr.*", dict,do { if (!dict) { do { do { if (0) printf ("setxattr dict is null"
); } while (0); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__
, 1708, GF_LOG_ERROR, "setxattr dict is null"); } while (0); goto
out; } if (dict_foreach_fnmatch (dict, "trusted.glusterfs.afr.*"
, dict_null_foreach_fn, ((void*)0)) > 0) { op_errno = 1; do
{ do { if (0) printf ("attempt to set internal" " xattr: %s: %s"
, "trusted.glusterfs.afr.*", strerror (op_errno)); } while (0
); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__,
1708, GF_LOG_ERROR, "attempt to set internal" " xattr: %s: %s"
, "trusted.glusterfs.afr.*", strerror (op_errno)); } while (0
); goto out; } } while (0)
1708 op_errno, out)do { if (!dict) { do { do { if (0) printf ("setxattr dict is null"
); } while (0); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__
, 1708, GF_LOG_ERROR, "setxattr dict is null"); } while (0); goto
out; } if (dict_foreach_fnmatch (dict, "trusted.glusterfs.afr.*"
, dict_null_foreach_fn, ((void*)0)) > 0) { op_errno = 1; do
{ do { if (0) printf ("attempt to set internal" " xattr: %s: %s"
, "trusted.glusterfs.afr.*", strerror (op_errno)); } while (0
); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__,
1708, GF_LOG_ERROR, "attempt to set internal" " xattr: %s: %s"
, "trusted.glusterfs.afr.*", strerror (op_errno)); } while (0
); goto out; } } while (0)
;
1709
1710 priv = this->private;
1711
1712 if (afr_is_split_brain (this, fd->inode)) {
1713 op_errno = EIO5;
1714 goto out;
1715 }
1716
1717 QUORUM_CHECK(fsetxattr,out)do { if (priv->quorum_count && !afr_have_quorum(this
->name,priv)) { do { do { if (0) printf ("failing ""fsetxattr"
" due to lack of quorum"); } while (0); _gf_log (this->name
, "afr-inode-write.c", __FUNCTION__, 1717, GF_LOG_WARNING, "failing "
"fsetxattr"" due to lack of quorum"); } while (0); op_errno =
30; goto out; } } while (0);
;
1718
1719 AFR_LOCAL_ALLOC_OR_GOTO (local, out)do { local = mem_get0 ((*__glusterfs_this_location())->local_pool
); if (!local) { do { do { if (0) printf ("out of memory :(")
; } while (0); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__
, 1719, GF_LOG_ERROR, "out of memory :("); } while (0); op_errno
= 12; goto out; } } while (0);
;
1720
1721 ret = afr_local_init (local, priv, &op_errno);
1722 if (ret < 0)
1723 goto out;
1724
1725 transaction_frame = copy_frame (frame);
1726 if (!transaction_frame) {
1727 goto out;
1728 }
1729
1730 transaction_frame->local = local;
1731
1732 local->op_ret = -1;
1733
1734 local->cont.fsetxattr.dict = dict_ref (dict);
1735 local->cont.fsetxattr.flags = flags;
1736
1737 local->transaction.fop = afr_fsetxattr_wind;
1738 local->transaction.done = afr_fsetxattr_done;
1739 local->transaction.unwind = afr_fsetxattr_unwind;
1740
1741 local->fd = fd_ref (fd);
1742
1743 local->transaction.main_frame = frame;
1744 local->transaction.start = LLONG_MAX9223372036854775807LL - 1;
1745 local->transaction.len = 0;
1746
1747 ret = afr_transaction (transaction_frame, this, AFR_METADATA_TRANSACTION);
1748 if (ret < 0) {
1749 op_errno = -ret;
1750 goto out;
1751 }
1752
1753 ret = 0;
1754out:
1755 if (ret < 0) {
1756 if (transaction_frame)
1757 AFR_STACK_DESTROY (transaction_frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = transaction_frame->local; __this = transaction_frame
->this; transaction_frame->local = ((void*)0); STACK_DESTROY
(transaction_frame->root); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0);
;
1758 AFR_STACK_UNWIND (fsetxattr, frame, -1, op_errno, NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_fsetxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "afr-inode-write.c"
, __FUNCTION__, 1758, GF_LOG_CRITICAL, "!frame"); } while (0)
; break; } fn = (fop_fsetxattr_cbk_t )frame->ret; _parent =
frame->parent; pthread_spin_lock (&frame->root->
stack_lock); { _parent->ref_count--; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); if (__local) { afr_local_cleanup (__local, __this
); mem_put (__local); } } while (0)
;
1759 }
1760
1761 return 0;
1762}
1763
1764/* }}} */
1765
1766
1767/* {{{ removexattr */
1768
1769
1770int
1771afr_removexattr_unwind (call_frame_t *frame, xlator_t *this)
1772{
1773 afr_local_t * local = NULL((void*)0);
1774 call_frame_t *main_frame = NULL((void*)0);
1775
1776 local = frame->local;
1777
1778 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
1779 {
1780 if (local->transaction.main_frame)
1781 main_frame = local->transaction.main_frame;
1782 local->transaction.main_frame = NULL((void*)0);
1783 }
1784 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
1785
1786 if (main_frame) {
1787 AFR_STACK_UNWIND (removexattr, main_frame,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_removexattr_cbk_t fn = ((void*)0); call_frame_t *_parent
= ((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 1789, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_removexattr_cbk_t
)main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); if (__local) { afr_local_cleanup (__local, __this
); mem_put (__local); } } while (0)
1788 local->op_ret, local->op_errno,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_removexattr_cbk_t fn = ((void*)0); call_frame_t *_parent
= ((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 1789, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_removexattr_cbk_t
)main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); if (__local) { afr_local_cleanup (__local, __this
); mem_put (__local); } } while (0)
1789 NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_removexattr_cbk_t fn = ((void*)0); call_frame_t *_parent
= ((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 1789, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_removexattr_cbk_t
)main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); if (__local) { afr_local_cleanup (__local, __this
); mem_put (__local); } } while (0)
;
1790 }
1791 return 0;
1792}
1793
1794
1795int
1796afr_removexattr_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1797 int32_t op_ret, int32_t op_errno, dict_t *xdata)
1798{
1799 afr_local_t * local = NULL((void*)0);
1800 afr_private_t * priv = NULL((void*)0);
1801 int call_count = -1;
1802 int need_unwind = 0;
1803
1804 local = frame->local;
1805 priv = this->private;
1806
1807 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
1808 {
1809 if (op_ret != -1) {
1810 if (local->success_count == 0) {
1811 local->op_ret = op_ret;
1812 }
1813 local->success_count++;
1814
1815 if (local->success_count == priv->wait_count) {
1816 need_unwind = 1;
1817 }
1818 }
1819
1820 local->op_errno = op_errno;
1821 }
1822 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
1823
1824 if (need_unwind)
1825 local->transaction.unwind (frame, this);
1826
1827 call_count = afr_frame_return (frame);
1828
1829 if (call_count == 0) {
1830 local->transaction.resume (frame, this);
1831 }
1832
1833 return 0;
1834}
1835
1836
1837int32_t
1838afr_removexattr_wind (call_frame_t *frame, xlator_t *this)
1839{
1840 afr_local_t *local = NULL((void*)0);
1841 afr_private_t *priv = NULL((void*)0);
1842 int call_count = -1;
1843 int i = 0;
1844
1845 local = frame->local;
1846 priv = this->private;
1847
1848 call_count = afr_pre_op_done_children_count (local->transaction.pre_op,
1849 priv->child_count);
1850
1851 if (call_count == 0) {
1852 local->transaction.resume (frame, this);
1853 return 0;
1854 }
1855
1856 local->call_count = call_count;
1857
1858 for (i = 0; i < priv->child_count; i++) {
1859 if (local->transaction.pre_op[i]) {
1860 STACK_WIND_COOKIE (frame, afr_removexattr_wind_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-inode-write.c", __FUNCTION__, 1866
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->removexattr_cbk) tmp_cbk =
afr_removexattr_wind_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->removexattr"
; _new->unwind_to = "afr_removexattr_wind_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->removexattr_cbk = afr_removexattr_wind_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->removexattr); priv->children[i]->fops->
removexattr (_new, priv->children[i], &local->loc, local
->cont.removexattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1861 (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-inode-write.c", __FUNCTION__, 1866
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->removexattr_cbk) tmp_cbk =
afr_removexattr_wind_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->removexattr"
; _new->unwind_to = "afr_removexattr_wind_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->removexattr_cbk = afr_removexattr_wind_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->removexattr); priv->children[i]->fops->
removexattr (_new, priv->children[i], &local->loc, local
->cont.removexattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1862 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-inode-write.c", __FUNCTION__, 1866
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->removexattr_cbk) tmp_cbk =
afr_removexattr_wind_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->removexattr"
; _new->unwind_to = "afr_removexattr_wind_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->removexattr_cbk = afr_removexattr_wind_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->removexattr); priv->children[i]->fops->
removexattr (_new, priv->children[i], &local->loc, local
->cont.removexattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1863 priv->children[i]->fops->removexattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "afr-inode-write.c", __FUNCTION__, 1866
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->removexattr_cbk) tmp_cbk =
afr_removexattr_wind_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->removexattr"
; _new->unwind_to = "afr_removexattr_wind_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->removexattr_cbk = afr_removexattr_wind_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->removexattr); priv->children[i]->fops->
removexattr (_new, priv->children[i], &local->loc, local
->cont.removexattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1864 &local->loc,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-inode-write.c", __FUNCTION__, 1866
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->removexattr_cbk) tmp_cbk =
afr_removexattr_wind_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->removexattr"
; _new->unwind_to = "afr_removexattr_wind_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->removexattr_cbk = afr_removexattr_wind_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->removexattr); priv->children[i]->fops->
removexattr (_new, priv->children[i], &local->loc, local
->cont.removexattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1865 local->cont.removexattr.name,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-inode-write.c", __FUNCTION__, 1866
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->removexattr_cbk) tmp_cbk =
afr_removexattr_wind_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->removexattr"
; _new->unwind_to = "afr_removexattr_wind_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->removexattr_cbk = afr_removexattr_wind_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->removexattr); priv->children[i]->fops->
removexattr (_new, priv->children[i], &local->loc, local
->cont.removexattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1866 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-inode-write.c", __FUNCTION__, 1866
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->removexattr_cbk) tmp_cbk =
afr_removexattr_wind_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->removexattr"
; _new->unwind_to = "afr_removexattr_wind_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->removexattr_cbk = afr_removexattr_wind_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->removexattr); priv->children[i]->fops->
removexattr (_new, priv->children[i], &local->loc, local
->cont.removexattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
1867
1868 if (!--call_count)
1869 break;
1870 }
1871 }
1872
1873 return 0;
1874}
1875
1876
1877int
1878afr_removexattr_done (call_frame_t *frame, xlator_t *this)
1879{
1880 afr_local_t * local = frame->local;
1881
1882 local->transaction.unwind (frame, this);
1883
1884 AFR_STACK_DESTROY (frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = frame->local; __this = frame->this;
frame->local = ((void*)0); STACK_DESTROY (frame->root)
; if (__local) { afr_local_cleanup (__local, __this); mem_put
(__local); } } while (0);
;
1885
1886 return 0;
1887}
1888
1889
1890int
1891afr_removexattr (call_frame_t *frame, xlator_t *this,
1892 loc_t *loc, const char *name, dict_t *xdata)
1893{
1894 afr_private_t *priv = NULL((void*)0);
1895 afr_local_t *local = NULL((void*)0);
1896 call_frame_t *transaction_frame = NULL((void*)0);
1897 int ret = -1;
1898 int op_errno = 0;
1899
1900 VALIDATE_OR_GOTO (this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "afr-inode-write.c"
, __FUNCTION__, 1900, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto out; } } while (0)
;
1901
1902 GF_IF_NATIVE_XATTR_GOTO ("trusted.afr.*",do { if (!name) { do { do { if (0) printf ("no key for removexattr"
); } while (0); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__
, 1903, GF_LOG_ERROR, "no key for removexattr"); } while (0);
goto out; } if (!fnmatch ("trusted.afr.*", name, 0)) { op_errno
= 1; do { do { if (0) printf ("attempt to remove internal " "xattr: %s: %s"
, name, strerror (op_errno)); } while (0); _gf_log (this->
name, "afr-inode-write.c", __FUNCTION__, 1903, GF_LOG_ERROR, "attempt to remove internal "
"xattr: %s: %s", name, strerror (op_errno)); } while (0); goto
out; } } while (0)
1903 name, op_errno, out)do { if (!name) { do { do { if (0) printf ("no key for removexattr"
); } while (0); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__
, 1903, GF_LOG_ERROR, "no key for removexattr"); } while (0);
goto out; } if (!fnmatch ("trusted.afr.*", name, 0)) { op_errno
= 1; do { do { if (0) printf ("attempt to remove internal " "xattr: %s: %s"
, name, strerror (op_errno)); } while (0); _gf_log (this->
name, "afr-inode-write.c", __FUNCTION__, 1903, GF_LOG_ERROR, "attempt to remove internal "
"xattr: %s: %s", name, strerror (op_errno)); } while (0); goto
out; } } while (0)
;
1904
1905 GF_IF_NATIVE_XATTR_GOTO ("trusted.glusterfs.afr.*",do { if (!name) { do { do { if (0) printf ("no key for removexattr"
); } while (0); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__
, 1906, GF_LOG_ERROR, "no key for removexattr"); } while (0);
goto out; } if (!fnmatch ("trusted.glusterfs.afr.*", name, 0
)) { op_errno = 1; do { do { if (0) printf ("attempt to remove internal "
"xattr: %s: %s", name, strerror (op_errno)); } while (0); _gf_log
(this->name, "afr-inode-write.c", __FUNCTION__, 1906, GF_LOG_ERROR
, "attempt to remove internal " "xattr: %s: %s", name, strerror
(op_errno)); } while (0); goto out; } } while (0)
1906 name, op_errno, out)do { if (!name) { do { do { if (0) printf ("no key for removexattr"
); } while (0); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__
, 1906, GF_LOG_ERROR, "no key for removexattr"); } while (0);
goto out; } if (!fnmatch ("trusted.glusterfs.afr.*", name, 0
)) { op_errno = 1; do { do { if (0) printf ("attempt to remove internal "
"xattr: %s: %s", name, strerror (op_errno)); } while (0); _gf_log
(this->name, "afr-inode-write.c", __FUNCTION__, 1906, GF_LOG_ERROR
, "attempt to remove internal " "xattr: %s: %s", name, strerror
(op_errno)); } while (0); goto out; } } while (0)
;
1907
1908 VALIDATE_OR_GOTO (frame, out)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "afr-inode-write.c"
, __FUNCTION__, 1908, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto out; } } while (0)
;
1909 VALIDATE_OR_GOTO (this->private, out)do { if (!this->private) { (*__errno_location ()) = 22; do
{ do { if (0) printf ("invalid argument: " "this->private"
); } while (0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "afr-inode-write.c", __FUNCTION__, 1909, GF_LOG_WARNING, "invalid argument: "
"this->private"); } while (0); goto out; } } while (0)
;
1910 VALIDATE_OR_GOTO (loc, out)do { if (!loc) { (*__errno_location ()) = 22; do { do { if (0
) printf ("invalid argument: " "loc"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "afr-inode-write.c"
, __FUNCTION__, 1910, GF_LOG_WARNING, "invalid argument: " "loc"
); } while (0); goto out; } } while (0)
;
1911
1912 priv = this->private;
1913
1914 QUORUM_CHECK(removexattr,out)do { if (priv->quorum_count && !afr_have_quorum(this
->name,priv)) { do { do { if (0) printf ("failing ""removexattr"
" due to lack of quorum"); } while (0); _gf_log (this->name
, "afr-inode-write.c", __FUNCTION__, 1914, GF_LOG_WARNING, "failing "
"removexattr"" due to lack of quorum"); } while (0); op_errno
= 30; goto out; } } while (0);
;
1915
1916 transaction_frame = copy_frame (frame);
1917 if (!transaction_frame) {
1918 op_errno = ENOMEM12;
1919 goto out;
1920 }
1921
1922 AFR_LOCAL_ALLOC_OR_GOTO (transaction_frame->local, out)do { transaction_frame->local = mem_get0 ((*__glusterfs_this_location
())->local_pool); if (!transaction_frame->local) { do {
do { if (0) printf ("out of memory :("); } while (0); _gf_log
(this->name, "afr-inode-write.c", __FUNCTION__, 1922, GF_LOG_ERROR
, "out of memory :("); } while (0); op_errno = 12; goto out; }
} while (0);
;
1923 local = transaction_frame->local;
1924
1925 ret = afr_local_init (local, priv, &op_errno);
1926 if (ret < 0)
1927 goto out;
1928
1929 local->cont.removexattr.name = gf_strdup (name);
1930
1931 local->transaction.fop = afr_removexattr_wind;
1932 local->transaction.done = afr_removexattr_done;
1933 local->transaction.unwind = afr_removexattr_unwind;
1934
1935 loc_copy (&local->loc, loc);
1936
1937 local->transaction.main_frame = frame;
1938 local->transaction.start = LLONG_MAX9223372036854775807LL - 1;
1939 local->transaction.len = 0;
1940
1941 ret = afr_transaction (transaction_frame, this, AFR_METADATA_TRANSACTION);
1942 if (ret < 0) {
1943 op_errno = -ret;
1944 goto out;
1945 }
1946
1947 ret = 0;
1948out:
1949 if (ret < 0) {
1950 if (transaction_frame)
1951 AFR_STACK_DESTROY (transaction_frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = transaction_frame->local; __this = transaction_frame
->this; transaction_frame->local = ((void*)0); STACK_DESTROY
(transaction_frame->root); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0);
;
1952 AFR_STACK_UNWIND (removexattr, frame, -1, op_errno, NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_removexattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "afr-inode-write.c"
, __FUNCTION__, 1952, GF_LOG_CRITICAL, "!frame"); } while (0)
; break; } fn = (fop_removexattr_cbk_t )frame->ret; _parent
= frame->parent; pthread_spin_lock (&frame->root->
stack_lock); { _parent->ref_count--; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); if (__local) { afr_local_cleanup (__local, __this
); mem_put (__local); } } while (0)
;
1953 }
1954
1955 return 0;
1956}
1957
1958/* ffremovexattr */
1959int
1960afr_fremovexattr_unwind (call_frame_t *frame, xlator_t *this)
1961{
1962 afr_local_t * local = NULL((void*)0);
1963 call_frame_t *main_frame = NULL((void*)0);
1964
1965 local = frame->local;
1966
1967 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
1968 {
1969 if (local->transaction.main_frame)
1970 main_frame = local->transaction.main_frame;
1971 local->transaction.main_frame = NULL((void*)0);
1972 }
1973 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
1974
1975 if (main_frame) {
1976 AFR_STACK_UNWIND (fremovexattr, main_frame,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_fremovexattr_cbk_t fn = ((void*)0); call_frame_t *_parent
= ((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 1978, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_fremovexattr_cbk_t
)main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); if (__local) { afr_local_cleanup (__local, __this
); mem_put (__local); } } while (0)
1977 local->op_ret, local->op_errno,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_fremovexattr_cbk_t fn = ((void*)0); call_frame_t *_parent
= ((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 1978, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_fremovexattr_cbk_t
)main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); if (__local) { afr_local_cleanup (__local, __this
); mem_put (__local); } } while (0)
1978 NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_fremovexattr_cbk_t fn = ((void*)0); call_frame_t *_parent
= ((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "afr-inode-write.c", __FUNCTION__, 1978, GF_LOG_CRITICAL
, "!frame"); } while (0); break; } fn = (fop_fremovexattr_cbk_t
)main_frame->ret; _parent = main_frame->parent; pthread_spin_lock
(&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); if (__local) { afr_local_cleanup (__local, __this
); mem_put (__local); } } while (0)
;
1979 }
1980 return 0;
1981}
1982
1983
1984int
1985afr_fremovexattr_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1986 int32_t op_ret, int32_t op_errno, dict_t *xdata)
1987{
1988 afr_local_t * local = NULL((void*)0);
1989 afr_private_t * priv = NULL((void*)0);
1990 int call_count = -1;
1991 int need_unwind = 0;
1992
1993 local = frame->local;
1994 priv = this->private;
1995
1996 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
1997 {
1998 if (op_ret != -1) {
1999 if (local->success_count == 0) {
2000 local->op_ret = op_ret;
2001 }
2002 local->success_count++;
2003
2004 if (local->success_count == priv->wait_count) {
2005 need_unwind = 1;
2006 }
2007 }
2008
2009 local->op_errno = op_errno;
2010 }
2011 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
2012
2013 if (need_unwind)
2014 local->transaction.unwind (frame, this);
2015
2016 call_count = afr_frame_return (frame);
2017
2018 if (call_count == 0) {
2019 local->transaction.resume (frame, this);
2020 }
2021
2022 return 0;
2023}
2024
2025
2026int32_t
2027afr_fremovexattr_wind (call_frame_t *frame, xlator_t *this)
2028{
2029 afr_local_t *local = NULL((void*)0);
2030 afr_private_t *priv = NULL((void*)0);
2031 int call_count = -1;
2032 int i = 0;
2033
2034 local = frame->local;
2035 priv = this->private;
2036
2037 call_count = afr_pre_op_done_children_count (local->transaction.pre_op,
2038 priv->child_count);
2039
2040 if (call_count == 0) {
2041 local->transaction.resume (frame, this);
2042 return 0;
2043 }
2044
2045 local->call_count = call_count;
2046
2047 for (i = 0; i < priv->child_count; i++) {
2048 if (local->transaction.pre_op[i]) {
2049 STACK_WIND_COOKIE (frame, afr_fremovexattr_wind_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-inode-write.c", __FUNCTION__, 2055
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fremovexattr_cbk) tmp_cbk
= afr_fremovexattr_wind_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->fremovexattr"; _new->
unwind_to = "afr_fremovexattr_wind_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->fremovexattr_cbk = afr_fremovexattr_wind_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->fremovexattr); priv->children[i]->fops->
fremovexattr (_new, priv->children[i], local->fd, local
->cont.removexattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
2050 (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-inode-write.c", __FUNCTION__, 2055
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fremovexattr_cbk) tmp_cbk
= afr_fremovexattr_wind_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->fremovexattr"; _new->
unwind_to = "afr_fremovexattr_wind_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->fremovexattr_cbk = afr_fremovexattr_wind_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->fremovexattr); priv->children[i]->fops->
fremovexattr (_new, priv->children[i], local->fd, local
->cont.removexattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
2051 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-inode-write.c", __FUNCTION__, 2055
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fremovexattr_cbk) tmp_cbk
= afr_fremovexattr_wind_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->fremovexattr"; _new->
unwind_to = "afr_fremovexattr_wind_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->fremovexattr_cbk = afr_fremovexattr_wind_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->fremovexattr); priv->children[i]->fops->
fremovexattr (_new, priv->children[i], local->fd, local
->cont.removexattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
2052 priv->children[i]->fops->fremovexattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "afr-inode-write.c", __FUNCTION__, 2055
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fremovexattr_cbk) tmp_cbk
= afr_fremovexattr_wind_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->fremovexattr"; _new->
unwind_to = "afr_fremovexattr_wind_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->fremovexattr_cbk = afr_fremovexattr_wind_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->fremovexattr); priv->children[i]->fops->
fremovexattr (_new, priv->children[i], local->fd, local
->cont.removexattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
2053 local->fd,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-inode-write.c", __FUNCTION__, 2055
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fremovexattr_cbk) tmp_cbk
= afr_fremovexattr_wind_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->fremovexattr"; _new->
unwind_to = "afr_fremovexattr_wind_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->fremovexattr_cbk = afr_fremovexattr_wind_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->fremovexattr); priv->children[i]->fops->
fremovexattr (_new, priv->children[i], local->fd, local
->cont.removexattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
2054 local->cont.removexattr.name,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-inode-write.c", __FUNCTION__, 2055
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fremovexattr_cbk) tmp_cbk
= afr_fremovexattr_wind_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->fremovexattr"; _new->
unwind_to = "afr_fremovexattr_wind_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->fremovexattr_cbk = afr_fremovexattr_wind_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->fremovexattr); priv->children[i]->fops->
fremovexattr (_new, priv->children[i], local->fd, local
->cont.removexattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
2055 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-inode-write.c", __FUNCTION__, 2055
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fremovexattr_cbk) tmp_cbk
= afr_fremovexattr_wind_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->fremovexattr"; _new->
unwind_to = "afr_fremovexattr_wind_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->fremovexattr_cbk = afr_fremovexattr_wind_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->fremovexattr); priv->children[i]->fops->
fremovexattr (_new, priv->children[i], local->fd, local
->cont.removexattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
2056
2057 if (!--call_count)
2058 break;
2059 }
2060 }
2061
2062 return 0;
2063}
2064
2065
2066int
2067afr_fremovexattr_done (call_frame_t *frame, xlator_t *this)
2068{
2069 afr_local_t * local = frame->local;
2070
2071 local->transaction.unwind (frame, this);
2072
2073 AFR_STACK_DESTROY (frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = frame->local; __this = frame->this;
frame->local = ((void*)0); STACK_DESTROY (frame->root)
; if (__local) { afr_local_cleanup (__local, __this); mem_put
(__local); } } while (0);
;
2074
2075 return 0;
2076}
2077
2078
2079int
2080afr_fremovexattr (call_frame_t *frame, xlator_t *this,
2081 fd_t *fd, const char *name, dict_t *xdata)
2082{
2083 afr_private_t * priv = NULL((void*)0);
2084 afr_local_t * local = NULL((void*)0);
2085 call_frame_t *transaction_frame = NULL((void*)0);
2086 int ret = -1;
2087 int op_ret = -1;
2088 int op_errno = 0;
2089
2090 VALIDATE_OR_GOTO (this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "afr-inode-write.c"
, __FUNCTION__, 2090, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto out; } } while (0)
;
2091
2092 GF_IF_NATIVE_XATTR_GOTO ("trusted.afr.*",do { if (!name) { do { do { if (0) printf ("no key for removexattr"
); } while (0); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__
, 2093, GF_LOG_ERROR, "no key for removexattr"); } while (0);
goto out; } if (!fnmatch ("trusted.afr.*", name, 0)) { op_errno
= 1; do { do { if (0) printf ("attempt to remove internal " "xattr: %s: %s"
, name, strerror (op_errno)); } while (0); _gf_log (this->
name, "afr-inode-write.c", __FUNCTION__, 2093, GF_LOG_ERROR, "attempt to remove internal "
"xattr: %s: %s", name, strerror (op_errno)); } while (0); goto
out; } } while (0)
2093 name, op_errno, out)do { if (!name) { do { do { if (0) printf ("no key for removexattr"
); } while (0); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__
, 2093, GF_LOG_ERROR, "no key for removexattr"); } while (0);
goto out; } if (!fnmatch ("trusted.afr.*", name, 0)) { op_errno
= 1; do { do { if (0) printf ("attempt to remove internal " "xattr: %s: %s"
, name, strerror (op_errno)); } while (0); _gf_log (this->
name, "afr-inode-write.c", __FUNCTION__, 2093, GF_LOG_ERROR, "attempt to remove internal "
"xattr: %s: %s", name, strerror (op_errno)); } while (0); goto
out; } } while (0)
;
2094
2095 GF_IF_NATIVE_XATTR_GOTO ("trusted.glusterfs.afr.*",do { if (!name) { do { do { if (0) printf ("no key for removexattr"
); } while (0); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__
, 2096, GF_LOG_ERROR, "no key for removexattr"); } while (0);
goto out; } if (!fnmatch ("trusted.glusterfs.afr.*", name, 0
)) { op_errno = 1; do { do { if (0) printf ("attempt to remove internal "
"xattr: %s: %s", name, strerror (op_errno)); } while (0); _gf_log
(this->name, "afr-inode-write.c", __FUNCTION__, 2096, GF_LOG_ERROR
, "attempt to remove internal " "xattr: %s: %s", name, strerror
(op_errno)); } while (0); goto out; } } while (0)
2096 name, op_errno, out)do { if (!name) { do { do { if (0) printf ("no key for removexattr"
); } while (0); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__
, 2096, GF_LOG_ERROR, "no key for removexattr"); } while (0);
goto out; } if (!fnmatch ("trusted.glusterfs.afr.*", name, 0
)) { op_errno = 1; do { do { if (0) printf ("attempt to remove internal "
"xattr: %s: %s", name, strerror (op_errno)); } while (0); _gf_log
(this->name, "afr-inode-write.c", __FUNCTION__, 2096, GF_LOG_ERROR
, "attempt to remove internal " "xattr: %s: %s", name, strerror
(op_errno)); } while (0); goto out; } } while (0)
;
2097
2098 VALIDATE_OR_GOTO (frame, out)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "afr-inode-write.c"
, __FUNCTION__, 2098, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto out; } } while (0)
;
2099 VALIDATE_OR_GOTO (this->private, out)do { if (!this->private) { (*__errno_location ()) = 22; do
{ do { if (0) printf ("invalid argument: " "this->private"
); } while (0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "afr-inode-write.c", __FUNCTION__, 2099, GF_LOG_WARNING, "invalid argument: "
"this->private"); } while (0); goto out; } } while (0)
;
2100
2101 priv = this->private;
2102 if (afr_is_split_brain (this, fd->inode)) {
2103 op_errno = EIO5;
2104 goto out;
2105 }
2106
2107 QUORUM_CHECK(fremovexattr, out)do { if (priv->quorum_count && !afr_have_quorum(this
->name,priv)) { do { do { if (0) printf ("failing ""fremovexattr"
" due to lack of quorum"); } while (0); _gf_log (this->name
, "afr-inode-write.c", __FUNCTION__, 2107, GF_LOG_WARNING, "failing "
"fremovexattr"" due to lack of quorum"); } while (0); op_errno
= 30; goto out; } } while (0);
;
2108
2109 transaction_frame = copy_frame (frame);
2110 if (!transaction_frame) {
2111 goto out;
2112 }
2113
2114 AFR_LOCAL_ALLOC_OR_GOTO (local, out)do { local = mem_get0 ((*__glusterfs_this_location())->local_pool
); if (!local) { do { do { if (0) printf ("out of memory :(")
; } while (0); _gf_log (this->name, "afr-inode-write.c", __FUNCTION__
, 2114, GF_LOG_ERROR, "out of memory :("); } while (0); op_errno
= 12; goto out; } } while (0);
;
2115
2116 ret = afr_local_init (local, priv, &op_errno);
2117 if (ret < 0) {
2118 op_errno = -ret;
2119 goto out;
2120 }
2121
2122 transaction_frame->local = local;
2123
2124 local->op_ret = -1;
2125
2126 local->cont.removexattr.name = gf_strdup (name);
2127
2128 local->transaction.fop = afr_fremovexattr_wind;
2129 local->transaction.done = afr_fremovexattr_done;
2130 local->transaction.unwind = afr_fremovexattr_unwind;
2131
2132 local->fd = fd_ref (fd);
2133
2134 local->transaction.main_frame = frame;
2135 local->transaction.start = LLONG_MAX9223372036854775807LL - 1;
2136 local->transaction.len = 0;
2137
2138 op_ret = afr_transaction (transaction_frame, this, AFR_METADATA_TRANSACTION);
2139 if (op_ret < 0) {
2140 op_errno = -op_ret;
2141 goto out;
2142 }
2143
2144 op_ret = 0;
2145out:
2146 if (op_ret < 0) {
2147 if (transaction_frame)
2148 AFR_STACK_DESTROY (transaction_frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = transaction_frame->local; __this = transaction_frame
->this; transaction_frame->local = ((void*)0); STACK_DESTROY
(transaction_frame->root); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0);
;
2149 AFR_STACK_UNWIND (fremovexattr, frame, op_ret, op_errno, NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_fremovexattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "afr-inode-write.c"
, __FUNCTION__, 2149, GF_LOG_CRITICAL, "!frame"); } while (0)
; break; } fn = (fop_fremovexattr_cbk_t )frame->ret; _parent
= frame->parent; pthread_spin_lock (&frame->root->
stack_lock); { _parent->ref_count--; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, op_ret
, op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); if (__local) { afr_local_cleanup (__local, __this
); mem_put (__local); } } while (0)
;
2150 }
2151
2152 return 0;
2153}