File: | xlators/nfs/server/src/nfs-fops.c |
Location: | line 1133, column 34 |
Description: | Value stored to 'nfl' during its initialization is never read |
1 | /* |
2 | Copyright (c) 2010-2011 Gluster, Inc. <http://www.gluster.com> |
3 | This file is part of GlusterFS. |
4 | |
5 | GlusterFS is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 3 of the License, |
8 | or (at your option) any later version. |
9 | |
10 | GlusterFS is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU General Public License |
16 | along with this program. If not, see |
17 | <http://www.gnu.org/licenses/>. |
18 | */ |
19 | |
20 | #ifndef _CONFIG_H |
21 | #define _CONFIG_H |
22 | #include "config.h" |
23 | #endif |
24 | |
25 | #include <grp.h> |
26 | #include <pwd.h> |
27 | |
28 | #include "dict.h" |
29 | #include "xlator.h" |
30 | #include "iobuf.h" |
31 | #include "call-stub.h" |
32 | #include "stack.h" |
33 | #include "nfs.h" |
34 | #include "nfs-fops.h" |
35 | #include "inode.h" |
36 | #include "nfs-common.h" |
37 | #include "nfs3-helpers.h" |
38 | #include "nfs-mem-types.h" |
39 | #include <libgen.h> |
40 | #include <semaphore.h> |
41 | |
42 | void |
43 | nfs_fix_groups (xlator_t *this, call_stack_t *root) |
44 | { |
45 | struct passwd mypw; |
46 | char mystrs[1024]; |
47 | struct passwd *result; |
48 | gid_t mygroups[GF_MAX_AUX_GROUPS200]; |
49 | int ngroups; |
50 | int i; |
51 | struct nfs_state *priv = this->private; |
52 | const gid_list_t *agl; |
53 | gid_list_t gl; |
54 | |
55 | if (!priv->server_aux_gids) { |
56 | return; |
57 | } |
58 | |
59 | agl = gid_cache_lookup(&priv->gid_cache, root->uid); |
60 | if (agl) { |
61 | for (ngroups = 0; ngroups < agl->gl_count; ngroups++) |
62 | root->groups[ngroups] = agl->gl_list[ngroups]; |
63 | root->ngrps = ngroups; |
64 | gid_cache_release(&priv->gid_cache, agl); |
65 | return; |
66 | } |
67 | |
68 | /* No cached list found. */ |
69 | if (getpwuid_r(root->uid,&mypw,mystrs,sizeof(mystrs),&result) != 0) { |
70 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("getpwuid_r(%u) failed", root->uid ); } while (0); _gf_log (this->name, "nfs-fops.c", __FUNCTION__ , 71, GF_LOG_ERROR, "getpwuid_r(%u) failed", root->uid); } while (0) |
71 | "getpwuid_r(%u) failed", root->uid)do { do { if (0) printf ("getpwuid_r(%u) failed", root->uid ); } while (0); _gf_log (this->name, "nfs-fops.c", __FUNCTION__ , 71, GF_LOG_ERROR, "getpwuid_r(%u) failed", root->uid); } while (0); |
72 | return; |
73 | } |
74 | |
75 | if (!result) { |
76 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("getpwuid_r(%u) found nothing", root ->uid); } while (0); _gf_log (this->name, "nfs-fops.c", __FUNCTION__, 77, GF_LOG_ERROR, "getpwuid_r(%u) found nothing" , root->uid); } while (0) |
77 | "getpwuid_r(%u) found nothing", root->uid)do { do { if (0) printf ("getpwuid_r(%u) found nothing", root ->uid); } while (0); _gf_log (this->name, "nfs-fops.c", __FUNCTION__, 77, GF_LOG_ERROR, "getpwuid_r(%u) found nothing" , root->uid); } while (0); |
78 | return; |
79 | } |
80 | |
81 | gf_log (this->name, GF_LOG_TRACE, "mapped %u => %s",do { do { if (0) printf ("mapped %u => %s", root->uid, result ->pw_name); } while (0); _gf_log (this->name, "nfs-fops.c" , __FUNCTION__, 82, GF_LOG_TRACE, "mapped %u => %s", root-> uid, result->pw_name); } while (0) |
82 | root->uid, result->pw_name)do { do { if (0) printf ("mapped %u => %s", root->uid, result ->pw_name); } while (0); _gf_log (this->name, "nfs-fops.c" , __FUNCTION__, 82, GF_LOG_TRACE, "mapped %u => %s", root-> uid, result->pw_name); } while (0); |
83 | |
84 | ngroups = GF_MAX_AUX_GROUPS200; |
85 | if (getgrouplist(result->pw_name,root->gid,mygroups,&ngroups) == -1) { |
86 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("could not map %s to group list", result ->pw_name); } while (0); _gf_log (this->name, "nfs-fops.c" , __FUNCTION__, 87, GF_LOG_ERROR, "could not map %s to group list" , result->pw_name); } while (0) |
87 | "could not map %s to group list", result->pw_name)do { do { if (0) printf ("could not map %s to group list", result ->pw_name); } while (0); _gf_log (this->name, "nfs-fops.c" , __FUNCTION__, 87, GF_LOG_ERROR, "could not map %s to group list" , result->pw_name); } while (0); |
88 | return; |
89 | } |
90 | |
91 | /* Add the group data to the cache. */ |
92 | gl.gl_list = GF_CALLOC(ngroups, sizeof(gid_t), gf_nfs_mt_aux_gids)__gf_calloc (ngroups, sizeof(gid_t), gf_nfs_mt_aux_gids); |
93 | if (gl.gl_list) { |
94 | /* It's not fatal if the alloc failed. */ |
95 | gl.gl_id = root->uid; |
96 | gl.gl_count = ngroups; |
97 | memcpy(gl.gl_list, mygroups, sizeof(gid_t) * ngroups); |
98 | if (gid_cache_add(&priv->gid_cache, &gl) != 1) |
99 | GF_FREE(gl.gl_list)__gf_free (gl.gl_list); |
100 | } |
101 | |
102 | /* Copy data to the frame. */ |
103 | for (i = 0; i < ngroups; ++i) { |
104 | gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("%s is in group %u", result->pw_name , mygroups[i]); } while (0); _gf_log (this->name, "nfs-fops.c" , __FUNCTION__, 105, GF_LOG_TRACE, "%s is in group %u", result ->pw_name, mygroups[i]); } while (0) |
105 | "%s is in group %u", result->pw_name, mygroups[i])do { do { if (0) printf ("%s is in group %u", result->pw_name , mygroups[i]); } while (0); _gf_log (this->name, "nfs-fops.c" , __FUNCTION__, 105, GF_LOG_TRACE, "%s is in group %u", result ->pw_name, mygroups[i]); } while (0); |
106 | root->groups[i] = mygroups[i]; |
107 | } |
108 | root->ngrps = ngroups; |
109 | } |
110 | |
111 | struct nfs_fop_local * |
112 | nfs_fop_local_init (xlator_t *nfsx) |
113 | { |
114 | struct nfs_fop_local *l = NULL((void*)0); |
115 | |
116 | if (!nfsx) |
117 | return NULL((void*)0); |
118 | |
119 | l = mem_get (nfs_fop_mempool (nfsx)(((struct nfs_state *)(nfsx)->private)->foppool)); |
120 | |
121 | memset (l, 0, sizeof (*l)); |
122 | return l; |
123 | } |
124 | |
125 | void |
126 | nfs_fop_local_wipe (xlator_t *nfsx, struct nfs_fop_local *l) |
127 | { |
128 | if ((!nfsx) || (!l)) |
129 | return; |
130 | |
131 | if (l->iobref) |
132 | iobref_unref (l->iobref); |
133 | |
134 | if (l->parent) |
135 | inode_unref (l->parent); |
136 | |
137 | if (l->inode) |
138 | inode_unref (l->inode); |
139 | |
140 | if (l->newparent) |
141 | inode_unref (l->newparent); |
142 | |
143 | if (l->dictgfid) |
144 | dict_unref (l->dictgfid); |
145 | |
146 | mem_put (l); |
147 | |
148 | return; |
149 | } |
150 | |
151 | #define nfs_stack_destroy(nfl, fram)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (fram)->local = ((void*)0); STACK_DESTROY ((fram)->root); } while (0) \ |
152 | do { \ |
153 | nfs_fop_local_wipe ((nfl)->nfsx, nfl); \ |
154 | (fram)->local = NULL((void*)0); \ |
155 | STACK_DESTROY ((fram)->root); \ |
156 | } while (0) \ |
157 | |
158 | |
159 | pthread_mutex_t ctr = PTHREAD_MUTEX_INITIALIZER{ { 0, 0, 0, 0, 0, { 0 } } }; |
160 | unsigned int cval = 1; |
161 | |
162 | |
163 | int |
164 | nfs_frame_getctr () |
165 | { |
166 | uint64_t val = 0; |
167 | |
168 | pthread_mutex_lock (&ctr); |
169 | { |
170 | if (cval == 0) |
171 | cval = 1; |
172 | val = cval; |
173 | cval++; |
174 | } |
175 | pthread_mutex_unlock (&ctr); |
176 | |
177 | return val; |
178 | } |
179 | |
180 | |
181 | call_frame_t * |
182 | nfs_create_frame (xlator_t *xl, nfs_user_t *nfu) |
183 | { |
184 | call_frame_t *frame = NULL((void*)0); |
185 | int x = 0; |
186 | int y = 0; |
187 | |
188 | if ((!xl) || (!nfu) || (nfu->ngrps > NFS_NGROUPS(16 + 1))) |
189 | return NULL((void*)0); |
190 | |
191 | frame = create_frame (xl, (call_pool_t *)xl->ctx->pool); |
192 | if (!frame) |
193 | goto err; |
194 | frame->root->pid = NFS_PID1; |
195 | frame->root->uid = nfu->uid; |
196 | frame->root->gid = nfu->gids[NFS_PRIMGID_IDX0]; |
197 | frame->root->lk_owner = nfu->lk_owner; |
198 | |
199 | if (nfu->ngrps != 1) { |
200 | frame->root->ngrps = nfu->ngrps - 1; |
201 | |
202 | gf_log (GF_NFS, GF_LOG_TRACE,"uid: %d, gid %d, gids: %d",do { do { if (0) printf ("uid: %d, gid %d, gids: %d", frame-> root->uid, frame->root->gid, frame->root->ngrps ); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 203 , GF_LOG_TRACE,"uid: %d, gid %d, gids: %d", frame->root-> uid, frame->root->gid, frame->root->ngrps); } while (0) |
203 | frame->root->uid, frame->root->gid, frame->root->ngrps)do { do { if (0) printf ("uid: %d, gid %d, gids: %d", frame-> root->uid, frame->root->gid, frame->root->ngrps ); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 203 , GF_LOG_TRACE,"uid: %d, gid %d, gids: %d", frame->root-> uid, frame->root->gid, frame->root->ngrps); } while (0); |
204 | for(y = 0, x = 1; y < frame->root->ngrps; x++,y++) { |
205 | gf_log (GF_NFS, GF_LOG_TRACE, "gid: %d", nfu->gids[x])do { do { if (0) printf ("gid: %d", nfu->gids[x]); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 205, GF_LOG_TRACE , "gid: %d", nfu->gids[x]); } while (0); |
206 | frame->root->groups[y] = nfu->gids[x]; |
207 | } |
208 | } |
209 | |
210 | /* |
211 | * It's tempting to do this *instead* of using nfu above, but we need |
212 | * to have those values in case nfs_fix_groups doesn't do anything. |
213 | */ |
214 | nfs_fix_groups(xl,frame->root); |
215 | |
216 | err: |
217 | return frame; |
218 | } |
219 | |
220 | #define nfs_fop_handle_frame_create(fram, xla, nfuser, retval, errlabel)do { fram = nfs_create_frame (xla, (nfuser)); if (!fram) { retval = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 220, GF_LOG_ERROR ,"Frame creation failed"); } while (0); goto errlabel; } } while (0) \ |
221 | do { \ |
222 | fram = nfs_create_frame (xla, (nfuser)); \ |
223 | if (!fram) { \ |
224 | retval = (-ENOMEM12); \ |
225 | gf_log (GF_NFS, GF_LOG_ERROR,"Frame creation failed")do { do { if (0) printf ("Frame creation failed"); } while (0 ); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 225, GF_LOG_ERROR ,"Frame creation failed"); } while (0);\ |
226 | goto errlabel; \ |
227 | } \ |
228 | } while (0) \ |
229 | |
230 | /* Look into the inode and parent inode of a loc and save enough state |
231 | * for us to determine in the callback whether to funge the ino in the stat buf |
232 | * with 1 for the parent. |
233 | */ |
234 | #define nfs_fop_save_root_ino(locl, loc)do { if (((loc)->inode) && __is_root_gfid ((loc)-> inode->gfid)) (locl)->rootinode = 1; else if (((loc)-> parent) && __is_root_gfid ((loc)->parent->gfid) ) (locl)->rootparentinode = 1; } while (0) \ |
235 | do { \ |
236 | if (((loc)->inode) && \ |
237 | __is_root_gfid ((loc)->inode->gfid)) \ |
238 | (locl)->rootinode = 1; \ |
239 | else if (((loc)->parent) && \ |
240 | __is_root_gfid ((loc)->parent->gfid)) \ |
241 | (locl)->rootparentinode = 1; \ |
242 | } while (0) |
243 | |
244 | /* Do the same for an fd */ |
245 | #define nfs_fop_save_root_fd_ino(locl, fdesc)do { if (__is_root_gfid ((fdesc)->inode->gfid)) (locl)-> rootinode = 1; } while (0) \ |
246 | do { \ |
247 | if (__is_root_gfid ((fdesc)->inode->gfid)) \ |
248 | (locl)->rootinode = 1; \ |
249 | } while (0) |
250 | |
251 | |
252 | /* Use the state saved by the previous macro to funge the ino in the appropriate |
253 | * structure. |
254 | */ |
255 | #define nfs_fop_restore_root_ino(locl, fopret, preattr, postattr, prepar, postpar)do { if (fopret == -1) break; if ((locl)->rootinode) { if ( (preattr)) { ((struct iatt *)(preattr))->ia_ino = 1; ((struct iatt *)(preattr))->ia_dev = 0; } if ((postattr)) { ((struct iatt *)(postattr))->ia_ino = 1; ((struct iatt *)(postattr ))->ia_dev = 0; } } else if ((locl)->rootparentinode) { if ((prepar)) { ((struct iatt *)(prepar))->ia_ino = 1; (( struct iatt *)(prepar))->ia_dev = 0; } if ((postpar)) { (( struct iatt *)(postpar))->ia_ino = 1; ((struct iatt *)(postpar ))->ia_dev = 0; } } } while (0) \ |
256 | do { \ |
257 | if (fopret == -1) \ |
258 | break; \ |
259 | if ((locl)->rootinode) { \ |
260 | if ((preattr)) { \ |
261 | ((struct iatt *)(preattr))->ia_ino = 1; \ |
262 | ((struct iatt *)(preattr))->ia_dev = 0; \ |
263 | } \ |
264 | if ((postattr)) { \ |
265 | ((struct iatt *)(postattr))->ia_ino = 1; \ |
266 | ((struct iatt *)(postattr))->ia_dev = 0; \ |
267 | } \ |
268 | } else if ((locl)->rootparentinode) { \ |
269 | if ((prepar)) { \ |
270 | ((struct iatt *)(prepar))->ia_ino = 1; \ |
271 | ((struct iatt *)(prepar))->ia_dev = 0; \ |
272 | } \ |
273 | if ((postpar)) { \ |
274 | ((struct iatt *)(postpar))->ia_ino = 1; \ |
275 | ((struct iatt *)(postpar))->ia_dev = 0; \ |
276 | } \ |
277 | } \ |
278 | } while (0) \ |
279 | |
280 | /* If the newly created, inode's parent is root, we'll need to funge the ino |
281 | * in the parent attr when we receive them in the callback. |
282 | */ |
283 | #define nfs_fop_newloc_save_root_ino(locl, newloc)do { if (((newloc)->inode) && __is_root_gfid ((newloc )->inode->gfid)) (locl)->newrootinode = 1; else if ( ((newloc)->parent) && __is_root_gfid ((newloc)-> parent->gfid)) (locl)->newrootparentinode = 1; } while ( 0) \ |
284 | do { \ |
285 | if (((newloc)->inode) && \ |
286 | __is_root_gfid ((newloc)->inode->gfid)) \ |
287 | (locl)->newrootinode = 1; \ |
288 | else if (((newloc)->parent) && \ |
289 | __is_root_gfid ((newloc)->parent->gfid)) \ |
290 | (locl)->newrootparentinode = 1; \ |
291 | } while (0) |
292 | |
293 | #define nfs_fop_newloc_restore_root_ino(locl, fopret, preattr, postattr, prepar, postpar)do { if (fopret == -1) break; if ((locl)->newrootinode) { if ((preattr)) ((struct iatt *)(preattr))->ia_ino = 1; if (( postattr)) ((struct iatt *)(postattr))->ia_ino = 1; } else if ((locl)->newrootparentinode) { if ((prepar)) ((struct iatt *)(prepar))->ia_ino = 1; if ((postpar)) ((struct iatt *)( postpar))->ia_ino = 1; } } while (0) \ |
294 | do { \ |
295 | if (fopret == -1) \ |
296 | break; \ |
297 | \ |
298 | if ((locl)->newrootinode) { \ |
299 | if ((preattr)) \ |
300 | ((struct iatt *)(preattr))->ia_ino = 1; \ |
301 | if ((postattr)) \ |
302 | ((struct iatt *)(postattr))->ia_ino = 1; \ |
303 | } else if ((locl)->newrootparentinode) { \ |
304 | if ((prepar)) \ |
305 | ((struct iatt *)(prepar))->ia_ino = 1; \ |
306 | if ((postpar)) \ |
307 | ((struct iatt *)(postpar))->ia_ino = 1; \ |
308 | } \ |
309 | } while (0) \ |
310 | |
311 | dict_t * |
312 | nfs_gfid_dict (inode_t *inode) |
313 | { |
314 | uuid_t newgfid = {0, }; |
315 | char *dyngfid = NULL((void*)0); |
316 | dict_t *dictgfid = NULL((void*)0); |
317 | int ret = -1; |
318 | uuid_t rootgfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; |
319 | |
320 | dyngfid = GF_CALLOC (1, sizeof (uuid_t), gf_common_mt_char)__gf_calloc (1, sizeof (uuid_t), gf_common_mt_char); |
321 | uuid_generate (newgfid); |
322 | |
323 | if (uuid_compare (inode->gfid, rootgfid) == 0) |
324 | memcpy (dyngfid, rootgfid, sizeof (uuid_t)); |
325 | else |
326 | memcpy (dyngfid, newgfid, sizeof (uuid_t)); |
327 | |
328 | dictgfid = dict_new (); |
329 | if (!dictgfid) { |
330 | gf_log (GF_NFS, GF_LOG_ERROR, "Failed to create gfid dict")do { do { if (0) printf ("Failed to create gfid dict"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 330, GF_LOG_ERROR , "Failed to create gfid dict"); } while (0); |
331 | goto out; |
332 | } |
333 | |
334 | ret = dict_set_bin (dictgfid, "gfid-req", dyngfid, sizeof (uuid_t)); |
335 | if (ret < 0) { |
336 | dict_unref (dictgfid); |
337 | dictgfid = NULL((void*)0); |
338 | } |
339 | |
340 | out: |
341 | return dictgfid; |
342 | } |
343 | |
344 | #define nfs_fop_gfid_setup(nflcl, inode, retval, erlbl)do { if (nflcl) { (nflcl)->dictgfid = nfs_gfid_dict (inode ); if (!((nflcl)->dictgfid)) { retval = -14; goto erlbl; } } } while (0) \ |
345 | do { \ |
346 | if (nflcl) { \ |
347 | (nflcl)->dictgfid = nfs_gfid_dict (inode); \ |
348 | \ |
349 | if (!((nflcl)->dictgfid)) { \ |
350 | retval = -EFAULT14; \ |
351 | goto erlbl; \ |
352 | } \ |
353 | } \ |
354 | } while (0) \ |
355 | |
356 | /* Fops Layer Explained |
357 | * The fops layer has three types of functions. They can all be identified by |
358 | * their names. Here are the three patterns: |
359 | * |
360 | * nfs_fop_<fopname> |
361 | * This is the lowest level function that knows nothing about states and |
362 | * callbacks. At most this is required to create a frame and call the |
363 | * fop. The idea here is to provide a convenient way to call fops than |
364 | * directly use STACK_WINDs. If this type of interface is used, the caller's |
365 | * callback is responsible for doing the relevant GlusterFS state |
366 | * maintenance operations on the data returned in the callbacks. |
367 | * |
368 | * nfs_<fopname> |
369 | * Unlike the nfs_fop_<fopname> variety, this is the stateful type of fop, in |
370 | * that it silently performs all the relevant GlusterFS state maintenance |
371 | * operations on the data returned to the callbacks, leaving the caller's |
372 | * callback to just use the data returned for whatever it needs to do with that |
373 | * data, for eg. the nfs_lookup, will take care of looking up the inodes, |
374 | * revalidating them if needed and linking new inodes into the table, while |
375 | * the caller's callback, for eg, the NFSv3 LOOKUP callback can just use |
376 | * the stat bufs returned to create file handle, map the file handle into the |
377 | * fh cache and finally encode the fh and the stat bufs into a NFS reply. |
378 | * |
379 | */ |
380 | |
381 | int32_t |
382 | nfs_fop_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
383 | int32_t op_ret, int32_t op_errno, inode_t *inode, |
384 | struct iatt *buf, dict_t *xattr, struct iatt *postparent) |
385 | { |
386 | struct nfs_fop_local *local = NULL((void*)0); |
387 | fop_lookup_cbk_t progcbk; |
388 | int32_t spb = 0; |
389 | |
390 | /* |
391 | * With native protocol, self-heal failures would be detected during |
392 | * open. NFS doesn't issue that open when revalidating cache, so we |
393 | * have to check for failures here instead. |
394 | */ |
395 | if (dict_get_int32(xattr, "split-brain", &spb) == 0) { |
396 | if (spb) { |
397 | op_ret = -1; |
398 | op_errno = EIO5; |
399 | } |
400 | } |
401 | |
402 | if (op_ret == 0) { |
403 | nfs_fix_generation(this,inode); |
404 | } |
405 | |
406 | nfl_to_prog_data (local, progcbk, frame)do { local = frame->local; frame->local = local->proglocal ; progcbk = local->progcbk; } while (0); |
407 | nfs_fop_restore_root_ino (local, op_ret, buf, NULL, NULL, postparent)do { if (op_ret == -1) break; if ((local)->rootinode) { if ((buf)) { ((struct iatt *)(buf))->ia_ino = 1; ((struct iatt *)(buf))->ia_dev = 0; } if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)) )->ia_dev = 0; } } else if ((local)->rootparentinode) { if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } if ((postparent )) { ((struct iatt *)(postparent))->ia_ino = 1; ((struct iatt *)(postparent))->ia_dev = 0; } } } while (0); |
408 | if (progcbk) |
409 | progcbk (frame, cookie, this, op_ret, op_errno, inode, buf, |
410 | xattr, postparent); |
411 | |
412 | nfs_stack_destroy (local, frame)do { nfs_fop_local_wipe ((local)->nfsx, local); (frame)-> local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
413 | return 0; |
414 | } |
415 | |
416 | |
417 | int |
418 | nfs_fop_lookup (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, |
419 | fop_lookup_cbk_t cbk, void *local) |
420 | { |
421 | call_frame_t *frame = NULL((void*)0); |
422 | int ret = -EFAULT14; |
423 | struct nfs_fop_local *nfl = NULL((void*)0); |
424 | |
425 | if ((!xl) || (!loc) || (!nfu)) |
426 | return ret; |
427 | |
428 | gf_log (GF_NFS, GF_LOG_TRACE, "Lookup: %s", loc->path)do { do { if (0) printf ("Lookup: %s", loc->path); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 428, GF_LOG_TRACE , "Lookup: %s", loc->path); } while (0); |
429 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 429, GF_LOG_ERROR ,"Frame creation failed"); } while (0); goto err; } } while ( 0); |
430 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 430, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
431 | nfs_fop_save_root_ino (nfl, loc)do { if (((loc)->inode) && __is_root_gfid ((loc)-> inode->gfid)) (nfl)->rootinode = 1; else if (((loc)-> parent) && __is_root_gfid ((loc)->parent->gfid) ) (nfl)->rootparentinode = 1; } while (0); |
432 | nfs_fop_gfid_setup (nfl, loc->inode, ret, err)do { if (nfl) { (nfl)->dictgfid = nfs_gfid_dict (loc->inode ); if (!((nfl)->dictgfid)) { ret = -14; goto err; } } } while (0); |
433 | |
434 | STACK_WIND_COOKIE (frame, nfs_fop_lookup_cbk, xl, xl,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 435, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> lookup_cbk) tmp_cbk = nfs_fop_lookup_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->lookup"; _new->unwind_to = "nfs_fop_lookup_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 ); xl->fops->lookup_cbk = nfs_fop_lookup_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location( )) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->lookup); xl->fops->lookup (_new , xl, loc, nfl->dictgfid); (*__glusterfs_this_location()) = old_THIS; } while (0) |
435 | xl->fops->lookup, loc, nfl->dictgfid)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 435, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> lookup_cbk) tmp_cbk = nfs_fop_lookup_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->lookup"; _new->unwind_to = "nfs_fop_lookup_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 ); xl->fops->lookup_cbk = nfs_fop_lookup_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location( )) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->lookup); xl->fops->lookup (_new , xl, loc, nfl->dictgfid); (*__glusterfs_this_location()) = old_THIS; } while (0); |
436 | |
437 | ret = 0; |
438 | err: |
439 | if (ret < 0) { |
440 | if (frame) |
441 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
442 | } |
443 | |
444 | return ret; |
445 | } |
446 | |
447 | int32_t |
448 | nfs_fop_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
449 | int32_t op_ret, int32_t op_errno, dict_t *xdata) |
450 | { |
451 | struct nfs_fop_local *nfl = NULL((void*)0); |
452 | fop_access_cbk_t progcbk = NULL((void*)0); |
453 | |
454 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
455 | if (progcbk) |
456 | progcbk (frame, cookie, this, op_ret, op_errno, xdata); |
457 | |
458 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
459 | return 0; |
460 | } |
461 | |
462 | int |
463 | nfs_fop_access (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, |
464 | int32_t accesstest, fop_access_cbk_t cbk, void *local) |
465 | { |
466 | call_frame_t *frame = NULL((void*)0); |
467 | int ret = -EFAULT14; |
468 | struct nfs_fop_local *nfl = NULL((void*)0); |
469 | uint32_t accessbits = 0; |
470 | |
471 | if ((!xl) || (!loc) || (!nfu)) |
472 | return ret; |
473 | |
474 | gf_log (GF_NFS, GF_LOG_TRACE, "Access: %s", loc->path)do { do { if (0) printf ("Access: %s", loc->path); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 474, GF_LOG_TRACE , "Access: %s", loc->path); } while (0); |
475 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 475, GF_LOG_ERROR ,"Frame creation failed"); } while (0); goto err; } } while ( 0); |
476 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 476, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
477 | nfs_fop_save_root_ino (nfl, loc)do { if (((loc)->inode) && __is_root_gfid ((loc)-> inode->gfid)) (nfl)->rootinode = 1; else if (((loc)-> parent) && __is_root_gfid ((loc)->parent->gfid) ) (nfl)->rootparentinode = 1; } while (0); |
478 | |
479 | accessbits = nfs3_request_to_accessbits (accesstest); |
480 | STACK_WIND_COOKIE (frame, nfs_fop_access_cbk, xl, xl, xl->fops->access,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 481, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> access_cbk) tmp_cbk = nfs_fop_access_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->access"; _new->unwind_to = "nfs_fop_access_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 ); xl->fops->access_cbk = nfs_fop_access_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location( )) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->access); xl->fops->access (_new , xl, loc, accessbits, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) |
481 | loc, accessbits, 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", "nfs-fops.c", __FUNCTION__, 481, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> access_cbk) tmp_cbk = nfs_fop_access_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->access"; _new->unwind_to = "nfs_fop_access_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 ); xl->fops->access_cbk = nfs_fop_access_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location( )) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->access); xl->fops->access (_new , xl, loc, accessbits, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
482 | ret = 0; |
483 | err: |
484 | if (ret < 0) { |
485 | if (frame) |
486 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
487 | } |
488 | |
489 | return ret; |
490 | } |
491 | |
492 | int32_t |
493 | nfs_fop_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
494 | int32_t op_ret, int32_t op_errno, struct iatt *buf, |
495 | dict_t *xdata) |
496 | { |
497 | struct nfs_fop_local *nfl = NULL((void*)0); |
498 | fop_stat_cbk_t progcbk = NULL((void*)0); |
499 | |
500 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
501 | nfs_fop_restore_root_ino (nfl, op_ret, buf, NULL, NULL, NULL)do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (buf)) { ((struct iatt *)(buf))->ia_ino = 1; ((struct iatt *)(buf))->ia_dev = 0; } if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)) )->ia_dev = 0; } } else if ((nfl)->rootparentinode) { if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1 ; ((struct iatt *)(((void*)0)))->ia_dev = 0; } if ((((void *)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } } } while (0); |
502 | if (progcbk) |
503 | progcbk (frame, cookie, this, op_ret, op_errno, buf, xdata); |
504 | |
505 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
506 | return 0; |
507 | } |
508 | |
509 | |
510 | int |
511 | nfs_fop_stat (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, |
512 | fop_stat_cbk_t cbk, void *local) |
513 | { |
514 | call_frame_t *frame = NULL((void*)0); |
515 | int ret = -EFAULT14; |
516 | struct nfs_fop_local *nfl = NULL((void*)0); |
517 | |
518 | if ((!xl) || (!loc) || (!nfu)) |
519 | return ret; |
520 | |
521 | gf_log (GF_NFS, GF_LOG_TRACE, "Stat: %s", loc->path)do { do { if (0) printf ("Stat: %s", loc->path); } while ( 0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 521, GF_LOG_TRACE , "Stat: %s", loc->path); } while (0); |
522 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 522, GF_LOG_ERROR ,"Frame creation failed"); } while (0); goto err; } } while ( 0); |
523 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 523, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
524 | nfs_fop_save_root_ino (nfl, loc)do { if (((loc)->inode) && __is_root_gfid ((loc)-> inode->gfid)) (nfl)->rootinode = 1; else if (((loc)-> parent) && __is_root_gfid ((loc)->parent->gfid) ) (nfl)->rootparentinode = 1; } while (0); |
525 | |
526 | STACK_WIND_COOKIE (frame, nfs_fop_stat_cbk, xl, xl, xl->fops->stat,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 527, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> stat_cbk) tmp_cbk = nfs_fop_stat_cbk; _new->root = frame-> root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new ->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->stat"; _new ->unwind_to = "nfs_fop_stat_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 ); xl->fops->stat_cbk = nfs_fop_stat_cbk; old_THIS = (* __glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new , xl->fops->stat); xl->fops->stat (_new, xl, loc, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) |
527 | 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", "nfs-fops.c", __FUNCTION__, 527, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> stat_cbk) tmp_cbk = nfs_fop_stat_cbk; _new->root = frame-> root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new ->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->stat"; _new ->unwind_to = "nfs_fop_stat_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 ); xl->fops->stat_cbk = nfs_fop_stat_cbk; old_THIS = (* __glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new , xl->fops->stat); xl->fops->stat (_new, xl, loc, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); |
528 | ret = 0; |
529 | err: |
530 | if (ret < 0) { |
531 | if (frame) |
532 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
533 | } |
534 | |
535 | return ret; |
536 | } |
537 | |
538 | |
539 | int32_t |
540 | nfs_fop_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
541 | int32_t op_ret, int32_t op_errno, struct iatt *buf, |
542 | dict_t *xdata) |
543 | { |
544 | struct nfs_fop_local *nfl = NULL((void*)0); |
545 | fop_fstat_cbk_t progcbk = NULL((void*)0); |
546 | |
547 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
548 | nfs_fop_restore_root_ino (nfl, op_ret, buf, NULL, NULL, NULL)do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (buf)) { ((struct iatt *)(buf))->ia_ino = 1; ((struct iatt *)(buf))->ia_dev = 0; } if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)) )->ia_dev = 0; } } else if ((nfl)->rootparentinode) { if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1 ; ((struct iatt *)(((void*)0)))->ia_dev = 0; } if ((((void *)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } } } while (0); |
549 | if (progcbk) |
550 | progcbk (frame, cookie, this, op_ret, op_errno, buf, xdata); |
551 | |
552 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
553 | return 0; |
554 | } |
555 | |
556 | |
557 | int |
558 | nfs_fop_fstat (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, |
559 | fop_fstat_cbk_t cbk, void *local) |
560 | { |
561 | call_frame_t *frame = NULL((void*)0); |
562 | int ret = -EFAULT14; |
563 | struct nfs_fop_local *nfl = NULL((void*)0); |
564 | |
565 | if ((!nfsx) || (!xl) || (!fd) || (!nfu)) |
566 | return ret; |
567 | |
568 | gf_log (GF_NFS, GF_LOG_TRACE, "FStat")do { do { if (0) printf ("FStat"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 568, GF_LOG_TRACE, "FStat"); } while (0); |
569 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 569, GF_LOG_ERROR ,"Frame creation failed"); } while (0); goto err; } } while ( 0); |
570 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 570, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
571 | nfs_fop_save_root_fd_ino (nfl, fd)do { if (__is_root_gfid ((fd)->inode->gfid)) (nfl)-> rootinode = 1; } while (0); |
572 | |
573 | STACK_WIND_COOKIE (frame, nfs_fop_fstat_cbk, xl, xl, xl->fops->fstat,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 574, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> fstat_cbk) tmp_cbk = nfs_fop_fstat_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->fstat"; _new ->unwind_to = "nfs_fop_fstat_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 ); xl->fops->fstat_cbk = nfs_fop_fstat_cbk; old_THIS = ( *__glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin ( _new, xl->fops->fstat); xl->fops->fstat (_new, xl , fd, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) |
574 | fd, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 574, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> fstat_cbk) tmp_cbk = nfs_fop_fstat_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->fstat"; _new ->unwind_to = "nfs_fop_fstat_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 ); xl->fops->fstat_cbk = nfs_fop_fstat_cbk; old_THIS = ( *__glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin ( _new, xl->fops->fstat); xl->fops->fstat (_new, xl , fd, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); |
575 | |
576 | ret = 0; |
577 | err: |
578 | if (ret < 0) { |
579 | if (frame) |
580 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
581 | } |
582 | |
583 | return ret; |
584 | } |
585 | |
586 | |
587 | int32_t |
588 | nfs_fop_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
589 | int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) |
590 | { |
591 | struct nfs_fop_local *nfl = NULL((void*)0); |
592 | fop_opendir_cbk_t progcbk = NULL((void*)0); |
593 | |
594 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
595 | if (progcbk) |
596 | progcbk (frame, cookie, this, op_ret, op_errno, fd, xdata); |
597 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
598 | return 0; |
599 | } |
600 | |
601 | |
602 | int |
603 | nfs_fop_opendir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, |
604 | fd_t *dirfd, fop_opendir_cbk_t cbk, void *local) |
605 | { |
606 | call_frame_t *frame = NULL((void*)0); |
607 | int ret = -EFAULT14; |
608 | struct nfs_fop_local *nfl = NULL((void*)0); |
609 | |
610 | if ((!nfsx) || (!xl) || (!pathloc) || (!dirfd) || (!nfu)) |
611 | return ret; |
612 | |
613 | gf_log (GF_NFS, GF_LOG_TRACE, "Opendir: %s", pathloc->path)do { do { if (0) printf ("Opendir: %s", pathloc->path); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 613, GF_LOG_TRACE , "Opendir: %s", pathloc->path); } while (0); |
614 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 614, GF_LOG_ERROR ,"Frame creation failed"); } while (0); goto err; } } while ( 0); |
615 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 615, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
616 | |
617 | STACK_WIND_COOKIE (frame, nfs_fop_opendir_cbk, xl, xl,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 618, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> opendir_cbk) tmp_cbk = nfs_fop_opendir_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->opendir" ; _new->unwind_to = "nfs_fop_opendir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { frame->ref_count++; _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; } pthread_spin_unlock (&frame->root->stack_lock ); xl->fops->opendir_cbk = nfs_fop_opendir_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->opendir); xl->fops->opendir (_new , xl, pathloc, dirfd, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) |
618 | xl->fops->opendir, pathloc, dirfd, 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", "nfs-fops.c", __FUNCTION__, 618, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> opendir_cbk) tmp_cbk = nfs_fop_opendir_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->opendir" ; _new->unwind_to = "nfs_fop_opendir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { frame->ref_count++; _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; } pthread_spin_unlock (&frame->root->stack_lock ); xl->fops->opendir_cbk = nfs_fop_opendir_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->opendir); xl->fops->opendir (_new , xl, pathloc, dirfd, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
619 | ret = 0; |
620 | |
621 | err: |
622 | if (ret < 0) { |
623 | if (frame) |
624 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
625 | } |
626 | |
627 | return ret; |
628 | } |
629 | |
630 | int |
631 | nfs_fop_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
632 | int32_t op_ret, int32_t op_errno, dict_t *xdata) |
633 | { |
634 | struct nfs_fop_local *nfl = NULL((void*)0); |
635 | fop_flush_cbk_t progcbk = NULL((void*)0); |
636 | |
637 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
638 | if (progcbk) |
639 | progcbk (frame, cookie, this, op_ret, op_errno, xdata); |
640 | |
641 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
642 | return 0; |
643 | } |
644 | |
645 | |
646 | int |
647 | nfs_fop_flush (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, |
648 | fop_flush_cbk_t cbk, void *local) |
649 | { |
650 | call_frame_t *frame = NULL((void*)0); |
651 | int ret = -EFAULT14; |
652 | struct nfs_fop_local *nfl = NULL((void*)0); |
653 | |
654 | if ((!nfsx) || (!xl) || (!fd) || (!nfu)) |
655 | return ret; |
656 | |
657 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 657, GF_LOG_ERROR ,"Frame creation failed"); } while (0); goto err; } } while ( 0); |
658 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 658, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
659 | |
660 | STACK_WIND_COOKIE (frame, nfs_fop_flush_cbk, xl, xl, xl->fops->flush,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 661, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> flush_cbk) tmp_cbk = nfs_fop_flush_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->flush"; _new ->unwind_to = "nfs_fop_flush_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 ); xl->fops->flush_cbk = nfs_fop_flush_cbk; old_THIS = ( *__glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin ( _new, xl->fops->flush); xl->fops->flush (_new, xl , fd, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) |
661 | fd, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 661, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> flush_cbk) tmp_cbk = nfs_fop_flush_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->flush"; _new ->unwind_to = "nfs_fop_flush_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 ); xl->fops->flush_cbk = nfs_fop_flush_cbk; old_THIS = ( *__glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin ( _new, xl->fops->flush); xl->fops->flush (_new, xl , fd, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); |
662 | ret = 0; |
663 | err: |
664 | if (ret < 0) { |
665 | if (frame) |
666 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
667 | } |
668 | |
669 | return ret; |
670 | } |
671 | |
672 | |
673 | int32_t |
674 | nfs_fop_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
675 | int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, |
676 | dict_t *xdata) |
677 | { |
678 | struct nfs_fop_local *nfl = NULL((void*)0); |
679 | fop_readdirp_cbk_t progcbk = NULL((void*)0); |
680 | |
681 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
682 | if (progcbk) |
683 | progcbk (frame, cookie, this, op_ret, op_errno, entries, xdata); |
684 | |
685 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
686 | |
687 | return 0; |
688 | } |
689 | |
690 | |
691 | int |
692 | nfs_fop_readdirp (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *dirfd, |
693 | size_t bufsize, off_t offset, fop_readdirp_cbk_t cbk, |
694 | void *local) |
695 | { |
696 | call_frame_t *frame = NULL((void*)0); |
697 | int ret = -EFAULT14; |
698 | struct nfs_fop_local *nfl = NULL((void*)0); |
699 | |
700 | if ((!nfsx) || (!xl) || (!dirfd) || (!nfu)) |
701 | return ret; |
702 | |
703 | gf_log (GF_NFS, GF_LOG_TRACE, "readdir")do { do { if (0) printf ("readdir"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 703, GF_LOG_TRACE, "readdir"); } while (0); |
704 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 704, GF_LOG_ERROR ,"Frame creation failed"); } while (0); goto err; } } while ( 0); |
705 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 705, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
706 | |
707 | STACK_WIND_COOKIE (frame, nfs_fop_readdirp_cbk, xl, xl,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 708, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> readdirp_cbk) tmp_cbk = nfs_fop_readdirp_cbk; _new->root = frame->root; _new->this = xl; _new->ret = (ret_fn_t ) tmp_cbk; _new->parent = frame; _new->cookie = xl; _new ->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->readdirp" ; _new->unwind_to = "nfs_fop_readdirp_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 ); xl->fops->readdirp_cbk = nfs_fop_readdirp_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->readdirp); xl->fops->readdirp ( _new, xl, dirfd, bufsize, offset, 0); (*__glusterfs_this_location ()) = old_THIS; } while (0) |
708 | xl->fops->readdirp, dirfd, bufsize, offset, 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", "nfs-fops.c", __FUNCTION__, 708, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> readdirp_cbk) tmp_cbk = nfs_fop_readdirp_cbk; _new->root = frame->root; _new->this = xl; _new->ret = (ret_fn_t ) tmp_cbk; _new->parent = frame; _new->cookie = xl; _new ->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->readdirp" ; _new->unwind_to = "nfs_fop_readdirp_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 ); xl->fops->readdirp_cbk = nfs_fop_readdirp_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->readdirp); xl->fops->readdirp ( _new, xl, dirfd, bufsize, offset, 0); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
709 | |
710 | ret = 0; |
711 | err: |
712 | if (ret < 0) { |
713 | if (frame) |
714 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
715 | } |
716 | |
717 | return ret; |
718 | } |
719 | |
720 | |
721 | int32_t |
722 | nfs_fop_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
723 | int32_t op_ret, int32_t op_errno, struct statvfs *buf, |
724 | dict_t *xdata) |
725 | { |
726 | |
727 | struct nfs_fop_local *nfl = NULL((void*)0); |
728 | fop_statfs_cbk_t progcbk = NULL((void*)0); |
729 | |
730 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
731 | if (progcbk) |
732 | progcbk (frame, cookie, this, op_ret, op_errno, buf, xdata); |
733 | |
734 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
735 | return 0; |
736 | } |
737 | |
738 | |
739 | int |
740 | nfs_fop_statfs (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, |
741 | fop_statfs_cbk_t cbk, void *local) |
742 | { |
743 | call_frame_t *frame = NULL((void*)0); |
744 | int ret = -EFAULT14; |
745 | struct nfs_fop_local *nfl = NULL((void*)0); |
746 | |
747 | if ((!nfsx) || (!xl) || (!pathloc) || (!nfu)) |
748 | return ret; |
749 | |
750 | gf_log (GF_NFS, GF_LOG_TRACE, "Statfs: %s", pathloc->path)do { do { if (0) printf ("Statfs: %s", pathloc->path); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 750, GF_LOG_TRACE , "Statfs: %s", pathloc->path); } while (0); |
751 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 751, GF_LOG_ERROR ,"Frame creation failed"); } while (0); goto err; } } while ( 0); |
752 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 752, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
753 | |
754 | STACK_WIND_COOKIE (frame, nfs_fop_statfs_cbk, xl, xl,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 755, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> statfs_cbk) tmp_cbk = nfs_fop_statfs_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->statfs"; _new->unwind_to = "nfs_fop_statfs_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 ); xl->fops->statfs_cbk = nfs_fop_statfs_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location( )) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->statfs); xl->fops->statfs (_new , xl, pathloc, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0) |
755 | xl->fops->statfs, pathloc, 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", "nfs-fops.c", __FUNCTION__, 755, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> statfs_cbk) tmp_cbk = nfs_fop_statfs_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->statfs"; _new->unwind_to = "nfs_fop_statfs_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 ); xl->fops->statfs_cbk = nfs_fop_statfs_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location( )) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->statfs); xl->fops->statfs (_new , xl, pathloc, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); |
756 | ret = 0; |
757 | err: |
758 | if (ret < 0) { |
759 | if (frame) |
760 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
761 | } |
762 | |
763 | return ret; |
764 | } |
765 | |
766 | |
767 | int32_t |
768 | nfs_fop_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
769 | int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode, |
770 | struct iatt *buf, struct iatt *preparent, |
771 | struct iatt *postparent, dict_t *xdata) |
772 | { |
773 | struct nfs_fop_local *nfl = NULL((void*)0); |
774 | fop_create_cbk_t progcbk = NULL((void*)0); |
775 | |
776 | if (op_ret == 0) { |
777 | nfs_fix_generation(this,inode); |
778 | } |
779 | |
780 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
781 | nfs_fop_restore_root_ino (nfl, op_ret, buf, NULL, preparent,do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (buf)) { ((struct iatt *)(buf))->ia_ino = 1; ((struct iatt *)(buf))->ia_dev = 0; } if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)) )->ia_dev = 0; } } else if ((nfl)->rootparentinode) { if ((preparent)) { ((struct iatt *)(preparent))->ia_ino = 1; ((struct iatt *)(preparent))->ia_dev = 0; } if ((postparent )) { ((struct iatt *)(postparent))->ia_ino = 1; ((struct iatt *)(postparent))->ia_dev = 0; } } } while (0) |
782 | postparent)do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (buf)) { ((struct iatt *)(buf))->ia_ino = 1; ((struct iatt *)(buf))->ia_dev = 0; } if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)) )->ia_dev = 0; } } else if ((nfl)->rootparentinode) { if ((preparent)) { ((struct iatt *)(preparent))->ia_ino = 1; ((struct iatt *)(preparent))->ia_dev = 0; } if ((postparent )) { ((struct iatt *)(postparent))->ia_ino = 1; ((struct iatt *)(postparent))->ia_dev = 0; } } } while (0); |
783 | if (progcbk) |
784 | progcbk (frame, cookie, this, op_ret, op_errno, fd, inode, buf, |
785 | preparent, postparent, NULL((void*)0)); |
786 | |
787 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
788 | return 0; |
789 | } |
790 | |
791 | |
792 | int |
793 | nfs_fop_create (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, |
794 | int flags, mode_t mode, fd_t *fd, fop_create_cbk_t cbk, |
795 | void *local) |
796 | { |
797 | call_frame_t *frame = NULL((void*)0); |
798 | int ret = -EFAULT14; |
799 | struct nfs_fop_local *nfl = NULL((void*)0); |
800 | |
801 | if ((!nfsx) || (!xl) || (!pathloc) || (!nfu)) |
802 | return ret; |
803 | |
804 | gf_log (GF_NFS, GF_LOG_TRACE, "Create: %s", pathloc->path)do { do { if (0) printf ("Create: %s", pathloc->path); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 804, GF_LOG_TRACE , "Create: %s", pathloc->path); } while (0); |
805 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 805, GF_LOG_ERROR ,"Frame creation failed"); } while (0); goto err; } } while ( 0); |
806 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 806, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
807 | nfs_fop_save_root_ino (nfl, pathloc)do { if (((pathloc)->inode) && __is_root_gfid ((pathloc )->inode->gfid)) (nfl)->rootinode = 1; else if (((pathloc )->parent) && __is_root_gfid ((pathloc)->parent ->gfid)) (nfl)->rootparentinode = 1; } while (0); |
808 | nfs_fop_gfid_setup (nfl, pathloc->inode, ret, err)do { if (nfl) { (nfl)->dictgfid = nfs_gfid_dict (pathloc-> inode); if (!((nfl)->dictgfid)) { ret = -14; goto err; } } } while (0); |
809 | |
810 | STACK_WIND_COOKIE (frame, nfs_fop_create_cbk, xl, xl, xl->fops->create,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 811, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> create_cbk) tmp_cbk = nfs_fop_create_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->create"; _new->unwind_to = "nfs_fop_create_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 ); xl->fops->create_cbk = nfs_fop_create_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location( )) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->create); xl->fops->create (_new , xl, pathloc, flags, mode, 0, fd, nfl->dictgfid); (*__glusterfs_this_location ()) = old_THIS; } while (0) |
811 | pathloc, flags, mode, 0, fd, nfl->dictgfid)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 811, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> create_cbk) tmp_cbk = nfs_fop_create_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->create"; _new->unwind_to = "nfs_fop_create_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 ); xl->fops->create_cbk = nfs_fop_create_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location( )) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->create); xl->fops->create (_new , xl, pathloc, flags, mode, 0, fd, nfl->dictgfid); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
812 | |
813 | ret = 0; |
814 | err: |
815 | if (ret < 0) { |
816 | if (frame) |
817 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
818 | } |
819 | |
820 | return ret; |
821 | } |
822 | |
823 | |
824 | int32_t |
825 | nfs_fop_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
826 | int32_t op_ret, int32_t op_errno, struct iatt *pre, |
827 | struct iatt *post, dict_t *xdata) |
828 | { |
829 | struct nfs_fop_local *nfl = NULL((void*)0); |
830 | fop_setattr_cbk_t progcbk = NULL((void*)0); |
831 | |
832 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
833 | nfs_fop_restore_root_ino (nfl, op_ret, pre, post, NULL, NULL)do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (pre)) { ((struct iatt *)(pre))->ia_ino = 1; ((struct iatt *)(pre))->ia_dev = 0; } if ((post)) { ((struct iatt *)(post ))->ia_ino = 1; ((struct iatt *)(post))->ia_dev = 0; } } else if ((nfl)->rootparentinode) { if ((((void*)0))) { (( struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)( ((void*)0)))->ia_dev = 0; } if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)) )->ia_dev = 0; } } } while (0); |
834 | if (progcbk) |
835 | progcbk (frame, cookie, this, op_ret, op_errno, pre, post, |
836 | xdata); |
837 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
838 | return 0; |
839 | } |
840 | |
841 | |
842 | |
843 | int |
844 | nfs_fop_setattr (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, |
845 | struct iatt *buf, int32_t valid, fop_setattr_cbk_t cbk, |
846 | void *local) |
847 | { |
848 | call_frame_t *frame = NULL((void*)0); |
849 | int ret = -EFAULT14; |
850 | struct nfs_fop_local *nfl = NULL((void*)0); |
851 | |
852 | if ((!nfsx) || (!xl) || (!pathloc) || (!nfu)) |
853 | return ret; |
854 | |
855 | gf_log (GF_NFS, GF_LOG_TRACE, "Setattr: %s", pathloc->path)do { do { if (0) printf ("Setattr: %s", pathloc->path); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 855, GF_LOG_TRACE , "Setattr: %s", pathloc->path); } while (0); |
856 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 856, GF_LOG_ERROR ,"Frame creation failed"); } while (0); goto err; } } while ( 0); |
857 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 857, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
858 | nfs_fop_save_root_ino (nfl, pathloc)do { if (((pathloc)->inode) && __is_root_gfid ((pathloc )->inode->gfid)) (nfl)->rootinode = 1; else if (((pathloc )->parent) && __is_root_gfid ((pathloc)->parent ->gfid)) (nfl)->rootparentinode = 1; } while (0); |
859 | |
860 | STACK_WIND_COOKIE (frame, nfs_fop_setattr_cbk, xl, xl,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 861, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> setattr_cbk) tmp_cbk = nfs_fop_setattr_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->setattr" ; _new->unwind_to = "nfs_fop_setattr_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 ); xl->fops->setattr_cbk = nfs_fop_setattr_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->setattr); xl->fops->setattr (_new , xl, pathloc, buf, valid, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) |
861 | xl->fops->setattr, pathloc, buf, valid, 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", "nfs-fops.c", __FUNCTION__, 861, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> setattr_cbk) tmp_cbk = nfs_fop_setattr_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->setattr" ; _new->unwind_to = "nfs_fop_setattr_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 ); xl->fops->setattr_cbk = nfs_fop_setattr_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->setattr); xl->fops->setattr (_new , xl, pathloc, buf, valid, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
862 | ret = 0; |
863 | err: |
864 | if (ret < 0) { |
865 | if (frame) |
866 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
867 | } |
868 | |
869 | return ret; |
870 | } |
871 | |
872 | |
873 | int32_t |
874 | nfs_fop_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
875 | int32_t op_ret, int32_t op_errno, inode_t *inode, |
876 | struct iatt *buf, struct iatt *preparent, |
877 | struct iatt *postparent, dict_t *xdata) |
878 | { |
879 | struct nfs_fop_local *nfl = NULL((void*)0); |
880 | fop_mkdir_cbk_t progcbk = NULL((void*)0); |
881 | |
882 | if (op_ret == 0) { |
883 | nfs_fix_generation(this,inode); |
884 | } |
885 | |
886 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
887 | nfs_fop_restore_root_ino (nfl, op_ret, buf, NULL,preparent, postparent)do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (buf)) { ((struct iatt *)(buf))->ia_ino = 1; ((struct iatt *)(buf))->ia_dev = 0; } if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)) )->ia_dev = 0; } } else if ((nfl)->rootparentinode) { if ((preparent)) { ((struct iatt *)(preparent))->ia_ino = 1; ((struct iatt *)(preparent))->ia_dev = 0; } if ((postparent )) { ((struct iatt *)(postparent))->ia_ino = 1; ((struct iatt *)(postparent))->ia_dev = 0; } } } while (0); |
888 | if (progcbk) |
889 | progcbk (frame, cookie, this, op_ret, op_errno, inode, buf, |
890 | preparent, postparent, xdata); |
891 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
892 | return 0; |
893 | } |
894 | |
895 | |
896 | int |
897 | nfs_fop_mkdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, |
898 | mode_t mode, fop_mkdir_cbk_t cbk, void *local) |
899 | { |
900 | call_frame_t *frame = NULL((void*)0); |
901 | int ret = -EFAULT14; |
902 | struct nfs_fop_local *nfl = NULL((void*)0); |
903 | |
904 | if ((!nfsx) || (!xl) || (!pathloc) || (!nfu)) |
905 | return ret; |
906 | |
907 | gf_log (GF_NFS, GF_LOG_TRACE, "Mkdir: %s", pathloc->path)do { do { if (0) printf ("Mkdir: %s", pathloc->path); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 907, GF_LOG_TRACE , "Mkdir: %s", pathloc->path); } while (0); |
908 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 908, GF_LOG_ERROR ,"Frame creation failed"); } while (0); goto err; } } while ( 0); |
909 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 909, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
910 | nfs_fop_save_root_ino (nfl, pathloc)do { if (((pathloc)->inode) && __is_root_gfid ((pathloc )->inode->gfid)) (nfl)->rootinode = 1; else if (((pathloc )->parent) && __is_root_gfid ((pathloc)->parent ->gfid)) (nfl)->rootparentinode = 1; } while (0); |
911 | nfs_fop_gfid_setup (nfl, pathloc->inode, ret, err)do { if (nfl) { (nfl)->dictgfid = nfs_gfid_dict (pathloc-> inode); if (!((nfl)->dictgfid)) { ret = -14; goto err; } } } while (0); |
912 | |
913 | STACK_WIND_COOKIE (frame, nfs_fop_mkdir_cbk, xl, xl, xl->fops->mkdir,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 914, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> mkdir_cbk) tmp_cbk = nfs_fop_mkdir_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->mkdir"; _new ->unwind_to = "nfs_fop_mkdir_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 ); xl->fops->mkdir_cbk = nfs_fop_mkdir_cbk; old_THIS = ( *__glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin ( _new, xl->fops->mkdir); xl->fops->mkdir (_new, xl , pathloc, mode, 0, nfl->dictgfid); (*__glusterfs_this_location ()) = old_THIS; } while (0) |
914 | pathloc, mode, 0, nfl->dictgfid)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 914, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> mkdir_cbk) tmp_cbk = nfs_fop_mkdir_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->mkdir"; _new ->unwind_to = "nfs_fop_mkdir_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 ); xl->fops->mkdir_cbk = nfs_fop_mkdir_cbk; old_THIS = ( *__glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin ( _new, xl->fops->mkdir); xl->fops->mkdir (_new, xl , pathloc, mode, 0, nfl->dictgfid); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
915 | ret = 0; |
916 | err: |
917 | if (ret < 0) { |
918 | if (frame) |
919 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
920 | } |
921 | |
922 | return ret; |
923 | } |
924 | |
925 | |
926 | int32_t |
927 | nfs_fop_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
928 | int32_t op_ret, int32_t op_errno, inode_t *inode, |
929 | struct iatt *buf, struct iatt *preparent, |
930 | struct iatt *postparent, dict_t *xdata) |
931 | { |
932 | struct nfs_fop_local *nfl = NULL((void*)0); |
933 | fop_symlink_cbk_t progcbk = NULL((void*)0); |
934 | |
935 | if (op_ret == 0) { |
936 | nfs_fix_generation(this,inode); |
937 | } |
938 | |
939 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
940 | nfs_fop_restore_root_ino (nfl, op_ret,buf, NULL, preparent, postparent)do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (buf)) { ((struct iatt *)(buf))->ia_ino = 1; ((struct iatt *)(buf))->ia_dev = 0; } if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)) )->ia_dev = 0; } } else if ((nfl)->rootparentinode) { if ((preparent)) { ((struct iatt *)(preparent))->ia_ino = 1; ((struct iatt *)(preparent))->ia_dev = 0; } if ((postparent )) { ((struct iatt *)(postparent))->ia_ino = 1; ((struct iatt *)(postparent))->ia_dev = 0; } } } while (0); |
941 | if (progcbk) |
942 | progcbk (frame, cookie, this, op_ret, op_errno, inode, buf, |
943 | preparent, postparent, xdata); |
944 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
945 | return 0; |
946 | } |
947 | |
948 | int |
949 | nfs_fop_symlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target, |
950 | loc_t *pathloc, fop_symlink_cbk_t cbk, void *local) |
951 | { |
952 | call_frame_t *frame = NULL((void*)0); |
953 | int ret = -EFAULT14; |
954 | struct nfs_fop_local *nfl = NULL((void*)0); |
955 | |
956 | if ((!nfsx) || (!xl) || (!pathloc) || (!target) || (!nfu)) |
957 | return ret; |
958 | |
959 | gf_log (GF_NFS, GF_LOG_TRACE, "Symlink: %s", pathloc->path)do { do { if (0) printf ("Symlink: %s", pathloc->path); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 959, GF_LOG_TRACE , "Symlink: %s", pathloc->path); } while (0); |
960 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 960, GF_LOG_ERROR ,"Frame creation failed"); } while (0); goto err; } } while ( 0); |
961 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 961, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
962 | nfs_fop_save_root_ino (nfl, pathloc)do { if (((pathloc)->inode) && __is_root_gfid ((pathloc )->inode->gfid)) (nfl)->rootinode = 1; else if (((pathloc )->parent) && __is_root_gfid ((pathloc)->parent ->gfid)) (nfl)->rootparentinode = 1; } while (0); |
963 | nfs_fop_gfid_setup (nfl, pathloc->inode, ret, err)do { if (nfl) { (nfl)->dictgfid = nfs_gfid_dict (pathloc-> inode); if (!((nfl)->dictgfid)) { ret = -14; goto err; } } } while (0); |
964 | |
965 | STACK_WIND_COOKIE (frame, nfs_fop_symlink_cbk, xl, xl,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 967, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> symlink_cbk) tmp_cbk = nfs_fop_symlink_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->symlink" ; _new->unwind_to = "nfs_fop_symlink_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 ); xl->fops->symlink_cbk = nfs_fop_symlink_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->symlink); xl->fops->symlink (_new , xl, target, pathloc, 0, nfl->dictgfid); (*__glusterfs_this_location ()) = old_THIS; } while (0) |
966 | xl->fops->symlink, target, pathloc,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 967, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> symlink_cbk) tmp_cbk = nfs_fop_symlink_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->symlink" ; _new->unwind_to = "nfs_fop_symlink_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 ); xl->fops->symlink_cbk = nfs_fop_symlink_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->symlink); xl->fops->symlink (_new , xl, target, pathloc, 0, nfl->dictgfid); (*__glusterfs_this_location ()) = old_THIS; } while (0) |
967 | 0, nfl->dictgfid)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 967, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> symlink_cbk) tmp_cbk = nfs_fop_symlink_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->symlink" ; _new->unwind_to = "nfs_fop_symlink_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 ); xl->fops->symlink_cbk = nfs_fop_symlink_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->symlink); xl->fops->symlink (_new , xl, target, pathloc, 0, nfl->dictgfid); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
968 | ret = 0; |
969 | err: |
970 | if (ret < 0) { |
971 | if (frame) |
972 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
973 | } |
974 | |
975 | return ret; |
976 | } |
977 | |
978 | |
979 | int32_t |
980 | nfs_fop_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
981 | int32_t op_ret, int32_t op_errno, const char *path, |
982 | struct iatt *buf, dict_t *xdata) |
983 | { |
984 | struct nfs_fop_local *nfl = NULL((void*)0); |
985 | fop_readlink_cbk_t progcbk = NULL((void*)0); |
986 | |
987 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
988 | nfs_fop_restore_root_ino (nfl, op_ret, buf, NULL, NULL, NULL)do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (buf)) { ((struct iatt *)(buf))->ia_ino = 1; ((struct iatt *)(buf))->ia_dev = 0; } if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)) )->ia_dev = 0; } } else if ((nfl)->rootparentinode) { if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1 ; ((struct iatt *)(((void*)0)))->ia_dev = 0; } if ((((void *)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } } } while (0); |
989 | if (progcbk) |
990 | progcbk (frame, cookie, this, op_ret, op_errno, path, buf, |
991 | xdata); |
992 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
993 | return 0; |
994 | } |
995 | |
996 | |
997 | int |
998 | nfs_fop_readlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, |
999 | size_t size, fop_readlink_cbk_t cbk, void *local) |
1000 | { |
1001 | call_frame_t *frame = NULL((void*)0); |
1002 | int ret = -EFAULT14; |
1003 | struct nfs_fop_local *nfl = NULL((void*)0); |
1004 | |
1005 | if ((!nfsx) || (!xl) || (!pathloc) || (!nfu)) |
1006 | return ret; |
1007 | |
1008 | gf_log (GF_NFS, GF_LOG_TRACE, "Readlink: %s", pathloc->path)do { do { if (0) printf ("Readlink: %s", pathloc->path); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 1008, GF_LOG_TRACE, "Readlink: %s", pathloc->path); } while (0); |
1009 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 1009, GF_LOG_ERROR,"Frame creation failed"); } while (0); goto err ; } } while (0); |
1010 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 1010, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
1011 | nfs_fop_save_root_ino (nfl, pathloc)do { if (((pathloc)->inode) && __is_root_gfid ((pathloc )->inode->gfid)) (nfl)->rootinode = 1; else if (((pathloc )->parent) && __is_root_gfid ((pathloc)->parent ->gfid)) (nfl)->rootparentinode = 1; } while (0); |
1012 | |
1013 | STACK_WIND_COOKIE (frame, nfs_fop_readlink_cbk, xl, xl,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 1014, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> readlink_cbk) tmp_cbk = nfs_fop_readlink_cbk; _new->root = frame->root; _new->this = xl; _new->ret = (ret_fn_t ) tmp_cbk; _new->parent = frame; _new->cookie = xl; _new ->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->readlink" ; _new->unwind_to = "nfs_fop_readlink_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 ); xl->fops->readlink_cbk = nfs_fop_readlink_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->readlink); xl->fops->readlink ( _new, xl, pathloc, size, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) |
1014 | xl->fops->readlink, pathloc, size, 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", "nfs-fops.c", __FUNCTION__, 1014, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> readlink_cbk) tmp_cbk = nfs_fop_readlink_cbk; _new->root = frame->root; _new->this = xl; _new->ret = (ret_fn_t ) tmp_cbk; _new->parent = frame; _new->cookie = xl; _new ->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->readlink" ; _new->unwind_to = "nfs_fop_readlink_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 ); xl->fops->readlink_cbk = nfs_fop_readlink_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->readlink); xl->fops->readlink ( _new, xl, pathloc, size, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
1015 | ret = 0; |
1016 | err: |
1017 | if (ret < 0) { |
1018 | if (frame) |
1019 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1020 | } |
1021 | |
1022 | return ret; |
1023 | } |
1024 | |
1025 | |
1026 | int32_t |
1027 | nfs_fop_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1028 | int32_t op_ret, int32_t op_errno, inode_t *inode, |
1029 | struct iatt *buf, struct iatt *preparent, |
1030 | struct iatt *postparent, dict_t *xdata) |
1031 | { |
1032 | struct nfs_fop_local *nfl = NULL((void*)0); |
1033 | fop_mknod_cbk_t progcbk = NULL((void*)0); |
1034 | |
1035 | if (op_ret == 0) { |
1036 | nfs_fix_generation(this,inode); |
1037 | } |
1038 | |
1039 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
1040 | nfs_fop_restore_root_ino (nfl, op_ret,buf, NULL, preparent, postparent)do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (buf)) { ((struct iatt *)(buf))->ia_ino = 1; ((struct iatt *)(buf))->ia_dev = 0; } if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)) )->ia_dev = 0; } } else if ((nfl)->rootparentinode) { if ((preparent)) { ((struct iatt *)(preparent))->ia_ino = 1; ((struct iatt *)(preparent))->ia_dev = 0; } if ((postparent )) { ((struct iatt *)(postparent))->ia_ino = 1; ((struct iatt *)(postparent))->ia_dev = 0; } } } while (0); |
1041 | if (progcbk) |
1042 | progcbk (frame, cookie, this, op_ret, op_errno, inode, buf, |
1043 | preparent, postparent, xdata); |
1044 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1045 | return 0; |
1046 | } |
1047 | |
1048 | |
1049 | int |
1050 | nfs_fop_mknod (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, |
1051 | mode_t mode, dev_t dev, fop_mknod_cbk_t cbk, void *local) |
1052 | { |
1053 | call_frame_t *frame = NULL((void*)0); |
1054 | int ret = -EFAULT14; |
1055 | struct nfs_fop_local *nfl = NULL((void*)0); |
1056 | |
1057 | if ((!nfsx) || (!xl) || (!pathloc) || (!nfu)) |
1058 | return ret; |
1059 | |
1060 | gf_log (GF_NFS, GF_LOG_TRACE, "Mknod: %s", pathloc->path)do { do { if (0) printf ("Mknod: %s", pathloc->path); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 1060, GF_LOG_TRACE , "Mknod: %s", pathloc->path); } while (0); |
1061 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 1061, GF_LOG_ERROR,"Frame creation failed"); } while (0); goto err ; } } while (0); |
1062 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 1062, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
1063 | nfs_fop_save_root_ino (nfl, pathloc)do { if (((pathloc)->inode) && __is_root_gfid ((pathloc )->inode->gfid)) (nfl)->rootinode = 1; else if (((pathloc )->parent) && __is_root_gfid ((pathloc)->parent ->gfid)) (nfl)->rootparentinode = 1; } while (0); |
1064 | nfs_fop_gfid_setup (nfl, pathloc->inode, ret, err)do { if (nfl) { (nfl)->dictgfid = nfs_gfid_dict (pathloc-> inode); if (!((nfl)->dictgfid)) { ret = -14; goto err; } } } while (0); |
1065 | |
1066 | STACK_WIND_COOKIE (frame, nfs_fop_mknod_cbk, xl, xl, xl->fops->mknod,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 1067, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> mknod_cbk) tmp_cbk = nfs_fop_mknod_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->mknod"; _new ->unwind_to = "nfs_fop_mknod_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 ); xl->fops->mknod_cbk = nfs_fop_mknod_cbk; old_THIS = ( *__glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin ( _new, xl->fops->mknod); xl->fops->mknod (_new, xl , pathloc, mode, dev, 0, nfl->dictgfid); (*__glusterfs_this_location ()) = old_THIS; } while (0) |
1067 | pathloc, mode, dev, 0, nfl->dictgfid)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 1067, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> mknod_cbk) tmp_cbk = nfs_fop_mknod_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->mknod"; _new ->unwind_to = "nfs_fop_mknod_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 ); xl->fops->mknod_cbk = nfs_fop_mknod_cbk; old_THIS = ( *__glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin ( _new, xl->fops->mknod); xl->fops->mknod (_new, xl , pathloc, mode, dev, 0, nfl->dictgfid); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
1068 | ret = 0; |
1069 | err: |
1070 | if (ret < 0) { |
1071 | if (frame) |
1072 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1073 | } |
1074 | |
1075 | return ret; |
1076 | } |
1077 | |
1078 | int32_t |
1079 | nfs_fop_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1080 | int32_t op_ret, int32_t op_errno, struct iatt *preparent, |
1081 | struct iatt *postparent, dict_t *xdata) |
1082 | { |
1083 | struct nfs_fop_local *nfl = frame->local; |
1084 | fop_rmdir_cbk_t progcbk = NULL((void*)0); |
1085 | |
1086 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
1087 | nfs_fop_restore_root_ino (nfl, op_ret, NULL, NULL, preparent,do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } if ((((void* )0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } } else if ((nfl)-> rootparentinode) { if ((preparent)) { ((struct iatt *)(preparent ))->ia_ino = 1; ((struct iatt *)(preparent))->ia_dev = 0 ; } if ((postparent)) { ((struct iatt *)(postparent))->ia_ino = 1; ((struct iatt *)(postparent))->ia_dev = 0; } } } while (0) |
1088 | postparent)do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } if ((((void* )0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } } else if ((nfl)-> rootparentinode) { if ((preparent)) { ((struct iatt *)(preparent ))->ia_ino = 1; ((struct iatt *)(preparent))->ia_dev = 0 ; } if ((postparent)) { ((struct iatt *)(postparent))->ia_ino = 1; ((struct iatt *)(postparent))->ia_dev = 0; } } } while (0); |
1089 | if (progcbk) |
1090 | progcbk (frame, cookie, this, op_ret, op_errno, preparent, |
1091 | postparent, NULL((void*)0)); |
1092 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1093 | return 0; |
1094 | } |
1095 | |
1096 | |
1097 | |
1098 | int |
1099 | nfs_fop_rmdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, |
1100 | fop_rmdir_cbk_t cbk, void *local) |
1101 | { |
1102 | call_frame_t *frame = NULL((void*)0); |
1103 | int ret = -EFAULT14; |
1104 | struct nfs_fop_local *nfl = NULL((void*)0); |
1105 | |
1106 | if ((!nfsx) || (!xl) || (!pathloc) || (!nfu)) |
1107 | return ret; |
1108 | |
1109 | gf_log (GF_NFS, GF_LOG_TRACE, "Rmdir: %s", pathloc->path)do { do { if (0) printf ("Rmdir: %s", pathloc->path); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 1109, GF_LOG_TRACE , "Rmdir: %s", pathloc->path); } while (0); |
1110 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 1110, GF_LOG_ERROR,"Frame creation failed"); } while (0); goto err ; } } while (0); |
1111 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 1111, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
1112 | nfs_fop_save_root_ino (nfl, pathloc)do { if (((pathloc)->inode) && __is_root_gfid ((pathloc )->inode->gfid)) (nfl)->rootinode = 1; else if (((pathloc )->parent) && __is_root_gfid ((pathloc)->parent ->gfid)) (nfl)->rootparentinode = 1; } while (0); |
1113 | |
1114 | STACK_WIND_COOKIE (frame, nfs_fop_rmdir_cbk, xl, xl, xl->fops->rmdir,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 1115, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> rmdir_cbk) tmp_cbk = nfs_fop_rmdir_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->rmdir"; _new ->unwind_to = "nfs_fop_rmdir_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 ); xl->fops->rmdir_cbk = nfs_fop_rmdir_cbk; old_THIS = ( *__glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin ( _new, xl->fops->rmdir); xl->fops->rmdir (_new, xl , pathloc, 0, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0) |
1115 | pathloc, 0, 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", "nfs-fops.c", __FUNCTION__, 1115, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> rmdir_cbk) tmp_cbk = nfs_fop_rmdir_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->rmdir"; _new ->unwind_to = "nfs_fop_rmdir_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 ); xl->fops->rmdir_cbk = nfs_fop_rmdir_cbk; old_THIS = ( *__glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin ( _new, xl->fops->rmdir); xl->fops->rmdir (_new, xl , pathloc, 0, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); |
1116 | ret = 0; |
1117 | err: |
1118 | if (ret < 0) { |
1119 | if (frame) |
1120 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1121 | } |
1122 | |
1123 | return ret; |
1124 | |
1125 | } |
1126 | |
1127 | |
1128 | int32_t |
1129 | nfs_fop_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1130 | int32_t op_ret, int32_t op_errno, struct iatt *preparent, |
1131 | struct iatt *postparent, dict_t *xdata) |
1132 | { |
1133 | struct nfs_fop_local *nfl = frame->local; |
Value stored to 'nfl' during its initialization is never read | |
1134 | fop_unlink_cbk_t progcbk = NULL((void*)0); |
1135 | |
1136 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
1137 | nfs_fop_restore_root_ino (nfl, op_ret, NULL, NULL, preparent,do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } if ((((void* )0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } } else if ((nfl)-> rootparentinode) { if ((preparent)) { ((struct iatt *)(preparent ))->ia_ino = 1; ((struct iatt *)(preparent))->ia_dev = 0 ; } if ((postparent)) { ((struct iatt *)(postparent))->ia_ino = 1; ((struct iatt *)(postparent))->ia_dev = 0; } } } while (0) |
1138 | postparent)do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } if ((((void* )0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } } else if ((nfl)-> rootparentinode) { if ((preparent)) { ((struct iatt *)(preparent ))->ia_ino = 1; ((struct iatt *)(preparent))->ia_dev = 0 ; } if ((postparent)) { ((struct iatt *)(postparent))->ia_ino = 1; ((struct iatt *)(postparent))->ia_dev = 0; } } } while (0); |
1139 | if (progcbk) |
1140 | progcbk (frame, cookie, this, op_ret, op_errno, preparent, |
1141 | postparent, xdata); |
1142 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1143 | return 0; |
1144 | } |
1145 | |
1146 | |
1147 | int |
1148 | nfs_fop_unlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, |
1149 | fop_unlink_cbk_t cbk, void *local) |
1150 | { |
1151 | call_frame_t *frame = NULL((void*)0); |
1152 | int ret = -EFAULT14; |
1153 | struct nfs_fop_local *nfl = NULL((void*)0); |
1154 | |
1155 | if ((!nfsx) || (!xl) || (!pathloc) || (!nfu)) |
1156 | return ret; |
1157 | |
1158 | gf_log (GF_NFS, GF_LOG_TRACE, "Unlink: %s", pathloc->path)do { do { if (0) printf ("Unlink: %s", pathloc->path); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 1158, GF_LOG_TRACE , "Unlink: %s", pathloc->path); } while (0); |
1159 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 1159, GF_LOG_ERROR,"Frame creation failed"); } while (0); goto err ; } } while (0); |
1160 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 1160, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
1161 | nfs_fop_save_root_ino (nfl, pathloc)do { if (((pathloc)->inode) && __is_root_gfid ((pathloc )->inode->gfid)) (nfl)->rootinode = 1; else if (((pathloc )->parent) && __is_root_gfid ((pathloc)->parent ->gfid)) (nfl)->rootparentinode = 1; } while (0); |
1162 | |
1163 | STACK_WIND_COOKIE (frame, nfs_fop_unlink_cbk, xl, xl,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 1164, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> unlink_cbk) tmp_cbk = nfs_fop_unlink_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->unlink"; _new->unwind_to = "nfs_fop_unlink_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 ); xl->fops->unlink_cbk = nfs_fop_unlink_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location( )) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->unlink); xl->fops->unlink (_new , xl, pathloc, 0, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) |
1164 | xl->fops->unlink, pathloc, 0, 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", "nfs-fops.c", __FUNCTION__, 1164, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> unlink_cbk) tmp_cbk = nfs_fop_unlink_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->unlink"; _new->unwind_to = "nfs_fop_unlink_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 ); xl->fops->unlink_cbk = nfs_fop_unlink_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location( )) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->unlink); xl->fops->unlink (_new , xl, pathloc, 0, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); |
1165 | ret = 0; |
1166 | err: |
1167 | if (ret < 0) { |
1168 | if (frame) |
1169 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1170 | } |
1171 | |
1172 | return ret; |
1173 | |
1174 | } |
1175 | |
1176 | |
1177 | int32_t |
1178 | nfs_fop_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1179 | int32_t op_ret, int32_t op_errno, inode_t *inode, |
1180 | struct iatt *buf, struct iatt *preparent, |
1181 | struct iatt *postparent, dict_t *xdata) |
1182 | { |
1183 | struct nfs_fop_local *nfl = NULL((void*)0); |
1184 | fop_link_cbk_t progcbk = NULL((void*)0); |
1185 | |
1186 | if (op_ret == 0) { |
1187 | nfs_fix_generation(this,inode); |
1188 | } |
1189 | |
1190 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
1191 | nfs_fop_restore_root_ino (nfl, op_ret, buf, NULL, preparent,do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (buf)) { ((struct iatt *)(buf))->ia_ino = 1; ((struct iatt *)(buf))->ia_dev = 0; } if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)) )->ia_dev = 0; } } else if ((nfl)->rootparentinode) { if ((preparent)) { ((struct iatt *)(preparent))->ia_ino = 1; ((struct iatt *)(preparent))->ia_dev = 0; } if ((postparent )) { ((struct iatt *)(postparent))->ia_ino = 1; ((struct iatt *)(postparent))->ia_dev = 0; } } } while (0) |
1192 | postparent)do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (buf)) { ((struct iatt *)(buf))->ia_ino = 1; ((struct iatt *)(buf))->ia_dev = 0; } if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)) )->ia_dev = 0; } } else if ((nfl)->rootparentinode) { if ((preparent)) { ((struct iatt *)(preparent))->ia_ino = 1; ((struct iatt *)(preparent))->ia_dev = 0; } if ((postparent )) { ((struct iatt *)(postparent))->ia_ino = 1; ((struct iatt *)(postparent))->ia_dev = 0; } } } while (0); |
1193 | if (progcbk) |
1194 | progcbk (frame, cookie, this, op_ret, op_errno, inode, buf, |
1195 | preparent, postparent, xdata); |
1196 | |
1197 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1198 | return 0; |
1199 | } |
1200 | |
1201 | |
1202 | int |
1203 | nfs_fop_link (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, |
1204 | loc_t *newloc, fop_link_cbk_t cbk, void *local) |
1205 | { |
1206 | call_frame_t *frame = NULL((void*)0); |
1207 | int ret = -EFAULT14; |
1208 | struct nfs_fop_local *nfl = NULL((void*)0); |
1209 | |
1210 | if ((!nfsx) || (!xl) || (!oldloc) || (!newloc) || (!nfu)) |
1211 | return ret; |
1212 | |
1213 | gf_log (GF_NFS, GF_LOG_TRACE, "Link: %s -> %s", newloc->path,do { do { if (0) printf ("Link: %s -> %s", newloc->path , oldloc->path); } while (0); _gf_log ("nfs", "nfs-fops.c" , __FUNCTION__, 1214, GF_LOG_TRACE, "Link: %s -> %s", newloc ->path, oldloc->path); } while (0) |
1214 | oldloc->path)do { do { if (0) printf ("Link: %s -> %s", newloc->path , oldloc->path); } while (0); _gf_log ("nfs", "nfs-fops.c" , __FUNCTION__, 1214, GF_LOG_TRACE, "Link: %s -> %s", newloc ->path, oldloc->path); } while (0); |
1215 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 1215, GF_LOG_ERROR,"Frame creation failed"); } while (0); goto err ; } } while (0); |
1216 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 1216, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
1217 | nfs_fop_save_root_ino (nfl, newloc)do { if (((newloc)->inode) && __is_root_gfid ((newloc )->inode->gfid)) (nfl)->rootinode = 1; else if (((newloc )->parent) && __is_root_gfid ((newloc)->parent-> gfid)) (nfl)->rootparentinode = 1; } while (0); |
1218 | |
1219 | STACK_WIND_COOKIE (frame, nfs_fop_link_cbk, xl, xl, xl->fops->link,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 1220, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> link_cbk) tmp_cbk = nfs_fop_link_cbk; _new->root = frame-> root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new ->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->link"; _new ->unwind_to = "nfs_fop_link_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 ); xl->fops->link_cbk = nfs_fop_link_cbk; old_THIS = (* __glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new , xl->fops->link); xl->fops->link (_new, xl, oldloc , newloc, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0) |
1220 | oldloc, newloc, 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", "nfs-fops.c", __FUNCTION__, 1220, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> link_cbk) tmp_cbk = nfs_fop_link_cbk; _new->root = frame-> root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new ->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->link"; _new ->unwind_to = "nfs_fop_link_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 ); xl->fops->link_cbk = nfs_fop_link_cbk; old_THIS = (* __glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new , xl->fops->link); xl->fops->link (_new, xl, oldloc , newloc, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); |
1221 | ret = 0; |
1222 | err: |
1223 | if (ret < 0) { |
1224 | if (frame) |
1225 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1226 | } |
1227 | |
1228 | return ret; |
1229 | } |
1230 | |
1231 | |
1232 | int32_t |
1233 | nfs_fop_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1234 | int32_t op_ret, int32_t op_errno, struct iatt *buf, |
1235 | struct iatt *preoldparent, struct iatt *postoldparent, |
1236 | struct iatt *prenewparent, struct iatt *postnewparent, |
1237 | dict_t *xdata) |
1238 | { |
1239 | |
1240 | struct nfs_fop_local *nfl = NULL((void*)0); |
1241 | fop_rename_cbk_t progcbk = NULL((void*)0); |
1242 | |
1243 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
1244 | /* The preattr arg needs to be NULL instead of @buf because it is |
1245 | * possible that the new parent is not root whereas the source dir |
1246 | * could have been. That is handled in the next macro. |
1247 | */ |
1248 | nfs_fop_restore_root_ino (nfl, op_ret, NULL, NULL, preoldparent,do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } if ((((void* )0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } } else if ((nfl)-> rootparentinode) { if ((preoldparent)) { ((struct iatt *)(preoldparent ))->ia_ino = 1; ((struct iatt *)(preoldparent))->ia_dev = 0; } if ((postoldparent)) { ((struct iatt *)(postoldparent ))->ia_ino = 1; ((struct iatt *)(postoldparent))->ia_dev = 0; } } } while (0) |
1249 | postoldparent)do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } if ((((void* )0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } } else if ((nfl)-> rootparentinode) { if ((preoldparent)) { ((struct iatt *)(preoldparent ))->ia_ino = 1; ((struct iatt *)(preoldparent))->ia_dev = 0; } if ((postoldparent)) { ((struct iatt *)(postoldparent ))->ia_ino = 1; ((struct iatt *)(postoldparent))->ia_dev = 0; } } } while (0); |
1250 | nfs_fop_newloc_restore_root_ino (nfl, op_ret, buf, NULL, prenewparent,do { if (op_ret == -1) break; if ((nfl)->newrootinode) { if ((buf)) ((struct iatt *)(buf))->ia_ino = 1; if ((((void*) 0))) ((struct iatt *)(((void*)0)))->ia_ino = 1; } else if ( (nfl)->newrootparentinode) { if ((prenewparent)) ((struct iatt *)(prenewparent))->ia_ino = 1; if ((postnewparent)) ((struct iatt *)(postnewparent))->ia_ino = 1; } } while (0) |
1251 | postnewparent)do { if (op_ret == -1) break; if ((nfl)->newrootinode) { if ((buf)) ((struct iatt *)(buf))->ia_ino = 1; if ((((void*) 0))) ((struct iatt *)(((void*)0)))->ia_ino = 1; } else if ( (nfl)->newrootparentinode) { if ((prenewparent)) ((struct iatt *)(prenewparent))->ia_ino = 1; if ((postnewparent)) ((struct iatt *)(postnewparent))->ia_ino = 1; } } while (0); |
1252 | if (progcbk) |
1253 | progcbk (frame, cookie, this, op_ret, op_errno, buf, |
1254 | preoldparent, postoldparent, prenewparent, |
1255 | postnewparent, xdata); |
1256 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1257 | return 0; |
1258 | } |
1259 | |
1260 | |
1261 | int |
1262 | nfs_fop_rename (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, |
1263 | loc_t *newloc, fop_rename_cbk_t cbk, void *local) |
1264 | { |
1265 | call_frame_t *frame = NULL((void*)0); |
1266 | int ret = -EFAULT14; |
1267 | struct nfs_fop_local *nfl = NULL((void*)0); |
1268 | |
1269 | if ((!nfsx) || (!xl) || (!oldloc) || (!newloc) || (!nfu)) |
1270 | return ret; |
1271 | |
1272 | gf_log (GF_NFS, GF_LOG_TRACE, "Rename: %s -> %s", oldloc->path,do { do { if (0) printf ("Rename: %s -> %s", oldloc->path , newloc->path); } while (0); _gf_log ("nfs", "nfs-fops.c" , __FUNCTION__, 1273, GF_LOG_TRACE, "Rename: %s -> %s", oldloc ->path, newloc->path); } while (0) |
1273 | newloc->path)do { do { if (0) printf ("Rename: %s -> %s", oldloc->path , newloc->path); } while (0); _gf_log ("nfs", "nfs-fops.c" , __FUNCTION__, 1273, GF_LOG_TRACE, "Rename: %s -> %s", oldloc ->path, newloc->path); } while (0); |
1274 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 1274, GF_LOG_ERROR,"Frame creation failed"); } while (0); goto err ; } } while (0); |
1275 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 1275, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
1276 | nfs_fop_save_root_ino (nfl, oldloc)do { if (((oldloc)->inode) && __is_root_gfid ((oldloc )->inode->gfid)) (nfl)->rootinode = 1; else if (((oldloc )->parent) && __is_root_gfid ((oldloc)->parent-> gfid)) (nfl)->rootparentinode = 1; } while (0); |
1277 | nfs_fop_newloc_save_root_ino (nfl, newloc)do { if (((newloc)->inode) && __is_root_gfid ((newloc )->inode->gfid)) (nfl)->newrootinode = 1; else if (( (newloc)->parent) && __is_root_gfid ((newloc)-> parent->gfid)) (nfl)->newrootparentinode = 1; } while ( 0); |
1278 | |
1279 | STACK_WIND_COOKIE (frame, nfs_fop_rename_cbk, xl, xl,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 1280, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> rename_cbk) tmp_cbk = nfs_fop_rename_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->rename"; _new->unwind_to = "nfs_fop_rename_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 ); xl->fops->rename_cbk = nfs_fop_rename_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location( )) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->rename); xl->fops->rename (_new , xl, oldloc, newloc, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) |
1280 | xl->fops->rename, oldloc, newloc, 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", "nfs-fops.c", __FUNCTION__, 1280, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> rename_cbk) tmp_cbk = nfs_fop_rename_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->rename"; _new->unwind_to = "nfs_fop_rename_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 ); xl->fops->rename_cbk = nfs_fop_rename_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location( )) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->rename); xl->fops->rename (_new , xl, oldloc, newloc, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
1281 | ret = 0; |
1282 | err: |
1283 | if (ret < 0) { |
1284 | if (frame) |
1285 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1286 | } |
1287 | |
1288 | return ret; |
1289 | } |
1290 | |
1291 | |
1292 | int32_t |
1293 | nfs_fop_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1294 | int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) |
1295 | { |
1296 | struct nfs_fop_local *nfl = NULL((void*)0); |
1297 | fop_open_cbk_t progcbk = NULL((void*)0); |
1298 | |
1299 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
1300 | if (progcbk) |
1301 | progcbk (frame, cookie, this, op_ret, op_errno, fd, xdata); |
1302 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1303 | |
1304 | return 0; |
1305 | } |
1306 | |
1307 | int |
1308 | nfs_fop_open (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, |
1309 | int32_t flags, fd_t *fd, fop_open_cbk_t cbk, |
1310 | void *local) |
1311 | { |
1312 | call_frame_t *frame = NULL((void*)0); |
1313 | int ret = -EFAULT14; |
1314 | struct nfs_fop_local *nfl = NULL((void*)0); |
1315 | |
1316 | if ((!nfsx) || (!xl) || (!loc) || (!fd) || (!nfu)) |
1317 | return ret; |
1318 | |
1319 | gf_log (GF_NFS, GF_LOG_TRACE, "Open: %s", loc->path)do { do { if (0) printf ("Open: %s", loc->path); } while ( 0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 1319, GF_LOG_TRACE , "Open: %s", loc->path); } while (0); |
1320 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 1320, GF_LOG_ERROR,"Frame creation failed"); } while (0); goto err ; } } while (0); |
1321 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 1321, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
1322 | |
1323 | STACK_WIND_COOKIE (frame, nfs_fop_open_cbk, xl, xl, xl->fops->open,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 1324, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> open_cbk) tmp_cbk = nfs_fop_open_cbk; _new->root = frame-> root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new ->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->open"; _new ->unwind_to = "nfs_fop_open_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 ); xl->fops->open_cbk = nfs_fop_open_cbk; old_THIS = (* __glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new , xl->fops->open); xl->fops->open (_new, xl, loc, flags, fd, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0) |
1324 | loc, flags, fd, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 1324, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> open_cbk) tmp_cbk = nfs_fop_open_cbk; _new->root = frame-> root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new ->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->open"; _new ->unwind_to = "nfs_fop_open_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 ); xl->fops->open_cbk = nfs_fop_open_cbk; old_THIS = (* __glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new , xl->fops->open); xl->fops->open (_new, xl, loc, flags, fd, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); |
1325 | ret = 0; |
1326 | err: |
1327 | if (ret < 0) { |
1328 | if (frame) |
1329 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1330 | } |
1331 | |
1332 | return ret; |
1333 | } |
1334 | |
1335 | |
1336 | int32_t |
1337 | nfs_fop_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1338 | int32_t op_ret, int32_t op_errno, struct iatt *prebuf, |
1339 | struct iatt *postbuf, dict_t *xdata) |
1340 | { |
1341 | struct nfs_fop_local *nfl = NULL((void*)0); |
1342 | fop_writev_cbk_t progcbk = NULL((void*)0); |
1343 | |
1344 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
1345 | nfs_fop_restore_root_ino (nfl, op_ret, prebuf, postbuf, NULL, NULL)do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (prebuf)) { ((struct iatt *)(prebuf))->ia_ino = 1; ((struct iatt *)(prebuf))->ia_dev = 0; } if ((postbuf)) { ((struct iatt *)(postbuf))->ia_ino = 1; ((struct iatt *)(postbuf)) ->ia_dev = 0; } } else if ((nfl)->rootparentinode) { if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1 ; ((struct iatt *)(((void*)0)))->ia_dev = 0; } if ((((void *)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } } } while (0); |
1346 | if (progcbk) |
1347 | progcbk (frame, cookie, this, op_ret, op_errno, prebuf, |
1348 | postbuf, xdata); |
1349 | |
1350 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1351 | |
1352 | return 0; |
1353 | } |
1354 | |
1355 | |
1356 | int |
1357 | nfs_fop_write (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, |
1358 | struct iobref *srciobref, struct iovec *vector, int32_t count, |
1359 | off_t offset, fop_writev_cbk_t cbk, void *local) |
1360 | { |
1361 | call_frame_t *frame = NULL((void*)0); |
1362 | int ret = -EFAULT14; |
1363 | struct nfs_fop_local *nfl = NULL((void*)0); |
1364 | |
1365 | if ((!nfsx) || (!xl) || (!fd) || (!vector) || (!nfu) || (!srciobref)) |
1366 | return ret; |
1367 | |
1368 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 1368, GF_LOG_ERROR,"Frame creation failed"); } while (0); goto err ; } } while (0); |
1369 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 1369, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
1370 | nfs_fop_save_root_fd_ino (nfl, fd)do { if (__is_root_gfid ((fd)->inode->gfid)) (nfl)-> rootinode = 1; } while (0); |
1371 | /* |
1372 | nfl->iobref = iobref_new (); |
1373 | if (!nfl->iobref) { |
1374 | gf_log (GF_NFS, GF_LOG_ERROR, "iobref creation failed"); |
1375 | ret = -ENOMEM; |
1376 | goto err; |
1377 | } |
1378 | |
1379 | iobref_add (nfl->iobref, srciob); |
1380 | */ |
1381 | STACK_WIND_COOKIE (frame, nfs_fop_writev_cbk, xl, xl,xl->fops->writev,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 1382, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof(xl->fops-> writev_cbk) tmp_cbk = nfs_fop_writev_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->writev"; _new->unwind_to = "nfs_fop_writev_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 ); xl->fops->writev_cbk = nfs_fop_writev_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location( )) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->writev); xl->fops->writev (_new , xl, fd, vector, count, offset, fd->flags, srciobref, ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) |
1382 | fd, vector, count, offset, fd->flags, srciobref, 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", "nfs-fops.c", __FUNCTION__, 1382, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof(xl->fops-> writev_cbk) tmp_cbk = nfs_fop_writev_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->writev"; _new->unwind_to = "nfs_fop_writev_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 ); xl->fops->writev_cbk = nfs_fop_writev_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location( )) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->writev); xl->fops->writev (_new , xl, fd, vector, count, offset, fd->flags, srciobref, ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); |
1383 | ret = 0; |
1384 | err: |
1385 | if (ret < 0) { |
1386 | if (frame) |
1387 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1388 | } |
1389 | |
1390 | return ret; |
1391 | } |
1392 | |
1393 | |
1394 | int32_t |
1395 | nfs_fop_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1396 | int32_t op_ret, int32_t op_errno, struct iatt *prebuf, |
1397 | struct iatt *postbuf, dict_t *xdata) |
1398 | { |
1399 | struct nfs_fop_local *nfl = NULL((void*)0); |
1400 | fop_fsync_cbk_t progcbk = NULL((void*)0); |
1401 | |
1402 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
1403 | nfs_fop_restore_root_ino (nfl, op_ret, prebuf, postbuf, NULL, NULL)do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (prebuf)) { ((struct iatt *)(prebuf))->ia_ino = 1; ((struct iatt *)(prebuf))->ia_dev = 0; } if ((postbuf)) { ((struct iatt *)(postbuf))->ia_ino = 1; ((struct iatt *)(postbuf)) ->ia_dev = 0; } } else if ((nfl)->rootparentinode) { if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1 ; ((struct iatt *)(((void*)0)))->ia_dev = 0; } if ((((void *)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } } } while (0); |
1404 | if (progcbk) |
1405 | progcbk (frame, cookie, this, op_ret, op_errno, prebuf, |
1406 | postbuf, xdata); |
1407 | |
1408 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1409 | return 0; |
1410 | } |
1411 | |
1412 | |
1413 | |
1414 | int |
1415 | nfs_fop_fsync (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, |
1416 | int32_t datasync, fop_fsync_cbk_t cbk, void *local) |
1417 | { |
1418 | call_frame_t *frame = NULL((void*)0); |
1419 | int ret = -EFAULT14; |
1420 | struct nfs_fop_local *nfl = NULL((void*)0); |
1421 | |
1422 | if ((!nfsx) || (!xl) || (!fd)) |
1423 | return ret; |
1424 | |
1425 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 1425, GF_LOG_ERROR,"Frame creation failed"); } while (0); goto err ; } } while (0); |
1426 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 1426, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
1427 | nfs_fop_save_root_fd_ino (nfl, fd)do { if (__is_root_gfid ((fd)->inode->gfid)) (nfl)-> rootinode = 1; } while (0); |
1428 | |
1429 | STACK_WIND_COOKIE (frame, nfs_fop_fsync_cbk, xl, xl,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 1430, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> fsync_cbk) tmp_cbk = nfs_fop_fsync_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->fsync"; _new ->unwind_to = "nfs_fop_fsync_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 ); xl->fops->fsync_cbk = nfs_fop_fsync_cbk; old_THIS = ( *__glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin ( _new, xl->fops->fsync); xl->fops->fsync (_new, xl , fd, datasync, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) |
1430 | xl->fops->fsync, fd, datasync, 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", "nfs-fops.c", __FUNCTION__, 1430, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> fsync_cbk) tmp_cbk = nfs_fop_fsync_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->fsync"; _new ->unwind_to = "nfs_fop_fsync_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 ); xl->fops->fsync_cbk = nfs_fop_fsync_cbk; old_THIS = ( *__glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin ( _new, xl->fops->fsync); xl->fops->fsync (_new, xl , fd, datasync, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); |
1431 | ret = 0; |
1432 | err: |
1433 | if (ret < 0) { |
1434 | if (frame) |
1435 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1436 | } |
1437 | |
1438 | return ret; |
1439 | } |
1440 | |
1441 | |
1442 | int32_t |
1443 | nfs_fop_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1444 | int32_t op_ret, int32_t op_errno, struct iovec *vector, |
1445 | int32_t count, struct iatt *stbuf, struct iobref *iobref, |
1446 | dict_t *xdata) |
1447 | { |
1448 | struct nfs_fop_local *nfl = NULL((void*)0); |
1449 | fop_readv_cbk_t progcbk = NULL((void*)0); |
1450 | |
1451 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
1452 | nfs_fop_restore_root_ino (nfl, op_ret, stbuf, NULL, NULL, NULL)do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (stbuf)) { ((struct iatt *)(stbuf))->ia_ino = 1; ((struct iatt *)(stbuf))->ia_dev = 0; } if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)) )->ia_dev = 0; } } else if ((nfl)->rootparentinode) { if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1 ; ((struct iatt *)(((void*)0)))->ia_dev = 0; } if ((((void *)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } } } while (0); |
1453 | if (progcbk) |
1454 | progcbk (frame, cookie, this, op_ret, op_errno, vector, count, |
1455 | stbuf, iobref, xdata); |
1456 | |
1457 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1458 | return 0; |
1459 | } |
1460 | |
1461 | |
1462 | int |
1463 | nfs_fop_read (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, |
1464 | size_t size, off_t offset, fop_readv_cbk_t cbk, void *local) |
1465 | { |
1466 | call_frame_t *frame = NULL((void*)0); |
1467 | int ret = -EFAULT14; |
1468 | struct nfs_fop_local *nfl = NULL((void*)0); |
1469 | |
1470 | if ((!xl) || (!fd) || (!nfu)) |
1471 | return ret; |
1472 | |
1473 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 1473, GF_LOG_ERROR,"Frame creation failed"); } while (0); goto err ; } } while (0); |
1474 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 1474, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
1475 | nfs_fop_save_root_fd_ino (nfl, fd)do { if (__is_root_gfid ((fd)->inode->gfid)) (nfl)-> rootinode = 1; } while (0); |
1476 | |
1477 | STACK_WIND_COOKIE (frame, nfs_fop_readv_cbk, xl, xl, xl->fops->readv,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 1478, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> readv_cbk) tmp_cbk = nfs_fop_readv_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->readv"; _new ->unwind_to = "nfs_fop_readv_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 ); xl->fops->readv_cbk = nfs_fop_readv_cbk; old_THIS = ( *__glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin ( _new, xl->fops->readv); xl->fops->readv (_new, xl , fd, size, offset, 0, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) |
1478 | fd, size, offset, 0, 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", "nfs-fops.c", __FUNCTION__, 1478, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> readv_cbk) tmp_cbk = nfs_fop_readv_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->readv"; _new ->unwind_to = "nfs_fop_readv_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 ); xl->fops->readv_cbk = nfs_fop_readv_cbk; old_THIS = ( *__glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency) gf_latency_begin ( _new, xl->fops->readv); xl->fops->readv (_new, xl , fd, size, offset, 0, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
1479 | ret = 0; |
1480 | err: |
1481 | if (ret < 0) { |
1482 | if (frame) |
1483 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1484 | } |
1485 | |
1486 | return ret; |
1487 | } |
1488 | |
1489 | int32_t |
1490 | nfs_fop_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1491 | int32_t op_ret, int32_t op_errno, struct gf_flock *flock, |
1492 | dict_t *xdata) |
1493 | { |
1494 | struct nfs_fop_local *nfl = NULL((void*)0); |
1495 | fop_lk_cbk_t progcbk = NULL((void*)0); |
1496 | |
1497 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
1498 | |
1499 | if (!op_ret) |
1500 | fd_lk_insert_and_merge (nfl->fd, nfl->cmd, &nfl->flock); |
1501 | |
1502 | fd_unref (nfl->fd); |
1503 | |
1504 | if (progcbk) |
1505 | progcbk (frame, cookie, this, op_ret, op_errno, flock, xdata); |
1506 | |
1507 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1508 | return 0; |
1509 | } |
1510 | |
1511 | |
1512 | int |
1513 | nfs_fop_lk (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, |
1514 | int cmd, struct gf_flock *flock, fop_lk_cbk_t cbk, void *local) |
1515 | { |
1516 | call_frame_t *frame = NULL((void*)0); |
1517 | int ret = -EFAULT14; |
1518 | struct nfs_fop_local *nfl = NULL((void*)0); |
1519 | |
1520 | if ((!xl) || (!fd) || (!nfu)) |
1521 | return ret; |
1522 | |
1523 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 1523, GF_LOG_ERROR,"Frame creation failed"); } while (0); goto err ; } } while (0); |
1524 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 1524, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
1525 | |
1526 | nfl->cmd = cmd; |
1527 | nfl->fd = fd_ref (fd); |
1528 | nfl->flock = *flock; |
1529 | |
1530 | STACK_WIND_COOKIE (frame, nfs_fop_lk_cbk, xl, xl, xl->fops->lk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 1531, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> lk_cbk) tmp_cbk = nfs_fop_lk_cbk; _new->root = frame->root ; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new ->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->lk"; _new ->unwind_to = "nfs_fop_lk_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); xl->fops->lk_cbk = nfs_fop_lk_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency ) gf_latency_begin (_new, xl->fops->lk); xl->fops-> lk (_new, xl, fd, cmd, flock, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) |
1531 | fd, cmd, flock, 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", "nfs-fops.c", __FUNCTION__, 1531, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> lk_cbk) tmp_cbk = nfs_fop_lk_cbk; _new->root = frame->root ; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new ->parent = frame; _new->cookie = xl; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->lk"; _new ->unwind_to = "nfs_fop_lk_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); xl->fops->lk_cbk = nfs_fop_lk_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location()) = xl; if (xl->ctx->measure_latency ) gf_latency_begin (_new, xl->fops->lk); xl->fops-> lk (_new, xl, fd, cmd, flock, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
1532 | ret = 0; |
1533 | err: |
1534 | if (ret < 0) { |
1535 | if (frame) |
1536 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1537 | } |
1538 | |
1539 | return ret; |
1540 | } |
1541 | |
1542 | int32_t |
1543 | nfs_fop_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1544 | int32_t op_ret, int32_t op_errno, dict_t *dict, |
1545 | dict_t *xdata) |
1546 | { |
1547 | struct nfs_fop_local *nfl = NULL((void*)0); |
1548 | fop_getxattr_cbk_t progcbk = NULL((void*)0); |
1549 | |
1550 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
1551 | |
1552 | if (progcbk) |
1553 | progcbk (frame, cookie, this, op_ret, op_errno, dict, xdata); |
1554 | |
1555 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1556 | return 0; |
1557 | } |
1558 | |
1559 | |
1560 | int |
1561 | nfs_fop_getxattr (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, |
1562 | char *name, dict_t *xdata, fop_getxattr_cbk_t cbk, void *local) |
1563 | { |
1564 | call_frame_t *frame = NULL((void*)0); |
1565 | int ret = -EFAULT14; |
1566 | struct nfs_fop_local *nfl = NULL((void*)0); |
1567 | |
1568 | if ((!xl) || (!loc) || (!nfu)) |
1569 | return ret; |
1570 | |
1571 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 1571, GF_LOG_ERROR,"Frame creation failed"); } while (0); goto err ; } } while (0); |
1572 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 1572, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
1573 | |
1574 | STACK_WIND_COOKIE (frame, nfs_fop_getxattr_cbk, xl, xl, xl->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", "nfs-fops.c", __FUNCTION__, 1575, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> getxattr_cbk) tmp_cbk = nfs_fop_getxattr_cbk; _new->root = frame->root; _new->this = xl; _new->ret = (ret_fn_t ) tmp_cbk; _new->parent = frame; _new->cookie = xl; _new ->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->getxattr" ; _new->unwind_to = "nfs_fop_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 ); xl->fops->getxattr_cbk = nfs_fop_getxattr_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->getxattr); xl->fops->getxattr ( _new, xl, loc, name, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) |
1575 | loc, name, 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", "nfs-fops.c", __FUNCTION__, 1575, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> getxattr_cbk) tmp_cbk = nfs_fop_getxattr_cbk; _new->root = frame->root; _new->this = xl; _new->ret = (ret_fn_t ) tmp_cbk; _new->parent = frame; _new->cookie = xl; _new ->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->getxattr" ; _new->unwind_to = "nfs_fop_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 ); xl->fops->getxattr_cbk = nfs_fop_getxattr_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->getxattr); xl->fops->getxattr ( _new, xl, loc, name, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
1576 | ret = 0; |
1577 | err: |
1578 | if (ret < 0) { |
1579 | if (frame) |
1580 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1581 | } |
1582 | |
1583 | return ret; |
1584 | } |
1585 | |
1586 | |
1587 | int32_t |
1588 | nfs_fop_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1589 | int32_t op_ret, int32_t op_errno, dict_t *xdata) |
1590 | { |
1591 | struct nfs_fop_local *nfl = NULL((void*)0); |
1592 | fop_setxattr_cbk_t progcbk = NULL((void*)0); |
1593 | |
1594 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
1595 | |
1596 | if (progcbk) |
1597 | progcbk (frame, cookie, this, op_ret, op_errno, xdata); |
1598 | |
1599 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1600 | return 0; |
1601 | } |
1602 | |
1603 | |
1604 | int |
1605 | nfs_fop_setxattr (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, |
1606 | loc_t *loc, dict_t *dict, int32_t flags, dict_t *xdata, |
1607 | fop_setxattr_cbk_t cbk, void *local) |
1608 | { |
1609 | call_frame_t *frame = NULL((void*)0); |
1610 | int ret = -EFAULT14; |
1611 | struct nfs_fop_local *nfl = NULL((void*)0); |
1612 | |
1613 | if ((!xl) || (!loc) || (!nfu)) |
1614 | return ret; |
1615 | |
1616 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 1616, GF_LOG_ERROR,"Frame creation failed"); } while (0); goto err ; } } while (0); |
1617 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 1617, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
1618 | |
1619 | STACK_WIND_COOKIE (frame, nfs_fop_setxattr_cbk, xl, xl, xl->fops->setxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 1620, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> setxattr_cbk) tmp_cbk = nfs_fop_setxattr_cbk; _new->root = frame->root; _new->this = xl; _new->ret = (ret_fn_t ) tmp_cbk; _new->parent = frame; _new->cookie = xl; _new ->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->setxattr" ; _new->unwind_to = "nfs_fop_setxattr_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 ); xl->fops->setxattr_cbk = nfs_fop_setxattr_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->setxattr); xl->fops->setxattr ( _new, xl, loc, dict, flags, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) |
1620 | 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", "nfs-fops.c", __FUNCTION__, 1620, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> setxattr_cbk) tmp_cbk = nfs_fop_setxattr_cbk; _new->root = frame->root; _new->this = xl; _new->ret = (ret_fn_t ) tmp_cbk; _new->parent = frame; _new->cookie = xl; _new ->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->setxattr" ; _new->unwind_to = "nfs_fop_setxattr_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 ); xl->fops->setxattr_cbk = nfs_fop_setxattr_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->setxattr); xl->fops->setxattr ( _new, xl, loc, dict, flags, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
1621 | ret = 0; |
1622 | err: |
1623 | if (ret < 0) { |
1624 | if (frame) |
1625 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1626 | } |
1627 | |
1628 | return ret; |
1629 | } |
1630 | |
1631 | |
1632 | int32_t |
1633 | nfs_fop_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1634 | int32_t op_ret, int32_t op_errno, struct iatt *prebuf, |
1635 | struct iatt *postbuf, dict_t *xdata) |
1636 | { |
1637 | struct nfs_fop_local *nfl = NULL((void*)0); |
1638 | fop_truncate_cbk_t progcbk = NULL((void*)0); |
1639 | |
1640 | nfl_to_prog_data (nfl, progcbk, frame)do { nfl = frame->local; frame->local = nfl->proglocal ; progcbk = nfl->progcbk; } while (0); |
1641 | nfs_fop_restore_root_ino (nfl, op_ret, prebuf, postbuf, NULL, NULL)do { if (op_ret == -1) break; if ((nfl)->rootinode) { if ( (prebuf)) { ((struct iatt *)(prebuf))->ia_ino = 1; ((struct iatt *)(prebuf))->ia_dev = 0; } if ((postbuf)) { ((struct iatt *)(postbuf))->ia_ino = 1; ((struct iatt *)(postbuf)) ->ia_dev = 0; } } else if ((nfl)->rootparentinode) { if ((((void*)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1 ; ((struct iatt *)(((void*)0)))->ia_dev = 0; } if ((((void *)0))) { ((struct iatt *)(((void*)0)))->ia_ino = 1; ((struct iatt *)(((void*)0)))->ia_dev = 0; } } } while (0); |
1642 | if (progcbk) |
1643 | progcbk (frame, cookie, this, op_ret, op_errno, prebuf, |
1644 | postbuf, xdata); |
1645 | |
1646 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1647 | return 0; |
1648 | } |
1649 | |
1650 | |
1651 | int |
1652 | nfs_fop_truncate (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, |
1653 | off_t offset, fop_truncate_cbk_t cbk, void *local) |
1654 | { |
1655 | call_frame_t *frame = NULL((void*)0); |
1656 | int ret = -EFAULT14; |
1657 | struct nfs_fop_local *nfl = NULL((void*)0); |
1658 | |
1659 | if ((!nfsx) || (!xl) || (!loc) || (!nfu)) |
1660 | return ret; |
1661 | |
1662 | nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err)do { frame = nfs_create_frame (nfsx, (nfu)); if (!frame) { ret = (-12); do { do { if (0) printf ("Frame creation failed"); } while (0); _gf_log ("nfs", "nfs-fops.c", __FUNCTION__, 1662, GF_LOG_ERROR,"Frame creation failed"); } while (0); goto err ; } } while (0); |
1663 | nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err)do { do { nfl = nfs_fop_local_init (nfsx); if (nfl) { nfl-> proglocal = local; nfl->progcbk = *((void **) ((void *) & cbk)); nfl->nfsx = nfsx; if (frame) ((call_frame_t *)frame )->local = nfl; } } while (0); if (!nfl) { do { do { if (0 ) printf ("Failed to init local"); } while (0); _gf_log ("nfs" , "nfs-fops.c", __FUNCTION__, 1663, GF_LOG_ERROR,"Failed to init local" ); } while (0); ret = -12; goto err; } } while (0); |
1664 | nfs_fop_save_root_ino (nfl, loc)do { if (((loc)->inode) && __is_root_gfid ((loc)-> inode->gfid)) (nfl)->rootinode = 1; else if (((loc)-> parent) && __is_root_gfid ((loc)->parent->gfid) ) (nfl)->rootparentinode = 1; } while (0); |
1665 | |
1666 | STACK_WIND_COOKIE (frame, nfs_fop_truncate_cbk, xl, xl,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 1667, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> truncate_cbk) tmp_cbk = nfs_fop_truncate_cbk; _new->root = frame->root; _new->this = xl; _new->ret = (ret_fn_t ) tmp_cbk; _new->parent = frame; _new->cookie = xl; _new ->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->truncate" ; _new->unwind_to = "nfs_fop_truncate_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 ); xl->fops->truncate_cbk = nfs_fop_truncate_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->truncate); xl->fops->truncate ( _new, xl, loc, offset, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) |
1667 | xl->fops->truncate, loc, offset, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "nfs-fops.c", __FUNCTION__, 1667, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> truncate_cbk) tmp_cbk = nfs_fop_truncate_cbk; _new->root = frame->root; _new->this = xl; _new->ret = (ret_fn_t ) tmp_cbk; _new->parent = frame; _new->cookie = xl; _new ->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->truncate" ; _new->unwind_to = "nfs_fop_truncate_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 ); xl->fops->truncate_cbk = nfs_fop_truncate_cbk; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = xl; if (xl->ctx->measure_latency) gf_latency_begin (_new, xl->fops->truncate); xl->fops->truncate ( _new, xl, loc, offset, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
1668 | |
1669 | ret = 0; |
1670 | err: |
1671 | if (ret < 0) { |
1672 | if (frame) |
1673 | nfs_stack_destroy (nfl, frame)do { nfs_fop_local_wipe ((nfl)->nfsx, nfl); (frame)->local = ((void*)0); STACK_DESTROY ((frame)->root); } while (0); |
1674 | } |
1675 | |
1676 | return ret; |
1677 | } |