File: | xlators/features/marker/src/marker.c |
Location: | line 124, column 14 |
Description: | Dereference of null pointer |
1 | /* | |||
2 | Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com> | |||
3 | This file is part of GlusterFS. | |||
4 | ||||
5 | This file is licensed to you under your choice of the GNU Lesser | |||
6 | General Public License, version 3 or any later version (LGPLv3 or | |||
7 | later), or the GNU General Public License, version 2 (GPLv2), in all | |||
8 | cases as published by the Free Software Foundation. | |||
9 | */ | |||
10 | #ifndef _CONFIG_H | |||
11 | #define _CONFIG_H | |||
12 | #include "config.h" | |||
13 | #endif | |||
14 | ||||
15 | #include "xlator.h" | |||
16 | #include "defaults.h" | |||
17 | #include "libxlator.h" | |||
18 | #include "marker.h" | |||
19 | #include "marker-mem-types.h" | |||
20 | #include "marker-quota.h" | |||
21 | #include "marker-quota-helper.h" | |||
22 | #include "marker-common.h" | |||
23 | #include "byte-order.h" | |||
24 | ||||
25 | #define _GF_UID_GID_CHANGED1 1 | |||
26 | ||||
27 | void | |||
28 | fini (xlator_t *this); | |||
29 | ||||
30 | int32_t | |||
31 | marker_start_setxattr (call_frame_t *, xlator_t *); | |||
32 | ||||
33 | marker_local_t * | |||
34 | marker_local_ref (marker_local_t *local) | |||
35 | { | |||
36 | GF_VALIDATE_OR_GOTO ("marker", local, err)do { if (!local) { (*__errno_location ()) = 22; do { do { if ( 0) printf ("invalid argument: " "local"); } while (0); _gf_log_callingfn ("marker", "marker.c", __FUNCTION__, 36, GF_LOG_ERROR, "invalid argument: " "local"); } while (0); goto err; } } while (0); | |||
37 | ||||
38 | LOCK (&local->lock)pthread_spin_lock (&local->lock); | |||
39 | { | |||
40 | local->ref++; | |||
41 | } | |||
42 | UNLOCK (&local->lock)pthread_spin_unlock (&local->lock); | |||
43 | ||||
44 | return local; | |||
45 | err: | |||
46 | return NULL((void*)0); | |||
47 | } | |||
48 | ||||
49 | int | |||
50 | marker_loc_fill (loc_t *loc, inode_t *inode, inode_t *parent, char *path) | |||
51 | { | |||
52 | int ret = -1; | |||
53 | ||||
54 | if (!loc) | |||
55 | return ret; | |||
56 | ||||
57 | if (inode) { | |||
58 | loc->inode = inode_ref (inode); | |||
59 | if (uuid_is_null (loc->gfid)) { | |||
60 | uuid_copy (loc->gfid, loc->inode->gfid); | |||
61 | } | |||
62 | } | |||
63 | ||||
64 | if (parent) | |||
65 | loc->parent = inode_ref (parent); | |||
66 | ||||
67 | if (path) { | |||
68 | loc->path = gf_strdup (path); | |||
69 | if (!loc->path) { | |||
70 | gf_log ("loc fill", GF_LOG_ERROR, "strdup failed")do { do { if (0) printf ("strdup failed"); } while (0); _gf_log ("loc fill", "marker.c", __FUNCTION__, 70, GF_LOG_ERROR, "strdup failed" ); } while (0); | |||
71 | goto loc_wipe; | |||
72 | } | |||
73 | ||||
74 | loc->name = strrchr (loc->path, '/'); | |||
75 | if (loc->name) | |||
76 | loc->name++; | |||
77 | } | |||
78 | ||||
79 | ret = 0; | |||
80 | loc_wipe: | |||
81 | if (ret < 0) | |||
82 | loc_wipe (loc); | |||
83 | ||||
84 | return ret; | |||
85 | } | |||
86 | ||||
87 | int | |||
88 | marker_inode_loc_fill (inode_t *inode, loc_t *loc) | |||
89 | { | |||
90 | char *resolvedpath = NULL((void*)0); | |||
91 | int ret = -1; | |||
92 | inode_t *parent = NULL((void*)0); | |||
93 | ||||
94 | if ((!inode) || (!loc)) | |||
95 | return ret; | |||
96 | ||||
97 | parent = inode_parent (inode, NULL((void*)0), NULL((void*)0)); | |||
98 | ||||
99 | ret = inode_path (inode, NULL((void*)0), &resolvedpath); | |||
100 | if (ret < 0) | |||
101 | goto err; | |||
102 | ||||
103 | ret = marker_loc_fill (loc, inode, parent, resolvedpath); | |||
104 | if (ret < 0) | |||
105 | goto err; | |||
106 | ||||
107 | err: | |||
108 | if (parent) | |||
109 | inode_unref (parent); | |||
110 | ||||
111 | GF_FREE (resolvedpath)__gf_free (resolvedpath); | |||
112 | ||||
113 | return ret; | |||
114 | } | |||
115 | ||||
116 | int32_t | |||
117 | marker_trav_parent (marker_local_t *local) | |||
118 | { | |||
119 | int32_t ret = 0; | |||
120 | loc_t loc = {0, }; | |||
121 | inode_t *parent = NULL((void*)0); | |||
122 | int8_t need_unref = 0; | |||
123 | ||||
124 | if (!local->loc.parent) { | |||
| ||||
125 | parent = inode_parent (local->loc.inode, NULL((void*)0), NULL((void*)0)); | |||
126 | if (parent) | |||
127 | need_unref = 1; | |||
128 | } else | |||
129 | parent = local->loc.parent; | |||
130 | ||||
131 | ret = marker_inode_loc_fill (parent, &loc); | |||
132 | ||||
133 | if (ret < 0) { | |||
134 | ret = -1; | |||
135 | goto out; | |||
136 | } | |||
137 | ||||
138 | loc_wipe (&local->loc); | |||
139 | ||||
140 | local->loc = loc; | |||
141 | out: | |||
142 | if (need_unref) | |||
143 | inode_unref (parent); | |||
144 | ||||
145 | return ret; | |||
146 | } | |||
147 | ||||
148 | int32_t | |||
149 | marker_error_handler (xlator_t *this, marker_local_t *local, int32_t op_errno) | |||
150 | { | |||
151 | marker_conf_t *priv = NULL((void*)0); | |||
152 | const char *path = NULL((void*)0); | |||
153 | ||||
154 | priv = (marker_conf_t *) this->private; | |||
155 | path = local | |||
156 | ? (local->loc.path | |||
157 | ? local->loc.path : uuid_utoa(local->loc.gfid)) | |||
158 | : "<nul>"; | |||
159 | ||||
160 | gf_log (this->name, GF_LOG_CRITICAL,do { do { if (0) printf ("Indexing gone corrupt at %s (reason: %s)." " Geo-replication slave content needs to be revalidated", path , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 163, GF_LOG_CRITICAL, "Indexing gone corrupt at %s (reason: %s)." " Geo-replication slave content needs to be revalidated", path , strerror (op_errno)); } while (0) | |||
161 | "Indexing gone corrupt at %s (reason: %s)."do { do { if (0) printf ("Indexing gone corrupt at %s (reason: %s)." " Geo-replication slave content needs to be revalidated", path , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 163, GF_LOG_CRITICAL, "Indexing gone corrupt at %s (reason: %s)." " Geo-replication slave content needs to be revalidated", path , strerror (op_errno)); } while (0) | |||
162 | " Geo-replication slave content needs to be revalidated",do { do { if (0) printf ("Indexing gone corrupt at %s (reason: %s)." " Geo-replication slave content needs to be revalidated", path , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 163, GF_LOG_CRITICAL, "Indexing gone corrupt at %s (reason: %s)." " Geo-replication slave content needs to be revalidated", path , strerror (op_errno)); } while (0) | |||
163 | path, strerror (op_errno))do { do { if (0) printf ("Indexing gone corrupt at %s (reason: %s)." " Geo-replication slave content needs to be revalidated", path , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 163, GF_LOG_CRITICAL, "Indexing gone corrupt at %s (reason: %s)." " Geo-replication slave content needs to be revalidated", path , strerror (op_errno)); } while (0); | |||
164 | unlink (priv->timestamp_file); | |||
165 | ||||
166 | return 0; | |||
167 | } | |||
168 | ||||
169 | int32_t | |||
170 | marker_local_unref (marker_local_t *local) | |||
171 | { | |||
172 | int32_t var = 0; | |||
173 | ||||
174 | if (local == NULL((void*)0)) | |||
175 | return -1; | |||
176 | ||||
177 | LOCK (&local->lock)pthread_spin_lock (&local->lock); | |||
178 | { | |||
179 | var = --local->ref; | |||
180 | } | |||
181 | UNLOCK (&local->lock)pthread_spin_unlock (&local->lock); | |||
182 | ||||
183 | if (var != 0) | |||
184 | goto out; | |||
185 | ||||
186 | loc_wipe (&local->loc); | |||
187 | loc_wipe (&local->parent_loc); | |||
188 | ||||
189 | if (local->oplocal) { | |||
190 | marker_local_unref (local->oplocal); | |||
191 | local->oplocal = NULL((void*)0); | |||
192 | } | |||
193 | mem_put (local); | |||
194 | out: | |||
195 | return 0; | |||
196 | } | |||
197 | ||||
198 | int32_t | |||
199 | stat_stampfile (xlator_t *this, marker_conf_t *priv, | |||
200 | struct volume_mark **status) | |||
201 | { | |||
202 | struct stat buf = {0, }; | |||
203 | struct volume_mark *vol_mark = NULL((void*)0); | |||
204 | ||||
205 | vol_mark = GF_CALLOC (sizeof (struct volume_mark), 1,__gf_calloc (sizeof (struct volume_mark), 1, gf_marker_mt_volume_mark ) | |||
206 | gf_marker_mt_volume_mark)__gf_calloc (sizeof (struct volume_mark), 1, gf_marker_mt_volume_mark ); | |||
207 | ||||
208 | vol_mark->major = 1; | |||
209 | vol_mark->minor = 0; | |||
210 | ||||
211 | GF_ASSERT (sizeof (priv->volume_uuid_bin) == 16)do { if (!(sizeof (priv->volume_uuid_bin) == 16)) { do { do { if (0) printf ("Assertion failed: " "sizeof (priv->volume_uuid_bin) == 16" ); } while (0); _gf_log_callingfn ("", "marker.c", __FUNCTION__ , 211, GF_LOG_ERROR, "Assertion failed: " "sizeof (priv->volume_uuid_bin) == 16" ); } while (0); } } while (0); | |||
212 | memcpy (vol_mark->uuid, priv->volume_uuid_bin, 16); | |||
213 | ||||
214 | if (stat (priv->timestamp_file, &buf) != -1) { | |||
215 | vol_mark->retval = 0; | |||
216 | vol_mark->sec = htonl (buf.st_ctimest_ctim.tv_sec); | |||
217 | vol_mark->usec = htonl (ST_CTIM_NSEC (&buf)((&buf)->st_ctim.tv_nsec)/1000); | |||
218 | } else | |||
219 | vol_mark->retval = 1; | |||
220 | ||||
221 | *status = vol_mark; | |||
222 | ||||
223 | return 0; | |||
224 | } | |||
225 | ||||
226 | int32_t | |||
227 | marker_getxattr_stampfile_cbk (call_frame_t *frame, xlator_t *this, | |||
228 | const char *name, struct volume_mark *vol_mark, | |||
229 | dict_t *xdata) | |||
230 | { | |||
231 | int32_t ret = -1; | |||
232 | dict_t *dict = NULL((void*)0); | |||
233 | ||||
234 | if (vol_mark == NULL((void*)0)){ | |||
235 | STACK_UNWIND_STRICT (getxattr, frame, -1, ENOMEM, NULL, NULL)do { fop_getxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 235, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_getxattr_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , 12, ((void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
236 | ||||
237 | goto out; | |||
238 | } | |||
239 | ||||
240 | dict = dict_new (); | |||
241 | ||||
242 | ret = dict_set_bin (dict, (char *)name, vol_mark, | |||
243 | sizeof (struct volume_mark)); | |||
244 | if (ret) | |||
245 | gf_log (this->name, GF_LOG_WARNING, "failed to set key %s",do { do { if (0) printf ("failed to set key %s", name); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 246, GF_LOG_WARNING , "failed to set key %s", name); } while (0) | |||
246 | name)do { do { if (0) printf ("failed to set key %s", name); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 246, GF_LOG_WARNING , "failed to set key %s", name); } while (0); | |||
247 | ||||
248 | STACK_UNWIND_STRICT (getxattr, frame, 0, 0, dict, xdata)do { fop_getxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 248, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_getxattr_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, 0, 0, dict, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
249 | ||||
250 | dict_unref (dict); | |||
251 | out: | |||
252 | return 0; | |||
253 | } | |||
254 | ||||
255 | int32_t | |||
256 | call_from_special_client (call_frame_t *frame, xlator_t *this, const char *name) | |||
257 | { | |||
258 | struct volume_mark *vol_mark = NULL((void*)0); | |||
259 | marker_conf_t *priv = NULL((void*)0); | |||
260 | gf_boolean_t ret = _gf_true; | |||
261 | ||||
262 | priv = (marker_conf_t *)this->private; | |||
263 | ||||
264 | if (frame->root->pid != GF_CLIENT_PID_GSYNCD || name == NULL((void*)0) || | |||
265 | strcmp (name, MARKER_XATTR_PREFIX"trusted.glusterfs" "." VOLUME_MARK"volume-mark") != 0) { | |||
266 | ret = _gf_false; | |||
267 | goto out; | |||
268 | } | |||
269 | ||||
270 | stat_stampfile (this, priv, &vol_mark); | |||
271 | ||||
272 | marker_getxattr_stampfile_cbk (frame, this, name, vol_mark, NULL((void*)0)); | |||
273 | out: | |||
274 | return ret; | |||
275 | } | |||
276 | ||||
277 | int32_t | |||
278 | marker_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
279 | int32_t op_ret, int32_t op_errno, dict_t *dict, | |||
280 | dict_t *xdata) | |||
281 | { | |||
282 | if (cookie) { | |||
283 | gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Filtering the quota extended attributes" ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 284, GF_LOG_DEBUG, "Filtering the quota extended attributes" ); } while (0) | |||
284 | "Filtering the quota extended attributes")do { do { if (0) printf ("Filtering the quota extended attributes" ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 284, GF_LOG_DEBUG, "Filtering the quota extended attributes" ); } while (0); | |||
285 | ||||
286 | dict_foreach_fnmatch (dict, "trusted.glusterfs.quota*", | |||
287 | marker_filter_quota_xattr, NULL((void*)0)); | |||
288 | } | |||
289 | ||||
290 | STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict, xdata)do { fop_getxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 290, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_getxattr_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||
291 | return 0; | |||
292 | } | |||
293 | ||||
294 | int32_t | |||
295 | marker_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, | |||
296 | const char *name, dict_t *xdata) | |||
297 | { | |||
298 | gf_boolean_t ret = _gf_false; | |||
299 | marker_conf_t *priv = NULL((void*)0); | |||
300 | unsigned long cookie = 0; | |||
301 | ||||
302 | priv = this->private; | |||
303 | ||||
304 | if (priv == NULL((void*)0) || (priv->feature_enabled & GF_XTIME) == 0) | |||
305 | goto wind; | |||
306 | ||||
307 | gf_log (this->name, GF_LOG_DEBUG, "USER:PID = %d", frame->root->pid)do { do { if (0) printf ("USER:PID = %d", frame->root-> pid); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 307, GF_LOG_DEBUG, "USER:PID = %d", frame->root->pid) ; } while (0); | |||
308 | ||||
309 | ret = call_from_special_client (frame, this, name); | |||
310 | wind: | |||
311 | if (ret == _gf_false) { | |||
312 | if (name == NULL((void*)0)) { | |||
313 | /* Signifies that marker translator | |||
314 | * has to filter the quota's xattr's, | |||
315 | * this is to prevent afr from performing | |||
316 | * self healing on marker-quota xattrs' | |||
317 | */ | |||
318 | cookie = 1; | |||
319 | } | |||
320 | STACK_WIND_COOKIE (frame, marker_getxattr_cbk, (void *)cookie,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", "marker.c", __FUNCTION__, 323, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = marker_getxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = (void *)cookie; _new->wind_from = __FUNCTION__; _new->wind_to = "FIRST_CHILD(this)->fops->getxattr" ; _new->unwind_to = "marker_getxattr_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 ); (this->children->xlator)->fops->getxattr_cbk = marker_getxattr_cbk; old_THIS = (*__glusterfs_this_location( )); (*__glusterfs_this_location()) = (this->children->xlator ); if ((this->children->xlator)->ctx->measure_latency ) gf_latency_begin (_new, (this->children->xlator)-> fops->getxattr); (this->children->xlator)->fops-> getxattr (_new, (this->children->xlator), loc, name, xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
321 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 323, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = marker_getxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = (void *)cookie; _new->wind_from = __FUNCTION__; _new->wind_to = "FIRST_CHILD(this)->fops->getxattr" ; _new->unwind_to = "marker_getxattr_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 ); (this->children->xlator)->fops->getxattr_cbk = marker_getxattr_cbk; old_THIS = (*__glusterfs_this_location( )); (*__glusterfs_this_location()) = (this->children->xlator ); if ((this->children->xlator)->ctx->measure_latency ) gf_latency_begin (_new, (this->children->xlator)-> fops->getxattr); (this->children->xlator)->fops-> getxattr (_new, (this->children->xlator), loc, name, xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
322 | FIRST_CHILD(this)->fops->getxattr, 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", "marker.c", __FUNCTION__, 323, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = marker_getxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = (void *)cookie; _new->wind_from = __FUNCTION__; _new->wind_to = "FIRST_CHILD(this)->fops->getxattr" ; _new->unwind_to = "marker_getxattr_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 ); (this->children->xlator)->fops->getxattr_cbk = marker_getxattr_cbk; old_THIS = (*__glusterfs_this_location( )); (*__glusterfs_this_location()) = (this->children->xlator ); if ((this->children->xlator)->ctx->measure_latency ) gf_latency_begin (_new, (this->children->xlator)-> fops->getxattr); (this->children->xlator)->fops-> getxattr (_new, (this->children->xlator), loc, name, xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
323 | name, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 323, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = marker_getxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = (void *)cookie; _new->wind_from = __FUNCTION__; _new->wind_to = "FIRST_CHILD(this)->fops->getxattr" ; _new->unwind_to = "marker_getxattr_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 ); (this->children->xlator)->fops->getxattr_cbk = marker_getxattr_cbk; old_THIS = (*__glusterfs_this_location( )); (*__glusterfs_this_location()) = (this->children->xlator ); if ((this->children->xlator)->ctx->measure_latency ) gf_latency_begin (_new, (this->children->xlator)-> fops->getxattr); (this->children->xlator)->fops-> getxattr (_new, (this->children->xlator), loc, name, xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
324 | } | |||
325 | ||||
326 | return 0; | |||
327 | } | |||
328 | ||||
329 | ||||
330 | int32_t | |||
331 | marker_setxattr_done (call_frame_t *frame) | |||
332 | { | |||
333 | marker_local_t *local = NULL((void*)0); | |||
334 | ||||
335 | local = (marker_local_t *) frame->local; | |||
336 | ||||
337 | frame->local = NULL((void*)0); | |||
338 | ||||
339 | STACK_DESTROY (frame->root); | |||
340 | ||||
341 | marker_local_unref (local); | |||
342 | ||||
343 | return 0; | |||
344 | } | |||
345 | ||||
346 | int | |||
347 | marker_specific_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
348 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | |||
349 | { | |||
350 | int32_t ret = 0; | |||
351 | int32_t done = 0; | |||
352 | marker_local_t *local = NULL((void*)0); | |||
353 | ||||
354 | local = (marker_local_t*) frame->local; | |||
| ||||
355 | ||||
356 | if (op_ret == -1 && op_errno == ENOSPC28) { | |||
357 | marker_error_handler (this, local, op_errno); | |||
358 | done = 1; | |||
359 | goto out; | |||
360 | } | |||
361 | ||||
362 | if (local) { | |||
363 | if (local->loc.path && strcmp (local->loc.path, "/") == 0) { | |||
364 | done = 1; | |||
365 | goto out; | |||
366 | } | |||
367 | if (__is_root_gfid (local->loc.gfid)) { | |||
368 | done = 1; | |||
369 | goto out; | |||
370 | } | |||
371 | } | |||
372 | ||||
373 | ret = marker_trav_parent (local); | |||
374 | ||||
375 | if (ret == -1) { | |||
376 | gf_log (this->name, GF_LOG_DEBUG, "Error occurred "do { do { if (0) printf ("Error occurred " "while traversing to the parent, stopping marker" ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 377, GF_LOG_DEBUG, "Error occurred " "while traversing to the parent, stopping marker" ); } while (0) | |||
377 | "while traversing to the parent, stopping marker")do { do { if (0) printf ("Error occurred " "while traversing to the parent, stopping marker" ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 377, GF_LOG_DEBUG, "Error occurred " "while traversing to the parent, stopping marker" ); } while (0); | |||
378 | ||||
379 | done = 1; | |||
380 | ||||
381 | goto out; | |||
382 | } | |||
383 | ||||
384 | marker_start_setxattr (frame, this); | |||
385 | ||||
386 | out: | |||
387 | if (done) { | |||
388 | marker_setxattr_done (frame); | |||
389 | } | |||
390 | ||||
391 | return 0; | |||
392 | } | |||
393 | ||||
394 | int32_t | |||
395 | marker_start_setxattr (call_frame_t *frame, xlator_t *this) | |||
396 | { | |||
397 | int32_t ret = -1; | |||
398 | dict_t *dict = NULL((void*)0); | |||
399 | marker_local_t *local = NULL((void*)0); | |||
400 | marker_conf_t *priv = NULL((void*)0); | |||
401 | ||||
402 | priv = this->private; | |||
403 | ||||
404 | local = (marker_local_t*) frame->local; | |||
405 | ||||
406 | if (!local) | |||
407 | goto out; | |||
408 | ||||
409 | dict = dict_new (); | |||
410 | ||||
411 | if (!dict) | |||
412 | goto out; | |||
413 | ||||
414 | if (local->loc.inode && uuid_is_null (local->loc.gfid)) | |||
415 | uuid_copy (local->loc.gfid, local->loc.inode->gfid); | |||
416 | ||||
417 | GF_UUID_ASSERT (local->loc.gfid)if (uuid_is_null (local->loc.gfid)) do { if (!(!"uuid null" )) { do { do { if (0) printf ("Assertion failed: " "!\"uuid null\"" ); } while (0); _gf_log_callingfn ("", "marker.c", __FUNCTION__ , 417, GF_LOG_ERROR, "Assertion failed: " "!\"uuid null\""); } while (0); } } while (0);; | |||
418 | ||||
419 | ret = dict_set_static_bin (dict, priv->marker_xattr, | |||
420 | (void *)local->timebuf, 8); | |||
421 | if (ret) { | |||
422 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("failed to set marker xattr (%s)", local ->loc.path); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 423, GF_LOG_WARNING, "failed to set marker xattr (%s)" , local->loc.path); } while (0) | |||
423 | "failed to set marker xattr (%s)", local->loc.path)do { do { if (0) printf ("failed to set marker xattr (%s)", local ->loc.path); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 423, GF_LOG_WARNING, "failed to set marker xattr (%s)" , local->loc.path); } while (0); | |||
424 | goto out; | |||
425 | } | |||
426 | ||||
427 | STACK_WIND (frame, marker_specific_setxattr_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 429, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setxattr_cbk) tmp_cbk = marker_specific_setxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->setxattr" ; _new->unwind_to = "marker_specific_setxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->setxattr); (this->children->xlator )->fops->setxattr (_new, (this->children->xlator) , &local->loc, dict, 0, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
428 | FIRST_CHILD(this)->fops->setxattr, &local->loc, dict, 0,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", "marker.c", __FUNCTION__, 429, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setxattr_cbk) tmp_cbk = marker_specific_setxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->setxattr" ; _new->unwind_to = "marker_specific_setxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->setxattr); (this->children->xlator )->fops->setxattr (_new, (this->children->xlator) , &local->loc, dict, 0, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
429 | 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", "marker.c", __FUNCTION__, 429, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setxattr_cbk) tmp_cbk = marker_specific_setxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->setxattr" ; _new->unwind_to = "marker_specific_setxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->setxattr); (this->children->xlator )->fops->setxattr (_new, (this->children->xlator) , &local->loc, dict, 0, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
430 | ||||
431 | ret = 0; | |||
432 | out: | |||
433 | if (dict) | |||
434 | dict_unref (dict); | |||
435 | ||||
436 | return ret; | |||
437 | } | |||
438 | ||||
439 | void | |||
440 | marker_gettimeofday (marker_local_t *local) | |||
441 | { | |||
442 | struct timeval tv = {0, }; | |||
443 | ||||
444 | gettimeofday (&tv, NULL((void*)0)); | |||
445 | ||||
446 | local->timebuf [0] = htonl (tv.tv_sec); | |||
447 | local->timebuf [1] = htonl (tv.tv_usec); | |||
448 | ||||
449 | return; | |||
450 | } | |||
451 | ||||
452 | int32_t | |||
453 | marker_create_frame (xlator_t *this, marker_local_t *local) | |||
454 | { | |||
455 | call_frame_t *frame = NULL((void*)0); | |||
456 | ||||
457 | frame = create_frame (this, this->ctx->pool); | |||
458 | ||||
459 | frame->local = (void *) local; | |||
460 | ||||
461 | marker_start_setxattr (frame, this); | |||
462 | ||||
463 | return 0; | |||
464 | } | |||
465 | ||||
466 | int32_t | |||
467 | marker_xtime_update_marks (xlator_t *this, marker_local_t *local) | |||
468 | { | |||
469 | GF_VALIDATE_OR_GOTO ("marker", this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if ( 0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn ("marker", "marker.c", __FUNCTION__, 469, GF_LOG_ERROR, "invalid argument: " "this"); } while (0); goto out; } } while (0); | |||
470 | GF_VALIDATE_OR_GOTO (this->name, local, out)do { if (!local) { (*__errno_location ()) = 22; do { do { if ( 0) printf ("invalid argument: " "local"); } while (0); _gf_log_callingfn (this->name, "marker.c", __FUNCTION__, 470, GF_LOG_ERROR, "invalid argument: " "local"); } while (0); goto out; } } while (0); | |||
471 | ||||
472 | if ((local->pid == GF_CLIENT_PID_GSYNCD) || | |||
473 | (local->pid == GF_CLIENT_PID_DEFRAG)) | |||
474 | goto out; | |||
475 | ||||
476 | marker_gettimeofday (local); | |||
477 | ||||
478 | marker_local_ref (local); | |||
479 | ||||
480 | marker_create_frame (this, local); | |||
481 | out: | |||
482 | return 0; | |||
483 | } | |||
484 | ||||
485 | ||||
486 | int32_t | |||
487 | marker_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
488 | int32_t op_ret, int32_t op_errno, inode_t *inode, | |||
489 | struct iatt *buf, struct iatt *preparent, | |||
490 | struct iatt *postparent, dict_t *xdata) | |||
491 | { | |||
492 | marker_conf_t *priv = NULL((void*)0); | |||
493 | marker_local_t *local = NULL((void*)0); | |||
494 | ||||
495 | if (op_ret == -1) { | |||
496 | gf_log (this->name, GF_LOG_TRACE, "error occurred "do { do { if (0) printf ("error occurred " "while Creating a file %s" , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 497, GF_LOG_TRACE, "error occurred " "while Creating a file %s" , strerror (op_errno)); } while (0) | |||
497 | "while Creating a file %s", strerror (op_errno))do { do { if (0) printf ("error occurred " "while Creating a file %s" , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 497, GF_LOG_TRACE, "error occurred " "while Creating a file %s" , strerror (op_errno)); } while (0); | |||
498 | } | |||
499 | ||||
500 | local = (marker_local_t *) frame->local; | |||
501 | ||||
502 | frame->local = NULL((void*)0); | |||
503 | ||||
504 | STACK_UNWIND_STRICT (mkdir, frame, op_ret, op_errno, inode,do { fop_mkdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 505, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_mkdir_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
505 | buf, preparent, postparent, xdata)do { fop_mkdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 505, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_mkdir_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
506 | ||||
507 | if (op_ret == -1 || local == NULL((void*)0)) | |||
508 | goto out; | |||
509 | ||||
510 | if (uuid_is_null (local->loc.gfid)) | |||
511 | uuid_copy (local->loc.gfid, buf->ia_gfid); | |||
512 | ||||
513 | priv = this->private; | |||
514 | ||||
515 | if (priv->feature_enabled & GF_QUOTA) | |||
516 | mq_set_inode_xattr (this, &local->loc); | |||
517 | ||||
518 | if (priv->feature_enabled & GF_XTIME) | |||
519 | marker_xtime_update_marks (this, local); | |||
520 | ||||
521 | out: | |||
522 | marker_local_unref (local); | |||
523 | ||||
524 | return 0; | |||
525 | } | |||
526 | ||||
527 | int | |||
528 | marker_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, | |||
529 | mode_t umask, dict_t *xdata) | |||
530 | { | |||
531 | int32_t ret = 0; | |||
532 | marker_local_t *local = NULL((void*)0); | |||
533 | marker_conf_t *priv = NULL((void*)0); | |||
534 | ||||
535 | priv = this->private; | |||
536 | ||||
537 | if (priv->feature_enabled == 0) | |||
538 | goto wind; | |||
539 | ||||
540 | local = mem_get0 (this->local_pool); | |||
541 | ||||
542 | MARKER_INIT_LOCAL (frame, local)do { frame->local = local; local->pid = frame->root-> pid; memset (&local->loc, 0, sizeof (loc_t)); local-> ref = 1; local->uid = -1; local->gid = -1; pthread_spin_init (&local->lock, 0); local->oplocal = ((void*)0); } while (0); | |||
543 | ||||
544 | ret = loc_copy (&local->loc, loc); | |||
545 | ||||
546 | if (ret == -1) | |||
547 | goto err; | |||
548 | wind: | |||
549 | STACK_WIND (frame, marker_mkdir_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 550, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mkdir_cbk) tmp_cbk = marker_mkdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->mkdir"; _new ->unwind_to = "marker_mkdir_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->mkdir); (this->children->xlator )->fops->mkdir (_new, (this->children->xlator), loc , mode, umask, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||
550 | FIRST_CHILD(this)->fops->mkdir, loc, mode, umask, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 550, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mkdir_cbk) tmp_cbk = marker_mkdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->mkdir"; _new ->unwind_to = "marker_mkdir_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->mkdir); (this->children->xlator )->fops->mkdir (_new, (this->children->xlator), loc , mode, umask, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||
551 | ||||
552 | return 0; | |||
553 | err: | |||
554 | STACK_UNWIND_STRICT (mkdir, frame, -1, ENOMEM, NULL,do { fop_mkdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 555, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_mkdir_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , 12, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void* )0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
555 | NULL, NULL, NULL, NULL)do { fop_mkdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 555, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_mkdir_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , 12, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void* )0)); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
556 | return 0; | |||
557 | } | |||
558 | ||||
559 | ||||
560 | int32_t | |||
561 | marker_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
562 | int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode, | |||
563 | struct iatt *buf, struct iatt *preparent, | |||
564 | struct iatt *postparent, dict_t *xdata) | |||
565 | { | |||
566 | marker_local_t *local = NULL((void*)0); | |||
567 | marker_conf_t *priv = NULL((void*)0); | |||
568 | ||||
569 | if (op_ret == -1) { | |||
570 | gf_log (this->name, GF_LOG_TRACE, "error occurred "do { do { if (0) printf ("error occurred " "while Creating a file %s" , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 571, GF_LOG_TRACE, "error occurred " "while Creating a file %s" , strerror (op_errno)); } while (0) | |||
571 | "while Creating a file %s", strerror (op_errno))do { do { if (0) printf ("error occurred " "while Creating a file %s" , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 571, GF_LOG_TRACE, "error occurred " "while Creating a file %s" , strerror (op_errno)); } while (0); | |||
572 | } | |||
573 | ||||
574 | local = (marker_local_t *) frame->local; | |||
575 | ||||
576 | frame->local = NULL((void*)0); | |||
577 | ||||
578 | STACK_UNWIND_STRICT (create, frame, op_ret, op_errno, fd, inode, buf,do { fop_create_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 579, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_create_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, fd, inode, buf, preparent, postparent, xdata); (* __glusterfs_this_location()) = old_THIS; } while (0) | |||
579 | preparent, postparent, xdata)do { fop_create_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 579, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_create_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, fd, inode, buf, preparent, postparent, xdata); (* __glusterfs_this_location()) = old_THIS; } while (0); | |||
580 | ||||
581 | if (op_ret == -1 || local == NULL((void*)0)) | |||
582 | goto out; | |||
583 | ||||
584 | if (uuid_is_null (local->loc.gfid)) | |||
585 | uuid_copy (local->loc.gfid, buf->ia_gfid); | |||
586 | ||||
587 | priv = this->private; | |||
588 | ||||
589 | if (priv->feature_enabled & GF_QUOTA) | |||
590 | mq_set_inode_xattr (this, &local->loc); | |||
591 | ||||
592 | if (priv->feature_enabled & GF_XTIME) | |||
593 | marker_xtime_update_marks (this, local); | |||
594 | ||||
595 | out: | |||
596 | marker_local_unref (local); | |||
597 | ||||
598 | return 0; | |||
599 | } | |||
600 | ||||
601 | int32_t | |||
602 | marker_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, | |||
603 | mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata) | |||
604 | { | |||
605 | int32_t ret = 0; | |||
606 | marker_local_t *local = NULL((void*)0); | |||
607 | marker_conf_t *priv = NULL((void*)0); | |||
608 | ||||
609 | priv = this->private; | |||
610 | ||||
611 | if (priv->feature_enabled == 0) | |||
612 | goto wind; | |||
613 | ||||
614 | local = mem_get0 (this->local_pool); | |||
615 | ||||
616 | MARKER_INIT_LOCAL (frame, local)do { frame->local = local; local->pid = frame->root-> pid; memset (&local->loc, 0, sizeof (loc_t)); local-> ref = 1; local->uid = -1; local->gid = -1; pthread_spin_init (&local->lock, 0); local->oplocal = ((void*)0); } while (0); | |||
617 | ||||
618 | ret = loc_copy (&local->loc, loc); | |||
619 | ||||
620 | if (ret == -1) | |||
621 | goto err; | |||
622 | wind: | |||
623 | STACK_WIND (frame, marker_create_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 625, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->create_cbk) tmp_cbk = marker_create_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->create"; _new->unwind_to = "marker_create_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->create); (this->children->xlator )->fops->create (_new, (this->children->xlator), loc , flags, mode, umask, fd, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
624 | FIRST_CHILD(this)->fops->create, loc, flags, mode, umask,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", "marker.c", __FUNCTION__, 625, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->create_cbk) tmp_cbk = marker_create_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->create"; _new->unwind_to = "marker_create_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->create); (this->children->xlator )->fops->create (_new, (this->children->xlator), loc , flags, mode, umask, fd, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
625 | fd, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 625, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->create_cbk) tmp_cbk = marker_create_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->create"; _new->unwind_to = "marker_create_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->create); (this->children->xlator )->fops->create (_new, (this->children->xlator), loc , flags, mode, umask, fd, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
626 | return 0; | |||
627 | err: | |||
628 | STACK_UNWIND_STRICT (create, frame, -1, ENOMEM, NULL, NULL, NULL, NULL,do { fop_create_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 629, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_create_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , 12, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void* )0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
629 | NULL, NULL)do { fop_create_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 629, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_create_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , 12, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void* )0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
630 | ||||
631 | return 0; | |||
632 | } | |||
633 | ||||
634 | ||||
635 | int32_t | |||
636 | marker_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
637 | int32_t op_ret, int32_t op_errno, struct iatt *prebuf, | |||
638 | struct iatt *postbuf, dict_t *xdata) | |||
639 | { | |||
640 | marker_conf_t *priv = NULL((void*)0); | |||
641 | marker_local_t *local = NULL((void*)0); | |||
642 | ||||
643 | if (op_ret == -1) { | |||
644 | gf_log (this->name, GF_LOG_TRACE, "error occurred "do { do { if (0) printf ("error occurred " "while write, %s", strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 645, GF_LOG_TRACE, "error occurred " "while write, %s" , strerror (op_errno)); } while (0) | |||
645 | "while write, %s", strerror (op_errno))do { do { if (0) printf ("error occurred " "while write, %s", strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 645, GF_LOG_TRACE, "error occurred " "while write, %s" , strerror (op_errno)); } while (0); | |||
646 | } | |||
647 | ||||
648 | local = (marker_local_t *) frame->local; | |||
649 | ||||
650 | frame->local = NULL((void*)0); | |||
651 | ||||
652 | STACK_UNWIND_STRICT (writev, frame, op_ret, op_errno, prebuf, postbuf,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" , "marker.c", __FUNCTION__, 653, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_writev_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
653 | xdata)do { fop_writev_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 653, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_writev_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
654 | ||||
655 | if (op_ret == -1 || local == NULL((void*)0)) | |||
656 | goto out; | |||
657 | ||||
658 | priv = this->private; | |||
659 | ||||
660 | if (priv->feature_enabled & GF_QUOTA) | |||
661 | mq_initiate_quota_txn (this, &local->loc); | |||
662 | ||||
663 | if (priv->feature_enabled & GF_XTIME) | |||
664 | marker_xtime_update_marks (this, local); | |||
665 | ||||
666 | out: | |||
667 | marker_local_unref (local); | |||
668 | ||||
669 | return 0; | |||
670 | } | |||
671 | ||||
672 | int32_t | |||
673 | marker_writev (call_frame_t *frame, | |||
674 | xlator_t *this, | |||
675 | fd_t *fd, | |||
676 | struct iovec *vector, | |||
677 | int32_t count, | |||
678 | off_t offset, uint32_t flags, | |||
679 | struct iobref *iobref, dict_t *xdata) | |||
680 | { | |||
681 | int32_t ret = 0; | |||
682 | marker_local_t *local = NULL((void*)0); | |||
683 | marker_conf_t *priv = NULL((void*)0); | |||
684 | ||||
685 | priv = this->private; | |||
686 | ||||
687 | if (priv->feature_enabled == 0) | |||
688 | goto wind; | |||
689 | ||||
690 | local = mem_get0 (this->local_pool); | |||
691 | ||||
692 | MARKER_INIT_LOCAL (frame, local)do { frame->local = local; local->pid = frame->root-> pid; memset (&local->loc, 0, sizeof (loc_t)); local-> ref = 1; local->uid = -1; local->gid = -1; pthread_spin_init (&local->lock, 0); local->oplocal = ((void*)0); } while (0); | |||
693 | ||||
694 | ret = marker_inode_loc_fill (fd->inode, &local->loc); | |||
695 | ||||
696 | if (ret == -1) | |||
697 | goto err; | |||
698 | wind: | |||
699 | STACK_WIND (frame, marker_writev_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 701, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->writev_cbk) tmp_cbk = marker_writev_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->writev"; _new->unwind_to = "marker_writev_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->writev); (this->children->xlator )->fops->writev (_new, (this->children->xlator), fd , vector, count, offset, flags, iobref, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
700 | FIRST_CHILD(this)->fops->writev, fd, vector, count, 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", "marker.c", __FUNCTION__, 701, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->writev_cbk) tmp_cbk = marker_writev_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->writev"; _new->unwind_to = "marker_writev_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->writev); (this->children->xlator )->fops->writev (_new, (this->children->xlator), fd , vector, count, offset, flags, iobref, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
701 | flags, iobref, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 701, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->writev_cbk) tmp_cbk = marker_writev_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->writev"; _new->unwind_to = "marker_writev_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->writev); (this->children->xlator )->fops->writev (_new, (this->children->xlator), fd , vector, count, offset, flags, iobref, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
702 | return 0; | |||
703 | err: | |||
704 | STACK_UNWIND_STRICT (writev, frame, -1, ENOMEM, NULL, NULL, NULL)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" , "marker.c", __FUNCTION__, 704, 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 , 12, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
705 | ||||
706 | return 0; | |||
707 | } | |||
708 | ||||
709 | ||||
710 | int32_t | |||
711 | marker_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
712 | int32_t op_ret, int32_t op_errno, struct iatt *preparent, | |||
713 | struct iatt *postparent, dict_t *xdata) | |||
714 | { | |||
715 | marker_conf_t *priv = NULL((void*)0); | |||
716 | marker_local_t *local = NULL((void*)0); | |||
717 | ||||
718 | if (op_ret == -1) { | |||
719 | gf_log (this->name, GF_LOG_TRACE, "error occurred "do { do { if (0) printf ("error occurred " "rmdir %s", strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 720, GF_LOG_TRACE, "error occurred " "rmdir %s" , strerror (op_errno)); } while (0) | |||
720 | "rmdir %s", strerror (op_errno))do { do { if (0) printf ("error occurred " "rmdir %s", strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 720, GF_LOG_TRACE, "error occurred " "rmdir %s" , strerror (op_errno)); } while (0); | |||
721 | } | |||
722 | ||||
723 | local = (marker_local_t *) frame->local; | |||
724 | ||||
725 | frame->local = NULL((void*)0); | |||
726 | ||||
727 | STACK_UNWIND_STRICT (rmdir, frame, op_ret, op_errno, preparent,do { fop_rmdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 728, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_rmdir_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
728 | postparent, xdata)do { fop_rmdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 728, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_rmdir_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
729 | ||||
730 | if (op_ret == -1 || local == NULL((void*)0)) | |||
731 | goto out; | |||
732 | ||||
733 | priv = this->private; | |||
734 | ||||
735 | if (priv->feature_enabled & GF_QUOTA) | |||
736 | mq_reduce_parent_size (this, &local->loc, -1); | |||
737 | ||||
738 | if (priv->feature_enabled & GF_XTIME) | |||
739 | marker_xtime_update_marks (this, local); | |||
740 | out: | |||
741 | marker_local_unref (local); | |||
742 | ||||
743 | return 0; | |||
744 | } | |||
745 | ||||
746 | int32_t | |||
747 | marker_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, | |||
748 | dict_t *xdata) | |||
749 | { | |||
750 | int32_t ret = 0; | |||
751 | marker_local_t *local = NULL((void*)0); | |||
752 | marker_conf_t *priv = NULL((void*)0); | |||
753 | ||||
754 | priv = this->private; | |||
755 | ||||
756 | if (priv->feature_enabled == 0) | |||
757 | goto wind; | |||
758 | ||||
759 | local = mem_get0 (this->local_pool); | |||
760 | ||||
761 | MARKER_INIT_LOCAL (frame, local)do { frame->local = local; local->pid = frame->root-> pid; memset (&local->loc, 0, sizeof (loc_t)); local-> ref = 1; local->uid = -1; local->gid = -1; pthread_spin_init (&local->lock, 0); local->oplocal = ((void*)0); } while (0); | |||
762 | ||||
763 | ret = loc_copy (&local->loc, loc); | |||
764 | ||||
765 | if (ret == -1) | |||
766 | goto err; | |||
767 | wind: | |||
768 | STACK_WIND (frame, marker_rmdir_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 769, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rmdir_cbk) tmp_cbk = marker_rmdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->rmdir"; _new ->unwind_to = "marker_rmdir_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->rmdir); (this->children->xlator )->fops->rmdir (_new, (this->children->xlator), loc , flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
769 | FIRST_CHILD(this)->fops->rmdir, loc, flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 769, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rmdir_cbk) tmp_cbk = marker_rmdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->rmdir"; _new ->unwind_to = "marker_rmdir_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->rmdir); (this->children->xlator )->fops->rmdir (_new, (this->children->xlator), loc , flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
770 | return 0; | |||
771 | err: | |||
772 | STACK_UNWIND_STRICT (rmdir, frame, -1, ENOMEM, NULL, NULL, NULL)do { fop_rmdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 772, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_rmdir_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , 12, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
773 | ||||
774 | return 0; | |||
775 | } | |||
776 | ||||
777 | ||||
778 | int32_t | |||
779 | marker_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
780 | int32_t op_ret, int32_t op_errno, struct iatt *preparent, | |||
781 | struct iatt *postparent, dict_t *xdata) | |||
782 | { | |||
783 | marker_conf_t *priv = NULL((void*)0); | |||
784 | marker_local_t *local = NULL((void*)0); | |||
785 | ||||
786 | if (op_ret == -1) { | |||
787 | gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("%s occurred in unlink", strerror (op_errno )); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 788, GF_LOG_TRACE, "%s occurred in unlink", strerror (op_errno )); } while (0) | |||
788 | "%s occurred in unlink", strerror (op_errno))do { do { if (0) printf ("%s occurred in unlink", strerror (op_errno )); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 788, GF_LOG_TRACE, "%s occurred in unlink", strerror (op_errno )); } while (0); | |||
789 | } | |||
790 | ||||
791 | local = (marker_local_t *) frame->local; | |||
792 | ||||
793 | frame->local = NULL((void*)0); | |||
794 | ||||
795 | STACK_UNWIND_STRICT (unlink, frame, op_ret, op_errno, preparent,do { fop_unlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 796, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_unlink_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
796 | postparent, xdata)do { fop_unlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 796, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_unlink_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
797 | ||||
798 | if (op_ret == -1 || local == NULL((void*)0)) | |||
799 | goto out; | |||
800 | ||||
801 | priv = this->private; | |||
802 | ||||
803 | if ((priv->feature_enabled & GF_QUOTA) && (local->ia_nlink == 1)) | |||
804 | mq_reduce_parent_size (this, &local->loc, -1); | |||
805 | ||||
806 | if (priv->feature_enabled & GF_XTIME) | |||
807 | marker_xtime_update_marks (this, local); | |||
808 | out: | |||
809 | marker_local_unref (local); | |||
810 | ||||
811 | return 0; | |||
812 | } | |||
813 | ||||
814 | ||||
815 | int32_t | |||
816 | marker_unlink_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
817 | int32_t op_ret, int32_t op_errno, struct iatt *buf, | |||
818 | dict_t *xdata) | |||
819 | { | |||
820 | marker_local_t *local = NULL((void*)0); | |||
821 | ||||
822 | local = frame->local; | |||
823 | if (op_ret < 0) { | |||
824 | goto err; | |||
825 | } | |||
826 | ||||
827 | if (local == NULL((void*)0)) { | |||
828 | op_errno = EINVAL22; | |||
829 | goto err; | |||
830 | } | |||
831 | ||||
832 | local->ia_nlink = buf->ia_nlink; | |||
833 | ||||
834 | STACK_WIND (frame, marker_unlink_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 836, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->unlink_cbk) tmp_cbk = marker_unlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->unlink"; _new->unwind_to = "marker_unlink_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->unlink); (this->children->xlator )->fops->unlink (_new, (this->children->xlator), & local->loc, local->xflag, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
835 | FIRST_CHILD(this)->fops->unlink, &local->loc, local->xflag,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", "marker.c", __FUNCTION__, 836, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->unlink_cbk) tmp_cbk = marker_unlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->unlink"; _new->unwind_to = "marker_unlink_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->unlink); (this->children->xlator )->fops->unlink (_new, (this->children->xlator), & local->loc, local->xflag, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
836 | 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", "marker.c", __FUNCTION__, 836, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->unlink_cbk) tmp_cbk = marker_unlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->unlink"; _new->unwind_to = "marker_unlink_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->unlink); (this->children->xlator )->fops->unlink (_new, (this->children->xlator), & local->loc, local->xflag, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
837 | return 0; | |||
838 | err: | |||
839 | frame->local = NULL((void*)0); | |||
840 | STACK_UNWIND_STRICT (unlink, frame, -1, op_errno, NULL, NULL, NULL)do { fop_unlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 840, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_unlink_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
841 | marker_local_unref (local); | |||
842 | return 0; | |||
843 | } | |||
844 | ||||
845 | ||||
846 | int32_t | |||
847 | marker_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag, | |||
848 | dict_t *xdata) | |||
849 | { | |||
850 | int32_t ret = 0; | |||
851 | marker_local_t *local = NULL((void*)0); | |||
852 | marker_conf_t *priv = NULL((void*)0); | |||
853 | ||||
854 | priv = this->private; | |||
855 | ||||
856 | if (priv->feature_enabled == 0) | |||
857 | goto unlink_wind; | |||
858 | ||||
859 | local = mem_get0 (this->local_pool); | |||
860 | local->xflag = xflag; | |||
861 | MARKER_INIT_LOCAL (frame, local)do { frame->local = local; local->pid = frame->root-> pid; memset (&local->loc, 0, sizeof (loc_t)); local-> ref = 1; local->uid = -1; local->gid = -1; pthread_spin_init (&local->lock, 0); local->oplocal = ((void*)0); } while (0); | |||
862 | ||||
863 | ret = loc_copy (&local->loc, loc); | |||
864 | ||||
865 | if (ret == -1) | |||
866 | goto err; | |||
867 | ||||
868 | if (uuid_is_null (loc->gfid) && loc->inode) | |||
869 | uuid_copy (loc->gfid, loc->inode->gfid); | |||
870 | ||||
871 | STACK_WIND (frame, marker_unlink_stat_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 872, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->stat_cbk) tmp_cbk = marker_unlink_stat_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->stat"; _new ->unwind_to = "marker_unlink_stat_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->stat); (this->children->xlator )->fops->stat (_new, (this->children->xlator), loc , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||
872 | FIRST_CHILD(this)->fops->stat, loc, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 872, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->stat_cbk) tmp_cbk = marker_unlink_stat_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->stat"; _new ->unwind_to = "marker_unlink_stat_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->stat); (this->children->xlator )->fops->stat (_new, (this->children->xlator), loc , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0); | |||
873 | return 0; | |||
874 | ||||
875 | unlink_wind: | |||
876 | STACK_WIND (frame, marker_unlink_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 877, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->unlink_cbk) tmp_cbk = marker_unlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->unlink"; _new->unwind_to = "marker_unlink_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->unlink); (this->children->xlator )->fops->unlink (_new, (this->children->xlator), loc , xflag, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
877 | FIRST_CHILD(this)->fops->unlink, loc, xflag, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 877, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->unlink_cbk) tmp_cbk = marker_unlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->unlink"; _new->unwind_to = "marker_unlink_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->unlink); (this->children->xlator )->fops->unlink (_new, (this->children->xlator), loc , xflag, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
878 | return 0; | |||
879 | err: | |||
880 | frame->local = NULL((void*)0); | |||
881 | STACK_UNWIND_STRICT (unlink, frame, -1, ENOMEM, NULL, NULL, NULL)do { fop_unlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 881, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_unlink_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , 12, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
882 | marker_local_unref (local); | |||
883 | return 0; | |||
884 | } | |||
885 | ||||
886 | ||||
887 | int32_t | |||
888 | marker_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
889 | int32_t op_ret, int32_t op_errno, inode_t *inode, | |||
890 | struct iatt *buf, struct iatt *preparent, | |||
891 | struct iatt *postparent, dict_t *xdata) | |||
892 | { | |||
893 | marker_local_t *local = NULL((void*)0); | |||
894 | marker_conf_t *priv = NULL((void*)0); | |||
895 | ||||
896 | if (op_ret == -1) { | |||
897 | gf_log (this->name, GF_LOG_TRACE, "%s occurred while "do { do { if (0) printf ("%s occurred while " "linking a file " , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 898, GF_LOG_TRACE, "%s occurred while " "linking a file " , strerror (op_errno)); } while (0) | |||
898 | "linking a file ", strerror (op_errno))do { do { if (0) printf ("%s occurred while " "linking a file " , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 898, GF_LOG_TRACE, "%s occurred while " "linking a file " , strerror (op_errno)); } while (0); | |||
899 | } | |||
900 | ||||
901 | local = (marker_local_t *) frame->local; | |||
902 | ||||
903 | frame->local = NULL((void*)0); | |||
904 | ||||
905 | STACK_UNWIND_STRICT (link, frame, op_ret, op_errno, inode, buf,do { fop_link_cbk_t fn = ((void*)0); call_frame_t *_parent = ( (void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 906, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_link_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
906 | preparent, postparent, xdata)do { fop_link_cbk_t fn = ((void*)0); call_frame_t *_parent = ( (void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 906, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_link_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
907 | ||||
908 | if (op_ret == -1 || local == NULL((void*)0)) | |||
909 | goto out; | |||
910 | ||||
911 | priv = this->private; | |||
912 | ||||
913 | if (priv->feature_enabled & GF_QUOTA) | |||
914 | mq_initiate_quota_txn (this, &local->loc); | |||
915 | ||||
916 | if (priv->feature_enabled & GF_XTIME) | |||
917 | marker_xtime_update_marks (this, local); | |||
918 | out: | |||
919 | marker_local_unref (local); | |||
920 | ||||
921 | return 0; | |||
922 | } | |||
923 | ||||
924 | int32_t | |||
925 | marker_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, | |||
926 | dict_t *xdata) | |||
927 | { | |||
928 | int32_t ret = 0; | |||
929 | marker_local_t *local = NULL((void*)0); | |||
930 | marker_conf_t *priv = NULL((void*)0); | |||
931 | ||||
932 | priv = this->private; | |||
933 | ||||
934 | if (priv->feature_enabled == 0) | |||
935 | goto wind; | |||
936 | ||||
937 | local = mem_get0 (this->local_pool); | |||
938 | ||||
939 | MARKER_INIT_LOCAL (frame, local)do { frame->local = local; local->pid = frame->root-> pid; memset (&local->loc, 0, sizeof (loc_t)); local-> ref = 1; local->uid = -1; local->gid = -1; pthread_spin_init (&local->lock, 0); local->oplocal = ((void*)0); } while (0); | |||
940 | ||||
941 | ret = loc_copy (&local->loc, newloc); | |||
942 | ||||
943 | if (ret == -1) | |||
944 | goto err; | |||
945 | wind: | |||
946 | STACK_WIND (frame, marker_link_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 947, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->link_cbk) tmp_cbk = marker_link_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->link"; _new ->unwind_to = "marker_link_cbk"; pthread_spin_init (&_new ->lock, 0); pthread_spin_lock (&frame->root->stack_lock ); { _new->next = frame->root->frames.next; _new-> prev = &frame->root->frames; if (frame->root-> frames.next) frame->root->frames.next->prev = _new; frame ->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = (this->children-> xlator); if (frame->this->ctx->measure_latency) gf_latency_begin (_new, (this->children->xlator)->fops->link); (this ->children->xlator)->fops->link (_new, (this-> children->xlator), oldloc, newloc, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
947 | FIRST_CHILD(this)->fops->link, oldloc, newloc, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 947, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->link_cbk) tmp_cbk = marker_link_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->link"; _new ->unwind_to = "marker_link_cbk"; pthread_spin_init (&_new ->lock, 0); pthread_spin_lock (&frame->root->stack_lock ); { _new->next = frame->root->frames.next; _new-> prev = &frame->root->frames; if (frame->root-> frames.next) frame->root->frames.next->prev = _new; frame ->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = (this->children-> xlator); if (frame->this->ctx->measure_latency) gf_latency_begin (_new, (this->children->xlator)->fops->link); (this ->children->xlator)->fops->link (_new, (this-> children->xlator), oldloc, newloc, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
948 | return 0; | |||
949 | err: | |||
950 | STACK_UNWIND_STRICT (link, frame, -1, ENOMEM, NULL, NULL, NULL, NULL,do { fop_link_cbk_t fn = ((void*)0); call_frame_t *_parent = ( (void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 951, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_link_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , 12, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void* )0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
951 | NULL)do { fop_link_cbk_t fn = ((void*)0); call_frame_t *_parent = ( (void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 951, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_link_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , 12, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void* )0)); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
952 | ||||
953 | return 0; | |||
954 | } | |||
955 | ||||
956 | ||||
957 | int32_t | |||
958 | marker_rename_done (call_frame_t *frame, void *cookie, xlator_t *this, | |||
959 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | |||
960 | { | |||
961 | marker_local_t *local = NULL((void*)0), *oplocal = NULL((void*)0); | |||
962 | loc_t newloc = {0, }; | |||
963 | marker_conf_t *priv = NULL((void*)0); | |||
964 | ||||
965 | local = frame->local; | |||
966 | oplocal = local->oplocal; | |||
967 | ||||
968 | priv = this->private; | |||
969 | ||||
970 | frame->local = NULL((void*)0); | |||
971 | ||||
972 | if (op_ret < 0) { | |||
973 | if (local->err == 0) { | |||
974 | local->err = op_errno; | |||
975 | } | |||
976 | ||||
977 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("inodelk (UNLOCK) failed on path:%s (gfid:%s) (%s)" , local->parent_loc.path, uuid_utoa (local->parent_loc. inode->gfid), strerror (op_errno)); } while (0); _gf_log ( this->name, "marker.c", __FUNCTION__, 981, GF_LOG_WARNING, "inodelk (UNLOCK) failed on path:%s (gfid:%s) (%s)", local-> parent_loc.path, uuid_utoa (local->parent_loc.inode->gfid ), strerror (op_errno)); } while (0) | |||
978 | "inodelk (UNLOCK) failed on path:%s (gfid:%s) (%s)",do { do { if (0) printf ("inodelk (UNLOCK) failed on path:%s (gfid:%s) (%s)" , local->parent_loc.path, uuid_utoa (local->parent_loc. inode->gfid), strerror (op_errno)); } while (0); _gf_log ( this->name, "marker.c", __FUNCTION__, 981, GF_LOG_WARNING, "inodelk (UNLOCK) failed on path:%s (gfid:%s) (%s)", local-> parent_loc.path, uuid_utoa (local->parent_loc.inode->gfid ), strerror (op_errno)); } while (0) | |||
979 | local->parent_loc.path,do { do { if (0) printf ("inodelk (UNLOCK) failed on path:%s (gfid:%s) (%s)" , local->parent_loc.path, uuid_utoa (local->parent_loc. inode->gfid), strerror (op_errno)); } while (0); _gf_log ( this->name, "marker.c", __FUNCTION__, 981, GF_LOG_WARNING, "inodelk (UNLOCK) failed on path:%s (gfid:%s) (%s)", local-> parent_loc.path, uuid_utoa (local->parent_loc.inode->gfid ), strerror (op_errno)); } while (0) | |||
980 | uuid_utoa (local->parent_loc.inode->gfid),do { do { if (0) printf ("inodelk (UNLOCK) failed on path:%s (gfid:%s) (%s)" , local->parent_loc.path, uuid_utoa (local->parent_loc. inode->gfid), strerror (op_errno)); } while (0); _gf_log ( this->name, "marker.c", __FUNCTION__, 981, GF_LOG_WARNING, "inodelk (UNLOCK) failed on path:%s (gfid:%s) (%s)", local-> parent_loc.path, uuid_utoa (local->parent_loc.inode->gfid ), strerror (op_errno)); } while (0) | |||
981 | strerror (op_errno))do { do { if (0) printf ("inodelk (UNLOCK) failed on path:%s (gfid:%s) (%s)" , local->parent_loc.path, uuid_utoa (local->parent_loc. inode->gfid), strerror (op_errno)); } while (0); _gf_log ( this->name, "marker.c", __FUNCTION__, 981, GF_LOG_WARNING, "inodelk (UNLOCK) failed on path:%s (gfid:%s) (%s)", local-> parent_loc.path, uuid_utoa (local->parent_loc.inode->gfid ), strerror (op_errno)); } while (0); | |||
982 | } | |||
983 | ||||
984 | if (local->stub != NULL((void*)0)) { | |||
985 | call_resume (local->stub); | |||
986 | local->stub = NULL((void*)0); | |||
987 | } else if (local->err != 0) { | |||
988 | STACK_UNWIND_STRICT (rename, frame, -1, local->err, NULL, NULL,do { fop_rename_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 989, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_rename_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , local->err, ((void*)0), ((void*)0), ((void*)0), ((void*) 0), ((void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
989 | NULL, NULL, NULL, NULL)do { fop_rename_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 989, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_rename_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , local->err, ((void*)0), ((void*)0), ((void*)0), ((void*) 0), ((void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
990 | } | |||
991 | ||||
992 | mq_reduce_parent_size (this, &oplocal->loc, oplocal->contribution); | |||
993 | ||||
994 | if (local->loc.inode != NULL((void*)0)) { | |||
995 | mq_reduce_parent_size (this, &local->loc, local->contribution); | |||
996 | } | |||
997 | ||||
998 | newloc.inode = inode_ref (oplocal->loc.inode); | |||
999 | newloc.path = gf_strdup (local->loc.path); | |||
1000 | newloc.name = strrchr (newloc.path, '/'); | |||
1001 | if (newloc.name) | |||
1002 | newloc.name++; | |||
1003 | newloc.parent = inode_ref (local->loc.parent); | |||
1004 | ||||
1005 | mq_rename_update_newpath (this, &newloc); | |||
1006 | ||||
1007 | loc_wipe (&newloc); | |||
1008 | ||||
1009 | if (priv->feature_enabled & GF_XTIME) { | |||
1010 | //update marks on oldpath | |||
1011 | uuid_copy (local->loc.gfid, oplocal->loc.inode->gfid); | |||
1012 | marker_xtime_update_marks (this, oplocal); | |||
1013 | marker_xtime_update_marks (this, local); | |||
1014 | } | |||
1015 | ||||
1016 | marker_local_unref (local); | |||
1017 | marker_local_unref (oplocal); | |||
1018 | return 0; | |||
1019 | } | |||
1020 | ||||
1021 | ||||
1022 | int32_t | |||
1023 | marker_rename_release_newp_lock (call_frame_t *frame, void *cookie, | |||
1024 | xlator_t *this, int32_t op_ret, | |||
1025 | int32_t op_errno, dict_t *xdata) | |||
1026 | { | |||
1027 | marker_local_t *local = NULL((void*)0), *oplocal = NULL((void*)0); | |||
1028 | struct gf_flock lock = {0, }; | |||
1029 | ||||
1030 | local = frame->local; | |||
1031 | oplocal = local->oplocal; | |||
1032 | ||||
1033 | if (op_ret < 0) { | |||
1034 | if (local->err == 0) { | |||
1035 | local->err = op_errno; | |||
1036 | } | |||
1037 | ||||
1038 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("inodelk (UNLOCK) failed on %s (gfid:%s) (%s)" , oplocal->parent_loc.path, uuid_utoa (oplocal->parent_loc .inode->gfid), strerror (op_errno)); } while (0); _gf_log ( this->name, "marker.c", __FUNCTION__, 1042, GF_LOG_WARNING , "inodelk (UNLOCK) failed on %s (gfid:%s) (%s)", oplocal-> parent_loc.path, uuid_utoa (oplocal->parent_loc.inode-> gfid), strerror (op_errno)); } while (0) | |||
1039 | "inodelk (UNLOCK) failed on %s (gfid:%s) (%s)",do { do { if (0) printf ("inodelk (UNLOCK) failed on %s (gfid:%s) (%s)" , oplocal->parent_loc.path, uuid_utoa (oplocal->parent_loc .inode->gfid), strerror (op_errno)); } while (0); _gf_log ( this->name, "marker.c", __FUNCTION__, 1042, GF_LOG_WARNING , "inodelk (UNLOCK) failed on %s (gfid:%s) (%s)", oplocal-> parent_loc.path, uuid_utoa (oplocal->parent_loc.inode-> gfid), strerror (op_errno)); } while (0) | |||
1040 | oplocal->parent_loc.path,do { do { if (0) printf ("inodelk (UNLOCK) failed on %s (gfid:%s) (%s)" , oplocal->parent_loc.path, uuid_utoa (oplocal->parent_loc .inode->gfid), strerror (op_errno)); } while (0); _gf_log ( this->name, "marker.c", __FUNCTION__, 1042, GF_LOG_WARNING , "inodelk (UNLOCK) failed on %s (gfid:%s) (%s)", oplocal-> parent_loc.path, uuid_utoa (oplocal->parent_loc.inode-> gfid), strerror (op_errno)); } while (0) | |||
1041 | uuid_utoa (oplocal->parent_loc.inode->gfid),do { do { if (0) printf ("inodelk (UNLOCK) failed on %s (gfid:%s) (%s)" , oplocal->parent_loc.path, uuid_utoa (oplocal->parent_loc .inode->gfid), strerror (op_errno)); } while (0); _gf_log ( this->name, "marker.c", __FUNCTION__, 1042, GF_LOG_WARNING , "inodelk (UNLOCK) failed on %s (gfid:%s) (%s)", oplocal-> parent_loc.path, uuid_utoa (oplocal->parent_loc.inode-> gfid), strerror (op_errno)); } while (0) | |||
1042 | strerror (op_errno))do { do { if (0) printf ("inodelk (UNLOCK) failed on %s (gfid:%s) (%s)" , oplocal->parent_loc.path, uuid_utoa (oplocal->parent_loc .inode->gfid), strerror (op_errno)); } while (0); _gf_log ( this->name, "marker.c", __FUNCTION__, 1042, GF_LOG_WARNING , "inodelk (UNLOCK) failed on %s (gfid:%s) (%s)", oplocal-> parent_loc.path, uuid_utoa (oplocal->parent_loc.inode-> gfid), strerror (op_errno)); } while (0); | |||
1043 | } | |||
1044 | ||||
1045 | if (local->next_lock_on == NULL((void*)0)) { | |||
1046 | marker_rename_done (frame, NULL((void*)0), this, 0, 0, NULL((void*)0)); | |||
1047 | goto out; | |||
1048 | } | |||
1049 | ||||
1050 | lock.l_type = F_UNLCK2; | |||
1051 | lock.l_whence = SEEK_SET0; | |||
1052 | lock.l_start = 0; | |||
1053 | lock.l_len = 0; | |||
1054 | lock.l_pid = 0; | |||
1055 | ||||
1056 | STACK_WIND (frame,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", "marker.c", __FUNCTION__, 1060, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_rename_done ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_rename_done"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, &local->parent_loc, 14, &lock, ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1057 | marker_rename_done,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", "marker.c", __FUNCTION__, 1060, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_rename_done ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_rename_done"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, &local->parent_loc, 14, &lock, ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1058 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1060, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_rename_done ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_rename_done"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, &local->parent_loc, 14, &lock, ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1059 | FIRST_CHILD(this)->fops->inodelk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1060, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_rename_done ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_rename_done"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, &local->parent_loc, 14, &lock, ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1060 | this->name, &local->parent_loc, F_SETLKW, &lock, 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", "marker.c", __FUNCTION__, 1060, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_rename_done ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_rename_done"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, &local->parent_loc, 14, &lock, ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
1061 | ||||
1062 | out: | |||
1063 | return 0; | |||
1064 | } | |||
1065 | ||||
1066 | ||||
1067 | int32_t | |||
1068 | marker_rename_release_oldp_lock (call_frame_t *frame, void *cookie, | |||
1069 | xlator_t *this, int32_t op_ret, | |||
1070 | int32_t op_errno, dict_t *xdata) | |||
1071 | { | |||
1072 | marker_local_t *local = NULL((void*)0), *oplocal = NULL((void*)0); | |||
1073 | struct gf_flock lock = {0, }; | |||
1074 | ||||
1075 | local = frame->local; | |||
1076 | oplocal = local->oplocal; | |||
1077 | ||||
1078 | if ((op_ret < 0) && (op_errno != ENOATTR61)) { | |||
1079 | local->err = op_errno; | |||
1080 | } | |||
1081 | ||||
1082 | //Reset frame uid and gid if set. | |||
1083 | if (cookie == (void *) _GF_UID_GID_CHANGED1) | |||
1084 | MARKER_RESET_UID_GID (frame, frame->root, local)do { do { if (local->uid != -1 && local->gid != -1) { frame->root->uid = local->uid; frame->root ->gid = local->gid; } } while (0); frame->cookie = ( (void*)0); } while (0); | |||
1085 | ||||
1086 | lock.l_type = F_UNLCK2; | |||
1087 | lock.l_whence = SEEK_SET0; | |||
1088 | lock.l_start = 0; | |||
1089 | lock.l_len = 0; | |||
1090 | lock.l_pid = 0; | |||
1091 | ||||
1092 | STACK_WIND (frame,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", "marker.c", __FUNCTION__, 1096, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_rename_release_newp_lock ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_rename_release_newp_lock"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, &oplocal->parent_loc, 14, &lock, ( (void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1093 | marker_rename_release_newp_lock,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", "marker.c", __FUNCTION__, 1096, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_rename_release_newp_lock ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_rename_release_newp_lock"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, &oplocal->parent_loc, 14, &lock, ( (void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1094 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1096, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_rename_release_newp_lock ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_rename_release_newp_lock"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, &oplocal->parent_loc, 14, &lock, ( (void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1095 | FIRST_CHILD(this)->fops->inodelk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1096, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_rename_release_newp_lock ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_rename_release_newp_lock"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, &oplocal->parent_loc, 14, &lock, ( (void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1096 | this->name, &oplocal->parent_loc, F_SETLKW, &lock, 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", "marker.c", __FUNCTION__, 1096, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_rename_release_newp_lock ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_rename_release_newp_lock"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, &oplocal->parent_loc, 14, &lock, ( (void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
1097 | return 0; | |||
1098 | } | |||
1099 | ||||
1100 | ||||
1101 | int32_t | |||
1102 | marker_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
1103 | int32_t op_ret, int32_t op_errno, struct iatt *buf, | |||
1104 | struct iatt *preoldparent, struct iatt *postoldparent, | |||
1105 | struct iatt *prenewparent, struct iatt *postnewparent, | |||
1106 | dict_t *xdata) | |||
1107 | { | |||
1108 | marker_conf_t *priv = NULL((void*)0); | |||
1109 | marker_local_t *local = NULL((void*)0); | |||
1110 | marker_local_t *oplocal = NULL((void*)0); | |||
1111 | call_stub_t *stub = NULL((void*)0); | |||
1112 | int32_t ret = 0; | |||
1113 | char contri_key [512] = {0, }; | |||
1114 | loc_t newloc = {0, }; | |||
1115 | ||||
1116 | local = (marker_local_t *) frame->local; | |||
1117 | ||||
1118 | if (local != NULL((void*)0)) { | |||
1119 | oplocal = local->oplocal; | |||
1120 | } | |||
1121 | ||||
1122 | priv = this->private; | |||
1123 | ||||
1124 | if (op_ret < 0) { | |||
1125 | if (local != NULL((void*)0)) { | |||
1126 | local->err = op_errno; | |||
1127 | } | |||
1128 | ||||
1129 | gf_log (this->name, GF_LOG_TRACE, "%s occurred while "do { do { if (0) printf ("%s occurred while " "renaming a file " , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 1130, GF_LOG_TRACE, "%s occurred while " "renaming a file " , strerror (op_errno)); } while (0) | |||
1130 | "renaming a file ", strerror (op_errno))do { do { if (0) printf ("%s occurred while " "renaming a file " , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 1130, GF_LOG_TRACE, "%s occurred while " "renaming a file " , strerror (op_errno)); } while (0); | |||
1131 | } | |||
1132 | ||||
1133 | if (priv->feature_enabled & GF_QUOTA) { | |||
1134 | if ((op_ret < 0) || (local == NULL((void*)0))) { | |||
1135 | goto quota_err; | |||
1136 | } | |||
1137 | ||||
1138 | stub = fop_rename_cbk_stub (frame, default_rename_cbk, op_ret, | |||
1139 | op_errno, buf, preoldparent, | |||
1140 | postoldparent, prenewparent, | |||
1141 | postnewparent, xdata); | |||
1142 | if (stub == NULL((void*)0)) { | |||
1143 | local->err = ENOMEM12; | |||
1144 | goto quota_err; | |||
1145 | } | |||
1146 | ||||
1147 | local->stub = stub; | |||
1148 | ||||
1149 | GET_CONTRI_KEY (contri_key, oplocal->loc.parent->gfid, ret)do { char _gfid_unparsed[40]; uuid_unparse (oplocal->loc.parent ->gfid, _gfid_unparsed); ret = snprintf (contri_key, 512, "trusted.glusterfs" ".%s.%s." "contri", "quota", _gfid_unparsed); } while (0);; | |||
1150 | if (ret < 0) { | |||
1151 | local->err = ENOMEM12; | |||
1152 | goto quota_err; | |||
1153 | } | |||
1154 | ||||
1155 | /* Removexattr requires uid and gid to be 0, | |||
1156 | * reset them in the callback. | |||
1157 | */ | |||
1158 | MARKER_SET_UID_GID (frame, local, frame->root)do { do { if (frame->root->uid != -1 && frame-> root->gid != -1) { local->uid = frame->root->uid; local->gid = frame->root->gid; } } while (0); frame ->root->uid = 0; frame->root->gid = 0; frame-> cookie = (void *) 1; } while (0); | |||
1159 | ||||
1160 | newloc.inode = inode_ref (oplocal->loc.inode); | |||
1161 | newloc.path = gf_strdup (local->loc.path); | |||
1162 | newloc.name = strrchr (newloc.path, '/'); | |||
1163 | if (newloc.name) | |||
1164 | newloc.name++; | |||
1165 | newloc.parent = inode_ref (local->loc.parent); | |||
1166 | uuid_copy (newloc.gfid, oplocal->loc.inode->gfid); | |||
1167 | ||||
1168 | STACK_WIND_COOKIE (frame, marker_rename_release_oldp_lock,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", "marker.c", __FUNCTION__, 1171, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->removexattr_cbk) tmp_cbk = marker_rename_release_oldp_lock ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = frame->cookie; _new->wind_from = __FUNCTION__; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr" ; _new->unwind_to = "marker_rename_release_oldp_lock"; 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 ); (this->children->xlator)->fops->removexattr_cbk = marker_rename_release_oldp_lock; old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = (this->children-> xlator); if ((this->children->xlator)->ctx->measure_latency ) gf_latency_begin (_new, (this->children->xlator)-> fops->removexattr); (this->children->xlator)->fops ->removexattr (_new, (this->children->xlator), & newloc, contri_key, ((void*)0)); (*__glusterfs_this_location( )) = old_THIS; } while (0) | |||
1169 | frame->cookie, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1171, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->removexattr_cbk) tmp_cbk = marker_rename_release_oldp_lock ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = frame->cookie; _new->wind_from = __FUNCTION__; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr" ; _new->unwind_to = "marker_rename_release_oldp_lock"; 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 ); (this->children->xlator)->fops->removexattr_cbk = marker_rename_release_oldp_lock; old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = (this->children-> xlator); if ((this->children->xlator)->ctx->measure_latency ) gf_latency_begin (_new, (this->children->xlator)-> fops->removexattr); (this->children->xlator)->fops ->removexattr (_new, (this->children->xlator), & newloc, contri_key, ((void*)0)); (*__glusterfs_this_location( )) = old_THIS; } while (0) | |||
1170 | FIRST_CHILD(this)->fops->removexattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1171, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->removexattr_cbk) tmp_cbk = marker_rename_release_oldp_lock ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = frame->cookie; _new->wind_from = __FUNCTION__; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr" ; _new->unwind_to = "marker_rename_release_oldp_lock"; 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 ); (this->children->xlator)->fops->removexattr_cbk = marker_rename_release_oldp_lock; old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = (this->children-> xlator); if ((this->children->xlator)->ctx->measure_latency ) gf_latency_begin (_new, (this->children->xlator)-> fops->removexattr); (this->children->xlator)->fops ->removexattr (_new, (this->children->xlator), & newloc, contri_key, ((void*)0)); (*__glusterfs_this_location( )) = old_THIS; } while (0) | |||
1171 | &newloc, contri_key, 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", "marker.c", __FUNCTION__, 1171, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->removexattr_cbk) tmp_cbk = marker_rename_release_oldp_lock ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = frame->cookie; _new->wind_from = __FUNCTION__; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr" ; _new->unwind_to = "marker_rename_release_oldp_lock"; 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 ); (this->children->xlator)->fops->removexattr_cbk = marker_rename_release_oldp_lock; old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = (this->children-> xlator); if ((this->children->xlator)->ctx->measure_latency ) gf_latency_begin (_new, (this->children->xlator)-> fops->removexattr); (this->children->xlator)->fops ->removexattr (_new, (this->children->xlator), & newloc, contri_key, ((void*)0)); (*__glusterfs_this_location( )) = old_THIS; } while (0); | |||
1172 | ||||
1173 | loc_wipe (&newloc); | |||
1174 | } else { | |||
1175 | frame->local = NULL((void*)0); | |||
1176 | ||||
1177 | STACK_UNWIND_STRICT (rename, frame, op_ret, op_errno, buf,do { fop_rename_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 1179, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_rename_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, buf, preoldparent, postoldparent, prenewparent, postnewparent , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||
1178 | preoldparent, postoldparent, prenewparent,do { fop_rename_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 1179, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_rename_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, buf, preoldparent, postoldparent, prenewparent, postnewparent , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | |||
1179 | postnewparent, xdata)do { fop_rename_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 1179, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_rename_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, buf, preoldparent, postoldparent, prenewparent, postnewparent , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0); | |||
1180 | ||||
1181 | if ((op_ret < 0) || (local == NULL((void*)0))) { | |||
1182 | goto out; | |||
1183 | } | |||
1184 | ||||
1185 | if (priv->feature_enabled & GF_XTIME) { | |||
1186 | //update marks on oldpath | |||
1187 | uuid_copy (local->loc.gfid, oplocal->loc.inode->gfid); | |||
1188 | marker_xtime_update_marks (this, oplocal); | |||
1189 | marker_xtime_update_marks (this, local); | |||
1190 | } | |||
1191 | } | |||
1192 | ||||
1193 | out: | |||
1194 | if (!(priv->feature_enabled & GF_QUOTA)) { | |||
1195 | marker_local_unref (local); | |||
1196 | marker_local_unref (oplocal); | |||
1197 | } | |||
1198 | ||||
1199 | return 0; | |||
1200 | ||||
1201 | quota_err: | |||
1202 | marker_rename_release_oldp_lock (frame, NULL((void*)0), this, 0, 0, NULL((void*)0)); | |||
1203 | return 0; | |||
1204 | } | |||
1205 | ||||
1206 | ||||
1207 | int32_t | |||
1208 | marker_do_rename (call_frame_t *frame, void *cookie, xlator_t *this, | |||
1209 | int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata) | |||
1210 | { | |||
1211 | marker_local_t *local = NULL((void*)0), *oplocal = NULL((void*)0); | |||
1212 | char contri_key[512] = {0, }; | |||
1213 | int32_t ret = 0; | |||
1214 | int64_t *contribution = 0; | |||
1215 | ||||
1216 | local = frame->local; | |||
1217 | oplocal = local->oplocal; | |||
1218 | ||||
1219 | //Reset frame uid and gid if set. | |||
1220 | if (cookie == (void *) _GF_UID_GID_CHANGED1) | |||
1221 | MARKER_RESET_UID_GID (frame, frame->root, local)do { do { if (local->uid != -1 && local->gid != -1) { frame->root->uid = local->uid; frame->root ->gid = local->gid; } } while (0); frame->cookie = ( (void*)0); } while (0); | |||
1222 | ||||
1223 | if ((op_ret < 0) && (op_errno != ENOATTR61)) { | |||
1224 | local->err = op_errno; | |||
1225 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("fetching contribution values from %s (gfid:%s) " "failed (%s)", local->loc.path, uuid_utoa (local->loc. inode->gfid), strerror (op_errno)); } while (0); _gf_log ( this->name, "marker.c", __FUNCTION__, 1229, GF_LOG_WARNING , "fetching contribution values from %s (gfid:%s) " "failed (%s)" , local->loc.path, uuid_utoa (local->loc.inode->gfid ), strerror (op_errno)); } while (0) | |||
1226 | "fetching contribution values from %s (gfid:%s) "do { do { if (0) printf ("fetching contribution values from %s (gfid:%s) " "failed (%s)", local->loc.path, uuid_utoa (local->loc. inode->gfid), strerror (op_errno)); } while (0); _gf_log ( this->name, "marker.c", __FUNCTION__, 1229, GF_LOG_WARNING , "fetching contribution values from %s (gfid:%s) " "failed (%s)" , local->loc.path, uuid_utoa (local->loc.inode->gfid ), strerror (op_errno)); } while (0) | |||
1227 | "failed (%s)", local->loc.path,do { do { if (0) printf ("fetching contribution values from %s (gfid:%s) " "failed (%s)", local->loc.path, uuid_utoa (local->loc. inode->gfid), strerror (op_errno)); } while (0); _gf_log ( this->name, "marker.c", __FUNCTION__, 1229, GF_LOG_WARNING , "fetching contribution values from %s (gfid:%s) " "failed (%s)" , local->loc.path, uuid_utoa (local->loc.inode->gfid ), strerror (op_errno)); } while (0) | |||
1228 | uuid_utoa (local->loc.inode->gfid),do { do { if (0) printf ("fetching contribution values from %s (gfid:%s) " "failed (%s)", local->loc.path, uuid_utoa (local->loc. inode->gfid), strerror (op_errno)); } while (0); _gf_log ( this->name, "marker.c", __FUNCTION__, 1229, GF_LOG_WARNING , "fetching contribution values from %s (gfid:%s) " "failed (%s)" , local->loc.path, uuid_utoa (local->loc.inode->gfid ), strerror (op_errno)); } while (0) | |||
1229 | strerror (op_errno))do { do { if (0) printf ("fetching contribution values from %s (gfid:%s) " "failed (%s)", local->loc.path, uuid_utoa (local->loc. inode->gfid), strerror (op_errno)); } while (0); _gf_log ( this->name, "marker.c", __FUNCTION__, 1229, GF_LOG_WARNING , "fetching contribution values from %s (gfid:%s) " "failed (%s)" , local->loc.path, uuid_utoa (local->loc.inode->gfid ), strerror (op_errno)); } while (0); | |||
1230 | goto err; | |||
1231 | } | |||
1232 | ||||
1233 | if (local->loc.inode != NULL((void*)0)) { | |||
1234 | GET_CONTRI_KEY (contri_key, local->loc.parent->gfid, ret)do { char _gfid_unparsed[40]; uuid_unparse (local->loc.parent ->gfid, _gfid_unparsed); ret = snprintf (contri_key, 512, "trusted.glusterfs" ".%s.%s." "contri", "quota", _gfid_unparsed); } while (0);; | |||
1235 | if (ret < 0) { | |||
1236 | local->err = errno(*__errno_location ()); | |||
1237 | goto err; | |||
1238 | } | |||
1239 | ||||
1240 | if (dict_get_bin (dict, contri_key, | |||
1241 | (void **) &contribution) == 0) { | |||
1242 | local->contribution = ntoh64hton64 (*contribution); | |||
1243 | } | |||
1244 | } | |||
1245 | ||||
1246 | STACK_WIND (frame, marker_rename_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1248, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rename_cbk) tmp_cbk = marker_rename_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->rename"; _new->unwind_to = "marker_rename_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->rename); (this->children->xlator )->fops->rename (_new, (this->children->xlator), & oplocal->loc, &local->loc, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
1247 | FIRST_CHILD(this)->fops->rename, &oplocal->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", "marker.c", __FUNCTION__, 1248, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rename_cbk) tmp_cbk = marker_rename_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->rename"; _new->unwind_to = "marker_rename_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->rename); (this->children->xlator )->fops->rename (_new, (this->children->xlator), & oplocal->loc, &local->loc, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
1248 | &local->loc, 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", "marker.c", __FUNCTION__, 1248, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rename_cbk) tmp_cbk = marker_rename_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->rename"; _new->unwind_to = "marker_rename_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->rename); (this->children->xlator )->fops->rename (_new, (this->children->xlator), & oplocal->loc, &local->loc, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
1249 | ||||
1250 | return 0; | |||
1251 | ||||
1252 | err: | |||
1253 | marker_rename_release_oldp_lock (frame, NULL((void*)0), this, 0, 0, NULL((void*)0)); | |||
1254 | return 0; | |||
1255 | } | |||
1256 | ||||
1257 | ||||
1258 | int32_t | |||
1259 | marker_get_newpath_contribution (call_frame_t *frame, void *cookie, | |||
1260 | xlator_t *this, int32_t op_ret, | |||
1261 | int32_t op_errno, dict_t *dict, dict_t *xdata) | |||
1262 | { | |||
1263 | marker_local_t *local = NULL((void*)0), *oplocal = NULL((void*)0); | |||
1264 | char contri_key[512] = {0, }; | |||
1265 | int32_t ret = 0; | |||
1266 | int64_t *contribution = 0; | |||
1267 | ||||
1268 | local = frame->local; | |||
1269 | oplocal = local->oplocal; | |||
1270 | ||||
1271 | //Reset frame uid and gid if set. | |||
1272 | if (cookie == (void *) _GF_UID_GID_CHANGED1) | |||
1273 | MARKER_RESET_UID_GID (frame, frame->root, local)do { do { if (local->uid != -1 && local->gid != -1) { frame->root->uid = local->uid; frame->root ->gid = local->gid; } } while (0); frame->cookie = ( (void*)0); } while (0); | |||
1274 | ||||
1275 | if ((op_ret < 0) && (op_errno != ENOATTR61)) { | |||
1276 | local->err = op_errno; | |||
1277 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("fetching contribution values from %s (gfid:%s) " "failed (%s)", oplocal->loc.path, uuid_utoa (oplocal-> loc.inode->gfid), strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 1281, GF_LOG_WARNING , "fetching contribution values from %s (gfid:%s) " "failed (%s)" , oplocal->loc.path, uuid_utoa (oplocal->loc.inode-> gfid), strerror (op_errno)); } while (0) | |||
1278 | "fetching contribution values from %s (gfid:%s) "do { do { if (0) printf ("fetching contribution values from %s (gfid:%s) " "failed (%s)", oplocal->loc.path, uuid_utoa (oplocal-> loc.inode->gfid), strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 1281, GF_LOG_WARNING , "fetching contribution values from %s (gfid:%s) " "failed (%s)" , oplocal->loc.path, uuid_utoa (oplocal->loc.inode-> gfid), strerror (op_errno)); } while (0) | |||
1279 | "failed (%s)", oplocal->loc.path,do { do { if (0) printf ("fetching contribution values from %s (gfid:%s) " "failed (%s)", oplocal->loc.path, uuid_utoa (oplocal-> loc.inode->gfid), strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 1281, GF_LOG_WARNING , "fetching contribution values from %s (gfid:%s) " "failed (%s)" , oplocal->loc.path, uuid_utoa (oplocal->loc.inode-> gfid), strerror (op_errno)); } while (0) | |||
1280 | uuid_utoa (oplocal->loc.inode->gfid),do { do { if (0) printf ("fetching contribution values from %s (gfid:%s) " "failed (%s)", oplocal->loc.path, uuid_utoa (oplocal-> loc.inode->gfid), strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 1281, GF_LOG_WARNING , "fetching contribution values from %s (gfid:%s) " "failed (%s)" , oplocal->loc.path, uuid_utoa (oplocal->loc.inode-> gfid), strerror (op_errno)); } while (0) | |||
1281 | strerror (op_errno))do { do { if (0) printf ("fetching contribution values from %s (gfid:%s) " "failed (%s)", oplocal->loc.path, uuid_utoa (oplocal-> loc.inode->gfid), strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 1281, GF_LOG_WARNING , "fetching contribution values from %s (gfid:%s) " "failed (%s)" , oplocal->loc.path, uuid_utoa (oplocal->loc.inode-> gfid), strerror (op_errno)); } while (0); | |||
1282 | goto err; | |||
1283 | } | |||
1284 | ||||
1285 | GET_CONTRI_KEY (contri_key, oplocal->loc.parent->gfid, ret)do { char _gfid_unparsed[40]; uuid_unparse (oplocal->loc.parent ->gfid, _gfid_unparsed); ret = snprintf (contri_key, 512, "trusted.glusterfs" ".%s.%s." "contri", "quota", _gfid_unparsed); } while (0);; | |||
1286 | if (ret < 0) { | |||
1287 | local->err = errno(*__errno_location ()); | |||
1288 | goto err; | |||
1289 | } | |||
1290 | ||||
1291 | if (dict_get_bin (dict, contri_key, (void **) &contribution) == 0) | |||
1292 | oplocal->contribution = ntoh64hton64 (*contribution); | |||
1293 | ||||
1294 | if (local->loc.inode != NULL((void*)0)) { | |||
1295 | GET_CONTRI_KEY (contri_key, local->loc.parent->gfid, ret)do { char _gfid_unparsed[40]; uuid_unparse (local->loc.parent ->gfid, _gfid_unparsed); ret = snprintf (contri_key, 512, "trusted.glusterfs" ".%s.%s." "contri", "quota", _gfid_unparsed); } while (0);; | |||
1296 | if (ret < 0) { | |||
1297 | local->err = errno(*__errno_location ()); | |||
1298 | goto err; | |||
1299 | } | |||
1300 | ||||
1301 | /* getxattr requires uid and gid to be 0, | |||
1302 | * reset them in the callback. | |||
1303 | */ | |||
1304 | MARKER_SET_UID_GID (frame, local, frame->root)do { do { if (frame->root->uid != -1 && frame-> root->gid != -1) { local->uid = frame->root->uid; local->gid = frame->root->gid; } } while (0); frame ->root->uid = 0; frame->root->gid = 0; frame-> cookie = (void *) 1; } while (0); | |||
1305 | if (uuid_is_null (local->loc.gfid)) | |||
1306 | uuid_copy (local->loc.gfid, local->loc.inode->gfid); | |||
1307 | ||||
1308 | GF_UUID_ASSERT (local->loc.gfid)if (uuid_is_null (local->loc.gfid)) do { if (!(!"uuid null" )) { do { do { if (0) printf ("Assertion failed: " "!\"uuid null\"" ); } while (0); _gf_log_callingfn ("", "marker.c", __FUNCTION__ , 1308, GF_LOG_ERROR, "Assertion failed: " "!\"uuid null\""); } while (0); } } while (0);; | |||
1309 | ||||
1310 | STACK_WIND_COOKIE (frame, marker_do_rename,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1313, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = marker_do_rename ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = frame->cookie; _new->wind_from = __FUNCTION__; _new->wind_to = "FIRST_CHILD(this)->fops->getxattr" ; _new->unwind_to = "marker_do_rename"; 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 ); (this->children->xlator)->fops->getxattr_cbk = marker_do_rename; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location()) = (this->children->xlator ); if ((this->children->xlator)->ctx->measure_latency ) gf_latency_begin (_new, (this->children->xlator)-> fops->getxattr); (this->children->xlator)->fops-> getxattr (_new, (this->children->xlator), &local-> loc, contri_key, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1311 | frame->cookie, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1313, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = marker_do_rename ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = frame->cookie; _new->wind_from = __FUNCTION__; _new->wind_to = "FIRST_CHILD(this)->fops->getxattr" ; _new->unwind_to = "marker_do_rename"; 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 ); (this->children->xlator)->fops->getxattr_cbk = marker_do_rename; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location()) = (this->children->xlator ); if ((this->children->xlator)->ctx->measure_latency ) gf_latency_begin (_new, (this->children->xlator)-> fops->getxattr); (this->children->xlator)->fops-> getxattr (_new, (this->children->xlator), &local-> loc, contri_key, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1312 | FIRST_CHILD(this)->fops->getxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1313, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = marker_do_rename ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = frame->cookie; _new->wind_from = __FUNCTION__; _new->wind_to = "FIRST_CHILD(this)->fops->getxattr" ; _new->unwind_to = "marker_do_rename"; 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 ); (this->children->xlator)->fops->getxattr_cbk = marker_do_rename; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location()) = (this->children->xlator ); if ((this->children->xlator)->ctx->measure_latency ) gf_latency_begin (_new, (this->children->xlator)-> fops->getxattr); (this->children->xlator)->fops-> getxattr (_new, (this->children->xlator), &local-> loc, contri_key, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1313 | &local->loc, contri_key, 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", "marker.c", __FUNCTION__, 1313, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = marker_do_rename ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = frame->cookie; _new->wind_from = __FUNCTION__; _new->wind_to = "FIRST_CHILD(this)->fops->getxattr" ; _new->unwind_to = "marker_do_rename"; 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 ); (this->children->xlator)->fops->getxattr_cbk = marker_do_rename; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location()) = (this->children->xlator ); if ((this->children->xlator)->ctx->measure_latency ) gf_latency_begin (_new, (this->children->xlator)-> fops->getxattr); (this->children->xlator)->fops-> getxattr (_new, (this->children->xlator), &local-> loc, contri_key, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
1314 | } else { | |||
1315 | marker_do_rename (frame, NULL((void*)0), this, 0, 0, NULL((void*)0), NULL((void*)0)); | |||
1316 | } | |||
1317 | ||||
1318 | return 0; | |||
1319 | err: | |||
1320 | marker_rename_release_oldp_lock (frame, NULL((void*)0), this, 0, 0, NULL((void*)0)); | |||
1321 | return 0; | |||
1322 | } | |||
1323 | ||||
1324 | ||||
1325 | int32_t | |||
1326 | marker_get_oldpath_contribution (call_frame_t *frame, void *cookie, | |||
1327 | xlator_t *this, int32_t op_ret, | |||
1328 | int32_t op_errno, dict_t *xdata) | |||
1329 | { | |||
1330 | marker_local_t *local = NULL((void*)0), *oplocal = NULL((void*)0); | |||
1331 | char contri_key[512] = {0, }; | |||
1332 | int32_t ret = 0; | |||
1333 | ||||
1334 | local = frame->local; | |||
1335 | oplocal = local->oplocal; | |||
1336 | ||||
1337 | if (op_ret < 0) { | |||
1338 | local->err = op_errno; | |||
1339 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("cannot hold inodelk on %s (gfid:%s) (%s)" , local->next_lock_on->path, uuid_utoa (local->next_lock_on ->inode->gfid), strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 1343, GF_LOG_WARNING , "cannot hold inodelk on %s (gfid:%s) (%s)", local->next_lock_on ->path, uuid_utoa (local->next_lock_on->inode->gfid ), strerror (op_errno)); } while (0) | |||
1340 | "cannot hold inodelk on %s (gfid:%s) (%s)",do { do { if (0) printf ("cannot hold inodelk on %s (gfid:%s) (%s)" , local->next_lock_on->path, uuid_utoa (local->next_lock_on ->inode->gfid), strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 1343, GF_LOG_WARNING , "cannot hold inodelk on %s (gfid:%s) (%s)", local->next_lock_on ->path, uuid_utoa (local->next_lock_on->inode->gfid ), strerror (op_errno)); } while (0) | |||
1341 | local->next_lock_on->path,do { do { if (0) printf ("cannot hold inodelk on %s (gfid:%s) (%s)" , local->next_lock_on->path, uuid_utoa (local->next_lock_on ->inode->gfid), strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 1343, GF_LOG_WARNING , "cannot hold inodelk on %s (gfid:%s) (%s)", local->next_lock_on ->path, uuid_utoa (local->next_lock_on->inode->gfid ), strerror (op_errno)); } while (0) | |||
1342 | uuid_utoa (local->next_lock_on->inode->gfid),do { do { if (0) printf ("cannot hold inodelk on %s (gfid:%s) (%s)" , local->next_lock_on->path, uuid_utoa (local->next_lock_on ->inode->gfid), strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 1343, GF_LOG_WARNING , "cannot hold inodelk on %s (gfid:%s) (%s)", local->next_lock_on ->path, uuid_utoa (local->next_lock_on->inode->gfid ), strerror (op_errno)); } while (0) | |||
1343 | strerror (op_errno))do { do { if (0) printf ("cannot hold inodelk on %s (gfid:%s) (%s)" , local->next_lock_on->path, uuid_utoa (local->next_lock_on ->inode->gfid), strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 1343, GF_LOG_WARNING , "cannot hold inodelk on %s (gfid:%s) (%s)", local->next_lock_on ->path, uuid_utoa (local->next_lock_on->inode->gfid ), strerror (op_errno)); } while (0); | |||
1344 | goto lock_err; | |||
1345 | } | |||
1346 | ||||
1347 | GET_CONTRI_KEY (contri_key, oplocal->loc.parent->gfid, ret)do { char _gfid_unparsed[40]; uuid_unparse (oplocal->loc.parent ->gfid, _gfid_unparsed); ret = snprintf (contri_key, 512, "trusted.glusterfs" ".%s.%s." "contri", "quota", _gfid_unparsed); } while (0);; | |||
1348 | if (ret < 0) { | |||
1349 | local->err = errno(*__errno_location ()); | |||
1350 | goto quota_err; | |||
1351 | } | |||
1352 | ||||
1353 | /* getxattr requires uid and gid to be 0, | |||
1354 | * reset them in the callback. | |||
1355 | */ | |||
1356 | MARKER_SET_UID_GID (frame, local, frame->root)do { do { if (frame->root->uid != -1 && frame-> root->gid != -1) { local->uid = frame->root->uid; local->gid = frame->root->gid; } } while (0); frame ->root->uid = 0; frame->root->gid = 0; frame-> cookie = (void *) 1; } while (0); | |||
1357 | ||||
1358 | if (uuid_is_null (oplocal->loc.gfid)) | |||
1359 | uuid_copy (oplocal->loc.gfid, | |||
1360 | oplocal->loc.inode->gfid); | |||
1361 | ||||
1362 | GF_UUID_ASSERT (oplocal->loc.gfid)if (uuid_is_null (oplocal->loc.gfid)) do { if (!(!"uuid null" )) { do { do { if (0) printf ("Assertion failed: " "!\"uuid null\"" ); } while (0); _gf_log_callingfn ("", "marker.c", __FUNCTION__ , 1362, GF_LOG_ERROR, "Assertion failed: " "!\"uuid null\""); } while (0); } } while (0);; | |||
1363 | ||||
1364 | STACK_WIND_COOKIE (frame, marker_get_newpath_contribution,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", "marker.c", __FUNCTION__, 1367, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = marker_get_newpath_contribution ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = frame->cookie; _new->wind_from = __FUNCTION__; _new->wind_to = "FIRST_CHILD(this)->fops->getxattr" ; _new->unwind_to = "marker_get_newpath_contribution"; 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 ); (this->children->xlator)->fops->getxattr_cbk = marker_get_newpath_contribution; old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = (this->children-> xlator); if ((this->children->xlator)->ctx->measure_latency ) gf_latency_begin (_new, (this->children->xlator)-> fops->getxattr); (this->children->xlator)->fops-> getxattr (_new, (this->children->xlator), &oplocal-> loc, contri_key, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1365 | frame->cookie, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1367, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = marker_get_newpath_contribution ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = frame->cookie; _new->wind_from = __FUNCTION__; _new->wind_to = "FIRST_CHILD(this)->fops->getxattr" ; _new->unwind_to = "marker_get_newpath_contribution"; 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 ); (this->children->xlator)->fops->getxattr_cbk = marker_get_newpath_contribution; old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = (this->children-> xlator); if ((this->children->xlator)->ctx->measure_latency ) gf_latency_begin (_new, (this->children->xlator)-> fops->getxattr); (this->children->xlator)->fops-> getxattr (_new, (this->children->xlator), &oplocal-> loc, contri_key, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1366 | FIRST_CHILD(this)->fops->getxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1367, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = marker_get_newpath_contribution ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = frame->cookie; _new->wind_from = __FUNCTION__; _new->wind_to = "FIRST_CHILD(this)->fops->getxattr" ; _new->unwind_to = "marker_get_newpath_contribution"; 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 ); (this->children->xlator)->fops->getxattr_cbk = marker_get_newpath_contribution; old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = (this->children-> xlator); if ((this->children->xlator)->ctx->measure_latency ) gf_latency_begin (_new, (this->children->xlator)-> fops->getxattr); (this->children->xlator)->fops-> getxattr (_new, (this->children->xlator), &oplocal-> loc, contri_key, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1367 | &oplocal->loc, contri_key, 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", "marker.c", __FUNCTION__, 1367, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = marker_get_newpath_contribution ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = frame->cookie; _new->wind_from = __FUNCTION__; _new->wind_to = "FIRST_CHILD(this)->fops->getxattr" ; _new->unwind_to = "marker_get_newpath_contribution"; 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 ); (this->children->xlator)->fops->getxattr_cbk = marker_get_newpath_contribution; old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = (this->children-> xlator); if ((this->children->xlator)->ctx->measure_latency ) gf_latency_begin (_new, (this->children->xlator)-> fops->getxattr); (this->children->xlator)->fops-> getxattr (_new, (this->children->xlator), &oplocal-> loc, contri_key, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
1368 | return 0; | |||
1369 | ||||
1370 | quota_err: | |||
1371 | marker_rename_release_oldp_lock (frame, NULL((void*)0), this, 0, 0, NULL((void*)0)); | |||
1372 | return 0; | |||
1373 | ||||
1374 | lock_err: | |||
1375 | if ((local->next_lock_on == NULL((void*)0)) | |||
1376 | || (local->next_lock_on == &local->parent_loc)) { | |||
1377 | local->next_lock_on = NULL((void*)0); | |||
1378 | marker_rename_release_oldp_lock (frame, NULL((void*)0), this, 0, 0, NULL((void*)0)); | |||
1379 | } else { | |||
1380 | marker_rename_release_newp_lock (frame, NULL((void*)0), this, 0, 0, NULL((void*)0)); | |||
1381 | } | |||
1382 | ||||
1383 | return 0; | |||
1384 | } | |||
1385 | ||||
1386 | ||||
1387 | int32_t | |||
1388 | marker_rename_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
1389 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | |||
1390 | { | |||
1391 | marker_local_t *local = NULL((void*)0), *oplocal = NULL((void*)0); | |||
1392 | loc_t *loc = NULL((void*)0); | |||
1393 | struct gf_flock lock = {0, }; | |||
1394 | ||||
1395 | local = frame->local; | |||
1396 | oplocal = local->oplocal; | |||
1397 | ||||
1398 | if (op_ret < 0) { | |||
1399 | if (local->next_lock_on != &oplocal->parent_loc) { | |||
1400 | loc = &oplocal->parent_loc; | |||
1401 | } else { | |||
1402 | loc = &local->parent_loc; | |||
1403 | } | |||
1404 | ||||
1405 | local->err = op_errno; | |||
1406 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("cannot hold inodelk on %s (gfid:%s) (%s)" , loc->path, uuid_utoa (loc->inode->gfid), strerror ( op_errno)); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 1409, GF_LOG_WARNING, "cannot hold inodelk on %s (gfid:%s) (%s)" , loc->path, uuid_utoa (loc->inode->gfid), strerror ( op_errno)); } while (0) | |||
1407 | "cannot hold inodelk on %s (gfid:%s) (%s)",do { do { if (0) printf ("cannot hold inodelk on %s (gfid:%s) (%s)" , loc->path, uuid_utoa (loc->inode->gfid), strerror ( op_errno)); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 1409, GF_LOG_WARNING, "cannot hold inodelk on %s (gfid:%s) (%s)" , loc->path, uuid_utoa (loc->inode->gfid), strerror ( op_errno)); } while (0) | |||
1408 | loc->path, uuid_utoa (loc->inode->gfid),do { do { if (0) printf ("cannot hold inodelk on %s (gfid:%s) (%s)" , loc->path, uuid_utoa (loc->inode->gfid), strerror ( op_errno)); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 1409, GF_LOG_WARNING, "cannot hold inodelk on %s (gfid:%s) (%s)" , loc->path, uuid_utoa (loc->inode->gfid), strerror ( op_errno)); } while (0) | |||
1409 | strerror (op_errno))do { do { if (0) printf ("cannot hold inodelk on %s (gfid:%s) (%s)" , loc->path, uuid_utoa (loc->inode->gfid), strerror ( op_errno)); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 1409, GF_LOG_WARNING, "cannot hold inodelk on %s (gfid:%s) (%s)" , loc->path, uuid_utoa (loc->inode->gfid), strerror ( op_errno)); } while (0); | |||
1410 | goto err; | |||
1411 | } | |||
1412 | ||||
1413 | if (local->next_lock_on != NULL((void*)0)) { | |||
1414 | lock.l_len = 0; | |||
1415 | lock.l_start = 0; | |||
1416 | lock.l_type = F_WRLCK1; | |||
1417 | lock.l_whence = SEEK_SET0; | |||
1418 | ||||
1419 | STACK_WIND (frame,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", "marker.c", __FUNCTION__, 1424, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_get_oldpath_contribution ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_get_oldpath_contribution"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, local->next_lock_on, 14, &lock, ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1420 | marker_get_oldpath_contribution,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", "marker.c", __FUNCTION__, 1424, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_get_oldpath_contribution ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_get_oldpath_contribution"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, local->next_lock_on, 14, &lock, ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1421 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1424, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_get_oldpath_contribution ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_get_oldpath_contribution"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, local->next_lock_on, 14, &lock, ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1422 | FIRST_CHILD(this)->fops->inodelk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1424, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_get_oldpath_contribution ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_get_oldpath_contribution"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, local->next_lock_on, 14, &lock, ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1423 | this->name, local->next_lock_on,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", "marker.c", __FUNCTION__, 1424, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_get_oldpath_contribution ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_get_oldpath_contribution"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, local->next_lock_on, 14, &lock, ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1424 | F_SETLKW, &lock, 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", "marker.c", __FUNCTION__, 1424, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_get_oldpath_contribution ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_get_oldpath_contribution"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, local->next_lock_on, 14, &lock, ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
1425 | } else { | |||
1426 | marker_get_oldpath_contribution (frame, 0, this, 0, 0, NULL((void*)0)); | |||
1427 | } | |||
1428 | ||||
1429 | return 0; | |||
1430 | ||||
1431 | err: | |||
1432 | marker_rename_done (frame, NULL((void*)0), this, 0, 0, NULL((void*)0)); | |||
1433 | return 0; | |||
1434 | } | |||
1435 | ||||
1436 | ||||
1437 | int32_t | |||
1438 | marker_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, | |||
1439 | loc_t *newloc, dict_t *xdata) | |||
1440 | { | |||
1441 | int32_t ret = 0; | |||
1442 | marker_local_t *local = NULL((void*)0); | |||
1443 | marker_local_t *oplocal = NULL((void*)0); | |||
1444 | marker_conf_t *priv = NULL((void*)0); | |||
1445 | struct gf_flock lock = {0, }; | |||
1446 | loc_t *lock_on = NULL((void*)0); | |||
1447 | ||||
1448 | priv = this->private; | |||
1449 | ||||
1450 | if (priv->feature_enabled == 0) | |||
1451 | goto rename_wind; | |||
1452 | ||||
1453 | local = mem_get0 (this->local_pool); | |||
1454 | ||||
1455 | MARKER_INIT_LOCAL (frame, local)do { frame->local = local; local->pid = frame->root-> pid; memset (&local->loc, 0, sizeof (loc_t)); local-> ref = 1; local->uid = -1; local->gid = -1; pthread_spin_init (&local->lock, 0); local->oplocal = ((void*)0); } while (0); | |||
1456 | ||||
1457 | oplocal = mem_get0 (this->local_pool); | |||
1458 | ||||
1459 | MARKER_INIT_LOCAL (frame, oplocal)do { frame->local = oplocal; oplocal->pid = frame->root ->pid; memset (&oplocal->loc, 0, sizeof (loc_t)); oplocal ->ref = 1; oplocal->uid = -1; oplocal->gid = -1; pthread_spin_init (&oplocal->lock, 0); oplocal->oplocal = ((void*)0) ; } while (0); | |||
1460 | ||||
1461 | frame->local = local; | |||
1462 | ||||
1463 | local->oplocal = marker_local_ref (oplocal); | |||
1464 | ||||
1465 | ret = loc_copy (&local->loc, newloc); | |||
1466 | if (ret < 0) | |||
1467 | goto err; | |||
1468 | ||||
1469 | ret = loc_copy (&oplocal->loc, oldloc); | |||
1470 | if (ret < 0) | |||
1471 | goto err; | |||
1472 | ||||
1473 | if (!(priv->feature_enabled & GF_QUOTA)) { | |||
1474 | goto rename_wind; | |||
1475 | } | |||
1476 | ||||
1477 | ret = mq_inode_loc_fill (NULL((void*)0), newloc->parent, &local->parent_loc); | |||
1478 | if (ret < 0) | |||
1479 | goto err; | |||
1480 | ||||
1481 | ret = mq_inode_loc_fill (NULL((void*)0), oldloc->parent, &oplocal->parent_loc); | |||
1482 | if (ret < 0) | |||
1483 | goto err; | |||
1484 | ||||
1485 | if ((newloc->inode != NULL((void*)0)) && (newloc->parent != oldloc->parent) | |||
1486 | && (uuid_compare (newloc->parent->gfid, | |||
1487 | oldloc->parent->gfid) < 0)) { | |||
1488 | lock_on = &local->parent_loc; | |||
1489 | local->next_lock_on = &oplocal->parent_loc; | |||
1490 | } else { | |||
1491 | lock_on = &oplocal->parent_loc; | |||
1492 | if ((newloc->inode != NULL((void*)0)) && (newloc->parent | |||
1493 | != oldloc->parent)) { | |||
1494 | local->next_lock_on = &local->parent_loc; | |||
1495 | } | |||
1496 | } | |||
1497 | ||||
1498 | lock.l_len = 0; | |||
1499 | lock.l_start = 0; | |||
1500 | lock.l_type = F_WRLCK1; | |||
1501 | lock.l_whence = SEEK_SET0; | |||
1502 | ||||
1503 | STACK_WIND (frame,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", "marker.c", __FUNCTION__, 1508, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_rename_inodelk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_rename_inodelk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, lock_on, 14, &lock, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
1504 | marker_rename_inodelk_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1508, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_rename_inodelk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_rename_inodelk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, lock_on, 14, &lock, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
1505 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1508, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_rename_inodelk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_rename_inodelk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, lock_on, 14, &lock, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
1506 | FIRST_CHILD(this)->fops->inodelk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1508, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_rename_inodelk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_rename_inodelk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, lock_on, 14, &lock, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
1507 | this->name, lock_on,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", "marker.c", __FUNCTION__, 1508, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_rename_inodelk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_rename_inodelk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, lock_on, 14, &lock, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
1508 | F_SETLKW, &lock, 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", "marker.c", __FUNCTION__, 1508, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = marker_rename_inodelk_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->inodelk" ; _new->unwind_to = "marker_rename_inodelk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), this->name, lock_on, 14, &lock, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
1509 | ||||
1510 | return 0; | |||
1511 | ||||
1512 | rename_wind: | |||
1513 | STACK_WIND (frame, marker_rename_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1514, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rename_cbk) tmp_cbk = marker_rename_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->rename"; _new->unwind_to = "marker_rename_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->rename); (this->children->xlator )->fops->rename (_new, (this->children->xlator), oldloc , newloc, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1514 | FIRST_CHILD(this)->fops->rename, oldloc, newloc, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1514, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rename_cbk) tmp_cbk = marker_rename_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->rename"; _new->unwind_to = "marker_rename_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->rename); (this->children->xlator )->fops->rename (_new, (this->children->xlator), oldloc , newloc, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
1515 | ||||
1516 | return 0; | |||
1517 | err: | |||
1518 | STACK_UNWIND_STRICT (rename, frame, -1, ENOMEM, NULL,do { fop_rename_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 1519, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_rename_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , 12, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void* )0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1519 | NULL, NULL, NULL, NULL, NULL)do { fop_rename_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 1519, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_rename_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , 12, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void* )0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
1520 | ||||
1521 | return 0; | |||
1522 | } | |||
1523 | ||||
1524 | ||||
1525 | int32_t | |||
1526 | marker_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
1527 | int32_t op_ret, int32_t op_errno, struct iatt *prebuf, | |||
1528 | struct iatt *postbuf, dict_t *xdata) | |||
1529 | { | |||
1530 | marker_local_t *local = NULL((void*)0); | |||
1531 | marker_conf_t *priv = NULL((void*)0); | |||
1532 | ||||
1533 | if (op_ret == -1) { | |||
1534 | gf_log (this->name, GF_LOG_TRACE, "%s occurred while "do { do { if (0) printf ("%s occurred while " "truncating a file " , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 1535, GF_LOG_TRACE, "%s occurred while " "truncating a file " , strerror (op_errno)); } while (0) | |||
1535 | "truncating a file ", strerror (op_errno))do { do { if (0) printf ("%s occurred while " "truncating a file " , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 1535, GF_LOG_TRACE, "%s occurred while " "truncating a file " , strerror (op_errno)); } while (0); | |||
1536 | } | |||
1537 | ||||
1538 | local = (marker_local_t *) frame->local; | |||
1539 | ||||
1540 | frame->local = NULL((void*)0); | |||
1541 | ||||
1542 | STACK_UNWIND_STRICT (truncate, frame, op_ret, op_errno, prebuf,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" , "marker.c", __FUNCTION__, 1543, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_truncate_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
1543 | postbuf, xdata)do { fop_truncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 1543, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_truncate_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
1544 | ||||
1545 | if (op_ret == -1 || local == NULL((void*)0)) | |||
1546 | goto out; | |||
1547 | ||||
1548 | priv = this->private; | |||
1549 | ||||
1550 | if (priv->feature_enabled & GF_QUOTA) | |||
1551 | mq_initiate_quota_txn (this, &local->loc); | |||
1552 | ||||
1553 | if (priv->feature_enabled & GF_XTIME) | |||
1554 | marker_xtime_update_marks (this, local); | |||
1555 | ||||
1556 | out: | |||
1557 | marker_local_unref (local); | |||
1558 | ||||
1559 | return 0; | |||
1560 | } | |||
1561 | ||||
1562 | int32_t | |||
1563 | marker_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset, | |||
1564 | dict_t *xdata) | |||
1565 | { | |||
1566 | int32_t ret = 0; | |||
1567 | marker_local_t *local = NULL((void*)0); | |||
1568 | marker_conf_t *priv = NULL((void*)0); | |||
1569 | ||||
1570 | priv = this->private; | |||
1571 | ||||
1572 | if (priv->feature_enabled == 0) | |||
1573 | goto wind; | |||
1574 | ||||
1575 | local = mem_get0 (this->local_pool); | |||
1576 | ||||
1577 | MARKER_INIT_LOCAL (frame, local)do { frame->local = local; local->pid = frame->root-> pid; memset (&local->loc, 0, sizeof (loc_t)); local-> ref = 1; local->uid = -1; local->gid = -1; pthread_spin_init (&local->lock, 0); local->oplocal = ((void*)0); } while (0); | |||
1578 | ||||
1579 | ret = loc_copy (&local->loc, loc); | |||
1580 | ||||
1581 | if (ret == -1) | |||
1582 | goto err; | |||
1583 | wind: | |||
1584 | STACK_WIND (frame, marker_truncate_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1585, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->truncate_cbk) tmp_cbk = marker_truncate_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->truncate" ; _new->unwind_to = "marker_truncate_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->truncate); (this->children->xlator )->fops->truncate (_new, (this->children->xlator) , loc, offset, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||
1585 | FIRST_CHILD(this)->fops->truncate, loc, offset, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1585, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->truncate_cbk) tmp_cbk = marker_truncate_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->truncate" ; _new->unwind_to = "marker_truncate_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->truncate); (this->children->xlator )->fops->truncate (_new, (this->children->xlator) , loc, offset, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||
1586 | return 0; | |||
1587 | err: | |||
1588 | STACK_UNWIND_STRICT (truncate, frame, -1, ENOMEM, NULL, NULL, NULL)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" , "marker.c", __FUNCTION__, 1588, 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 , 12, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
1589 | ||||
1590 | return 0; | |||
1591 | } | |||
1592 | ||||
1593 | ||||
1594 | int32_t | |||
1595 | marker_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
1596 | int32_t op_ret, int32_t op_errno, struct iatt *prebuf, | |||
1597 | struct iatt *postbuf, dict_t *xdata) | |||
1598 | { | |||
1599 | marker_local_t *local = NULL((void*)0); | |||
1600 | marker_conf_t *priv = NULL((void*)0); | |||
1601 | ||||
1602 | if (op_ret == -1) { | |||
1603 | gf_log (this->name, GF_LOG_TRACE, "%s occurred while "do { do { if (0) printf ("%s occurred while " "truncating a file " , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 1604, GF_LOG_TRACE, "%s occurred while " "truncating a file " , strerror (op_errno)); } while (0) | |||
1604 | "truncating a file ", strerror (op_errno))do { do { if (0) printf ("%s occurred while " "truncating a file " , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 1604, GF_LOG_TRACE, "%s occurred while " "truncating a file " , strerror (op_errno)); } while (0); | |||
1605 | } | |||
1606 | ||||
1607 | local = (marker_local_t *) frame->local; | |||
1608 | ||||
1609 | frame->local = NULL((void*)0); | |||
1610 | ||||
1611 | STACK_UNWIND_STRICT (ftruncate, frame, op_ret, op_errno, prebuf,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" , "marker.c", __FUNCTION__, 1612, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_ftruncate_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
1612 | postbuf, xdata)do { fop_ftruncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 1612, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_ftruncate_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
1613 | ||||
1614 | if (op_ret == -1 || local == NULL((void*)0)) | |||
1615 | goto out; | |||
1616 | ||||
1617 | priv = this->private; | |||
1618 | ||||
1619 | if (priv->feature_enabled & GF_QUOTA) | |||
1620 | mq_initiate_quota_txn (this, &local->loc); | |||
1621 | ||||
1622 | if (priv->feature_enabled & GF_XTIME) | |||
1623 | marker_xtime_update_marks (this, local); | |||
1624 | out: | |||
1625 | marker_local_unref (local); | |||
1626 | ||||
1627 | return 0; | |||
1628 | } | |||
1629 | ||||
1630 | int32_t | |||
1631 | marker_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, | |||
1632 | dict_t *xdata) | |||
1633 | { | |||
1634 | int32_t ret = 0; | |||
1635 | marker_local_t *local = NULL((void*)0); | |||
1636 | marker_conf_t *priv = NULL((void*)0); | |||
1637 | ||||
1638 | priv = this->private; | |||
1639 | ||||
1640 | if (priv->feature_enabled == 0) | |||
1641 | goto wind; | |||
1642 | ||||
1643 | local = mem_get0 (this->local_pool); | |||
1644 | ||||
1645 | MARKER_INIT_LOCAL (frame, local)do { frame->local = local; local->pid = frame->root-> pid; memset (&local->loc, 0, sizeof (loc_t)); local-> ref = 1; local->uid = -1; local->gid = -1; pthread_spin_init (&local->lock, 0); local->oplocal = ((void*)0); } while (0); | |||
1646 | ||||
1647 | ret = marker_inode_loc_fill (fd->inode, &local->loc); | |||
1648 | ||||
1649 | if (ret == -1) | |||
1650 | goto err; | |||
1651 | wind: | |||
1652 | STACK_WIND (frame, marker_ftruncate_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1653, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->ftruncate_cbk) tmp_cbk = marker_ftruncate_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->ftruncate" ; _new->unwind_to = "marker_ftruncate_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->ftruncate); (this->children-> xlator)->fops->ftruncate (_new, (this->children-> xlator), fd, offset, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1653 | FIRST_CHILD(this)->fops->ftruncate, fd, offset, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1653, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->ftruncate_cbk) tmp_cbk = marker_ftruncate_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->ftruncate" ; _new->unwind_to = "marker_ftruncate_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->ftruncate); (this->children-> xlator)->fops->ftruncate (_new, (this->children-> xlator), fd, offset, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
1654 | return 0; | |||
1655 | err: | |||
1656 | STACK_UNWIND_STRICT (ftruncate, frame, -1, ENOMEM, NULL, NULL, NULL)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" , "marker.c", __FUNCTION__, 1656, 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 , 12, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
1657 | ||||
1658 | return 0; | |||
1659 | } | |||
1660 | ||||
1661 | ||||
1662 | int32_t | |||
1663 | marker_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
1664 | int32_t op_ret, int32_t op_errno, inode_t *inode, | |||
1665 | struct iatt *buf, struct iatt *preparent, | |||
1666 | struct iatt *postparent, dict_t *xdata) | |||
1667 | { | |||
1668 | marker_conf_t *priv = NULL((void*)0); | |||
1669 | marker_local_t *local = NULL((void*)0); | |||
1670 | ||||
1671 | if (op_ret == -1) { | |||
1672 | gf_log (this->name, GF_LOG_TRACE, "%s occurred while "do { do { if (0) printf ("%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 1673, GF_LOG_TRACE, "%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0) | |||
1673 | "creating symlinks ", strerror (op_errno))do { do { if (0) printf ("%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 1673, GF_LOG_TRACE, "%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0); | |||
1674 | } | |||
1675 | ||||
1676 | local = (marker_local_t *) frame->local; | |||
1677 | ||||
1678 | frame->local = NULL((void*)0); | |||
1679 | ||||
1680 | STACK_UNWIND_STRICT (symlink, frame, op_ret, op_errno, inode, buf,do { fop_symlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 1681, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_symlink_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
1681 | preparent, postparent, xdata)do { fop_symlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 1681, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_symlink_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
1682 | ||||
1683 | if (op_ret == -1 || local == NULL((void*)0)) | |||
1684 | goto out; | |||
1685 | ||||
1686 | if (uuid_is_null (local->loc.gfid)) | |||
1687 | uuid_copy (local->loc.gfid, buf->ia_gfid); | |||
1688 | ||||
1689 | priv = this->private; | |||
1690 | ||||
1691 | if (priv->feature_enabled & GF_QUOTA) | |||
1692 | mq_set_inode_xattr (this, &local->loc); | |||
1693 | ||||
1694 | if (priv->feature_enabled & GF_XTIME) | |||
1695 | marker_xtime_update_marks (this, local); | |||
1696 | out: | |||
1697 | marker_local_unref (local); | |||
1698 | ||||
1699 | return 0; | |||
1700 | } | |||
1701 | ||||
1702 | int | |||
1703 | marker_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, | |||
1704 | loc_t *loc, mode_t umask, dict_t *xdata) | |||
1705 | { | |||
1706 | int32_t ret = 0; | |||
1707 | marker_local_t *local = NULL((void*)0); | |||
1708 | marker_conf_t *priv = NULL((void*)0); | |||
1709 | ||||
1710 | priv = this->private; | |||
1711 | ||||
1712 | if (priv->feature_enabled == 0) | |||
1713 | goto wind; | |||
1714 | ||||
1715 | local = mem_get0 (this->local_pool); | |||
1716 | ||||
1717 | MARKER_INIT_LOCAL (frame, local)do { frame->local = local; local->pid = frame->root-> pid; memset (&local->loc, 0, sizeof (loc_t)); local-> ref = 1; local->uid = -1; local->gid = -1; pthread_spin_init (&local->lock, 0); local->oplocal = ((void*)0); } while (0); | |||
1718 | ||||
1719 | ret = loc_copy (&local->loc, loc); | |||
1720 | ||||
1721 | if (ret == -1) | |||
1722 | goto err; | |||
1723 | wind: | |||
1724 | STACK_WIND (frame, marker_symlink_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1726, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->symlink_cbk) tmp_cbk = marker_symlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->symlink" ; _new->unwind_to = "marker_symlink_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->symlink); (this->children->xlator )->fops->symlink (_new, (this->children->xlator), linkpath, loc, umask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1725 | FIRST_CHILD(this)->fops->symlink, linkpath, loc, umask,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", "marker.c", __FUNCTION__, 1726, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->symlink_cbk) tmp_cbk = marker_symlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->symlink" ; _new->unwind_to = "marker_symlink_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->symlink); (this->children->xlator )->fops->symlink (_new, (this->children->xlator), linkpath, loc, umask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1726 | xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1726, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->symlink_cbk) tmp_cbk = marker_symlink_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->symlink" ; _new->unwind_to = "marker_symlink_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->symlink); (this->children->xlator )->fops->symlink (_new, (this->children->xlator), linkpath, loc, umask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
1727 | return 0; | |||
1728 | err: | |||
1729 | STACK_UNWIND_STRICT (symlink, frame, -1, ENOMEM, NULL,do { fop_symlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 1730, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_symlink_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , 12, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void* )0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1730 | NULL, NULL, NULL, NULL)do { fop_symlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 1730, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_symlink_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , 12, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void* )0)); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
1731 | return 0; | |||
1732 | } | |||
1733 | ||||
1734 | ||||
1735 | int32_t | |||
1736 | marker_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
1737 | int32_t op_ret, int32_t op_errno, inode_t *inode, | |||
1738 | struct iatt *buf, struct iatt *preparent, | |||
1739 | struct iatt *postparent, dict_t *xdata) | |||
1740 | { | |||
1741 | marker_local_t *local = NULL((void*)0); | |||
1742 | marker_conf_t *priv = NULL((void*)0); | |||
1743 | ||||
1744 | if (op_ret == -1) { | |||
1745 | gf_log (this->name, GF_LOG_TRACE, "%s occurred while "do { do { if (0) printf ("%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 1746, GF_LOG_TRACE, "%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0) | |||
1746 | "creating symlinks ", strerror (op_errno))do { do { if (0) printf ("%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 1746, GF_LOG_TRACE, "%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0); | |||
1747 | } | |||
1748 | ||||
1749 | local = (marker_local_t *) frame->local; | |||
1750 | ||||
1751 | frame->local = NULL((void*)0); | |||
1752 | ||||
1753 | STACK_UNWIND_STRICT (mknod, frame, op_ret, op_errno, inode,do { fop_mknod_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 1754, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_mknod_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
1754 | buf, preparent, postparent, xdata)do { fop_mknod_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 1754, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_mknod_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, preparent, postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
1755 | ||||
1756 | if (op_ret == -1 || local == NULL((void*)0)) | |||
1757 | goto out; | |||
1758 | ||||
1759 | if (uuid_is_null (local->loc.gfid)) | |||
1760 | uuid_copy (local->loc.gfid, buf->ia_gfid); | |||
1761 | ||||
1762 | priv = this->private; | |||
1763 | ||||
1764 | if ((priv->feature_enabled & GF_QUOTA) && (S_ISREG (local->mode)((((local->mode)) & 0170000) == (0100000)))) { | |||
1765 | mq_set_inode_xattr (this, &local->loc); | |||
1766 | } | |||
1767 | ||||
1768 | if (priv->feature_enabled & GF_XTIME) | |||
1769 | marker_xtime_update_marks (this, local); | |||
1770 | out: | |||
1771 | marker_local_unref (local); | |||
1772 | ||||
1773 | return 0; | |||
1774 | } | |||
1775 | ||||
1776 | int | |||
1777 | marker_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, | |||
1778 | dev_t rdev, mode_t umask, dict_t *xdata) | |||
1779 | { | |||
1780 | int32_t ret = 0; | |||
1781 | marker_local_t *local = NULL((void*)0); | |||
1782 | marker_conf_t *priv = NULL((void*)0); | |||
1783 | ||||
1784 | priv = this->private; | |||
1785 | ||||
1786 | if (priv->feature_enabled == 0) | |||
1787 | goto wind; | |||
1788 | ||||
1789 | local = mem_get0 (this->local_pool); | |||
1790 | ||||
1791 | MARKER_INIT_LOCAL (frame, local)do { frame->local = local; local->pid = frame->root-> pid; memset (&local->loc, 0, sizeof (loc_t)); local-> ref = 1; local->uid = -1; local->gid = -1; pthread_spin_init (&local->lock, 0); local->oplocal = ((void*)0); } while (0); | |||
1792 | ||||
1793 | ret = loc_copy (&local->loc, loc); | |||
1794 | ||||
1795 | local->mode = mode; | |||
1796 | ||||
1797 | if (ret == -1) | |||
1798 | goto err; | |||
1799 | wind: | |||
1800 | STACK_WIND (frame, marker_mknod_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1802, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mknod_cbk) tmp_cbk = marker_mknod_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->mknod"; _new ->unwind_to = "marker_mknod_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->mknod); (this->children->xlator )->fops->mknod (_new, (this->children->xlator), loc , mode, rdev, umask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1801 | FIRST_CHILD(this)->fops->mknod, loc, mode, rdev, umask,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", "marker.c", __FUNCTION__, 1802, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mknod_cbk) tmp_cbk = marker_mknod_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->mknod"; _new ->unwind_to = "marker_mknod_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->mknod); (this->children->xlator )->fops->mknod (_new, (this->children->xlator), loc , mode, rdev, umask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1802 | xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1802, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mknod_cbk) tmp_cbk = marker_mknod_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->mknod"; _new ->unwind_to = "marker_mknod_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->mknod); (this->children->xlator )->fops->mknod (_new, (this->children->xlator), loc , mode, rdev, umask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
1803 | return 0; | |||
1804 | err: | |||
1805 | STACK_UNWIND_STRICT (mknod, frame, -1, ENOMEM, NULL,do { fop_mknod_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 1806, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_mknod_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , 12, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void* )0)); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
1806 | NULL, NULL, NULL, NULL)do { fop_mknod_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 1806, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_mknod_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root-> stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , 12, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void* )0)); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
1807 | return 0; | |||
1808 | } | |||
1809 | ||||
1810 | ||||
1811 | /* when a call from the special client is received on | |||
1812 | * key trusted.glusterfs.volume-mark with value "RESET" | |||
1813 | * or if the value is 0length, update the change the | |||
1814 | * access time and modification time via touching the | |||
1815 | * timestamp file. | |||
1816 | */ | |||
1817 | int32_t | |||
1818 | call_from_sp_client_to_reset_tmfile (call_frame_t *frame, | |||
1819 | xlator_t *this, | |||
1820 | dict_t *dict) | |||
1821 | { | |||
1822 | int32_t fd = 0; | |||
1823 | int32_t op_ret = 0; | |||
1824 | int32_t op_errno = 0; | |||
1825 | data_t *data = NULL((void*)0); | |||
1826 | marker_conf_t *priv = NULL((void*)0); | |||
1827 | ||||
1828 | if (frame == NULL((void*)0) || this == NULL((void*)0) || dict == NULL((void*)0)) | |||
1829 | return -1; | |||
1830 | ||||
1831 | priv = this->private; | |||
1832 | ||||
1833 | data = dict_get (dict, "trusted.glusterfs.volume-mark"); | |||
1834 | if (data == NULL((void*)0)) | |||
1835 | return -1; | |||
1836 | ||||
1837 | if (frame->root->pid != GF_CLIENT_PID_GSYNCD) { | |||
1838 | op_ret = -1; | |||
1839 | op_errno = EPERM1; | |||
1840 | ||||
1841 | goto out; | |||
1842 | } | |||
1843 | ||||
1844 | if (data->len == 0 || (data->len == 5 && | |||
1845 | memcmp (data->data, "RESET", 5) == 0)) { | |||
1846 | fd = open (priv->timestamp_file, O_WRONLY01|O_TRUNC01000); | |||
1847 | if (fd != -1) { | |||
1848 | /* TODO check whether the O_TRUNC would update the | |||
1849 | * timestamps on a zero length file on all machies. | |||
1850 | */ | |||
1851 | close (fd); | |||
1852 | } | |||
1853 | ||||
1854 | if (fd != -1 || errno(*__errno_location ()) == ENOENT2) { | |||
1855 | op_ret = 0; | |||
1856 | op_errno = 0; | |||
1857 | } else { | |||
1858 | op_ret = -1; | |||
1859 | op_errno = errno(*__errno_location ()); | |||
1860 | } | |||
1861 | } else { | |||
1862 | op_ret = -1; | |||
1863 | op_errno = EINVAL22; | |||
1864 | } | |||
1865 | out: | |||
1866 | STACK_UNWIND_STRICT (setxattr, frame, op_ret, op_errno, NULL)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" , "marker.c", __FUNCTION__, 1866, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_setxattr_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||
1867 | ||||
1868 | return 0; | |||
1869 | } | |||
1870 | ||||
1871 | ||||
1872 | int32_t | |||
1873 | marker_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
1874 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | |||
1875 | { | |||
1876 | marker_local_t *local = NULL((void*)0); | |||
1877 | marker_conf_t *priv = NULL((void*)0); | |||
1878 | ||||
1879 | if (op_ret == -1) { | |||
1880 | gf_log (this->name, GF_LOG_TRACE, "%s occurred in "do { do { if (0) printf ("%s occurred in " "setxattr ", strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 1881, GF_LOG_TRACE, "%s occurred in " "setxattr " , strerror (op_errno)); } while (0) | |||
1881 | "setxattr ", strerror (op_errno))do { do { if (0) printf ("%s occurred in " "setxattr ", strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 1881, GF_LOG_TRACE, "%s occurred in " "setxattr " , strerror (op_errno)); } while (0); | |||
1882 | } | |||
1883 | ||||
1884 | local = (marker_local_t *) frame->local; | |||
1885 | ||||
1886 | frame->local = NULL((void*)0); | |||
1887 | ||||
1888 | STACK_UNWIND_STRICT (setxattr, frame, op_ret, op_errno, xdata)do { fop_setxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 1888, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_setxattr_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||
1889 | ||||
1890 | if (op_ret == -1 || local == NULL((void*)0)) | |||
1891 | goto out; | |||
1892 | ||||
1893 | priv = this->private; | |||
1894 | ||||
1895 | if (priv->feature_enabled & GF_XTIME) | |||
1896 | marker_xtime_update_marks (this, local); | |||
1897 | out: | |||
1898 | marker_local_unref (local); | |||
1899 | ||||
1900 | return 0; | |||
1901 | } | |||
1902 | ||||
1903 | int32_t | |||
1904 | marker_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, | |||
1905 | int32_t flags, dict_t *xdata) | |||
1906 | { | |||
1907 | int32_t ret = 0; | |||
1908 | marker_local_t *local = NULL((void*)0); | |||
1909 | marker_conf_t *priv = NULL((void*)0); | |||
1910 | ||||
1911 | priv = this->private; | |||
1912 | ||||
1913 | if (priv->feature_enabled == 0) | |||
1914 | goto wind; | |||
1915 | ||||
1916 | ret = call_from_sp_client_to_reset_tmfile (frame, this, dict); | |||
1917 | if (ret == 0) | |||
1918 | return 0; | |||
1919 | ||||
1920 | local = mem_get0 (this->local_pool); | |||
1921 | ||||
1922 | MARKER_INIT_LOCAL (frame, local)do { frame->local = local; local->pid = frame->root-> pid; memset (&local->loc, 0, sizeof (loc_t)); local-> ref = 1; local->uid = -1; local->gid = -1; pthread_spin_init (&local->lock, 0); local->oplocal = ((void*)0); } while (0); | |||
1923 | ||||
1924 | ret = loc_copy (&local->loc, loc); | |||
1925 | ||||
1926 | if (ret == -1) | |||
1927 | goto err; | |||
1928 | wind: | |||
1929 | STACK_WIND (frame, marker_setxattr_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1930, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setxattr_cbk) tmp_cbk = marker_setxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->setxattr" ; _new->unwind_to = "marker_setxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->setxattr); (this->children->xlator )->fops->setxattr (_new, (this->children->xlator) , loc, dict, flags, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||
1930 | FIRST_CHILD(this)->fops->setxattr, loc, dict, flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1930, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setxattr_cbk) tmp_cbk = marker_setxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->setxattr" ; _new->unwind_to = "marker_setxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->setxattr); (this->children->xlator )->fops->setxattr (_new, (this->children->xlator) , loc, dict, flags, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||
1931 | return 0; | |||
1932 | err: | |||
1933 | STACK_UNWIND_STRICT (setxattr, frame, -1, ENOMEM, NULL)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" , "marker.c", __FUNCTION__, 1933, 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 , 12, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
1934 | ||||
1935 | return 0; | |||
1936 | } | |||
1937 | ||||
1938 | ||||
1939 | int32_t | |||
1940 | marker_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
1941 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | |||
1942 | { | |||
1943 | marker_local_t *local = NULL((void*)0); | |||
1944 | marker_conf_t *priv = NULL((void*)0); | |||
1945 | ||||
1946 | if (op_ret == -1) { | |||
1947 | gf_log (this->name, GF_LOG_TRACE, "%s occurred while "do { do { if (0) printf ("%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 1948, GF_LOG_TRACE, "%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0) | |||
1948 | "creating symlinks ", strerror (op_errno))do { do { if (0) printf ("%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 1948, GF_LOG_TRACE, "%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0); | |||
1949 | } | |||
1950 | ||||
1951 | local = (marker_local_t *) frame->local; | |||
1952 | ||||
1953 | frame->local = NULL((void*)0); | |||
1954 | ||||
1955 | STACK_UNWIND_STRICT (fsetxattr, frame, op_ret, op_errno, xdata)do { fop_fsetxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 1955, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_fsetxattr_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||
1956 | ||||
1957 | if (op_ret == -1 || local == NULL((void*)0)) | |||
1958 | goto out; | |||
1959 | ||||
1960 | priv = this->private; | |||
1961 | ||||
1962 | if (priv->feature_enabled & GF_XTIME) | |||
1963 | marker_xtime_update_marks (this, local); | |||
1964 | out: | |||
1965 | marker_local_unref (local); | |||
1966 | ||||
1967 | return 0; | |||
1968 | } | |||
1969 | ||||
1970 | int32_t | |||
1971 | marker_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict, | |||
1972 | int32_t flags, dict_t *xdata) | |||
1973 | { | |||
1974 | int32_t ret = 0; | |||
1975 | marker_local_t *local = NULL((void*)0); | |||
1976 | marker_conf_t *priv = NULL((void*)0); | |||
1977 | ||||
1978 | priv = this->private; | |||
1979 | ||||
1980 | if (priv->feature_enabled == 0) | |||
1981 | goto wind; | |||
1982 | ||||
1983 | ret = call_from_sp_client_to_reset_tmfile (frame, this, dict); | |||
1984 | if (ret == 0) | |||
1985 | return 0; | |||
1986 | ||||
1987 | local = mem_get0 (this->local_pool); | |||
1988 | ||||
1989 | MARKER_INIT_LOCAL (frame, local)do { frame->local = local; local->pid = frame->root-> pid; memset (&local->loc, 0, sizeof (loc_t)); local-> ref = 1; local->uid = -1; local->gid = -1; pthread_spin_init (&local->lock, 0); local->oplocal = ((void*)0); } while (0); | |||
1990 | ||||
1991 | ret = marker_inode_loc_fill (fd->inode, &local->loc); | |||
1992 | ||||
1993 | if (ret == -1) | |||
1994 | goto err; | |||
1995 | wind: | |||
1996 | STACK_WIND (frame, marker_fsetxattr_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1997, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetxattr_cbk) tmp_cbk = marker_fsetxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsetxattr" ; _new->unwind_to = "marker_fsetxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsetxattr); (this->children-> xlator)->fops->fsetxattr (_new, (this->children-> xlator), fd, dict, flags, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
1997 | FIRST_CHILD(this)->fops->fsetxattr, fd, dict, flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 1997, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetxattr_cbk) tmp_cbk = marker_fsetxattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsetxattr" ; _new->unwind_to = "marker_fsetxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsetxattr); (this->children-> xlator)->fops->fsetxattr (_new, (this->children-> xlator), fd, dict, flags, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
1998 | return 0; | |||
1999 | err: | |||
2000 | STACK_UNWIND_STRICT (fsetxattr, frame, -1, ENOMEM, NULL)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" , "marker.c", __FUNCTION__, 2000, 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 , 12, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
2001 | ||||
2002 | return 0; | |||
2003 | } | |||
2004 | ||||
2005 | ||||
2006 | int32_t | |||
2007 | marker_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
2008 | int32_t op_ret, int32_t op_errno, struct iatt *statpre, | |||
2009 | struct iatt *statpost, dict_t *xdata) | |||
2010 | { | |||
2011 | marker_local_t *local = NULL((void*)0); | |||
2012 | marker_conf_t *priv = NULL((void*)0); | |||
2013 | ||||
2014 | if (op_ret == -1) { | |||
2015 | gf_log (this->name, GF_LOG_ERROR, "%s occurred while "do { do { if (0) printf ("%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 2016, GF_LOG_ERROR, "%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0) | |||
2016 | "creating symlinks ", strerror (op_errno))do { do { if (0) printf ("%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 2016, GF_LOG_ERROR, "%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0); | |||
2017 | } | |||
2018 | ||||
2019 | local = (marker_local_t *) frame->local; | |||
2020 | ||||
2021 | frame->local = NULL((void*)0); | |||
2022 | ||||
2023 | STACK_UNWIND_STRICT (fsetattr, frame, op_ret, op_errno, statpre,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" , "marker.c", __FUNCTION__, 2024, 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, op_ret , op_errno, statpre, statpost, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
2024 | statpost, xdata)do { fop_fsetattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 2024, 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, op_ret , op_errno, statpre, statpost, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
2025 | ||||
2026 | if (op_ret == -1 || local == NULL((void*)0)) | |||
2027 | goto out; | |||
2028 | ||||
2029 | priv = this->private; | |||
2030 | ||||
2031 | if (priv->feature_enabled & GF_XTIME) | |||
2032 | marker_xtime_update_marks (this, local); | |||
2033 | out: | |||
2034 | marker_local_unref (local); | |||
2035 | ||||
2036 | return 0; | |||
2037 | } | |||
2038 | ||||
2039 | ||||
2040 | int32_t | |||
2041 | marker_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, | |||
2042 | struct iatt *stbuf, int32_t valid, dict_t *xdata) | |||
2043 | { | |||
2044 | int32_t ret = 0; | |||
2045 | marker_local_t *local = NULL((void*)0); | |||
2046 | marker_conf_t *priv = NULL((void*)0); | |||
2047 | ||||
2048 | priv = this->private; | |||
2049 | ||||
2050 | if (priv->feature_enabled == 0) | |||
2051 | goto wind; | |||
2052 | ||||
2053 | local = mem_get0 (this->local_pool); | |||
2054 | ||||
2055 | MARKER_INIT_LOCAL (frame, local)do { frame->local = local; local->pid = frame->root-> pid; memset (&local->loc, 0, sizeof (loc_t)); local-> ref = 1; local->uid = -1; local->gid = -1; pthread_spin_init (&local->lock, 0); local->oplocal = ((void*)0); } while (0); | |||
2056 | ||||
2057 | ret = marker_inode_loc_fill (fd->inode, &local->loc); | |||
2058 | ||||
2059 | if (ret == -1) | |||
2060 | goto err; | |||
2061 | wind: | |||
2062 | STACK_WIND (frame, marker_fsetattr_cbk, FIRST_CHILD (this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 2063, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetattr_cbk) tmp_cbk = marker_fsetattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD (this)->fops->fsetattr" ; _new->unwind_to = "marker_fsetattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsetattr); (this->children->xlator )->fops->fsetattr (_new, (this->children->xlator) , fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||
2063 | FIRST_CHILD (this)->fops->fsetattr, fd, stbuf, valid, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 2063, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetattr_cbk) tmp_cbk = marker_fsetattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD (this)->fops->fsetattr" ; _new->unwind_to = "marker_fsetattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsetattr); (this->children->xlator )->fops->fsetattr (_new, (this->children->xlator) , fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||
2064 | return 0; | |||
2065 | err: | |||
2066 | STACK_UNWIND_STRICT (fsetattr, frame, -1, ENOMEM, NULL, NULL, NULL)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" , "marker.c", __FUNCTION__, 2066, 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 , 12, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
2067 | ||||
2068 | return 0; | |||
2069 | } | |||
2070 | ||||
2071 | ||||
2072 | int32_t | |||
2073 | marker_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
2074 | int32_t op_ret, int32_t op_errno, struct iatt *statpre, | |||
2075 | struct iatt *statpost, dict_t *xdata) | |||
2076 | { | |||
2077 | marker_local_t *local = NULL((void*)0); | |||
2078 | marker_conf_t *priv = NULL((void*)0); | |||
2079 | ||||
2080 | local = (marker_local_t *) frame->local; | |||
2081 | ||||
2082 | frame->local = NULL((void*)0); | |||
2083 | ||||
2084 | if (op_ret == -1) { | |||
2085 | gf_log (this->name, ((op_errno == ENOENT) ? GF_LOG_DEBUG :do { do { if (0) printf ("%s occurred during setattr of %s", strerror (op_errno), (local ? local->loc.path : "<nul>")); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 2089, ((op_errno == 2) ? GF_LOG_DEBUG : GF_LOG_ERROR), "%s occurred during setattr of %s" , strerror (op_errno), (local ? local->loc.path : "<nul>" )); } while (0) | |||
2086 | GF_LOG_ERROR),do { do { if (0) printf ("%s occurred during setattr of %s", strerror (op_errno), (local ? local->loc.path : "<nul>")); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 2089, ((op_errno == 2) ? GF_LOG_DEBUG : GF_LOG_ERROR), "%s occurred during setattr of %s" , strerror (op_errno), (local ? local->loc.path : "<nul>" )); } while (0) | |||
2087 | "%s occurred during setattr of %s",do { do { if (0) printf ("%s occurred during setattr of %s", strerror (op_errno), (local ? local->loc.path : "<nul>")); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 2089, ((op_errno == 2) ? GF_LOG_DEBUG : GF_LOG_ERROR), "%s occurred during setattr of %s" , strerror (op_errno), (local ? local->loc.path : "<nul>" )); } while (0) | |||
2088 | strerror (op_errno),do { do { if (0) printf ("%s occurred during setattr of %s", strerror (op_errno), (local ? local->loc.path : "<nul>")); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 2089, ((op_errno == 2) ? GF_LOG_DEBUG : GF_LOG_ERROR), "%s occurred during setattr of %s" , strerror (op_errno), (local ? local->loc.path : "<nul>" )); } while (0) | |||
2089 | (local ? local->loc.path : "<nul>"))do { do { if (0) printf ("%s occurred during setattr of %s", strerror (op_errno), (local ? local->loc.path : "<nul>")); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 2089, ((op_errno == 2) ? GF_LOG_DEBUG : GF_LOG_ERROR), "%s occurred during setattr of %s" , strerror (op_errno), (local ? local->loc.path : "<nul>" )); } while (0); | |||
2090 | } | |||
2091 | ||||
2092 | STACK_UNWIND_STRICT (setattr, frame, op_ret, op_errno, statpre,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" , "marker.c", __FUNCTION__, 2093, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_setattr_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, statpre, statpost, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
2093 | statpost, xdata)do { fop_setattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 2093, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_setattr_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, statpre, statpost, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
2094 | ||||
2095 | if (op_ret == -1 || local == NULL((void*)0)) | |||
2096 | goto out; | |||
2097 | ||||
2098 | priv = this->private; | |||
2099 | ||||
2100 | if (priv->feature_enabled & GF_XTIME) | |||
2101 | marker_xtime_update_marks (this, local); | |||
2102 | out: | |||
2103 | marker_local_unref (local); | |||
2104 | ||||
2105 | return 0; | |||
2106 | } | |||
2107 | ||||
2108 | int32_t | |||
2109 | marker_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, | |||
2110 | struct iatt *stbuf, int32_t valid, dict_t *xdata) | |||
2111 | { | |||
2112 | int32_t ret = 0; | |||
2113 | marker_local_t *local = NULL((void*)0); | |||
2114 | marker_conf_t *priv = NULL((void*)0); | |||
2115 | ||||
2116 | priv = this->private; | |||
2117 | ||||
2118 | if (priv->feature_enabled == 0) | |||
2119 | goto wind; | |||
2120 | ||||
2121 | local = mem_get0 (this->local_pool); | |||
2122 | ||||
2123 | MARKER_INIT_LOCAL (frame, local)do { frame->local = local; local->pid = frame->root-> pid; memset (&local->loc, 0, sizeof (loc_t)); local-> ref = 1; local->uid = -1; local->gid = -1; pthread_spin_init (&local->lock, 0); local->oplocal = ((void*)0); } while (0); | |||
2124 | ||||
2125 | ret = loc_copy (&local->loc, loc); | |||
2126 | ||||
2127 | if (ret == -1) | |||
2128 | goto err; | |||
2129 | wind: | |||
2130 | STACK_WIND (frame, marker_setattr_cbk, FIRST_CHILD (this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 2131, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setattr_cbk) tmp_cbk = marker_setattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD (this)->fops->setattr" ; _new->unwind_to = "marker_setattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->setattr); (this->children->xlator )->fops->setattr (_new, (this->children->xlator), loc, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||
2131 | FIRST_CHILD (this)->fops->setattr, loc, stbuf, valid, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 2131, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setattr_cbk) tmp_cbk = marker_setattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD (this)->fops->setattr" ; _new->unwind_to = "marker_setattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->setattr); (this->children->xlator )->fops->setattr (_new, (this->children->xlator), loc, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||
2132 | return 0; | |||
2133 | err: | |||
2134 | STACK_UNWIND_STRICT (setattr, frame, -1, ENOMEM, NULL, NULL, NULL)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" , "marker.c", __FUNCTION__, 2134, 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 , 12, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
2135 | ||||
2136 | return 0; | |||
2137 | } | |||
2138 | ||||
2139 | ||||
2140 | int32_t | |||
2141 | marker_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
2142 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | |||
2143 | { | |||
2144 | marker_local_t *local = NULL((void*)0); | |||
2145 | marker_conf_t *priv = NULL((void*)0); | |||
2146 | ||||
2147 | if (op_ret == -1) { | |||
2148 | gf_log (this->name, GF_LOG_ERROR, "%s occurred while "do { do { if (0) printf ("%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 2149, GF_LOG_ERROR, "%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0) | |||
2149 | "creating symlinks ", strerror (op_errno))do { do { if (0) printf ("%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 2149, GF_LOG_ERROR, "%s occurred while " "creating symlinks " , strerror (op_errno)); } while (0); | |||
2150 | } | |||
2151 | ||||
2152 | local = (marker_local_t *) frame->local; | |||
2153 | ||||
2154 | frame->local = NULL((void*)0); | |||
2155 | ||||
2156 | STACK_UNWIND_STRICT (removexattr, frame, op_ret, op_errno, xdata)do { fop_removexattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 2156, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_removexattr_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||
2157 | ||||
2158 | if (op_ret == -1 || local == NULL((void*)0)) | |||
2159 | goto out; | |||
2160 | ||||
2161 | priv = this->private; | |||
2162 | ||||
2163 | if (priv->feature_enabled & GF_XTIME) | |||
2164 | marker_xtime_update_marks (this, local); | |||
2165 | out: | |||
2166 | marker_local_unref (local); | |||
2167 | ||||
2168 | return 0; | |||
2169 | } | |||
2170 | ||||
2171 | int32_t | |||
2172 | marker_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, | |||
2173 | const char *name, dict_t *xdata) | |||
2174 | { | |||
2175 | int32_t ret = 0; | |||
2176 | marker_local_t *local = NULL((void*)0); | |||
2177 | marker_conf_t *priv = NULL((void*)0); | |||
2178 | ||||
2179 | priv = this->private; | |||
2180 | ||||
2181 | if (priv->feature_enabled == 0) | |||
2182 | goto wind; | |||
2183 | ||||
2184 | local = mem_get0 (this->local_pool); | |||
2185 | ||||
2186 | MARKER_INIT_LOCAL (frame, local)do { frame->local = local; local->pid = frame->root-> pid; memset (&local->loc, 0, sizeof (loc_t)); local-> ref = 1; local->uid = -1; local->gid = -1; pthread_spin_init (&local->lock, 0); local->oplocal = ((void*)0); } while (0); | |||
2187 | ||||
2188 | ret = loc_copy (&local->loc, loc); | |||
2189 | ||||
2190 | if (ret == -1) | |||
2191 | goto err; | |||
2192 | wind: | |||
2193 | STACK_WIND (frame, marker_removexattr_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 2194, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->removexattr_cbk) tmp_cbk = marker_removexattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr" ; _new->unwind_to = "marker_removexattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->removexattr); (this->children-> xlator)->fops->removexattr (_new, (this->children-> xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||
2194 | FIRST_CHILD(this)->fops->removexattr, loc, name, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 2194, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->removexattr_cbk) tmp_cbk = marker_removexattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr" ; _new->unwind_to = "marker_removexattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->removexattr); (this->children-> xlator)->fops->removexattr (_new, (this->children-> xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||
2195 | return 0; | |||
2196 | err: | |||
2197 | STACK_UNWIND_STRICT (removexattr, frame, -1, ENOMEM, NULL)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" , "marker.c", __FUNCTION__, 2197, 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 , 12, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
2198 | ||||
2199 | return 0; | |||
2200 | } | |||
2201 | ||||
2202 | ||||
2203 | int32_t | |||
2204 | marker_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
2205 | int32_t op_ret, int32_t op_errno, inode_t *inode, | |||
2206 | struct iatt *buf, dict_t *dict, struct iatt *postparent) | |||
2207 | { | |||
2208 | marker_conf_t *priv = NULL((void*)0); | |||
2209 | marker_local_t *local = NULL((void*)0); | |||
2210 | ||||
2211 | if (op_ret == -1) { | |||
2212 | gf_log (this->name, GF_LOG_TRACE, "lookup failed with %s",do { do { if (0) printf ("lookup failed with %s", strerror (op_errno )); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 2213, GF_LOG_TRACE, "lookup failed with %s", strerror (op_errno )); } while (0) | |||
2213 | strerror (op_errno))do { do { if (0) printf ("lookup failed with %s", strerror (op_errno )); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 2213, GF_LOG_TRACE, "lookup failed with %s", strerror (op_errno )); } while (0); | |||
2214 | } | |||
2215 | ||||
2216 | local = (marker_local_t *) frame->local; | |||
2217 | ||||
2218 | frame->local = NULL((void*)0); | |||
2219 | ||||
2220 | STACK_UNWIND_STRICT (lookup, frame, op_ret, op_errno, inode, buf,do { fop_lookup_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 2221, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_lookup_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, dict, postparent); (*__glusterfs_this_location ()) = old_THIS; } while (0) | |||
2221 | dict, postparent)do { fop_lookup_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 2221, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_lookup_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, inode, buf, dict, postparent); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
2222 | ||||
2223 | if (op_ret == -1 || local == NULL((void*)0)) | |||
2224 | goto out; | |||
2225 | ||||
2226 | /* copy the gfid from the stat structure instead of inode, | |||
2227 | * since if the lookup is fresh lookup, then the inode | |||
2228 | * would have not yet linked to the inode table which happens | |||
2229 | * in protocol/server. | |||
2230 | */ | |||
2231 | if (uuid_is_null (local->loc.gfid)) | |||
2232 | uuid_copy (local->loc.gfid, buf->ia_gfid); | |||
2233 | ||||
2234 | ||||
2235 | priv = this->private; | |||
2236 | ||||
2237 | if (priv->feature_enabled & GF_QUOTA) { | |||
2238 | mq_xattr_state (this, &local->loc, dict, *buf); | |||
2239 | } | |||
2240 | ||||
2241 | out: | |||
2242 | marker_local_unref (local); | |||
2243 | ||||
2244 | return 0; | |||
2245 | } | |||
2246 | ||||
2247 | int32_t | |||
2248 | marker_lookup (call_frame_t *frame, xlator_t *this, | |||
2249 | loc_t *loc, dict_t *xattr_req) | |||
2250 | { | |||
2251 | int32_t ret = 0; | |||
2252 | marker_local_t *local = NULL((void*)0); | |||
2253 | marker_conf_t *priv = NULL((void*)0); | |||
2254 | ||||
2255 | priv = this->private; | |||
2256 | ||||
2257 | if (priv->feature_enabled == 0) | |||
2258 | goto wind; | |||
2259 | ||||
2260 | local = mem_get0 (this->local_pool); | |||
2261 | ||||
2262 | MARKER_INIT_LOCAL (frame, local)do { frame->local = local; local->pid = frame->root-> pid; memset (&local->loc, 0, sizeof (loc_t)); local-> ref = 1; local->uid = -1; local->gid = -1; pthread_spin_init (&local->lock, 0); local->oplocal = ((void*)0); } while (0); | |||
2263 | ||||
2264 | ret = loc_copy (&local->loc, loc); | |||
2265 | if (ret == -1) | |||
2266 | goto err; | |||
2267 | ||||
2268 | if ((priv->feature_enabled & GF_QUOTA) && xattr_req) | |||
2269 | mq_req_xattr (this, loc, xattr_req); | |||
2270 | wind: | |||
2271 | STACK_WIND (frame, marker_lookup_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 2272, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->lookup_cbk) tmp_cbk = marker_lookup_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->lookup"; _new->unwind_to = "marker_lookup_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->lookup); (this->children->xlator )->fops->lookup (_new, (this->children->xlator), loc , xattr_req); (*__glusterfs_this_location()) = old_THIS; } while (0) | |||
2272 | FIRST_CHILD(this)->fops->lookup, loc, xattr_req)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", "marker.c", __FUNCTION__, 2272, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->lookup_cbk) tmp_cbk = marker_lookup_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->lookup"; _new->unwind_to = "marker_lookup_cbk"; pthread_spin_init ( &_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->lookup); (this->children->xlator )->fops->lookup (_new, (this->children->xlator), loc , xattr_req); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
2273 | return 0; | |||
2274 | err: | |||
2275 | STACK_UNWIND_STRICT (lookup, frame, -1, 0, NULL, NULL, NULL, NULL)do { fop_lookup_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 2275, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_lookup_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , 0, ((void*)0), ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); | |||
2276 | ||||
2277 | return 0; | |||
2278 | } | |||
2279 | ||||
2280 | int | |||
2281 | marker_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | |||
2282 | int op_ret, int op_errno, gf_dirent_t *entries, | |||
2283 | dict_t *xdata) | |||
2284 | { | |||
2285 | gf_dirent_t *entry = NULL((void*)0); | |||
2286 | ||||
2287 | if (op_ret <= 0) | |||
2288 | goto unwind; | |||
2289 | ||||
2290 | list_for_each_entry (entry, &entries->list, list)for (entry = ((typeof(*entry) *)((char *)((&entries->list )->next)-(unsigned long)(&((typeof(*entry) *)0)->list ))); &entry->list != (&entries->list); entry = ( (typeof(*entry) *)((char *)(entry->list.next)-(unsigned long )(&((typeof(*entry) *)0)->list)))) { | |||
2291 | /* TODO: fill things */ | |||
2292 | } | |||
2293 | ||||
2294 | unwind: | |||
2295 | STACK_UNWIND_STRICT (readdirp, frame, op_ret, op_errno, entries, xdata)do { fop_readdirp_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "marker.c", __FUNCTION__, 2295, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_readdirp_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, entries, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | |||
2296 | ||||
2297 | return 0; | |||
2298 | } | |||
2299 | ||||
2300 | int | |||
2301 | marker_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, | |||
2302 | off_t offset, dict_t *dict) | |||
2303 | { | |||
2304 | marker_conf_t *priv = NULL((void*)0); | |||
2305 | ||||
2306 | priv = this->private; | |||
2307 | ||||
2308 | if (priv->feature_enabled == 0) | |||
2309 | goto wind; | |||
2310 | ||||
2311 | if ((priv->feature_enabled & GF_QUOTA) && dict) | |||
2312 | mq_req_xattr (this, NULL((void*)0), dict); | |||
2313 | ||||
2314 | wind: | |||
2315 | STACK_WIND (frame, marker_readdirp_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 2317, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readdirp_cbk) tmp_cbk = marker_readdirp_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->readdirp" ; _new->unwind_to = "marker_readdirp_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->readdirp); (this->children->xlator )->fops->readdirp (_new, (this->children->xlator) , fd, size, offset, dict); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||
2316 | FIRST_CHILD(this), FIRST_CHILD(this)->fops->readdirp,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "marker.c", __FUNCTION__, 2317, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readdirp_cbk) tmp_cbk = marker_readdirp_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->readdirp" ; _new->unwind_to = "marker_readdirp_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->readdirp); (this->children->xlator )->fops->readdirp (_new, (this->children->xlator) , fd, size, offset, dict); (*__glusterfs_this_location()) = old_THIS ; } while (0) | |||
2317 | fd, size, offset, 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", "marker.c", __FUNCTION__, 2317, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readdirp_cbk) tmp_cbk = marker_readdirp_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->readdirp" ; _new->unwind_to = "marker_readdirp_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->readdirp); (this->children->xlator )->fops->readdirp (_new, (this->children->xlator) , fd, size, offset, dict); (*__glusterfs_this_location()) = old_THIS ; } while (0); | |||
2318 | ||||
2319 | return 0; | |||
2320 | } | |||
2321 | ||||
2322 | ||||
2323 | int32_t | |||
2324 | mem_acct_init (xlator_t *this) | |||
2325 | { | |||
2326 | int ret = -1; | |||
2327 | ||||
2328 | if (!this) | |||
2329 | return ret; | |||
2330 | ||||
2331 | ret = xlator_mem_acct_init (this, gf_marker_mt_end + 1); | |||
2332 | ||||
2333 | if (ret != 0) { | |||
2334 | gf_log(this->name, GF_LOG_ERROR, "Memory accounting init"do { do { if (0) printf ("Memory accounting init" "failed"); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 2335, GF_LOG_ERROR, "Memory accounting init" "failed"); } while (0) | |||
2335 | "failed")do { do { if (0) printf ("Memory accounting init" "failed"); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 2335, GF_LOG_ERROR, "Memory accounting init" "failed"); } while (0); | |||
2336 | return ret; | |||
2337 | } | |||
2338 | ||||
2339 | return ret; | |||
2340 | } | |||
2341 | ||||
2342 | ||||
2343 | int32_t | |||
2344 | init_xtime_priv (xlator_t *this, dict_t *options) | |||
2345 | { | |||
2346 | data_t *data = NULL((void*)0); | |||
2347 | int32_t ret = -1; | |||
2348 | marker_conf_t *priv = NULL((void*)0); | |||
2349 | ||||
2350 | GF_VALIDATE_OR_GOTO ("marker", this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if ( 0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn ("marker", "marker.c", __FUNCTION__, 2350, GF_LOG_ERROR, "invalid argument: " "this"); } while (0); goto out; } } while (0); | |||
2351 | GF_VALIDATE_OR_GOTO (this->name, options, out)do { if (!options) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "options"); } while (0); _gf_log_callingfn (this->name, "marker.c", __FUNCTION__, 2351, GF_LOG_ERROR , "invalid argument: " "options"); } while (0); goto out; } } while (0); | |||
2352 | GF_VALIDATE_OR_GOTO (this->name, 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->name, "marker.c", __FUNCTION__, 2352, GF_LOG_ERROR, "invalid argument: " "this->private" ); } while (0); goto out; } } while (0); | |||
2353 | ||||
2354 | priv = this->private; | |||
2355 | ||||
2356 | if((data = dict_get (options, VOLUME_UUID"volume-uuid")) != NULL((void*)0)) { | |||
2357 | priv->volume_uuid = data->data; | |||
2358 | ||||
2359 | ret = uuid_parse (priv->volume_uuid, priv->volume_uuid_bin); | |||
2360 | if (ret == -1) { | |||
2361 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("invalid volume uuid %s", priv->volume_uuid ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 2362, GF_LOG_ERROR, "invalid volume uuid %s", priv->volume_uuid ); } while (0) | |||
2362 | "invalid volume uuid %s", priv->volume_uuid)do { do { if (0) printf ("invalid volume uuid %s", priv->volume_uuid ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 2362, GF_LOG_ERROR, "invalid volume uuid %s", priv->volume_uuid ); } while (0); | |||
2363 | goto out; | |||
2364 | } | |||
2365 | ||||
2366 | ret = gf_asprintf (& (priv->marker_xattr), "%s.%s.%s", | |||
2367 | MARKER_XATTR_PREFIX"trusted.glusterfs", priv->volume_uuid, | |||
2368 | XTIME"xtime"); | |||
2369 | ||||
2370 | if (ret == -1){ | |||
2371 | priv->marker_xattr = NULL((void*)0); | |||
2372 | ||||
2373 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Failed to allocate memory"); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 2374, GF_LOG_ERROR, "Failed to allocate memory"); } while (0) | |||
2374 | "Failed to allocate memory")do { do { if (0) printf ("Failed to allocate memory"); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 2374, GF_LOG_ERROR, "Failed to allocate memory"); } while (0); | |||
2375 | goto out; | |||
2376 | } | |||
2377 | ||||
2378 | gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("the volume-uuid = %s", priv->volume_uuid ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 2379, GF_LOG_DEBUG, "the volume-uuid = %s", priv->volume_uuid ); } while (0) | |||
2379 | "the volume-uuid = %s", priv->volume_uuid)do { do { if (0) printf ("the volume-uuid = %s", priv->volume_uuid ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 2379, GF_LOG_DEBUG, "the volume-uuid = %s", priv->volume_uuid ); } while (0); | |||
2380 | } else { | |||
2381 | priv->volume_uuid = NULL((void*)0); | |||
2382 | ||||
2383 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("please specify the volume-uuid" "in the translator options" ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 2385, GF_LOG_ERROR, "please specify the volume-uuid" "in the translator options" ); } while (0) | |||
2384 | "please specify the volume-uuid"do { do { if (0) printf ("please specify the volume-uuid" "in the translator options" ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 2385, GF_LOG_ERROR, "please specify the volume-uuid" "in the translator options" ); } while (0) | |||
2385 | "in the translator options")do { do { if (0) printf ("please specify the volume-uuid" "in the translator options" ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 2385, GF_LOG_ERROR, "please specify the volume-uuid" "in the translator options" ); } while (0); | |||
2386 | ||||
2387 | return -1; | |||
2388 | } | |||
2389 | ||||
2390 | if ((data = dict_get (options, TIMESTAMP_FILE"timestamp-file")) != NULL((void*)0)) { | |||
2391 | priv->timestamp_file = data->data; | |||
2392 | ||||
2393 | gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("the timestamp-file is = %s", priv-> timestamp_file); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 2395, GF_LOG_DEBUG, "the timestamp-file is = %s" , priv->timestamp_file); } while (0) | |||
2394 | "the timestamp-file is = %s",do { do { if (0) printf ("the timestamp-file is = %s", priv-> timestamp_file); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 2395, GF_LOG_DEBUG, "the timestamp-file is = %s" , priv->timestamp_file); } while (0) | |||
2395 | priv->timestamp_file)do { do { if (0) printf ("the timestamp-file is = %s", priv-> timestamp_file); } while (0); _gf_log (this->name, "marker.c" , __FUNCTION__, 2395, GF_LOG_DEBUG, "the timestamp-file is = %s" , priv->timestamp_file); } while (0); | |||
2396 | ||||
2397 | } else { | |||
2398 | priv->timestamp_file = NULL((void*)0); | |||
2399 | ||||
2400 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("please specify the timestamp-file" "in the translator options" ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 2402, GF_LOG_ERROR, "please specify the timestamp-file" "in the translator options" ); } while (0) | |||
2401 | "please specify the timestamp-file"do { do { if (0) printf ("please specify the timestamp-file" "in the translator options" ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 2402, GF_LOG_ERROR, "please specify the timestamp-file" "in the translator options" ); } while (0) | |||
2402 | "in the translator options")do { do { if (0) printf ("please specify the timestamp-file" "in the translator options" ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 2402, GF_LOG_ERROR, "please specify the timestamp-file" "in the translator options" ); } while (0); | |||
2403 | ||||
2404 | goto out; | |||
2405 | } | |||
2406 | ||||
2407 | ret = 0; | |||
2408 | out: | |||
2409 | return ret; | |||
2410 | } | |||
2411 | ||||
2412 | void | |||
2413 | marker_xtime_priv_cleanup (xlator_t *this) | |||
2414 | { | |||
2415 | marker_conf_t *priv = NULL((void*)0); | |||
2416 | ||||
2417 | GF_VALIDATE_OR_GOTO ("marker", this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if ( 0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn ("marker", "marker.c", __FUNCTION__, 2417, GF_LOG_ERROR, "invalid argument: " "this"); } while (0); goto out; } } while (0); | |||
2418 | ||||
2419 | priv = (marker_conf_t *) this->private; | |||
2420 | ||||
2421 | GF_VALIDATE_OR_GOTO (this->name, priv, out)do { if (!priv) { (*__errno_location ()) = 22; do { do { if ( 0) printf ("invalid argument: " "priv"); } while (0); _gf_log_callingfn (this->name, "marker.c", __FUNCTION__, 2421, GF_LOG_ERROR , "invalid argument: " "priv"); } while (0); goto out; } } while (0); | |||
2422 | ||||
2423 | GF_FREE (priv->volume_uuid)__gf_free (priv->volume_uuid); | |||
2424 | ||||
2425 | GF_FREE (priv->timestamp_file)__gf_free (priv->timestamp_file); | |||
2426 | ||||
2427 | GF_FREE (priv->marker_xattr)__gf_free (priv->marker_xattr); | |||
2428 | out: | |||
2429 | return; | |||
2430 | } | |||
2431 | ||||
2432 | void | |||
2433 | marker_priv_cleanup (xlator_t *this) | |||
2434 | { | |||
2435 | marker_conf_t *priv = NULL((void*)0); | |||
2436 | ||||
2437 | GF_VALIDATE_OR_GOTO ("marker", this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if ( 0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn ("marker", "marker.c", __FUNCTION__, 2437, GF_LOG_ERROR, "invalid argument: " "this"); } while (0); goto out; } } while (0); | |||
2438 | ||||
2439 | priv = (marker_conf_t *) this->private; | |||
2440 | ||||
2441 | GF_VALIDATE_OR_GOTO (this->name, priv, out)do { if (!priv) { (*__errno_location ()) = 22; do { do { if ( 0) printf ("invalid argument: " "priv"); } while (0); _gf_log_callingfn (this->name, "marker.c", __FUNCTION__, 2441, GF_LOG_ERROR , "invalid argument: " "priv"); } while (0); goto out; } } while (0); | |||
2442 | ||||
2443 | marker_xtime_priv_cleanup (this); | |||
2444 | ||||
2445 | LOCK_DESTROY (&priv->lock)pthread_spin_destroy (&priv->lock); | |||
2446 | ||||
2447 | GF_FREE (priv)__gf_free (priv); | |||
2448 | out: | |||
2449 | return; | |||
2450 | } | |||
2451 | ||||
2452 | int32_t | |||
2453 | reconfigure (xlator_t *this, dict_t *options) | |||
2454 | { | |||
2455 | int32_t ret = -1; | |||
2456 | data_t *data = NULL((void*)0); | |||
2457 | gf_boolean_t flag = _gf_false; | |||
2458 | marker_conf_t *priv = NULL((void*)0); | |||
2459 | ||||
2460 | GF_ASSERT (this)do { if (!(this)) { do { do { if (0) printf ("Assertion failed: " "this"); } while (0); _gf_log_callingfn ("", "marker.c", __FUNCTION__ , 2460, GF_LOG_ERROR, "Assertion failed: " "this"); } while ( 0); } } while (0); | |||
2461 | GF_ASSERT (this->private)do { if (!(this->private)) { do { do { if (0) printf ("Assertion failed: " "this->private"); } while (0); _gf_log_callingfn ("", "marker.c" , __FUNCTION__, 2461, GF_LOG_ERROR, "Assertion failed: " "this->private" ); } while (0); } } while (0); | |||
2462 | ||||
2463 | priv = this->private; | |||
2464 | ||||
2465 | priv->feature_enabled = 0; | |||
2466 | ||||
2467 | GF_VALIDATE_OR_GOTO (this->name, options, out)do { if (!options) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "options"); } while (0); _gf_log_callingfn (this->name, "marker.c", __FUNCTION__, 2467, GF_LOG_ERROR , "invalid argument: " "options"); } while (0); goto out; } } while (0); | |||
2468 | ||||
2469 | data = dict_get (options, "quota"); | |||
2470 | if (data) { | |||
2471 | ret = gf_string2boolean (data->data, &flag); | |||
2472 | if (ret == 0 && flag == _gf_true) { | |||
2473 | ret = init_quota_priv (this); | |||
2474 | if (ret < 0) { | |||
2475 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("failed to initialize quota private" ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 2476, GF_LOG_WARNING, "failed to initialize quota private") ; } while (0) | |||
2476 | "failed to initialize quota private")do { do { if (0) printf ("failed to initialize quota private" ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 2476, GF_LOG_WARNING, "failed to initialize quota private") ; } while (0); | |||
2477 | } else { | |||
2478 | priv->feature_enabled |= GF_QUOTA; | |||
2479 | } | |||
2480 | } | |||
2481 | } | |||
2482 | ||||
2483 | data = dict_get (options, "xtime"); | |||
2484 | if (data) { | |||
2485 | ret = gf_string2boolean (data->data, &flag); | |||
2486 | if (ret == 0 && flag == _gf_true) { | |||
2487 | marker_xtime_priv_cleanup (this); | |||
2488 | ||||
2489 | ret = init_xtime_priv (this, options); | |||
2490 | if (ret < 0) { | |||
2491 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("failed to initialize xtime private, " "xtime updation will fail"); } while (0); _gf_log (this-> name, "marker.c", __FUNCTION__, 2493, GF_LOG_WARNING, "failed to initialize xtime private, " "xtime updation will fail"); } while (0) | |||
2492 | "failed to initialize xtime private, "do { do { if (0) printf ("failed to initialize xtime private, " "xtime updation will fail"); } while (0); _gf_log (this-> name, "marker.c", __FUNCTION__, 2493, GF_LOG_WARNING, "failed to initialize xtime private, " "xtime updation will fail"); } while (0) | |||
2493 | "xtime updation will fail")do { do { if (0) printf ("failed to initialize xtime private, " "xtime updation will fail"); } while (0); _gf_log (this-> name, "marker.c", __FUNCTION__, 2493, GF_LOG_WARNING, "failed to initialize xtime private, " "xtime updation will fail"); } while (0); | |||
2494 | } else { | |||
2495 | priv->feature_enabled |= GF_XTIME; | |||
2496 | } | |||
2497 | } | |||
2498 | } | |||
2499 | out: | |||
2500 | return 0; | |||
2501 | } | |||
2502 | ||||
2503 | ||||
2504 | int32_t | |||
2505 | init (xlator_t *this) | |||
2506 | { | |||
2507 | dict_t *options = NULL((void*)0); | |||
2508 | data_t *data = NULL((void*)0); | |||
2509 | int32_t ret = 0; | |||
2510 | gf_boolean_t flag = _gf_false; | |||
2511 | marker_conf_t *priv = NULL((void*)0); | |||
2512 | ||||
2513 | if (!this->children) { | |||
2514 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("marker translator needs subvolume defined." ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 2515, GF_LOG_ERROR, "marker translator needs subvolume defined." ); } while (0) | |||
2515 | "marker translator needs subvolume defined.")do { do { if (0) printf ("marker translator needs subvolume defined." ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 2515, GF_LOG_ERROR, "marker translator needs subvolume defined." ); } while (0); | |||
2516 | return -1; | |||
2517 | } | |||
2518 | ||||
2519 | if (!this->parents) { | |||
2520 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("Volume is dangling."); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 2521, GF_LOG_WARNING , "Volume is dangling."); } while (0) | |||
2521 | "Volume is dangling.")do { do { if (0) printf ("Volume is dangling."); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__, 2521, GF_LOG_WARNING , "Volume is dangling."); } while (0); | |||
2522 | return -1; | |||
2523 | } | |||
2524 | ||||
2525 | options = this->options; | |||
2526 | ||||
2527 | ALLOCATE_OR_GOTO (this->private, marker_conf_t, err)do { this->private = __gf_calloc (sizeof (marker_conf_t), 1 , gf_marker_mt_marker_conf_t); if (!this->private) { do { do { if (0) printf ("out of memory :("); } while (0); _gf_log ( this->name, "marker.c", __FUNCTION__, 2527, GF_LOG_ERROR, "out of memory :(" ); } while (0); goto err; } } while (0); | |||
2528 | ||||
2529 | priv = this->private; | |||
2530 | ||||
2531 | priv->feature_enabled = 0; | |||
2532 | ||||
2533 | LOCK_INIT (&priv->lock)pthread_spin_init (&priv->lock, 0); | |||
2534 | ||||
2535 | data = dict_get (options, "quota"); | |||
2536 | if (data) { | |||
2537 | ret = gf_string2boolean (data->data, &flag); | |||
2538 | if (ret == 0 && flag == _gf_true) { | |||
2539 | ret = init_quota_priv (this); | |||
2540 | if (ret < 0) | |||
2541 | goto err; | |||
2542 | ||||
2543 | priv->feature_enabled |= GF_QUOTA; | |||
2544 | } | |||
2545 | } | |||
2546 | ||||
2547 | data = dict_get (options, "xtime"); | |||
2548 | if (data) { | |||
2549 | ret = gf_string2boolean (data->data, &flag); | |||
2550 | if (ret == 0 && flag == _gf_true) { | |||
2551 | ret = init_xtime_priv (this, options); | |||
2552 | if (ret < 0) | |||
2553 | goto err; | |||
2554 | ||||
2555 | priv->feature_enabled |= GF_XTIME; | |||
2556 | } | |||
2557 | } | |||
2558 | ||||
2559 | this->local_pool = mem_pool_new (marker_local_t, 128)mem_pool_new_fn (sizeof(marker_local_t), 128, "marker_local_t" ); | |||
2560 | if (!this->local_pool) { | |||
2561 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("failed to create local_t's memory pool" ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 2562, GF_LOG_ERROR, "failed to create local_t's memory pool" ); } while (0) | |||
2562 | "failed to create local_t's memory pool")do { do { if (0) printf ("failed to create local_t's memory pool" ); } while (0); _gf_log (this->name, "marker.c", __FUNCTION__ , 2562, GF_LOG_ERROR, "failed to create local_t's memory pool" ); } while (0); | |||
2563 | goto err; | |||
2564 | } | |||
2565 | ||||
2566 | return 0; | |||
2567 | err: | |||
2568 | marker_priv_cleanup (this); | |||
2569 | ||||
2570 | return -1; | |||
2571 | } | |||
2572 | ||||
2573 | int32_t | |||
2574 | marker_forget (xlator_t *this, inode_t *inode) | |||
2575 | { | |||
2576 | marker_inode_ctx_t *ctx = NULL((void*)0); | |||
2577 | uint64_t value = 0; | |||
2578 | ||||
2579 | if (inode_ctx_del (inode, this, &value)inode_ctx_del2(inode,this,&value,0) != 0) | |||
2580 | goto out; | |||
2581 | ||||
2582 | ctx = (marker_inode_ctx_t *)(unsigned long)value; | |||
2583 | if (ctx == NULL((void*)0)) { | |||
2584 | goto out; | |||
2585 | } | |||
2586 | ||||
2587 | mq_forget (this, ctx->quota_ctx); | |||
2588 | ||||
2589 | GF_FREE (ctx)__gf_free (ctx); | |||
2590 | out: | |||
2591 | return 0; | |||
2592 | } | |||
2593 | ||||
2594 | void | |||
2595 | fini (xlator_t *this) | |||
2596 | { | |||
2597 | marker_priv_cleanup (this); | |||
2598 | } | |||
2599 | ||||
2600 | struct xlator_fops fops = { | |||
2601 | .lookup = marker_lookup, | |||
2602 | .create = marker_create, | |||
2603 | .mkdir = marker_mkdir, | |||
2604 | .writev = marker_writev, | |||
2605 | .truncate = marker_truncate, | |||
2606 | .ftruncate = marker_ftruncate, | |||
2607 | .symlink = marker_symlink, | |||
2608 | .link = marker_link, | |||
2609 | .unlink = marker_unlink, | |||
2610 | .rmdir = marker_rmdir, | |||
2611 | .rename = marker_rename, | |||
2612 | .mknod = marker_mknod, | |||
2613 | .setxattr = marker_setxattr, | |||
2614 | .fsetxattr = marker_fsetxattr, | |||
2615 | .setattr = marker_setattr, | |||
2616 | .fsetattr = marker_fsetattr, | |||
2617 | .removexattr = marker_removexattr, | |||
2618 | .getxattr = marker_getxattr, | |||
2619 | .readdirp = marker_readdirp, | |||
2620 | }; | |||
2621 | ||||
2622 | struct xlator_cbks cbks = { | |||
2623 | .forget = marker_forget | |||
2624 | }; | |||
2625 | ||||
2626 | struct volume_options options[] = { | |||
2627 | {.key = {"volume-uuid"}}, | |||
2628 | {.key = {"timestamp-file"}}, | |||
2629 | {.key = {"quota"}}, | |||
2630 | {.key = {"xtime"}}, | |||
2631 | {.key = {NULL((void*)0)}} | |||
2632 | }; |