File: | fuse-bridge.c |
Location: | line 103, column 9 |
Description: | Value stored to 'ret' is never read |
1 | /* |
2 | Copyright (c) 2006-2012 Red Hat, Inc. <http://www.redhat.com> |
3 | This file is part of GlusterFS. |
4 | |
5 | This file is licensed to you under your choice of the GNU Lesser |
6 | General Public License, version 3 or any later version (LGPLv3 or |
7 | later), or the GNU General Public License, version 2 (GPLv2), in all |
8 | cases as published by the Free Software Foundation. |
9 | */ |
10 | |
11 | #include <sys/wait.h> |
12 | #include "fuse-bridge.h" |
13 | #include "mount-gluster-compat.h" |
14 | #include "glusterfs.h" |
15 | #include "glusterfs-acl.h" |
16 | |
17 | #ifdef __NetBSD__ |
18 | #undef open /* in perfuse.h, pulled from mount-gluster-compat.h */ |
19 | #endif |
20 | |
21 | static int gf_fuse_conn_err_log; |
22 | static int gf_fuse_xattr_enotsup_log; |
23 | |
24 | void fini (xlator_t *this_xl); |
25 | |
26 | static void fuse_invalidate_inode(xlator_t *this, uint64_t fuse_ino); |
27 | |
28 | /* |
29 | * Send an invalidate notification up to fuse to purge the file from local |
30 | * page cache. |
31 | */ |
32 | static int32_t |
33 | fuse_invalidate(xlator_t *this, inode_t *inode) |
34 | { |
35 | fuse_private_t *priv = this->private; |
36 | uint64_t nodeid; |
37 | |
38 | /* |
39 | * NOTE: We only invalidate at the moment if fopen_keep_cache is |
40 | * enabled because otherwise this is a departure from default |
41 | * behavior. Specifically, the performance/write-behind xlator |
42 | * causes unconditional invalidations on write requests. |
43 | */ |
44 | if (!priv->fopen_keep_cache) |
45 | return 0; |
46 | |
47 | nodeid = inode_to_fuse_nodeid(inode); |
48 | gf_log(this->name, GF_LOG_DEBUG, "Invalidate inode id %lu.", nodeid)do { do { if (0) printf ("Invalidate inode id %lu.", nodeid); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__ , 48, GF_LOG_DEBUG, "Invalidate inode id %lu.", nodeid); } while (0); |
49 | fuse_log_eh (this, "Sending invalidate inode id: %lu gfid: %s", nodeid,do { if (this->history) do { do { if (0) printf ("Sending invalidate inode id: %lu gfid: %s" , nodeid, uuid_utoa (inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"Sending invalidate inode id: %lu gfid: %s", nodeid , uuid_utoa (inode->gfid)); } while (0); } while (0) |
50 | uuid_utoa (inode->gfid))do { if (this->history) do { do { if (0) printf ("Sending invalidate inode id: %lu gfid: %s" , nodeid, uuid_utoa (inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"Sending invalidate inode id: %lu gfid: %s", nodeid , uuid_utoa (inode->gfid)); } while (0); } while (0); |
51 | fuse_invalidate_inode(this, nodeid); |
52 | |
53 | return 0; |
54 | } |
55 | |
56 | static int32_t |
57 | fuse_forget_cbk (xlator_t *this, inode_t *inode) |
58 | { |
59 | //Nothing to free in inode ctx, hence return. |
60 | return 0; |
61 | } |
62 | |
63 | void |
64 | fuse_inode_set_need_lookup (inode_t *inode, xlator_t *this) |
65 | { |
66 | uint64_t need_lookup = 1; |
67 | |
68 | if (!inode || !this) |
69 | return; |
70 | |
71 | inode_ctx_set (inode, this, &need_lookup)inode_ctx_set0(inode,this,&need_lookup); |
72 | |
73 | return; |
74 | } |
75 | |
76 | |
77 | gf_boolean_t |
78 | fuse_inode_needs_lookup (inode_t *inode, xlator_t *this) |
79 | { |
80 | uint64_t need_lookup = 0; |
81 | gf_boolean_t ret = _gf_false; |
82 | |
83 | if (!inode || !this) |
84 | return ret; |
85 | |
86 | inode_ctx_get (inode, this, &need_lookup)inode_ctx_get0(inode,this,&need_lookup); |
87 | if (need_lookup) |
88 | ret = _gf_true; |
89 | need_lookup = 0; |
90 | inode_ctx_set (inode, this, &need_lookup)inode_ctx_set0(inode,this,&need_lookup); |
91 | |
92 | return ret; |
93 | } |
94 | |
95 | |
96 | fuse_fd_ctx_t * |
97 | __fuse_fd_ctx_check_n_create (xlator_t *this, fd_t *fd) |
98 | { |
99 | uint64_t val = 0; |
100 | int32_t ret = 0; |
101 | fuse_fd_ctx_t *fd_ctx = NULL((void*)0); |
102 | |
103 | ret = __fd_ctx_get (fd, this, &val); |
Value stored to 'ret' is never read | |
104 | |
105 | fd_ctx = (fuse_fd_ctx_t *)(unsigned long) val; |
106 | |
107 | if (fd_ctx == NULL((void*)0)) { |
108 | fd_ctx = GF_CALLOC (1, sizeof (*fd_ctx),__gf_calloc (1, sizeof (*fd_ctx), gf_fuse_mt_fd_ctx_t) |
109 | gf_fuse_mt_fd_ctx_t)__gf_calloc (1, sizeof (*fd_ctx), gf_fuse_mt_fd_ctx_t); |
110 | if (!fd_ctx) { |
111 | goto out; |
112 | } |
113 | ret = __fd_ctx_set (fd, this, |
114 | (uint64_t)(unsigned long)fd_ctx); |
115 | if (ret < 0) { |
116 | gf_log ("glusterfs-fuse", GF_LOG_DEBUG,do { do { if (0) printf ("fd-ctx-set failed"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 117, GF_LOG_DEBUG , "fd-ctx-set failed"); } while (0) |
117 | "fd-ctx-set failed")do { do { if (0) printf ("fd-ctx-set failed"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 117, GF_LOG_DEBUG , "fd-ctx-set failed"); } while (0); |
118 | GF_FREE (fd_ctx)__gf_free (fd_ctx); |
119 | fd_ctx = NULL((void*)0); |
120 | } |
121 | } |
122 | out: |
123 | return fd_ctx; |
124 | } |
125 | |
126 | fuse_fd_ctx_t * |
127 | fuse_fd_ctx_check_n_create (xlator_t *this, fd_t *fd) |
128 | { |
129 | fuse_fd_ctx_t *fd_ctx = NULL((void*)0); |
130 | |
131 | if ((fd == NULL((void*)0)) || (this == NULL((void*)0))) { |
132 | goto out; |
133 | } |
134 | |
135 | LOCK (&fd->lock)pthread_spin_lock (&fd->lock); |
136 | { |
137 | fd_ctx = __fuse_fd_ctx_check_n_create (this, fd); |
138 | } |
139 | UNLOCK (&fd->lock)pthread_spin_unlock (&fd->lock); |
140 | |
141 | out: |
142 | return fd_ctx; |
143 | } |
144 | |
145 | fuse_fd_ctx_t * |
146 | fuse_fd_ctx_get (xlator_t *this, fd_t *fd) |
147 | { |
148 | fuse_fd_ctx_t *fdctx = NULL((void*)0); |
149 | uint64_t value = 0; |
150 | int ret = 0; |
151 | |
152 | ret = fd_ctx_get (fd, this, &value); |
153 | if (ret < 0) { |
154 | goto out; |
155 | } |
156 | |
157 | fdctx = (fuse_fd_ctx_t *) (unsigned long)value; |
158 | |
159 | out: |
160 | return fdctx; |
161 | } |
162 | |
163 | /* |
164 | * iov_out should contain a fuse_out_header at zeroth position. |
165 | * The error value of this header is sent to kernel. |
166 | */ |
167 | static int |
168 | send_fuse_iov (xlator_t *this, fuse_in_header_t *finh, struct iovec *iov_out, |
169 | int count) |
170 | { |
171 | fuse_private_t *priv = NULL((void*)0); |
172 | struct fuse_out_header *fouh = NULL((void*)0); |
173 | int res, i; |
174 | |
175 | if (!this || !finh || !iov_out) { |
176 | gf_log ("send_fuse_iov", GF_LOG_ERROR,"Invalid arguments")do { do { if (0) printf ("Invalid arguments"); } while (0); _gf_log ("send_fuse_iov", "fuse-bridge.c", __FUNCTION__, 176, GF_LOG_ERROR ,"Invalid arguments"); } while (0); |
177 | return EINVAL22; |
178 | } |
179 | priv = this->private; |
180 | |
181 | fouh = iov_out[0].iov_base; |
182 | iov_out[0].iov_len = sizeof (*fouh); |
183 | fouh->len = 0; |
184 | for (i = 0; i < count; i++) |
185 | fouh->len += iov_out[i].iov_len; |
186 | fouh->unique = finh->unique; |
187 | |
188 | res = writev (priv->fd, iov_out, count); |
189 | |
190 | if (res == -1) |
191 | return errno(*__errno_location ()); |
192 | if (res != fouh->len) |
193 | return EINVAL22; |
194 | |
195 | if (priv->fuse_dump_fd != -1) { |
196 | char w = 'W'; |
197 | |
198 | pthread_mutex_lock (&priv->fuse_dump_mutex); |
199 | res = write (priv->fuse_dump_fd, &w, 1); |
200 | if (res != -1) |
201 | res = writev (priv->fuse_dump_fd, iov_out, count); |
202 | pthread_mutex_unlock (&priv->fuse_dump_mutex); |
203 | |
204 | if (res == -1) |
205 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("failed to dump fuse message (W): %s" , strerror ((*__errno_location ()))); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 207, GF_LOG_ERROR, "failed to dump fuse message (W): %s" , strerror ((*__errno_location ()))); } while (0) |
206 | "failed to dump fuse message (W): %s",do { do { if (0) printf ("failed to dump fuse message (W): %s" , strerror ((*__errno_location ()))); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 207, GF_LOG_ERROR, "failed to dump fuse message (W): %s" , strerror ((*__errno_location ()))); } while (0) |
207 | strerror (errno))do { do { if (0) printf ("failed to dump fuse message (W): %s" , strerror ((*__errno_location ()))); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 207, GF_LOG_ERROR, "failed to dump fuse message (W): %s" , strerror ((*__errno_location ()))); } while (0); |
208 | } |
209 | |
210 | return 0; |
211 | } |
212 | |
213 | static int |
214 | send_fuse_data (xlator_t *this, fuse_in_header_t *finh, void *data, size_t size) |
215 | { |
216 | struct fuse_out_header fouh = {0, }; |
217 | struct iovec iov_out[2]; |
218 | |
219 | fouh.error = 0; |
220 | iov_out[0].iov_base = &fouh; |
221 | iov_out[1].iov_base = data; |
222 | iov_out[1].iov_len = size; |
223 | |
224 | return send_fuse_iov (this, finh, iov_out, 2); |
225 | } |
226 | |
227 | #define send_fuse_obj(this, finh, obj)send_fuse_data (this, finh, obj, sizeof (*(obj))) \ |
228 | send_fuse_data (this, finh, obj, sizeof (*(obj))) |
229 | |
230 | |
231 | static void |
232 | fuse_invalidate_entry (xlator_t *this, uint64_t fuse_ino) |
233 | { |
234 | struct fuse_out_header *fouh = NULL((void*)0); |
235 | struct fuse_notify_inval_entry_out *fnieo = NULL((void*)0); |
236 | fuse_private_t *priv = NULL((void*)0); |
237 | dentry_t *dentry = NULL((void*)0); |
238 | inode_t *inode = NULL((void*)0); |
239 | size_t nlen = 0; |
240 | int rv = 0; |
241 | char inval_buf[INVAL_BUF_SIZE(sizeof (struct fuse_out_header) + ((sizeof (struct fuse_notify_inval_inode_out ))>(sizeof (struct fuse_notify_inval_entry_out) + 255 + 1) ?(sizeof (struct fuse_notify_inval_inode_out)):(sizeof (struct fuse_notify_inval_entry_out) + 255 + 1)))] = {0,}; |
242 | |
243 | fouh = (struct fuse_out_header *)inval_buf; |
244 | fnieo = (struct fuse_notify_inval_entry_out *)(fouh + 1); |
245 | |
246 | priv = this->private; |
247 | if (priv->revchan_out == -1) |
248 | return; |
249 | |
250 | fouh->unique = 0; |
251 | fouh->error = FUSE_NOTIFY_INVAL_ENTRY; |
252 | |
253 | inode = fuse_ino_to_inode (fuse_ino, this); |
254 | |
255 | list_for_each_entry (dentry, &inode->dentry_list, inode_list)for (dentry = ((typeof(*dentry) *)((char *)((&inode->dentry_list )->next)-(unsigned long)(&((typeof(*dentry) *)0)->inode_list ))); &dentry->inode_list != (&inode->dentry_list ); dentry = ((typeof(*dentry) *)((char *)(dentry->inode_list .next)-(unsigned long)(&((typeof(*dentry) *)0)->inode_list )))) { |
256 | nlen = strlen (dentry->name); |
257 | fouh->len = sizeof (*fouh) + sizeof (*fnieo) + nlen + 1; |
258 | fnieo->parent = inode_to_fuse_nodeid (dentry->parent); |
259 | |
260 | fnieo->namelen = nlen; |
261 | strcpy (inval_buf + sizeof (*fouh) + sizeof (*fnieo), dentry->name); |
262 | |
263 | rv = write (priv->revchan_out, inval_buf, fouh->len); |
264 | if (rv != fouh->len) { |
265 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("kernel notification daemon defunct" ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 266, GF_LOG_ERROR, "kernel notification daemon defunct"); } while (0) |
266 | "kernel notification daemon defunct")do { do { if (0) printf ("kernel notification daemon defunct" ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 266, GF_LOG_ERROR, "kernel notification daemon defunct"); } while (0); |
267 | |
268 | close (priv->fd); |
269 | break; |
270 | } |
271 | |
272 | gf_log ("glusterfs-fuse", GF_LOG_TRACE, "INVALIDATE entry: "do { do { if (0) printf ("INVALIDATE entry: " "%""l" "u""/%s" , fnieo->parent, dentry->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 273, GF_LOG_TRACE, "INVALIDATE entry: " "%""l" "u""/%s", fnieo->parent, dentry->name); } while (0) |
273 | "%"PRIu64"/%s", fnieo->parent, dentry->name)do { do { if (0) printf ("INVALIDATE entry: " "%""l" "u""/%s" , fnieo->parent, dentry->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 273, GF_LOG_TRACE, "INVALIDATE entry: " "%""l" "u""/%s", fnieo->parent, dentry->name); } while (0); |
274 | |
275 | if (dentry->parent) { |
276 | fuse_log_eh (this, "Invalidated entry %s (parent: %s)",do { if (this->history) do { do { if (0) printf ("Invalidated entry %s (parent: %s)" , dentry->name, uuid_utoa (dentry->parent->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"Invalidated entry %s (parent: %s)" , dentry->name, uuid_utoa (dentry->parent->gfid)); } while (0); } while (0) |
277 | dentry->name,do { if (this->history) do { do { if (0) printf ("Invalidated entry %s (parent: %s)" , dentry->name, uuid_utoa (dentry->parent->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"Invalidated entry %s (parent: %s)" , dentry->name, uuid_utoa (dentry->parent->gfid)); } while (0); } while (0) |
278 | uuid_utoa (dentry->parent->gfid))do { if (this->history) do { do { if (0) printf ("Invalidated entry %s (parent: %s)" , dentry->name, uuid_utoa (dentry->parent->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"Invalidated entry %s (parent: %s)" , dentry->name, uuid_utoa (dentry->parent->gfid)); } while (0); } while (0); |
279 | } else { |
280 | fuse_log_eh (this, "Invalidated entry %s(nodeid: %ld)",do { if (this->history) do { do { if (0) printf ("Invalidated entry %s(nodeid: %ld)" , dentry->name, fnieo->parent); } while (0); _gf_log_eh (__FUNCTION__,"Invalidated entry %s(nodeid: %ld)", dentry-> name, fnieo->parent); } while (0); } while (0) |
281 | dentry->name, fnieo->parent)do { if (this->history) do { do { if (0) printf ("Invalidated entry %s(nodeid: %ld)" , dentry->name, fnieo->parent); } while (0); _gf_log_eh (__FUNCTION__,"Invalidated entry %s(nodeid: %ld)", dentry-> name, fnieo->parent); } while (0); } while (0); |
282 | } |
283 | } |
284 | |
285 | if (inode) |
286 | inode_unref (inode); |
287 | } |
288 | |
289 | /* |
290 | * Send an inval inode notification to fuse. This causes an invalidation of the |
291 | * entire page cache mapping on the inode. |
292 | */ |
293 | static void |
294 | fuse_invalidate_inode(xlator_t *this, uint64_t fuse_ino) |
295 | { |
296 | struct fuse_out_header *fouh = NULL((void*)0); |
297 | struct fuse_notify_inval_inode_out *fniio = NULL((void*)0); |
298 | fuse_private_t *priv = NULL((void*)0); |
299 | int rv = 0; |
300 | char inval_buf[INVAL_BUF_SIZE(sizeof (struct fuse_out_header) + ((sizeof (struct fuse_notify_inval_inode_out ))>(sizeof (struct fuse_notify_inval_entry_out) + 255 + 1) ?(sizeof (struct fuse_notify_inval_inode_out)):(sizeof (struct fuse_notify_inval_entry_out) + 255 + 1)))] = {0}; |
301 | inode_t *inode = NULL((void*)0); |
302 | |
303 | fouh = (struct fuse_out_header *) inval_buf; |
304 | fniio = (struct fuse_notify_inval_inode_out *) (fouh + 1); |
305 | |
306 | priv = this->private; |
307 | |
308 | if (priv->revchan_out < 0) |
309 | return; |
310 | |
311 | fouh->unique = 0; |
312 | fouh->error = FUSE_NOTIFY_INVAL_INODE; |
313 | fouh->len = sizeof(struct fuse_out_header) + |
314 | sizeof(struct fuse_notify_inval_inode_out); |
315 | |
316 | /* inval the entire mapping until we learn how to be more granular */ |
317 | fniio->ino = fuse_ino; |
318 | fniio->off = 0; |
319 | fniio->len = -1; |
320 | |
321 | inode = fuse_ino_to_inode (fuse_ino, this); |
322 | |
323 | rv = write(priv->revchan_out, inval_buf, fouh->len); |
324 | if (rv != fouh->len) { |
325 | gf_log("glusterfs-fuse", GF_LOG_ERROR, "kernel notification "do { do { if (0) printf ("kernel notification " "daemon defunct" ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 326, GF_LOG_ERROR, "kernel notification " "daemon defunct") ; } while (0) |
326 | "daemon defunct")do { do { if (0) printf ("kernel notification " "daemon defunct" ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 326, GF_LOG_ERROR, "kernel notification " "daemon defunct") ; } while (0); |
327 | close(priv->fd); |
328 | } |
329 | |
330 | gf_log("glusterfs-fuse", GF_LOG_TRACE, "INVALIDATE inode: %lu", fuse_ino)do { do { if (0) printf ("INVALIDATE inode: %lu", fuse_ino); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 330, GF_LOG_TRACE, "INVALIDATE inode: %lu", fuse_ino); } while (0); |
331 | |
332 | if (inode) { |
333 | fuse_log_eh (this, "Invalidated inode %lu (gfid: %s)",do { if (this->history) do { do { if (0) printf ("Invalidated inode %lu (gfid: %s)" , fuse_ino, uuid_utoa (inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"Invalidated inode %lu (gfid: %s)", fuse_ino, uuid_utoa (inode->gfid)); } while (0); } while (0) |
334 | fuse_ino, uuid_utoa (inode->gfid))do { if (this->history) do { do { if (0) printf ("Invalidated inode %lu (gfid: %s)" , fuse_ino, uuid_utoa (inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"Invalidated inode %lu (gfid: %s)", fuse_ino, uuid_utoa (inode->gfid)); } while (0); } while (0); |
335 | } else { |
336 | fuse_log_eh (this, "Invalidated inode %lu ", fuse_ino)do { if (this->history) do { do { if (0) printf ("Invalidated inode %lu " , fuse_ino); } while (0); _gf_log_eh (__FUNCTION__,"Invalidated inode %lu " , fuse_ino); } while (0); } while (0); |
337 | } |
338 | |
339 | if (inode) |
340 | inode_unref (inode); |
341 | } |
342 | |
343 | int |
344 | send_fuse_err (xlator_t *this, fuse_in_header_t *finh, int error) |
345 | { |
346 | struct fuse_out_header fouh = {0, }; |
347 | struct iovec iov_out; |
348 | inode_t *inode = NULL((void*)0); |
349 | |
350 | fouh.error = -error; |
351 | iov_out.iov_base = &fouh; |
352 | |
353 | inode = fuse_ino_to_inode (finh->nodeid, this); |
354 | |
355 | // filter out ENOENT |
356 | if (error != ENOENT2) { |
357 | if (inode) { |
358 | fuse_log_eh (this,"Sending %s for operation %d on "do { if (this->history) do { do { if (0) printf ("Sending %s for operation %d on " "inode %s", strerror (error), finh->opcode, uuid_utoa (inode ->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"Sending %s for operation %d on " "inode %s", strerror (error), finh->opcode, uuid_utoa (inode ->gfid)); } while (0); } while (0) |
359 | "inode %s", strerror (error), finh->opcode,do { if (this->history) do { do { if (0) printf ("Sending %s for operation %d on " "inode %s", strerror (error), finh->opcode, uuid_utoa (inode ->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"Sending %s for operation %d on " "inode %s", strerror (error), finh->opcode, uuid_utoa (inode ->gfid)); } while (0); } while (0) |
360 | uuid_utoa (inode->gfid))do { if (this->history) do { do { if (0) printf ("Sending %s for operation %d on " "inode %s", strerror (error), finh->opcode, uuid_utoa (inode ->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"Sending %s for operation %d on " "inode %s", strerror (error), finh->opcode, uuid_utoa (inode ->gfid)); } while (0); } while (0); |
361 | } else { |
362 | fuse_log_eh (this, "Sending %s for operation %d on "do { if (this->history) do { do { if (0) printf ("Sending %s for operation %d on " "inode %ld", strerror (error), finh->opcode, finh->nodeid ); } while (0); _gf_log_eh (__FUNCTION__,"Sending %s for operation %d on " "inode %ld", strerror (error), finh->opcode, finh->nodeid ); } while (0); } while (0) |
363 | "inode %ld", strerror (error),do { if (this->history) do { do { if (0) printf ("Sending %s for operation %d on " "inode %ld", strerror (error), finh->opcode, finh->nodeid ); } while (0); _gf_log_eh (__FUNCTION__,"Sending %s for operation %d on " "inode %ld", strerror (error), finh->opcode, finh->nodeid ); } while (0); } while (0) |
364 | finh->opcode, finh->nodeid)do { if (this->history) do { do { if (0) printf ("Sending %s for operation %d on " "inode %ld", strerror (error), finh->opcode, finh->nodeid ); } while (0); _gf_log_eh (__FUNCTION__,"Sending %s for operation %d on " "inode %ld", strerror (error), finh->opcode, finh->nodeid ); } while (0); } while (0); |
365 | } |
366 | } |
367 | |
368 | if (inode) |
369 | inode_unref (inode); |
370 | |
371 | return send_fuse_iov (this, finh, &iov_out, 1); |
372 | } |
373 | |
374 | static int |
375 | fuse_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
376 | int32_t op_ret, int32_t op_errno, |
377 | inode_t *inode, struct iatt *buf, dict_t *xdata) |
378 | { |
379 | fuse_state_t *state = NULL((void*)0); |
380 | fuse_in_header_t *finh = NULL((void*)0); |
381 | struct fuse_entry_out feo = {0, }; |
382 | fuse_private_t *priv = NULL((void*)0); |
383 | inode_t *linked_inode = NULL((void*)0); |
384 | |
385 | priv = this->private; |
386 | state = frame->root->state; |
387 | finh = state->finh; |
388 | |
389 | if (op_ret == 0) { |
390 | if (__is_root_gfid (state->loc.inode->gfid)) |
391 | buf->ia_ino = 1; |
392 | if (uuid_is_null (buf->ia_gfid)) { |
393 | /* With a NULL gfid inode linking is |
394 | not possible. Let's not pretend this |
395 | call was a "success". |
396 | */ |
397 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("Received NULL gfid for %s. Forcing EIO" , state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 399, GF_LOG_WARNING, "Received NULL gfid for %s. Forcing EIO" , state->loc.path); } while (0) |
398 | "Received NULL gfid for %s. Forcing EIO",do { do { if (0) printf ("Received NULL gfid for %s. Forcing EIO" , state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 399, GF_LOG_WARNING, "Received NULL gfid for %s. Forcing EIO" , state->loc.path); } while (0) |
399 | state->loc.path)do { do { if (0) printf ("Received NULL gfid for %s. Forcing EIO" , state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 399, GF_LOG_WARNING, "Received NULL gfid for %s. Forcing EIO" , state->loc.path); } while (0); |
400 | op_ret = -1; |
401 | op_errno = EIO5; |
402 | } |
403 | } |
404 | |
405 | /* log into the event-history after the null uuid check is done, since |
406 | * the op_ret and op_errno are being changed if the gfid is NULL. |
407 | */ |
408 | fuse_log_eh (this, "op_ret: %d op_errno: %d "do { if (this->history) do { do { if (0) printf ("op_ret: %d op_errno: %d " "%""l" "u"": %s() %s => %s", op_ret, op_errno, frame-> root->unique, gf_fop_list[frame->root->op], state-> loc.path, (op_ret == 0)? uuid_utoa(buf->ia_gfid):uuid_utoa (state->loc.gfid)); } while (0); _gf_log_eh (__FUNCTION__, "op_ret: %d op_errno: %d " "%""l" "u"": %s() %s => %s", op_ret , op_errno, frame->root->unique, gf_fop_list[frame-> root->op], state->loc.path, (op_ret == 0)? uuid_utoa(buf ->ia_gfid):uuid_utoa(state->loc.gfid)); } while (0); } while (0) |
409 | "%"PRIu64": %s() %s => %s", op_ret, op_errno,do { if (this->history) do { do { if (0) printf ("op_ret: %d op_errno: %d " "%""l" "u"": %s() %s => %s", op_ret, op_errno, frame-> root->unique, gf_fop_list[frame->root->op], state-> loc.path, (op_ret == 0)? uuid_utoa(buf->ia_gfid):uuid_utoa (state->loc.gfid)); } while (0); _gf_log_eh (__FUNCTION__, "op_ret: %d op_errno: %d " "%""l" "u"": %s() %s => %s", op_ret , op_errno, frame->root->unique, gf_fop_list[frame-> root->op], state->loc.path, (op_ret == 0)? uuid_utoa(buf ->ia_gfid):uuid_utoa(state->loc.gfid)); } while (0); } while (0) |
410 | frame->root->unique, gf_fop_list[frame->root->op],do { if (this->history) do { do { if (0) printf ("op_ret: %d op_errno: %d " "%""l" "u"": %s() %s => %s", op_ret, op_errno, frame-> root->unique, gf_fop_list[frame->root->op], state-> loc.path, (op_ret == 0)? uuid_utoa(buf->ia_gfid):uuid_utoa (state->loc.gfid)); } while (0); _gf_log_eh (__FUNCTION__, "op_ret: %d op_errno: %d " "%""l" "u"": %s() %s => %s", op_ret , op_errno, frame->root->unique, gf_fop_list[frame-> root->op], state->loc.path, (op_ret == 0)? uuid_utoa(buf ->ia_gfid):uuid_utoa(state->loc.gfid)); } while (0); } while (0) |
411 | state->loc.path, (op_ret == 0)?do { if (this->history) do { do { if (0) printf ("op_ret: %d op_errno: %d " "%""l" "u"": %s() %s => %s", op_ret, op_errno, frame-> root->unique, gf_fop_list[frame->root->op], state-> loc.path, (op_ret == 0)? uuid_utoa(buf->ia_gfid):uuid_utoa (state->loc.gfid)); } while (0); _gf_log_eh (__FUNCTION__, "op_ret: %d op_errno: %d " "%""l" "u"": %s() %s => %s", op_ret , op_errno, frame->root->unique, gf_fop_list[frame-> root->op], state->loc.path, (op_ret == 0)? uuid_utoa(buf ->ia_gfid):uuid_utoa(state->loc.gfid)); } while (0); } while (0) |
412 | uuid_utoa(buf->ia_gfid):uuid_utoa(state->loc.gfid))do { if (this->history) do { do { if (0) printf ("op_ret: %d op_errno: %d " "%""l" "u"": %s() %s => %s", op_ret, op_errno, frame-> root->unique, gf_fop_list[frame->root->op], state-> loc.path, (op_ret == 0)? uuid_utoa(buf->ia_gfid):uuid_utoa (state->loc.gfid)); } while (0); _gf_log_eh (__FUNCTION__, "op_ret: %d op_errno: %d " "%""l" "u"": %s() %s => %s", op_ret , op_errno, frame->root->unique, gf_fop_list[frame-> root->op], state->loc.path, (op_ret == 0)? uuid_utoa(buf ->ia_gfid):uuid_utoa(state->loc.gfid)); } while (0); } while (0); |
413 | |
414 | if (op_ret == 0) { |
415 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": %s() %s => %""l" "u" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, buf->ia_ino); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 418, GF_LOG_TRACE , "%""l" "u"": %s() %s => %""l" "u", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path, buf ->ia_ino); } while (0) |
416 | "%"PRIu64": %s() %s => %"PRIu64,do { do { if (0) printf ("%""l" "u"": %s() %s => %""l" "u" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, buf->ia_ino); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 418, GF_LOG_TRACE , "%""l" "u"": %s() %s => %""l" "u", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path, buf ->ia_ino); } while (0) |
417 | frame->root->unique, gf_fop_list[frame->root->op],do { do { if (0) printf ("%""l" "u"": %s() %s => %""l" "u" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, buf->ia_ino); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 418, GF_LOG_TRACE , "%""l" "u"": %s() %s => %""l" "u", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path, buf ->ia_ino); } while (0) |
418 | state->loc.path, buf->ia_ino)do { do { if (0) printf ("%""l" "u"": %s() %s => %""l" "u" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, buf->ia_ino); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 418, GF_LOG_TRACE , "%""l" "u"": %s() %s => %""l" "u", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path, buf ->ia_ino); } while (0); |
419 | |
420 | buf->ia_blksize = this->ctx->page_size; |
421 | gf_fuse_stat2attr (buf, &feo.attr, priv->enable_ino32); |
422 | |
423 | if (!buf->ia_ino) { |
424 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": %s() %s returning inode 0" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 427, GF_LOG_WARNING, "%""l" "u" ": %s() %s returning inode 0", frame->root->unique, gf_fop_list [frame->root->op], state->loc.path); } while (0) |
425 | "%"PRIu64": %s() %s returning inode 0",do { do { if (0) printf ("%""l" "u"": %s() %s returning inode 0" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 427, GF_LOG_WARNING, "%""l" "u" ": %s() %s returning inode 0", frame->root->unique, gf_fop_list [frame->root->op], state->loc.path); } while (0) |
426 | frame->root->unique,do { do { if (0) printf ("%""l" "u"": %s() %s returning inode 0" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 427, GF_LOG_WARNING, "%""l" "u" ": %s() %s returning inode 0", frame->root->unique, gf_fop_list [frame->root->op], state->loc.path); } while (0) |
427 | gf_fop_list[frame->root->op], state->loc.path)do { do { if (0) printf ("%""l" "u"": %s() %s returning inode 0" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 427, GF_LOG_WARNING, "%""l" "u" ": %s() %s returning inode 0", frame->root->unique, gf_fop_list [frame->root->op], state->loc.path); } while (0); |
428 | } |
429 | |
430 | linked_inode = inode_link (inode, state->loc.parent, |
431 | state->loc.name, buf); |
432 | |
433 | if (linked_inode != inode) { |
434 | } |
435 | |
436 | inode_lookup (linked_inode); |
437 | |
438 | feo.nodeid = inode_to_fuse_nodeid (linked_inode); |
439 | |
440 | inode_unref (linked_inode); |
441 | |
442 | feo.entry_valid = |
443 | calc_timeout_sec (priv->entry_timeout); |
444 | feo.entry_valid_nsec = |
445 | calc_timeout_nsec (priv->entry_timeout); |
446 | feo.attr_valid = |
447 | calc_timeout_sec (priv->attribute_timeout); |
448 | feo.attr_valid_nsec = |
449 | calc_timeout_nsec (priv->attribute_timeout); |
450 | |
451 | #if FUSE_KERNEL_MINOR_VERSION22 >= 9 |
452 | priv->proto_minor >= 9 ? |
453 | send_fuse_obj (this, finh, &feo)send_fuse_data (this, finh, &feo, sizeof (*(&feo))) : |
454 | send_fuse_data (this, finh, &feo, |
455 | FUSE_COMPAT_ENTRY_OUT_SIZE120); |
456 | #else |
457 | send_fuse_obj (this, finh, &feo)send_fuse_data (this, finh, &feo, sizeof (*(&feo))); |
458 | #endif |
459 | } else { |
460 | gf_log ("glusterfs-fuse",do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 464, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0) |
461 | (op_errno == ENOENT ? GF_LOG_TRACE : GF_LOG_WARNING),do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 464, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0) |
462 | "%"PRIu64": %s() %s => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 464, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0) |
463 | gf_fop_list[frame->root->op], state->loc.path,do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 464, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0) |
464 | strerror (op_errno))do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 464, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0); |
465 | |
466 | if ((op_errno == ENOENT2) && (priv->negative_timeout != 0)) { |
467 | feo.entry_valid = |
468 | calc_timeout_sec (priv->negative_timeout); |
469 | feo.entry_valid_nsec = |
470 | calc_timeout_nsec (priv->negative_timeout); |
471 | send_fuse_obj (this, finh, &feo)send_fuse_data (this, finh, &feo, sizeof (*(&feo))); |
472 | } else { |
473 | send_fuse_err (this, state->finh, op_errno); |
474 | } |
475 | } |
476 | |
477 | free_fuse_state (state); |
478 | STACK_DESTROY (frame->root); |
479 | return 0; |
480 | } |
481 | |
482 | static int |
483 | fuse_newentry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
484 | int32_t op_ret, int32_t op_errno, |
485 | inode_t *inode, struct iatt *buf, struct iatt *preparent, |
486 | struct iatt *postparent, dict_t *xdata) |
487 | { |
488 | fuse_entry_cbk (frame, cookie, this, op_ret, op_errno, inode, buf, |
489 | xdata); |
490 | return 0; |
491 | } |
492 | |
493 | static int |
494 | fuse_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
495 | int32_t op_ret, int32_t op_errno, |
496 | inode_t *inode, struct iatt *stat, dict_t *dict, |
497 | struct iatt *postparent) |
498 | { |
499 | fuse_state_t *state = NULL((void*)0); |
500 | call_frame_t *prev = NULL((void*)0); |
501 | inode_table_t *itable = NULL((void*)0); |
502 | |
503 | state = frame->root->state; |
504 | prev = cookie; |
505 | |
506 | if (op_ret == -1 && state->is_revalidate == 1) { |
507 | itable = state->itable; |
508 | /* |
509 | * A stale mapping might exist for a dentry/inode that has been |
510 | * removed from another client. |
511 | */ |
512 | if (op_errno == ENOENT2) |
513 | inode_unlink(state->loc.inode, state->loc.parent, |
514 | state->loc.name); |
515 | inode_unref (state->loc.inode); |
516 | state->loc.inode = inode_new (itable); |
517 | state->is_revalidate = 2; |
518 | if (uuid_is_null (state->gfid)) |
519 | uuid_generate (state->gfid); |
520 | fuse_gfid_set (state); |
521 | |
522 | STACK_WIND (frame, fuse_lookup_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "fuse-bridge.c", __FUNCTION__, 524, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( prev->this ->fops->lookup_cbk) tmp_cbk = fuse_lookup_cbk; _new-> root = frame->root; _new->this = prev->this; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "prev->this->fops->lookup"; _new->unwind_to = "fuse_lookup_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = prev->this; if (frame ->this->ctx->measure_latency) gf_latency_begin (_new , prev->this->fops->lookup); prev->this->fops-> lookup (_new, prev->this, &state->loc, state->xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0) |
523 | prev->this, prev->this->fops->lookup,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "fuse-bridge.c", __FUNCTION__, 524, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( prev->this ->fops->lookup_cbk) tmp_cbk = fuse_lookup_cbk; _new-> root = frame->root; _new->this = prev->this; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "prev->this->fops->lookup"; _new->unwind_to = "fuse_lookup_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = prev->this; if (frame ->this->ctx->measure_latency) gf_latency_begin (_new , prev->this->fops->lookup); prev->this->fops-> lookup (_new, prev->this, &state->loc, state->xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0) |
524 | &state->loc, state->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", "fuse-bridge.c", __FUNCTION__, 524, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( prev->this ->fops->lookup_cbk) tmp_cbk = fuse_lookup_cbk; _new-> root = frame->root; _new->this = prev->this; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "prev->this->fops->lookup"; _new->unwind_to = "fuse_lookup_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = prev->this; if (frame ->this->ctx->measure_latency) gf_latency_begin (_new , prev->this->fops->lookup); prev->this->fops-> lookup (_new, prev->this, &state->loc, state->xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); |
525 | return 0; |
526 | } |
527 | |
528 | fuse_entry_cbk (frame, cookie, this, op_ret, op_errno, inode, stat, |
529 | dict); |
530 | return 0; |
531 | } |
532 | |
533 | void |
534 | fuse_lookup_resume (fuse_state_t *state) |
535 | { |
536 | if (!state->loc.parent && !state->loc.inode) { |
537 | gf_log ("fuse", GF_LOG_ERROR, "failed to resolve path %s",do { do { if (0) printf ("failed to resolve path %s", state-> loc.path); } while (0); _gf_log ("fuse", "fuse-bridge.c", __FUNCTION__ , 538, GF_LOG_ERROR, "failed to resolve path %s", state->loc .path); } while (0) |
538 | state->loc.path)do { do { if (0) printf ("failed to resolve path %s", state-> loc.path); } while (0); _gf_log ("fuse", "fuse-bridge.c", __FUNCTION__ , 538, GF_LOG_ERROR, "failed to resolve path %s", state->loc .path); } while (0); |
539 | send_fuse_err (state->this, state->finh, ENOENT2); |
540 | free_fuse_state (state); |
541 | return; |
542 | } |
543 | |
544 | /* parent was resolved, entry could not, may be a missing gfid? |
545 | * Hence try to do a regular lookup |
546 | */ |
547 | if ((state->resolve.op_ret == -1) |
548 | && (state->resolve.op_errno == ENODATA61)) { |
549 | state->resolve.op_ret = 0; |
550 | } |
551 | |
552 | if (state->loc.inode) { |
553 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": LOOKUP %s(%s)", state-> finh->unique, state->loc.path, uuid_utoa (state->loc .inode->gfid)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 555, GF_LOG_TRACE, "%""l" "u"": LOOKUP %s(%s)" , state->finh->unique, state->loc.path, uuid_utoa (state ->loc.inode->gfid)); } while (0) |
554 | "%"PRIu64": LOOKUP %s(%s)", state->finh->unique,do { do { if (0) printf ("%""l" "u"": LOOKUP %s(%s)", state-> finh->unique, state->loc.path, uuid_utoa (state->loc .inode->gfid)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 555, GF_LOG_TRACE, "%""l" "u"": LOOKUP %s(%s)" , state->finh->unique, state->loc.path, uuid_utoa (state ->loc.inode->gfid)); } while (0) |
555 | state->loc.path, uuid_utoa (state->loc.inode->gfid))do { do { if (0) printf ("%""l" "u"": LOOKUP %s(%s)", state-> finh->unique, state->loc.path, uuid_utoa (state->loc .inode->gfid)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 555, GF_LOG_TRACE, "%""l" "u"": LOOKUP %s(%s)" , state->finh->unique, state->loc.path, uuid_utoa (state ->loc.inode->gfid)); } while (0); |
556 | state->is_revalidate = 1; |
557 | } else { |
558 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": LOOKUP %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 560, GF_LOG_TRACE, "%""l" "u" ": LOOKUP %s", state->finh->unique, state->loc.path) ; } while (0) |
559 | "%"PRIu64": LOOKUP %s", state->finh->unique,do { do { if (0) printf ("%""l" "u"": LOOKUP %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 560, GF_LOG_TRACE, "%""l" "u" ": LOOKUP %s", state->finh->unique, state->loc.path) ; } while (0) |
560 | state->loc.path)do { do { if (0) printf ("%""l" "u"": LOOKUP %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 560, GF_LOG_TRACE, "%""l" "u" ": LOOKUP %s", state->finh->unique, state->loc.path) ; } while (0); |
561 | state->loc.inode = inode_new (state->loc.parent->table); |
562 | if (uuid_is_null (state->gfid)) |
563 | uuid_generate (state->gfid); |
564 | fuse_gfid_set (state); |
565 | } |
566 | |
567 | FUSE_FOP (state, fuse_lookup_cbk, GF_FOP_LOOKUP,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 568, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_LOOKUP; frame->op = GF_FOP_LOOKUP; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 568, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_LOOKUP == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root-> unique, gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 568, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 568, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 568, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 568, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->lookup_cbk) tmp_cbk = fuse_lookup_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> lookup"; _new->unwind_to = "fuse_lookup_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> lookup); xl->fops->lookup (_new, xl, &state->loc , state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0) |
568 | lookup, &state->loc, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 568, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_LOOKUP; frame->op = GF_FOP_LOOKUP; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 568, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_LOOKUP == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root-> unique, gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 568, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 568, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 568, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 568, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->lookup_cbk) tmp_cbk = fuse_lookup_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> lookup"; _new->unwind_to = "fuse_lookup_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> lookup); xl->fops->lookup (_new, xl, &state->loc , state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0); |
569 | } |
570 | |
571 | static void |
572 | fuse_lookup (xlator_t *this, fuse_in_header_t *finh, void *msg) |
573 | { |
574 | char *name = msg; |
575 | fuse_state_t *state = NULL((void*)0); |
576 | |
577 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 577, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
578 | |
579 | (void) fuse_resolve_entry_init (state, &state->resolve, |
580 | finh->nodeid, name); |
581 | |
582 | fuse_resolve_and_resume (state, fuse_lookup_resume); |
583 | |
584 | return; |
585 | } |
586 | |
587 | static inline void |
588 | do_forget(xlator_t *this, uint64_t unique, uint64_t nodeid, uint64_t nlookup) |
589 | { |
590 | inode_t *fuse_inode = fuse_ino_to_inode(nodeid, this); |
591 | |
592 | fuse_log_eh(this, "%"PRIu64": FORGET %"PRIu64"/%"PRIu64" gfid: (%s)",do { if (this->history) do { do { if (0) printf ("%""l" "u" ": FORGET %""l" "u""/%""l" "u"" gfid: (%s)", unique, nodeid, nlookup , uuid_utoa(fuse_inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__ ,"%""l" "u"": FORGET %""l" "u""/%""l" "u"" gfid: (%s)", unique , nodeid, nlookup, uuid_utoa(fuse_inode->gfid)); } while ( 0); } while (0) |
593 | unique, nodeid, nlookup, uuid_utoa(fuse_inode->gfid))do { if (this->history) do { do { if (0) printf ("%""l" "u" ": FORGET %""l" "u""/%""l" "u"" gfid: (%s)", unique, nodeid, nlookup , uuid_utoa(fuse_inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__ ,"%""l" "u"": FORGET %""l" "u""/%""l" "u"" gfid: (%s)", unique , nodeid, nlookup, uuid_utoa(fuse_inode->gfid)); } while ( 0); } while (0); |
594 | |
595 | inode_forget(fuse_inode, nlookup); |
596 | inode_unref(fuse_inode); |
597 | } |
598 | |
599 | static void |
600 | fuse_forget (xlator_t *this, fuse_in_header_t *finh, void *msg) |
601 | |
602 | { |
603 | struct fuse_forget_in *ffi = msg; |
604 | |
605 | if (finh->nodeid == 1) { |
606 | GF_FREE (finh)__gf_free (finh); |
607 | return; |
608 | } |
609 | |
610 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": FORGET %""l" "u""/%""l" "u", finh->unique, finh->nodeid, ffi->nlookup); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 612, GF_LOG_TRACE, "%""l" "u"": FORGET %""l" "u""/%""l" "u" , finh->unique, finh->nodeid, ffi->nlookup); } while (0) |
611 | "%"PRIu64": FORGET %"PRIu64"/%"PRIu64,do { do { if (0) printf ("%""l" "u"": FORGET %""l" "u""/%""l" "u", finh->unique, finh->nodeid, ffi->nlookup); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 612, GF_LOG_TRACE, "%""l" "u"": FORGET %""l" "u""/%""l" "u" , finh->unique, finh->nodeid, ffi->nlookup); } while (0) |
612 | finh->unique, finh->nodeid, ffi->nlookup)do { do { if (0) printf ("%""l" "u"": FORGET %""l" "u""/%""l" "u", finh->unique, finh->nodeid, ffi->nlookup); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 612, GF_LOG_TRACE, "%""l" "u"": FORGET %""l" "u""/%""l" "u" , finh->unique, finh->nodeid, ffi->nlookup); } while (0); |
613 | |
614 | do_forget(this, finh->unique, finh->nodeid, ffi->nlookup); |
615 | |
616 | GF_FREE (finh)__gf_free (finh); |
617 | } |
618 | |
619 | static void |
620 | fuse_batch_forget(xlator_t *this, fuse_in_header_t *finh, void *msg) |
621 | { |
622 | struct fuse_batch_forget_in *fbfi = msg; |
623 | struct fuse_forget_one *ffo = (struct fuse_forget_one *) (fbfi + 1); |
624 | int i; |
625 | |
626 | gf_log("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": BATCH_FORGET %""l" "u""/%" "u", finh->unique, finh->nodeid, fbfi->count); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 628, GF_LOG_TRACE, "%""l" "u"": BATCH_FORGET %""l" "u""/%""u" , finh->unique, finh->nodeid, fbfi->count); } while ( 0) |
627 | "%"PRIu64": BATCH_FORGET %"PRIu64"/%"PRIu32,do { do { if (0) printf ("%""l" "u"": BATCH_FORGET %""l" "u""/%" "u", finh->unique, finh->nodeid, fbfi->count); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 628, GF_LOG_TRACE, "%""l" "u"": BATCH_FORGET %""l" "u""/%""u" , finh->unique, finh->nodeid, fbfi->count); } while ( 0) |
628 | finh->unique, finh->nodeid, fbfi->count)do { do { if (0) printf ("%""l" "u"": BATCH_FORGET %""l" "u""/%" "u", finh->unique, finh->nodeid, fbfi->count); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 628, GF_LOG_TRACE, "%""l" "u"": BATCH_FORGET %""l" "u""/%""u" , finh->unique, finh->nodeid, fbfi->count); } while ( 0); |
629 | |
630 | for (i = 0; i < fbfi->count; i++) { |
631 | if (ffo[i].nodeid == 1) |
632 | continue; |
633 | do_forget(this, finh->unique, ffo[i].nodeid, ffo[i].nlookup); |
634 | } |
635 | |
636 | GF_FREE(finh)__gf_free (finh); |
637 | } |
638 | |
639 | static int |
640 | fuse_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
641 | int32_t op_ret, int32_t op_errno, struct iatt *prebuf, |
642 | struct iatt *postbuf, dict_t *xdata) |
643 | { |
644 | fuse_state_t *state; |
645 | fuse_in_header_t *finh; |
646 | fuse_private_t *priv = NULL((void*)0); |
647 | struct fuse_attr_out fao; |
648 | |
649 | priv = this->private; |
650 | state = frame->root->state; |
651 | finh = state->finh; |
652 | |
653 | fuse_log_eh_fop(this, state, frame, op_ret, op_errno)do { if (this->history) { if (state->fd) do { do { if ( 0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->fd, uuid_utoa (state->fd-> inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->fd, uuid_utoa (state->fd->inode->gfid)); } while (0); else do { do { if (0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, uuid_utoa (state->loc.gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, uuid_utoa (state->loc .gfid)); } while (0); } } while(0); |
654 | |
655 | if (op_ret == 0) { |
656 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": %s() %s => %""l" "u" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", prebuf-> ia_ino); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 660, GF_LOG_TRACE, "%""l" "u"": %s() %s => %" "l" "u", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", prebuf ->ia_ino); } while (0) |
657 | "%"PRIu64": %s() %s => %"PRIu64, frame->root->unique,do { do { if (0) printf ("%""l" "u"": %s() %s => %""l" "u" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", prebuf-> ia_ino); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 660, GF_LOG_TRACE, "%""l" "u"": %s() %s => %" "l" "u", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", prebuf ->ia_ino); } while (0) |
658 | gf_fop_list[frame->root->op],do { do { if (0) printf ("%""l" "u"": %s() %s => %""l" "u" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", prebuf-> ia_ino); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 660, GF_LOG_TRACE, "%""l" "u"": %s() %s => %" "l" "u", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", prebuf ->ia_ino); } while (0) |
659 | state->loc.path ? state->loc.path : "ERR",do { do { if (0) printf ("%""l" "u"": %s() %s => %""l" "u" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", prebuf-> ia_ino); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 660, GF_LOG_TRACE, "%""l" "u"": %s() %s => %" "l" "u", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", prebuf ->ia_ino); } while (0) |
660 | prebuf->ia_ino)do { do { if (0) printf ("%""l" "u"": %s() %s => %""l" "u" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", prebuf-> ia_ino); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 660, GF_LOG_TRACE, "%""l" "u"": %s() %s => %" "l" "u", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", prebuf ->ia_ino); } while (0); |
661 | |
662 | postbuf->ia_blksize = this->ctx->page_size; |
663 | gf_fuse_stat2attr (postbuf, &fao.attr, priv->enable_ino32); |
664 | |
665 | fao.attr_valid = calc_timeout_sec (priv->attribute_timeout); |
666 | fao.attr_valid_nsec = |
667 | calc_timeout_nsec (priv->attribute_timeout); |
668 | |
669 | #if FUSE_KERNEL_MINOR_VERSION22 >= 9 |
670 | priv->proto_minor >= 9 ? |
671 | send_fuse_obj (this, finh, &fao)send_fuse_data (this, finh, &fao, sizeof (*(&fao))) : |
672 | send_fuse_data (this, finh, &fao, |
673 | FUSE_COMPAT_ATTR_OUT_SIZE96); |
674 | #else |
675 | send_fuse_obj (this, finh, &fao)send_fuse_data (this, finh, &fao, sizeof (*(&fao))); |
676 | #endif |
677 | } else { |
678 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 682, GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0) |
679 | "%"PRIu64": %s() %s => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 682, GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0) |
680 | gf_fop_list[frame->root->op],do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 682, GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0) |
681 | state->loc.path ? state->loc.path : "ERR",do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 682, GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0) |
682 | strerror (op_errno))do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 682, GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0); |
683 | |
684 | send_fuse_err (this, finh, op_errno); |
685 | } |
686 | |
687 | free_fuse_state (state); |
688 | STACK_DESTROY (frame->root); |
689 | |
690 | return 0; |
691 | } |
692 | |
693 | static int |
694 | fuse_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
695 | int32_t op_ret, int32_t op_errno, struct iatt *buf, dict_t *xdata) |
696 | { |
697 | fuse_state_t *state; |
698 | fuse_in_header_t *finh; |
699 | fuse_private_t *priv = NULL((void*)0); |
700 | struct fuse_attr_out fao; |
701 | |
702 | priv = this->private; |
703 | state = frame->root->state; |
704 | finh = state->finh; |
705 | |
706 | fuse_log_eh (this, "op_ret: %d, op_errno: %d, %"PRIu64": %s() %s => "do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"": %s() %s => " "gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, state->loc.inode ? uuid_utoa (state->loc .inode->gfid) : ""); } while (0); _gf_log_eh (__FUNCTION__ ,"op_ret: %d, op_errno: %d, %""l" "u"": %s() %s => " "gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : ""); } while (0); } while ( 0) |
707 | "gfid: %s", op_ret, op_errno, frame->root->unique,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"": %s() %s => " "gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, state->loc.inode ? uuid_utoa (state->loc .inode->gfid) : ""); } while (0); _gf_log_eh (__FUNCTION__ ,"op_ret: %d, op_errno: %d, %""l" "u"": %s() %s => " "gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : ""); } while (0); } while ( 0) |
708 | gf_fop_list[frame->root->op], state->loc.path,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"": %s() %s => " "gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, state->loc.inode ? uuid_utoa (state->loc .inode->gfid) : ""); } while (0); _gf_log_eh (__FUNCTION__ ,"op_ret: %d, op_errno: %d, %""l" "u"": %s() %s => " "gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : ""); } while (0); } while ( 0) |
709 | state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : "")do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"": %s() %s => " "gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, state->loc.inode ? uuid_utoa (state->loc .inode->gfid) : ""); } while (0); _gf_log_eh (__FUNCTION__ ,"op_ret: %d, op_errno: %d, %""l" "u"": %s() %s => " "gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : ""); } while (0); } while ( 0); |
710 | if (op_ret == 0) { |
711 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": %s() %s => %""l" "u" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", buf->ia_ino ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 715, GF_LOG_TRACE, "%""l" "u"": %s() %s => %""l" "u", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path ? state->loc.path : "ERR", buf->ia_ino); } while (0) |
712 | "%"PRIu64": %s() %s => %"PRIu64, frame->root->unique,do { do { if (0) printf ("%""l" "u"": %s() %s => %""l" "u" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", buf->ia_ino ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 715, GF_LOG_TRACE, "%""l" "u"": %s() %s => %""l" "u", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path ? state->loc.path : "ERR", buf->ia_ino); } while (0) |
713 | gf_fop_list[frame->root->op],do { do { if (0) printf ("%""l" "u"": %s() %s => %""l" "u" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", buf->ia_ino ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 715, GF_LOG_TRACE, "%""l" "u"": %s() %s => %""l" "u", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path ? state->loc.path : "ERR", buf->ia_ino); } while (0) |
714 | state->loc.path ? state->loc.path : "ERR",do { do { if (0) printf ("%""l" "u"": %s() %s => %""l" "u" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", buf->ia_ino ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 715, GF_LOG_TRACE, "%""l" "u"": %s() %s => %""l" "u", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path ? state->loc.path : "ERR", buf->ia_ino); } while (0) |
715 | buf->ia_ino)do { do { if (0) printf ("%""l" "u"": %s() %s => %""l" "u" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", buf->ia_ino ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 715, GF_LOG_TRACE, "%""l" "u"": %s() %s => %""l" "u", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path ? state->loc.path : "ERR", buf->ia_ino); } while (0); |
716 | |
717 | buf->ia_blksize = this->ctx->page_size; |
718 | gf_fuse_stat2attr (buf, &fao.attr, priv->enable_ino32); |
719 | |
720 | fao.attr_valid = calc_timeout_sec (priv->attribute_timeout); |
721 | fao.attr_valid_nsec = |
722 | calc_timeout_nsec (priv->attribute_timeout); |
723 | |
724 | #if FUSE_KERNEL_MINOR_VERSION22 >= 9 |
725 | priv->proto_minor >= 9 ? |
726 | send_fuse_obj (this, finh, &fao)send_fuse_data (this, finh, &fao, sizeof (*(&fao))) : |
727 | send_fuse_data (this, finh, &fao, |
728 | FUSE_COMPAT_ATTR_OUT_SIZE96); |
729 | #else |
730 | send_fuse_obj (this, finh, &fao)send_fuse_data (this, finh, &fao, sizeof (*(&fao))); |
731 | #endif |
732 | } else { |
733 | GF_LOG_OCCASIONALLY ( gf_fuse_conn_err_log, "glusterfs-fuse",if (!(gf_fuse_conn_err_log++%42)) { do { do { if (0) printf ( "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path ? state ->loc.path : "ERR", strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 739, GF_LOG_WARNING , "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path ? state ->loc.path : "ERR", strerror (op_errno)); } while (0); } |
734 | GF_LOG_WARNING,if (!(gf_fuse_conn_err_log++%42)) { do { do { if (0) printf ( "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path ? state ->loc.path : "ERR", strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 739, GF_LOG_WARNING , "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path ? state ->loc.path : "ERR", strerror (op_errno)); } while (0); } |
735 | "%"PRIu64": %s() %s => -1 (%s)",if (!(gf_fuse_conn_err_log++%42)) { do { do { if (0) printf ( "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path ? state ->loc.path : "ERR", strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 739, GF_LOG_WARNING , "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path ? state ->loc.path : "ERR", strerror (op_errno)); } while (0); } |
736 | frame->root->unique,if (!(gf_fuse_conn_err_log++%42)) { do { do { if (0) printf ( "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path ? state ->loc.path : "ERR", strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 739, GF_LOG_WARNING , "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path ? state ->loc.path : "ERR", strerror (op_errno)); } while (0); } |
737 | gf_fop_list[frame->root->op],if (!(gf_fuse_conn_err_log++%42)) { do { do { if (0) printf ( "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path ? state ->loc.path : "ERR", strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 739, GF_LOG_WARNING , "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path ? state ->loc.path : "ERR", strerror (op_errno)); } while (0); } |
738 | state->loc.path ? state->loc.path : "ERR",if (!(gf_fuse_conn_err_log++%42)) { do { do { if (0) printf ( "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path ? state ->loc.path : "ERR", strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 739, GF_LOG_WARNING , "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path ? state ->loc.path : "ERR", strerror (op_errno)); } while (0); } |
739 | strerror (op_errno))if (!(gf_fuse_conn_err_log++%42)) { do { do { if (0) printf ( "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path ? state ->loc.path : "ERR", strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 739, GF_LOG_WARNING , "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path ? state ->loc.path : "ERR", strerror (op_errno)); } while (0); }; |
740 | |
741 | send_fuse_err (this, finh, op_errno); |
742 | } |
743 | |
744 | free_fuse_state (state); |
745 | STACK_DESTROY (frame->root); |
746 | |
747 | return 0; |
748 | } |
749 | |
750 | static int |
751 | fuse_root_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
752 | int32_t op_ret, int32_t op_errno, |
753 | inode_t *inode, struct iatt *stat, dict_t *dict, |
754 | struct iatt *postparent) |
755 | { |
756 | fuse_attr_cbk (frame, cookie, this, op_ret, op_errno, stat, dict); |
757 | |
758 | return 0; |
759 | } |
760 | |
761 | void |
762 | fuse_getattr_resume (fuse_state_t *state) |
763 | { |
764 | if (!state->loc.inode) { |
765 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("%""l" "u"": GETATTR %""l" "u"" (%s) resolution failed" , state->finh->unique, state->finh->nodeid, uuid_utoa (state->resolve.gfid)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 768, GF_LOG_ERROR, "%""l" "u" ": GETATTR %""l" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0) |
766 | "%"PRIu64": GETATTR %"PRIu64" (%s) resolution failed",do { do { if (0) printf ("%""l" "u"": GETATTR %""l" "u"" (%s) resolution failed" , state->finh->unique, state->finh->nodeid, uuid_utoa (state->resolve.gfid)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 768, GF_LOG_ERROR, "%""l" "u" ": GETATTR %""l" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0) |
767 | state->finh->unique, state->finh->nodeid,do { do { if (0) printf ("%""l" "u"": GETATTR %""l" "u"" (%s) resolution failed" , state->finh->unique, state->finh->nodeid, uuid_utoa (state->resolve.gfid)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 768, GF_LOG_ERROR, "%""l" "u" ": GETATTR %""l" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0) |
768 | uuid_utoa (state->resolve.gfid))do { do { if (0) printf ("%""l" "u"": GETATTR %""l" "u"" (%s) resolution failed" , state->finh->unique, state->finh->nodeid, uuid_utoa (state->resolve.gfid)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 768, GF_LOG_ERROR, "%""l" "u" ": GETATTR %""l" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0); |
769 | send_fuse_err (state->this, state->finh, ENOENT2); |
770 | free_fuse_state (state); |
771 | return; |
772 | } |
773 | |
774 | if (!IA_ISDIR (state->loc.inode->ia_type)(state->loc.inode->ia_type == IA_IFDIR)) { |
775 | state->fd = fd_lookup (state->loc.inode, state->finh->pid); |
776 | } |
777 | |
778 | if (!state->fd) { |
779 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": GETATTR %""l" "u"" (%s)" , state->finh->unique, state->finh->nodeid, state ->loc.path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 782, GF_LOG_TRACE, "%""l" "u"": GETATTR %""l" "u"" (%s)", state->finh->unique, state->finh->nodeid , state->loc.path); } while (0) |
780 | "%"PRIu64": GETATTR %"PRIu64" (%s)",do { do { if (0) printf ("%""l" "u"": GETATTR %""l" "u"" (%s)" , state->finh->unique, state->finh->nodeid, state ->loc.path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 782, GF_LOG_TRACE, "%""l" "u"": GETATTR %""l" "u"" (%s)", state->finh->unique, state->finh->nodeid , state->loc.path); } while (0) |
781 | state->finh->unique, state->finh->nodeid,do { do { if (0) printf ("%""l" "u"": GETATTR %""l" "u"" (%s)" , state->finh->unique, state->finh->nodeid, state ->loc.path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 782, GF_LOG_TRACE, "%""l" "u"": GETATTR %""l" "u"" (%s)", state->finh->unique, state->finh->nodeid , state->loc.path); } while (0) |
782 | state->loc.path)do { do { if (0) printf ("%""l" "u"": GETATTR %""l" "u"" (%s)" , state->finh->unique, state->finh->nodeid, state ->loc.path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 782, GF_LOG_TRACE, "%""l" "u"": GETATTR %""l" "u"" (%s)", state->finh->unique, state->finh->nodeid , state->loc.path); } while (0); |
783 | |
784 | FUSE_FOP (state, fuse_attr_cbk, GF_FOP_STAT,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 785, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_STAT; frame->op = GF_FOP_STAT; if ( state->resolve_now ) { resolve = state-> resolve_now; } else { resolve = &(state->resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 785, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_STAT == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 785, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 785, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 785, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 785, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->stat_cbk) tmp_cbk = fuse_attr_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> stat"; _new->unwind_to = "fuse_attr_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> stat); xl->fops->stat (_new, xl, &state->loc, state ->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0) |
785 | stat, &state->loc, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 785, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_STAT; frame->op = GF_FOP_STAT; if ( state->resolve_now ) { resolve = state-> resolve_now; } else { resolve = &(state->resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 785, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_STAT == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 785, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 785, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 785, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 785, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->stat_cbk) tmp_cbk = fuse_attr_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> stat"; _new->unwind_to = "fuse_attr_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> stat); xl->fops->stat (_new, xl, &state->loc, state ->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0); |
786 | } else { |
787 | |
788 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": FGETATTR %""l" "u"" (%s/%p)" , state->finh->unique, state->finh->nodeid, state ->loc.path, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 791, GF_LOG_TRACE, "%""l" "u" ": FGETATTR %""l" "u"" (%s/%p)", state->finh->unique, state ->finh->nodeid, state->loc.path, state->fd); } while (0) |
789 | "%"PRIu64": FGETATTR %"PRIu64" (%s/%p)",do { do { if (0) printf ("%""l" "u"": FGETATTR %""l" "u"" (%s/%p)" , state->finh->unique, state->finh->nodeid, state ->loc.path, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 791, GF_LOG_TRACE, "%""l" "u" ": FGETATTR %""l" "u"" (%s/%p)", state->finh->unique, state ->finh->nodeid, state->loc.path, state->fd); } while (0) |
790 | state->finh->unique, state->finh->nodeid,do { do { if (0) printf ("%""l" "u"": FGETATTR %""l" "u"" (%s/%p)" , state->finh->unique, state->finh->nodeid, state ->loc.path, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 791, GF_LOG_TRACE, "%""l" "u" ": FGETATTR %""l" "u"" (%s/%p)", state->finh->unique, state ->finh->nodeid, state->loc.path, state->fd); } while (0) |
791 | state->loc.path, state->fd)do { do { if (0) printf ("%""l" "u"": FGETATTR %""l" "u"" (%s/%p)" , state->finh->unique, state->finh->nodeid, state ->loc.path, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 791, GF_LOG_TRACE, "%""l" "u" ": FGETATTR %""l" "u"" (%s/%p)", state->finh->unique, state ->finh->nodeid, state->loc.path, state->fd); } while (0); |
792 | |
793 | FUSE_FOP (state, fuse_attr_cbk, GF_FOP_FSTAT,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 794, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FSTAT; frame->op = GF_FOP_FSTAT; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 794, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_FSTAT == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 794, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 794, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 794, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 794, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fstat_cbk) tmp_cbk = fuse_attr_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> fstat"; _new->unwind_to = "fuse_attr_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fstat); xl->fops->fstat (_new, xl, state->fd, state-> xdata); (*__glusterfs_this_location()) = old_THIS; } while (0 ); } } while (0) |
794 | fstat, state->fd, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 794, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FSTAT; frame->op = GF_FOP_FSTAT; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 794, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_FSTAT == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 794, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 794, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 794, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 794, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fstat_cbk) tmp_cbk = fuse_attr_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> fstat"; _new->unwind_to = "fuse_attr_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fstat); xl->fops->fstat (_new, xl, state->fd, state-> xdata); (*__glusterfs_this_location()) = old_THIS; } while (0 ); } } while (0); |
795 | } |
796 | } |
797 | |
798 | static void |
799 | fuse_getattr (xlator_t *this, fuse_in_header_t *finh, void *msg) |
800 | { |
801 | fuse_state_t *state; |
802 | int32_t ret = -1; |
803 | |
804 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 804, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
805 | |
806 | if (finh->nodeid == 1) { |
807 | state->gfid[15] = 1; |
808 | |
809 | ret = fuse_loc_fill (&state->loc, state, finh->nodeid, 0, NULL((void*)0)); |
810 | if (ret < 0) { |
811 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": GETATTR on / (fuse_loc_fill() failed)" , finh->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 813, GF_LOG_WARNING, "%""l" "u"": GETATTR on / (fuse_loc_fill() failed)" , finh->unique); } while (0) |
812 | "%"PRIu64": GETATTR on / (fuse_loc_fill() failed)",do { do { if (0) printf ("%""l" "u"": GETATTR on / (fuse_loc_fill() failed)" , finh->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 813, GF_LOG_WARNING, "%""l" "u"": GETATTR on / (fuse_loc_fill() failed)" , finh->unique); } while (0) |
813 | finh->unique)do { do { if (0) printf ("%""l" "u"": GETATTR on / (fuse_loc_fill() failed)" , finh->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 813, GF_LOG_WARNING, "%""l" "u"": GETATTR on / (fuse_loc_fill() failed)" , finh->unique); } while (0); |
814 | send_fuse_err (this, finh, ENOENT2); |
815 | free_fuse_state (state); |
816 | return; |
817 | } |
818 | |
819 | fuse_gfid_set (state); |
820 | |
821 | FUSE_FOP (state, fuse_root_lookup_cbk, GF_FOP_LOOKUP,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 822, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_LOOKUP; frame->op = GF_FOP_LOOKUP; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 822, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_LOOKUP == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root-> unique, gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 822, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 822, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 822, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 822, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->lookup_cbk) tmp_cbk = fuse_root_lookup_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> lookup"; _new->unwind_to = "fuse_root_lookup_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> lookup); xl->fops->lookup (_new, xl, &state->loc , state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0) |
822 | lookup, &state->loc, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 822, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_LOOKUP; frame->op = GF_FOP_LOOKUP; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 822, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_LOOKUP == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root-> unique, gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 822, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 822, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 822, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 822, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->lookup_cbk) tmp_cbk = fuse_root_lookup_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> lookup"; _new->unwind_to = "fuse_root_lookup_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> lookup); xl->fops->lookup (_new, xl, &state->loc , state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0); |
823 | return; |
824 | } |
825 | |
826 | fuse_resolve_inode_init (state, &state->resolve, state->finh->nodeid); |
827 | |
828 | fuse_resolve_and_resume (state, fuse_getattr_resume); |
829 | } |
830 | |
831 | static int32_t |
832 | fuse_fd_inherit_directio (xlator_t *this, fd_t *fd, struct fuse_open_out *foo) |
833 | { |
834 | int32_t ret = 0; |
835 | fuse_fd_ctx_t *fdctx = NULL((void*)0), *tmp_fdctx = NULL((void*)0); |
836 | fd_t *tmp_fd = NULL((void*)0); |
837 | |
838 | GF_VALIDATE_OR_GOTO_WITH_ERROR ("glusterfs-fuse", this, out, ret,do { if (!this) { ret = -22; do { do { if (0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 839, GF_LOG_ERROR, "invalid argument: " "this" ); } while (0); goto out; } }while (0) |
839 | -EINVAL)do { if (!this) { ret = -22; do { do { if (0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 839, GF_LOG_ERROR, "invalid argument: " "this" ); } while (0); goto out; } }while (0); |
840 | GF_VALIDATE_OR_GOTO_WITH_ERROR ("glusterfs-fuse", fd, out, ret,do { if (!fd) { ret = -22; do { do { if (0) printf ("invalid argument: " "fd"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 841, GF_LOG_ERROR, "invalid argument: " "fd") ; } while (0); goto out; } }while (0) |
841 | -EINVAL)do { if (!fd) { ret = -22; do { do { if (0) printf ("invalid argument: " "fd"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 841, GF_LOG_ERROR, "invalid argument: " "fd") ; } while (0); goto out; } }while (0); |
842 | GF_VALIDATE_OR_GOTO_WITH_ERROR ("glusterfs-fuse", foo, out, ret,do { if (!foo) { ret = -22; do { do { if (0) printf ("invalid argument: " "foo"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 843, GF_LOG_ERROR, "invalid argument: " "foo" ); } while (0); goto out; } }while (0) |
843 | -EINVAL)do { if (!foo) { ret = -22; do { do { if (0) printf ("invalid argument: " "foo"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 843, GF_LOG_ERROR, "invalid argument: " "foo" ); } while (0); goto out; } }while (0); |
844 | |
845 | fdctx = fuse_fd_ctx_get (this, fd); |
846 | if (!fdctx) { |
847 | ret = -ENOMEM12; |
848 | goto out; |
849 | } |
850 | |
851 | tmp_fd = fd_lookup (fd->inode, 0); |
852 | if (tmp_fd) { |
853 | tmp_fdctx = fuse_fd_ctx_get (this, tmp_fd); |
854 | if (tmp_fdctx) { |
855 | foo->open_flags &= ~FOPEN_DIRECT_IO(1 << 0); |
856 | foo->open_flags |= (tmp_fdctx->open_flags |
857 | & FOPEN_DIRECT_IO(1 << 0)); |
858 | } |
859 | } |
860 | |
861 | fdctx->open_flags |= (foo->open_flags & FOPEN_DIRECT_IO(1 << 0)); |
862 | |
863 | if (tmp_fd != NULL((void*)0)) { |
864 | fd_unref (tmp_fd); |
865 | } |
866 | |
867 | ret = 0; |
868 | out: |
869 | return ret; |
870 | } |
871 | |
872 | static int |
873 | fuse_fd_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
874 | int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) |
875 | { |
876 | fuse_state_t *state = NULL((void*)0); |
877 | fuse_in_header_t *finh = NULL((void*)0); |
878 | fuse_private_t *priv = NULL((void*)0); |
879 | int32_t ret = 0; |
880 | struct fuse_open_out foo = {0, }; |
881 | |
882 | priv = this->private; |
883 | state = frame->root->state; |
884 | finh = state->finh; |
885 | |
886 | fuse_log_eh_fop(this, state, frame, op_ret, op_errno)do { if (this->history) { if (state->fd) do { do { if ( 0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->fd, uuid_utoa (state->fd-> inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->fd, uuid_utoa (state->fd->inode->gfid)); } while (0); else do { do { if (0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, uuid_utoa (state->loc.gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, uuid_utoa (state->loc .gfid)); } while (0); } } while(0); |
887 | |
888 | if (op_ret >= 0) { |
889 | foo.fh = (uintptr_t) fd; |
890 | foo.open_flags = 0; |
891 | |
892 | if (!IA_ISDIR (fd->inode->ia_type)(fd->inode->ia_type == IA_IFDIR)) { |
893 | if (((priv->direct_io_mode == 2) |
894 | && ((state->flags & O_ACCMODE0003) != O_RDONLY00)) |
895 | || (priv->direct_io_mode == 1)) |
896 | foo.open_flags |= FOPEN_DIRECT_IO(1 << 0); |
897 | #ifdef GF_DARWIN_HOST_OS |
898 | /* In Linux: by default, buffer cache |
899 | * is purged upon open, setting |
900 | * FOPEN_KEEP_CACHE implies no-purge |
901 | * |
902 | * In MacFUSE: by default, buffer cache |
903 | * is left intact upon open, setting |
904 | * FOPEN_PURGE_UBC implies purge |
905 | * |
906 | * [[Interesting...]] |
907 | */ |
908 | if (!priv->fopen_keep_cache) |
909 | foo.open_flags |= FOPEN_PURGE_UBC; |
910 | #else |
911 | /* |
912 | * If fopen-keep-cache is enabled, we set the associated |
913 | * flag here such that files are not invalidated on open. |
914 | * File invalidations occur either in fuse or explicitly |
915 | * when the cache is set invalid on the inode. |
916 | */ |
917 | if (priv->fopen_keep_cache) |
918 | foo.open_flags |= FOPEN_KEEP_CACHE(1 << 1); |
919 | #endif |
920 | } |
921 | |
922 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": %s() %s => %p", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, fd); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 924, GF_LOG_TRACE, "%""l" "u"": %s() %s => %p" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, fd); } while (0) |
923 | "%"PRIu64": %s() %s => %p", frame->root->unique,do { do { if (0) printf ("%""l" "u"": %s() %s => %p", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, fd); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 924, GF_LOG_TRACE, "%""l" "u"": %s() %s => %p" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, fd); } while (0) |
924 | gf_fop_list[frame->root->op], state->loc.path, fd)do { do { if (0) printf ("%""l" "u"": %s() %s => %p", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, fd); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 924, GF_LOG_TRACE, "%""l" "u"": %s() %s => %p" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, fd); } while (0); |
925 | |
926 | ret = fuse_fd_inherit_directio (this, fd, &foo); |
927 | if (ret < 0) { |
928 | op_errno = -ret; |
929 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("cannot inherit direct-io values for fd " "(ptr:%p inode-gfid:%s) from fds already " "opened", fd, uuid_utoa (fd->inode->gfid)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 932, GF_LOG_WARNING, "cannot inherit direct-io values for fd " "(ptr:%p inode-gfid:%s) from fds already " "opened", fd, uuid_utoa (fd->inode->gfid)); } while (0) |
930 | "cannot inherit direct-io values for fd "do { do { if (0) printf ("cannot inherit direct-io values for fd " "(ptr:%p inode-gfid:%s) from fds already " "opened", fd, uuid_utoa (fd->inode->gfid)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 932, GF_LOG_WARNING, "cannot inherit direct-io values for fd " "(ptr:%p inode-gfid:%s) from fds already " "opened", fd, uuid_utoa (fd->inode->gfid)); } while (0) |
931 | "(ptr:%p inode-gfid:%s) from fds already "do { do { if (0) printf ("cannot inherit direct-io values for fd " "(ptr:%p inode-gfid:%s) from fds already " "opened", fd, uuid_utoa (fd->inode->gfid)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 932, GF_LOG_WARNING, "cannot inherit direct-io values for fd " "(ptr:%p inode-gfid:%s) from fds already " "opened", fd, uuid_utoa (fd->inode->gfid)); } while (0) |
932 | "opened", fd, uuid_utoa (fd->inode->gfid))do { do { if (0) printf ("cannot inherit direct-io values for fd " "(ptr:%p inode-gfid:%s) from fds already " "opened", fd, uuid_utoa (fd->inode->gfid)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 932, GF_LOG_WARNING, "cannot inherit direct-io values for fd " "(ptr:%p inode-gfid:%s) from fds already " "opened", fd, uuid_utoa (fd->inode->gfid)); } while (0); |
933 | goto err; |
934 | } |
935 | |
936 | if (send_fuse_obj (this, finh, &foo)send_fuse_data (this, finh, &foo, sizeof (*(&foo))) == ENOENT2) { |
937 | gf_log ("glusterfs-fuse", GF_LOG_DEBUG,do { do { if (0) printf ("open(%s) got EINTR", state->loc. path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 938, GF_LOG_DEBUG, "open(%s) got EINTR", state ->loc.path); } while (0) |
938 | "open(%s) got EINTR", state->loc.path)do { do { if (0) printf ("open(%s) got EINTR", state->loc. path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 938, GF_LOG_DEBUG, "open(%s) got EINTR", state ->loc.path); } while (0); |
939 | gf_fd_put (priv->fdtable, state->fd_no); |
940 | goto out; |
941 | } |
942 | |
943 | fd_bind (fd); |
944 | } else { |
945 | err: |
946 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 949, GF_LOG_WARNING , "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path, strerror (op_errno)); } while (0) |
947 | "%"PRIu64": %s() %s => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 949, GF_LOG_WARNING , "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path, strerror (op_errno)); } while (0) |
948 | gf_fop_list[frame->root->op], state->loc.path,do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 949, GF_LOG_WARNING , "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path, strerror (op_errno)); } while (0) |
949 | strerror (op_errno))do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 949, GF_LOG_WARNING , "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path, strerror (op_errno)); } while (0); |
950 | |
951 | send_fuse_err (this, finh, op_errno); |
952 | gf_fd_put (priv->fdtable, state->fd_no); |
953 | } |
954 | out: |
955 | free_fuse_state (state); |
956 | STACK_DESTROY (frame->root); |
957 | return 0; |
958 | } |
959 | |
960 | static void |
961 | fuse_do_truncate (fuse_state_t *state, size_t size) |
962 | { |
963 | if (state->fd) { |
964 | FUSE_FOP (state, fuse_truncate_cbk, GF_FOP_FTRUNCATE,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 965, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FTRUNCATE; frame-> op = GF_FOP_FTRUNCATE; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state-> resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 965, GF_LOG_ERROR , "xl is NULL"); } while (0); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno ; op_ret = -1; if (GF_FOP_FTRUNCATE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame-> root->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 965, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 965, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 965, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 965, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->ftruncate_cbk) tmp_cbk = fuse_truncate_cbk; _new->root = frame->root; _new-> this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "xl->fops-> ftruncate"; _new->unwind_to = "fuse_truncate_cbk"; pthread_spin_init (&_new->lock , 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame->root->frames.next; _new->prev = &frame->root->frames; if (frame->root->frames .next) frame->root->frames.next->prev = _new; frame-> root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> ftruncate); xl->fops->ftruncate (_new, xl, state->fd , size, state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0) |
965 | ftruncate, state->fd, size, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 965, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FTRUNCATE; frame-> op = GF_FOP_FTRUNCATE; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state-> resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 965, GF_LOG_ERROR , "xl is NULL"); } while (0); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno ; op_ret = -1; if (GF_FOP_FTRUNCATE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame-> root->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 965, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 965, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 965, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 965, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->ftruncate_cbk) tmp_cbk = fuse_truncate_cbk; _new->root = frame->root; _new-> this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "xl->fops-> ftruncate"; _new->unwind_to = "fuse_truncate_cbk"; pthread_spin_init (&_new->lock , 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame->root->frames.next; _new->prev = &frame->root->frames; if (frame->root->frames .next) frame->root->frames.next->prev = _new; frame-> root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> ftruncate); xl->fops->ftruncate (_new, xl, state->fd , size, state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0); |
966 | } else { |
967 | FUSE_FOP (state, fuse_truncate_cbk, GF_FOP_TRUNCATE,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 968, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_TRUNCATE; frame-> op = GF_FOP_TRUNCATE; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state->resolve ); } xl = state->active_subvol; if (!xl) { do { do { if (0 ) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 968, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_TRUNCATE == GF_FOP_LOOKUP) { do { do { if ( 0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 968, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 968, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 968, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 968, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->truncate_cbk) tmp_cbk = fuse_truncate_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> truncate"; _new->unwind_to = "fuse_truncate_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> truncate); xl->fops->truncate (_new, xl, &state-> loc, size, state->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0) |
968 | truncate, &state->loc, size, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 968, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_TRUNCATE; frame-> op = GF_FOP_TRUNCATE; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state->resolve ); } xl = state->active_subvol; if (!xl) { do { do { if (0 ) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 968, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_TRUNCATE == GF_FOP_LOOKUP) { do { do { if ( 0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 968, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 968, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 968, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 968, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->truncate_cbk) tmp_cbk = fuse_truncate_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> truncate"; _new->unwind_to = "fuse_truncate_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> truncate); xl->fops->truncate (_new, xl, &state-> loc, size, state->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0); |
969 | } |
970 | |
971 | return; |
972 | } |
973 | |
974 | static int |
975 | fuse_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
976 | int32_t op_ret, int32_t op_errno, |
977 | struct iatt *statpre, struct iatt *statpost, dict_t *xdata) |
978 | { |
979 | fuse_state_t *state; |
980 | fuse_in_header_t *finh; |
981 | fuse_private_t *priv = NULL((void*)0); |
982 | struct fuse_attr_out fao; |
983 | |
984 | int op_done = 0; |
985 | |
986 | priv = this->private; |
987 | state = frame->root->state; |
988 | finh = state->finh; |
989 | |
990 | fuse_log_eh(this, "op_ret: %d, op_errno: %d, %"PRIu64", %s() %s => "do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"", %s() %s => " "gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, state->loc.inode ? uuid_utoa (state->loc .inode->gfid) : ""); } while (0); _gf_log_eh (__FUNCTION__ ,"op_ret: %d, op_errno: %d, %""l" "u"", %s() %s => " "gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : ""); } while (0); } while ( 0) |
991 | "gfid: %s", op_ret, op_errno, frame->root->unique,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"", %s() %s => " "gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, state->loc.inode ? uuid_utoa (state->loc .inode->gfid) : ""); } while (0); _gf_log_eh (__FUNCTION__ ,"op_ret: %d, op_errno: %d, %""l" "u"", %s() %s => " "gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : ""); } while (0); } while ( 0) |
992 | gf_fop_list[frame->root->op], state->loc.path,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"", %s() %s => " "gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, state->loc.inode ? uuid_utoa (state->loc .inode->gfid) : ""); } while (0); _gf_log_eh (__FUNCTION__ ,"op_ret: %d, op_errno: %d, %""l" "u"", %s() %s => " "gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : ""); } while (0); } while ( 0) |
993 | state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : "")do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"", %s() %s => " "gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, state->loc.inode ? uuid_utoa (state->loc .inode->gfid) : ""); } while (0); _gf_log_eh (__FUNCTION__ ,"op_ret: %d, op_errno: %d, %""l" "u"", %s() %s => " "gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : ""); } while (0); } while ( 0); |
994 | |
995 | if (op_ret == 0) { |
996 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": %s() %s => %""l" "u" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", statpost-> ia_ino); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1000, GF_LOG_TRACE, "%""l" "u"": %s() %s => %" "l" "u", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", statpost ->ia_ino); } while (0) |
997 | "%"PRIu64": %s() %s => %"PRIu64, frame->root->unique,do { do { if (0) printf ("%""l" "u"": %s() %s => %""l" "u" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", statpost-> ia_ino); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1000, GF_LOG_TRACE, "%""l" "u"": %s() %s => %" "l" "u", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", statpost ->ia_ino); } while (0) |
998 | gf_fop_list[frame->root->op],do { do { if (0) printf ("%""l" "u"": %s() %s => %""l" "u" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", statpost-> ia_ino); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1000, GF_LOG_TRACE, "%""l" "u"": %s() %s => %" "l" "u", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", statpost ->ia_ino); } while (0) |
999 | state->loc.path ? state->loc.path : "ERR",do { do { if (0) printf ("%""l" "u"": %s() %s => %""l" "u" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", statpost-> ia_ino); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1000, GF_LOG_TRACE, "%""l" "u"": %s() %s => %" "l" "u", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", statpost ->ia_ino); } while (0) |
1000 | statpost->ia_ino)do { do { if (0) printf ("%""l" "u"": %s() %s => %""l" "u" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", statpost-> ia_ino); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1000, GF_LOG_TRACE, "%""l" "u"": %s() %s => %" "l" "u", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", statpost ->ia_ino); } while (0); |
1001 | |
1002 | statpost->ia_blksize = this->ctx->page_size; |
1003 | gf_fuse_stat2attr (statpost, &fao.attr, priv->enable_ino32); |
1004 | |
1005 | fao.attr_valid = calc_timeout_sec (priv->attribute_timeout); |
1006 | fao.attr_valid_nsec = |
1007 | calc_timeout_nsec (priv->attribute_timeout); |
1008 | |
1009 | if (state->truncate_needed) { |
1010 | fuse_do_truncate (state, state->size); |
1011 | } else { |
1012 | #if FUSE_KERNEL_MINOR_VERSION22 >= 9 |
1013 | priv->proto_minor >= 9 ? |
1014 | send_fuse_obj (this, finh, &fao)send_fuse_data (this, finh, &fao, sizeof (*(&fao))) : |
1015 | send_fuse_data (this, finh, &fao, |
1016 | FUSE_COMPAT_ATTR_OUT_SIZE96); |
1017 | #else |
1018 | send_fuse_obj (this, finh, &fao)send_fuse_data (this, finh, &fao, sizeof (*(&fao))); |
1019 | #endif |
1020 | op_done = 1; |
1021 | } |
1022 | } else { |
1023 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1027, GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0) |
1024 | "%"PRIu64": %s() %s => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1027, GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0) |
1025 | gf_fop_list[frame->root->op],do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1027, GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0) |
1026 | state->loc.path ? state->loc.path : "ERR",do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1027, GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0) |
1027 | strerror (op_errno))do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1027, GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0); |
1028 | |
1029 | send_fuse_err (this, finh, op_errno); |
1030 | op_done = 1; |
1031 | } |
1032 | |
1033 | if (op_done) { |
1034 | free_fuse_state (state); |
1035 | } |
1036 | |
1037 | STACK_DESTROY (frame->root); |
1038 | |
1039 | return 0; |
1040 | } |
1041 | |
1042 | static int32_t |
1043 | fattr_to_gf_set_attr (int32_t valid) |
1044 | { |
1045 | int32_t gf_valid = 0; |
1046 | |
1047 | if (valid & FATTR_MODE(1 << 0)) |
1048 | gf_valid |= GF_SET_ATTR_MODE0x1; |
1049 | |
1050 | if (valid & FATTR_UID(1 << 1)) |
1051 | gf_valid |= GF_SET_ATTR_UID0x2; |
1052 | |
1053 | if (valid & FATTR_GID(1 << 2)) |
1054 | gf_valid |= GF_SET_ATTR_GID0x4; |
1055 | |
1056 | if (valid & FATTR_ATIME(1 << 4)) |
1057 | gf_valid |= GF_SET_ATTR_ATIME0x10; |
1058 | |
1059 | if (valid & FATTR_MTIME(1 << 5)) |
1060 | gf_valid |= GF_SET_ATTR_MTIME0x20; |
1061 | |
1062 | if (valid & FATTR_SIZE(1 << 3)) |
1063 | gf_valid |= GF_SET_ATTR_SIZE0x8; |
1064 | |
1065 | return gf_valid; |
1066 | } |
1067 | |
1068 | #define FATTR_MASK((1 << 3) | (1 << 1) | (1 << 2) | (1 << 4) | (1 << 5) | (1 << 0)) (FATTR_SIZE(1 << 3) \ |
1069 | | FATTR_UID(1 << 1) | FATTR_GID(1 << 2) \ |
1070 | | FATTR_ATIME(1 << 4) | FATTR_MTIME(1 << 5) \ |
1071 | | FATTR_MODE(1 << 0)) |
1072 | |
1073 | void |
1074 | fuse_setattr_resume (fuse_state_t *state) |
1075 | { |
1076 | if (!state->fd && !state->loc.inode) { |
1077 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("%""l" "u"": SETATTR %""l" "u"" (%s) resolution failed" , state->finh->unique, state->finh->nodeid, uuid_utoa (state->resolve.gfid)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1080, GF_LOG_ERROR, "%""l" "u" ": SETATTR %""l" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0) |
1078 | "%"PRIu64": SETATTR %"PRIu64" (%s) resolution failed",do { do { if (0) printf ("%""l" "u"": SETATTR %""l" "u"" (%s) resolution failed" , state->finh->unique, state->finh->nodeid, uuid_utoa (state->resolve.gfid)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1080, GF_LOG_ERROR, "%""l" "u" ": SETATTR %""l" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0) |
1079 | state->finh->unique, state->finh->nodeid,do { do { if (0) printf ("%""l" "u"": SETATTR %""l" "u"" (%s) resolution failed" , state->finh->unique, state->finh->nodeid, uuid_utoa (state->resolve.gfid)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1080, GF_LOG_ERROR, "%""l" "u" ": SETATTR %""l" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0) |
1080 | uuid_utoa (state->resolve.gfid))do { do { if (0) printf ("%""l" "u"": SETATTR %""l" "u"" (%s) resolution failed" , state->finh->unique, state->finh->nodeid, uuid_utoa (state->resolve.gfid)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1080, GF_LOG_ERROR, "%""l" "u" ": SETATTR %""l" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0); |
1081 | send_fuse_err (state->this, state->finh, ENOENT2); |
1082 | free_fuse_state (state); |
1083 | return; |
1084 | } |
1085 | |
1086 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": SETATTR (%""l" "u"")%s" , state->finh->unique, state->finh->nodeid, state ->loc.path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1088, GF_LOG_TRACE, "%""l" "u"": SETATTR (%""l" "u"")%s", state->finh->unique, state->finh->nodeid , state->loc.path); } while (0) |
1087 | "%"PRIu64": SETATTR (%"PRIu64")%s", state->finh->unique,do { do { if (0) printf ("%""l" "u"": SETATTR (%""l" "u"")%s" , state->finh->unique, state->finh->nodeid, state ->loc.path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1088, GF_LOG_TRACE, "%""l" "u"": SETATTR (%""l" "u"")%s", state->finh->unique, state->finh->nodeid , state->loc.path); } while (0) |
1088 | state->finh->nodeid, state->loc.path)do { do { if (0) printf ("%""l" "u"": SETATTR (%""l" "u"")%s" , state->finh->unique, state->finh->nodeid, state ->loc.path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1088, GF_LOG_TRACE, "%""l" "u"": SETATTR (%""l" "u"")%s", state->finh->unique, state->finh->nodeid , state->loc.path); } while (0); |
1089 | |
1090 | #ifdef GF_TEST_FFOP |
1091 | /* this is for calls like 'fchmod()' */ |
1092 | if (!state->fd) |
1093 | state->fd = fd_lookup (state->loc.inode, state->finh->pid); |
1094 | #endif /* GF_TEST_FFOP */ |
1095 | |
1096 | if ((state->valid & (FATTR_MASK((1 << 3) | (1 << 1) | (1 << 2) | (1 << 4) | (1 << 5) | (1 << 0)))) != FATTR_SIZE(1 << 3)) { |
1097 | if (state->fd && |
1098 | !((state->valid & FATTR_ATIME(1 << 4)) || |
1099 | (state->valid & FATTR_MTIME(1 << 5)))) { |
1100 | /* |
1101 | there is no "futimes" call, so don't send |
1102 | fsetattr if ATIME or MTIME is set |
1103 | */ |
1104 | |
1105 | FUSE_FOP (state, fuse_setattr_cbk, GF_FOP_FSETATTR,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1108, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FSETATTR; frame-> op = GF_FOP_FSETATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state->resolve ); } xl = state->active_subvol; if (!xl) { do { do { if (0 ) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1108, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_FSETATTR == GF_FOP_LOOKUP) { do { do { if ( 0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1108, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1108, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1108, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1108, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fsetattr_cbk) tmp_cbk = fuse_setattr_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> fsetattr"; _new->unwind_to = "fuse_setattr_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fsetattr); xl->fops->fsetattr (_new, xl, state->fd, & state->attr, fattr_to_gf_set_attr (state->valid), state ->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0) |
1106 | fsetattr, state->fd, &state->attr,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1108, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FSETATTR; frame-> op = GF_FOP_FSETATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state->resolve ); } xl = state->active_subvol; if (!xl) { do { do { if (0 ) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1108, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_FSETATTR == GF_FOP_LOOKUP) { do { do { if ( 0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1108, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1108, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1108, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1108, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fsetattr_cbk) tmp_cbk = fuse_setattr_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> fsetattr"; _new->unwind_to = "fuse_setattr_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fsetattr); xl->fops->fsetattr (_new, xl, state->fd, & state->attr, fattr_to_gf_set_attr (state->valid), state ->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0) |
1107 | fattr_to_gf_set_attr (state->valid),do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1108, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FSETATTR; frame-> op = GF_FOP_FSETATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state->resolve ); } xl = state->active_subvol; if (!xl) { do { do { if (0 ) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1108, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_FSETATTR == GF_FOP_LOOKUP) { do { do { if ( 0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1108, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1108, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1108, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1108, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fsetattr_cbk) tmp_cbk = fuse_setattr_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> fsetattr"; _new->unwind_to = "fuse_setattr_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fsetattr); xl->fops->fsetattr (_new, xl, state->fd, & state->attr, fattr_to_gf_set_attr (state->valid), state ->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0) |
1108 | state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1108, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FSETATTR; frame-> op = GF_FOP_FSETATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state->resolve ); } xl = state->active_subvol; if (!xl) { do { do { if (0 ) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1108, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_FSETATTR == GF_FOP_LOOKUP) { do { do { if ( 0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1108, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1108, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1108, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1108, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fsetattr_cbk) tmp_cbk = fuse_setattr_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> fsetattr"; _new->unwind_to = "fuse_setattr_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fsetattr); xl->fops->fsetattr (_new, xl, state->fd, & state->attr, fattr_to_gf_set_attr (state->valid), state ->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0); |
1109 | } else { |
1110 | FUSE_FOP (state, fuse_setattr_cbk, GF_FOP_SETATTR,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1113, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_SETATTR; frame->op = GF_FOP_SETATTR; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1113, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_SETATTR == GF_FOP_LOOKUP) { do { do { if (0 ) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1113, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1113, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1113, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1113, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->setattr_cbk) tmp_cbk = fuse_setattr_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> setattr"; _new->unwind_to = "fuse_setattr_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> setattr); xl->fops->setattr (_new, xl, &state->loc , &state->attr, fattr_to_gf_set_attr (state->valid) , state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0) |
1111 | setattr, &state->loc, &state->attr,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1113, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_SETATTR; frame->op = GF_FOP_SETATTR; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1113, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_SETATTR == GF_FOP_LOOKUP) { do { do { if (0 ) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1113, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1113, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1113, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1113, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->setattr_cbk) tmp_cbk = fuse_setattr_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> setattr"; _new->unwind_to = "fuse_setattr_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> setattr); xl->fops->setattr (_new, xl, &state->loc , &state->attr, fattr_to_gf_set_attr (state->valid) , state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0) |
1112 | fattr_to_gf_set_attr (state->valid),do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1113, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_SETATTR; frame->op = GF_FOP_SETATTR; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1113, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_SETATTR == GF_FOP_LOOKUP) { do { do { if (0 ) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1113, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1113, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1113, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1113, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->setattr_cbk) tmp_cbk = fuse_setattr_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> setattr"; _new->unwind_to = "fuse_setattr_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> setattr); xl->fops->setattr (_new, xl, &state->loc , &state->attr, fattr_to_gf_set_attr (state->valid) , state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0) |
1113 | state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1113, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_SETATTR; frame->op = GF_FOP_SETATTR; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1113, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_SETATTR == GF_FOP_LOOKUP) { do { do { if (0 ) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1113, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1113, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1113, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1113, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->setattr_cbk) tmp_cbk = fuse_setattr_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> setattr"; _new->unwind_to = "fuse_setattr_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> setattr); xl->fops->setattr (_new, xl, &state->loc , &state->attr, fattr_to_gf_set_attr (state->valid) , state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0); |
1114 | } |
1115 | } else { |
1116 | fuse_do_truncate (state, state->size); |
1117 | } |
1118 | |
1119 | } |
1120 | |
1121 | static void |
1122 | fuse_setattr (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1123 | { |
1124 | struct fuse_setattr_in *fsi = msg; |
1125 | |
1126 | fuse_private_t *priv = NULL((void*)0); |
1127 | fuse_state_t *state = NULL((void*)0); |
1128 | |
1129 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1129, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1130 | |
1131 | if (fsi->valid & FATTR_FH(1 << 6) && |
1132 | !(fsi->valid & (FATTR_ATIME(1 << 4)|FATTR_MTIME(1 << 5)))) { |
1133 | /* We need no loc if kernel sent us an fd and |
1134 | * we are not fiddling with times */ |
1135 | state->fd = FH_TO_FD (fsi->fh)((((fd_t *)(uintptr_t)(fsi->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fsi->fh)))):((fd_t *) 0)); |
1136 | fuse_resolve_fd_init (state, &state->resolve, state->fd); |
1137 | } else { |
1138 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
1139 | } |
1140 | |
1141 | /* |
1142 | * This is just stub code demonstrating how to retrieve |
1143 | * lock_owner in setattr, according to the FUSE proto. |
1144 | * We do not make use of ATM. Its purpose is supporting |
1145 | * mandatory locking, but getting that right is further |
1146 | * down the road. Cf. |
1147 | * |
1148 | * http://thread.gmane.org/gmane.comp.file-systems.fuse.devel/ |
1149 | * 4962/focus=4982 |
1150 | * |
1151 | * http://git.kernel.org/?p=linux/kernel/git/torvalds/ |
1152 | * linux-2.6.git;a=commit;h=v2.6.23-5896-gf333211 |
1153 | */ |
1154 | priv = this->private; |
1155 | #if FUSE_KERNEL_MINOR_VERSION22 >= 9 |
1156 | if (priv->proto_minor >= 9 && fsi->valid & FATTR_LOCKOWNER(1 << 9)) |
1157 | state->lk_owner = fsi->lock_owner; |
1158 | #endif |
1159 | |
1160 | state->valid = fsi->valid; |
1161 | |
1162 | if ((fsi->valid & (FATTR_MASK((1 << 3) | (1 << 1) | (1 << 2) | (1 << 4) | (1 << 5) | (1 << 0)))) != FATTR_SIZE(1 << 3)) { |
1163 | if (fsi->valid & FATTR_SIZE(1 << 3)) { |
1164 | state->size = fsi->size; |
1165 | state->truncate_needed = _gf_true; |
1166 | } |
1167 | |
1168 | state->attr.ia_size = fsi->size; |
1169 | state->attr.ia_atime = fsi->atime; |
1170 | state->attr.ia_mtime = fsi->mtime; |
1171 | state->attr.ia_atime_nsec = fsi->atimensec; |
1172 | state->attr.ia_mtime_nsec = fsi->mtimensec; |
1173 | |
1174 | state->attr.ia_prot = ia_prot_from_st_mode (fsi->mode); |
1175 | state->attr.ia_uid = fsi->uid; |
1176 | state->attr.ia_gid = fsi->gid; |
1177 | } else { |
1178 | state->size = fsi->size; |
1179 | } |
1180 | |
1181 | fuse_resolve_and_resume (state, fuse_setattr_resume); |
1182 | } |
1183 | |
1184 | static int |
1185 | fuse_err_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1186 | int32_t op_ret, int32_t op_errno, dict_t *xdata) |
1187 | { |
1188 | fuse_state_t *state = frame->root->state; |
1189 | fuse_in_header_t *finh = state->finh; |
1190 | |
1191 | fuse_log_eh_fop(this, state, frame, op_ret, op_errno)do { if (this->history) { if (state->fd) do { do { if ( 0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->fd, uuid_utoa (state->fd-> inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->fd, uuid_utoa (state->fd->inode->gfid)); } while (0); else do { do { if (0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, uuid_utoa (state->loc.gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, uuid_utoa (state->loc .gfid)); } while (0); } } while(0); |
1192 | |
1193 | if (op_ret == 0) { |
1194 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": %s() %s => 0", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path ? state->loc.path : "ERR"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1197, GF_LOG_TRACE , "%""l" "u"": %s() %s => 0", frame->root->unique, gf_fop_list [frame->root->op], state->loc.path ? state->loc.path : "ERR"); } while (0) |
1195 | "%"PRIu64": %s() %s => 0", frame->root->unique,do { do { if (0) printf ("%""l" "u"": %s() %s => 0", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path ? state->loc.path : "ERR"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1197, GF_LOG_TRACE , "%""l" "u"": %s() %s => 0", frame->root->unique, gf_fop_list [frame->root->op], state->loc.path ? state->loc.path : "ERR"); } while (0) |
1196 | gf_fop_list[frame->root->op],do { do { if (0) printf ("%""l" "u"": %s() %s => 0", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path ? state->loc.path : "ERR"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1197, GF_LOG_TRACE , "%""l" "u"": %s() %s => 0", frame->root->unique, gf_fop_list [frame->root->op], state->loc.path ? state->loc.path : "ERR"); } while (0) |
1197 | state->loc.path ? state->loc.path : "ERR")do { do { if (0) printf ("%""l" "u"": %s() %s => 0", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path ? state->loc.path : "ERR"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1197, GF_LOG_TRACE , "%""l" "u"": %s() %s => 0", frame->root->unique, gf_fop_list [frame->root->op], state->loc.path ? state->loc.path : "ERR"); } while (0); |
1198 | |
1199 | send_fuse_err (this, finh, 0); |
1200 | } else { |
1201 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1206, GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0) |
1202 | "%"PRIu64": %s() %s => -1 (%s)",do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1206, GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0) |
1203 | frame->root->unique,do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1206, GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0) |
1204 | gf_fop_list[frame->root->op],do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1206, GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0) |
1205 | state->loc.path ? state->loc.path : "ERR",do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1206, GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0) |
1206 | strerror (op_errno))do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1206, GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path ? state->loc.path : "ERR", strerror ( op_errno)); } while (0); |
1207 | |
1208 | send_fuse_err (this, finh, op_errno); |
1209 | } |
1210 | |
1211 | free_fuse_state (state); |
1212 | STACK_DESTROY (frame->root); |
1213 | |
1214 | return 0; |
1215 | } |
1216 | |
1217 | static int |
1218 | fuse_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1219 | int32_t op_ret, int32_t op_errno, struct iatt *prebuf, |
1220 | struct iatt *postbuf, dict_t *xdata) |
1221 | { |
1222 | return fuse_err_cbk (frame, cookie, this, op_ret, op_errno, xdata); |
1223 | } |
1224 | |
1225 | static int |
1226 | fuse_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1227 | int32_t op_ret, int32_t op_errno, dict_t *xdata) |
1228 | { |
1229 | if (op_ret == -1 && op_errno == ENOTSUP95) |
1230 | GF_LOG_OCCASIONALLY (gf_fuse_xattr_enotsup_log,if (!(gf_fuse_xattr_enotsup_log++%42)) { do { do { if (0) printf ("extended attribute not supported " "by the backend storage" ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1233, GF_LOG_CRITICAL, "extended attribute not supported " "by the backend storage" ); } while (0); } |
1231 | "glusterfs-fuse", GF_LOG_CRITICAL,if (!(gf_fuse_xattr_enotsup_log++%42)) { do { do { if (0) printf ("extended attribute not supported " "by the backend storage" ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1233, GF_LOG_CRITICAL, "extended attribute not supported " "by the backend storage" ); } while (0); } |
1232 | "extended attribute not supported "if (!(gf_fuse_xattr_enotsup_log++%42)) { do { do { if (0) printf ("extended attribute not supported " "by the backend storage" ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1233, GF_LOG_CRITICAL, "extended attribute not supported " "by the backend storage" ); } while (0); } |
1233 | "by the backend storage")if (!(gf_fuse_xattr_enotsup_log++%42)) { do { do { if (0) printf ("extended attribute not supported " "by the backend storage" ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1233, GF_LOG_CRITICAL, "extended attribute not supported " "by the backend storage" ); } while (0); }; |
1234 | |
1235 | return fuse_err_cbk (frame, cookie, this, op_ret, op_errno, xdata); |
1236 | } |
1237 | |
1238 | static int |
1239 | fuse_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1240 | int32_t op_ret, int32_t op_errno, struct iatt *preparent, |
1241 | struct iatt *postparent, dict_t *xdata) |
1242 | { |
1243 | fuse_state_t *state = NULL((void*)0); |
1244 | fuse_in_header_t *finh = NULL((void*)0); |
1245 | |
1246 | state = frame->root->state; |
1247 | finh = state->finh; |
1248 | |
1249 | fuse_log_eh (this, "op_ret: %d, op_errno: %d, %"PRIu64": %s() %s => "do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"": %s() %s => " "gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, state->loc.inode ? uuid_utoa (state->loc .inode->gfid) : ""); } while (0); _gf_log_eh (__FUNCTION__ ,"op_ret: %d, op_errno: %d, %""l" "u"": %s() %s => " "gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : ""); } while (0); } while ( 0) |
1250 | "gfid: %s", op_ret, op_errno, frame->root->unique,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"": %s() %s => " "gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, state->loc.inode ? uuid_utoa (state->loc .inode->gfid) : ""); } while (0); _gf_log_eh (__FUNCTION__ ,"op_ret: %d, op_errno: %d, %""l" "u"": %s() %s => " "gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : ""); } while (0); } while ( 0) |
1251 | gf_fop_list[frame->root->op], state->loc.path,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"": %s() %s => " "gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, state->loc.inode ? uuid_utoa (state->loc .inode->gfid) : ""); } while (0); _gf_log_eh (__FUNCTION__ ,"op_ret: %d, op_errno: %d, %""l" "u"": %s() %s => " "gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : ""); } while (0); } while ( 0) |
1252 | state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : "")do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"": %s() %s => " "gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, state->loc.inode ? uuid_utoa (state->loc .inode->gfid) : ""); } while (0); _gf_log_eh (__FUNCTION__ ,"op_ret: %d, op_errno: %d, %""l" "u"": %s() %s => " "gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : ""); } while (0); } while ( 0); |
1253 | |
1254 | if (op_ret == 0) { |
1255 | inode_unlink (state->loc.inode, state->loc.parent, |
1256 | state->loc.name); |
1257 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": %s() %s => 0", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1259, GF_LOG_TRACE, "%""l" "u"": %s() %s => 0" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path); } while (0) |
1258 | "%"PRIu64": %s() %s => 0", frame->root->unique,do { do { if (0) printf ("%""l" "u"": %s() %s => 0", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1259, GF_LOG_TRACE, "%""l" "u"": %s() %s => 0" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path); } while (0) |
1259 | gf_fop_list[frame->root->op], state->loc.path)do { do { if (0) printf ("%""l" "u"": %s() %s => 0", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1259, GF_LOG_TRACE, "%""l" "u"": %s() %s => 0" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path); } while (0); |
1260 | |
1261 | send_fuse_err (this, finh, 0); |
1262 | } else { |
1263 | gf_log ("glusterfs-fuse",do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1267, op_errno == 39 ? GF_LOG_DEBUG : GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0) |
1264 | op_errno == ENOTEMPTY ? GF_LOG_DEBUG : GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1267, op_errno == 39 ? GF_LOG_DEBUG : GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0) |
1265 | "%"PRIu64": %s() %s => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1267, op_errno == 39 ? GF_LOG_DEBUG : GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0) |
1266 | gf_fop_list[frame->root->op], state->loc.path,do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1267, op_errno == 39 ? GF_LOG_DEBUG : GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0) |
1267 | strerror (op_errno))do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1267, op_errno == 39 ? GF_LOG_DEBUG : GF_LOG_WARNING, "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0); |
1268 | |
1269 | send_fuse_err (this, finh, op_errno); |
1270 | } |
1271 | |
1272 | free_fuse_state (state); |
1273 | STACK_DESTROY (frame->root); |
1274 | |
1275 | return 0; |
1276 | } |
1277 | |
1278 | void |
1279 | fuse_access_resume (fuse_state_t *state) |
1280 | { |
1281 | if (!state->loc.inode) { |
1282 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("%""l" "u"": ACCESS %""l" "u"" (%s) resolution failed" , state->finh->unique, state->finh->nodeid, uuid_utoa (state->resolve.gfid)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1285, GF_LOG_ERROR, "%""l" "u" ": ACCESS %""l" "u"" (%s) resolution failed", state->finh-> unique, state->finh->nodeid, uuid_utoa (state->resolve .gfid)); } while (0) |
1283 | "%"PRIu64": ACCESS %"PRIu64" (%s) resolution failed",do { do { if (0) printf ("%""l" "u"": ACCESS %""l" "u"" (%s) resolution failed" , state->finh->unique, state->finh->nodeid, uuid_utoa (state->resolve.gfid)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1285, GF_LOG_ERROR, "%""l" "u" ": ACCESS %""l" "u"" (%s) resolution failed", state->finh-> unique, state->finh->nodeid, uuid_utoa (state->resolve .gfid)); } while (0) |
1284 | state->finh->unique, state->finh->nodeid,do { do { if (0) printf ("%""l" "u"": ACCESS %""l" "u"" (%s) resolution failed" , state->finh->unique, state->finh->nodeid, uuid_utoa (state->resolve.gfid)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1285, GF_LOG_ERROR, "%""l" "u" ": ACCESS %""l" "u"" (%s) resolution failed", state->finh-> unique, state->finh->nodeid, uuid_utoa (state->resolve .gfid)); } while (0) |
1285 | uuid_utoa (state->resolve.gfid))do { do { if (0) printf ("%""l" "u"": ACCESS %""l" "u"" (%s) resolution failed" , state->finh->unique, state->finh->nodeid, uuid_utoa (state->resolve.gfid)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1285, GF_LOG_ERROR, "%""l" "u" ": ACCESS %""l" "u"" (%s) resolution failed", state->finh-> unique, state->finh->nodeid, uuid_utoa (state->resolve .gfid)); } while (0); |
1286 | send_fuse_err (state->this, state->finh, ENOENT2); |
1287 | free_fuse_state (state); |
1288 | return; |
1289 | } |
1290 | |
1291 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"" ACCESS %s/%""l" "u"" mask=%d" , state->finh->unique, state->loc.path, state->finh ->nodeid, state->mask); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1294, GF_LOG_TRACE, "%""l" "u" " ACCESS %s/%""l" "u"" mask=%d", state->finh->unique, state ->loc.path, state->finh->nodeid, state->mask); } while (0) |
1292 | "%"PRIu64" ACCESS %s/%"PRIu64" mask=%d",do { do { if (0) printf ("%""l" "u"" ACCESS %s/%""l" "u"" mask=%d" , state->finh->unique, state->loc.path, state->finh ->nodeid, state->mask); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1294, GF_LOG_TRACE, "%""l" "u" " ACCESS %s/%""l" "u"" mask=%d", state->finh->unique, state ->loc.path, state->finh->nodeid, state->mask); } while (0) |
1293 | state->finh->unique, state->loc.path,do { do { if (0) printf ("%""l" "u"" ACCESS %s/%""l" "u"" mask=%d" , state->finh->unique, state->loc.path, state->finh ->nodeid, state->mask); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1294, GF_LOG_TRACE, "%""l" "u" " ACCESS %s/%""l" "u"" mask=%d", state->finh->unique, state ->loc.path, state->finh->nodeid, state->mask); } while (0) |
1294 | state->finh->nodeid, state->mask)do { do { if (0) printf ("%""l" "u"" ACCESS %s/%""l" "u"" mask=%d" , state->finh->unique, state->loc.path, state->finh ->nodeid, state->mask); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1294, GF_LOG_TRACE, "%""l" "u" " ACCESS %s/%""l" "u"" mask=%d", state->finh->unique, state ->loc.path, state->finh->nodeid, state->mask); } while (0); |
1295 | |
1296 | FUSE_FOP (state, fuse_err_cbk, GF_FOP_ACCESS, access,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1297, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_ACCESS; frame->op = GF_FOP_ACCESS; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1297, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_ACCESS == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root-> unique, gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1297, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1297, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1297, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1297, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->access_cbk) tmp_cbk = fuse_err_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->access"; _new->unwind_to = "fuse_err_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> access); xl->fops->access (_new, xl, &state->loc , state->mask, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0) |
1297 | &state->loc, state->mask, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1297, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_ACCESS; frame->op = GF_FOP_ACCESS; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1297, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_ACCESS == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root-> unique, gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1297, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1297, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1297, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1297, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->access_cbk) tmp_cbk = fuse_err_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->access"; _new->unwind_to = "fuse_err_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> access); xl->fops->access (_new, xl, &state->loc , state->mask, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0); |
1298 | } |
1299 | |
1300 | static void |
1301 | fuse_access (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1302 | { |
1303 | struct fuse_access_in *fai = msg; |
1304 | fuse_state_t *state = NULL((void*)0); |
1305 | |
1306 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1306, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1307 | |
1308 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
1309 | |
1310 | state->mask = fai->mask; |
1311 | |
1312 | fuse_resolve_and_resume (state, fuse_access_resume); |
1313 | |
1314 | return; |
1315 | } |
1316 | |
1317 | static int |
1318 | fuse_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1319 | int32_t op_ret, int32_t op_errno, const char *linkname, |
1320 | struct iatt *buf, dict_t *xdata) |
1321 | { |
1322 | fuse_state_t *state = NULL((void*)0); |
1323 | fuse_in_header_t *finh = NULL((void*)0); |
1324 | |
1325 | state = frame->root->state; |
1326 | finh = state->finh; |
1327 | |
1328 | fuse_log_eh (this, "op_ret: %d, op_errno: %d %"PRIu64": %s() => %s"do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d %" "l" "u"": %s() => %s" " linkname: %s, gfid: %s", op_ret, op_errno , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.gfid, linkname, uuid_utoa (state->loc.gfid )); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d %" "l" "u"": %s() => %s" " linkname: %s, gfid: %s", op_ret, op_errno , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.gfid, linkname, uuid_utoa (state->loc.gfid )); } while (0); } while (0) |
1329 | " linkname: %s, gfid: %s", op_ret, op_errno,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d %" "l" "u"": %s() => %s" " linkname: %s, gfid: %s", op_ret, op_errno , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.gfid, linkname, uuid_utoa (state->loc.gfid )); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d %" "l" "u"": %s() => %s" " linkname: %s, gfid: %s", op_ret, op_errno , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.gfid, linkname, uuid_utoa (state->loc.gfid )); } while (0); } while (0) |
1330 | frame->root->unique, gf_fop_list[frame->root->op],do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d %" "l" "u"": %s() => %s" " linkname: %s, gfid: %s", op_ret, op_errno , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.gfid, linkname, uuid_utoa (state->loc.gfid )); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d %" "l" "u"": %s() => %s" " linkname: %s, gfid: %s", op_ret, op_errno , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.gfid, linkname, uuid_utoa (state->loc.gfid )); } while (0); } while (0) |
1331 | state->loc.gfid, linkname,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d %" "l" "u"": %s() => %s" " linkname: %s, gfid: %s", op_ret, op_errno , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.gfid, linkname, uuid_utoa (state->loc.gfid )); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d %" "l" "u"": %s() => %s" " linkname: %s, gfid: %s", op_ret, op_errno , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.gfid, linkname, uuid_utoa (state->loc.gfid )); } while (0); } while (0) |
1332 | uuid_utoa (state->loc.gfid))do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d %" "l" "u"": %s() => %s" " linkname: %s, gfid: %s", op_ret, op_errno , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.gfid, linkname, uuid_utoa (state->loc.gfid )); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d %" "l" "u"": %s() => %s" " linkname: %s, gfid: %s", op_ret, op_errno , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.gfid, linkname, uuid_utoa (state->loc.gfid )); } while (0); } while (0); |
1333 | |
1334 | if (op_ret > 0) { |
1335 | ((char *)linkname)[op_ret] = '\0'; |
1336 | |
1337 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": %s => %s", frame-> root->unique, state->loc.path, linkname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1339, GF_LOG_TRACE , "%""l" "u"": %s => %s", frame->root->unique, state ->loc.path, linkname); } while (0) |
1338 | "%"PRIu64": %s => %s", frame->root->unique,do { do { if (0) printf ("%""l" "u"": %s => %s", frame-> root->unique, state->loc.path, linkname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1339, GF_LOG_TRACE , "%""l" "u"": %s => %s", frame->root->unique, state ->loc.path, linkname); } while (0) |
1339 | state->loc.path, linkname)do { do { if (0) printf ("%""l" "u"": %s => %s", frame-> root->unique, state->loc.path, linkname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1339, GF_LOG_TRACE , "%""l" "u"": %s => %s", frame->root->unique, state ->loc.path, linkname); } while (0); |
1340 | |
1341 | send_fuse_data (this, finh, (void *)linkname, op_ret + 1); |
1342 | } else { |
1343 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": %s => -1 (%s)", frame ->root->unique, state->loc.path, strerror (op_errno) ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1345, GF_LOG_WARNING, "%""l" "u"": %s => -1 (%s)", frame ->root->unique, state->loc.path, strerror (op_errno) ); } while (0) |
1344 | "%"PRIu64": %s => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""l" "u"": %s => -1 (%s)", frame ->root->unique, state->loc.path, strerror (op_errno) ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1345, GF_LOG_WARNING, "%""l" "u"": %s => -1 (%s)", frame ->root->unique, state->loc.path, strerror (op_errno) ); } while (0) |
1345 | state->loc.path, strerror (op_errno))do { do { if (0) printf ("%""l" "u"": %s => -1 (%s)", frame ->root->unique, state->loc.path, strerror (op_errno) ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1345, GF_LOG_WARNING, "%""l" "u"": %s => -1 (%s)", frame ->root->unique, state->loc.path, strerror (op_errno) ); } while (0); |
1346 | |
1347 | send_fuse_err (this, finh, op_errno); |
1348 | } |
1349 | |
1350 | free_fuse_state (state); |
1351 | STACK_DESTROY (frame->root); |
1352 | |
1353 | return 0; |
1354 | } |
1355 | |
1356 | void |
1357 | fuse_readlink_resume (fuse_state_t *state) |
1358 | { |
1359 | if (!state->loc.inode) { |
1360 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("READLINK %""l" "u"" (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1362, GF_LOG_ERROR, "READLINK %""l" "u"" (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0) |
1361 | "READLINK %"PRIu64" (%s) resolution failed",do { do { if (0) printf ("READLINK %""l" "u"" (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1362, GF_LOG_ERROR, "READLINK %""l" "u"" (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0) |
1362 | state->finh->unique, uuid_utoa (state->resolve.gfid))do { do { if (0) printf ("READLINK %""l" "u"" (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1362, GF_LOG_ERROR, "READLINK %""l" "u"" (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); |
1363 | send_fuse_err (state->this, state->finh, ENOENT2); |
1364 | free_fuse_state (state); |
1365 | return; |
1366 | } |
1367 | |
1368 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"" READLINK %s/%s", state-> finh->unique, state->loc.path, uuid_utoa (state->loc .inode->gfid)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1370, GF_LOG_TRACE, "%""l" "u"" READLINK %s/%s" , state->finh->unique, state->loc.path, uuid_utoa (state ->loc.inode->gfid)); } while (0) |
1369 | "%"PRIu64" READLINK %s/%s", state->finh->unique,do { do { if (0) printf ("%""l" "u"" READLINK %s/%s", state-> finh->unique, state->loc.path, uuid_utoa (state->loc .inode->gfid)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1370, GF_LOG_TRACE, "%""l" "u"" READLINK %s/%s" , state->finh->unique, state->loc.path, uuid_utoa (state ->loc.inode->gfid)); } while (0) |
1370 | state->loc.path, uuid_utoa (state->loc.inode->gfid))do { do { if (0) printf ("%""l" "u"" READLINK %s/%s", state-> finh->unique, state->loc.path, uuid_utoa (state->loc .inode->gfid)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1370, GF_LOG_TRACE, "%""l" "u"" READLINK %s/%s" , state->finh->unique, state->loc.path, uuid_utoa (state ->loc.inode->gfid)); } while (0); |
1371 | |
1372 | FUSE_FOP (state, fuse_readlink_cbk, GF_FOP_READLINK,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1373, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_READLINK; frame-> op = GF_FOP_READLINK; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state->resolve ); } xl = state->active_subvol; if (!xl) { do { do { if (0 ) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1373, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_READLINK == GF_FOP_LOOKUP) { do { do { if ( 0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1373, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1373, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1373, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1373, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->readlink_cbk) tmp_cbk = fuse_readlink_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> readlink"; _new->unwind_to = "fuse_readlink_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> readlink); xl->fops->readlink (_new, xl, &state-> loc, 4096, state->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0) |
1373 | readlink, &state->loc, 4096, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1373, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_READLINK; frame-> op = GF_FOP_READLINK; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state->resolve ); } xl = state->active_subvol; if (!xl) { do { do { if (0 ) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1373, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_READLINK == GF_FOP_LOOKUP) { do { do { if ( 0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1373, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1373, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1373, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1373, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->readlink_cbk) tmp_cbk = fuse_readlink_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> readlink"; _new->unwind_to = "fuse_readlink_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> readlink); xl->fops->readlink (_new, xl, &state-> loc, 4096, state->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0); |
1374 | } |
1375 | |
1376 | static void |
1377 | fuse_readlink (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1378 | { |
1379 | fuse_state_t *state = NULL((void*)0); |
1380 | |
1381 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1381, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1382 | |
1383 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
1384 | |
1385 | fuse_resolve_and_resume (state, fuse_readlink_resume); |
1386 | |
1387 | return; |
1388 | } |
1389 | |
1390 | void |
1391 | fuse_mknod_resume (fuse_state_t *state) |
1392 | { |
1393 | if (!state->loc.parent) { |
1394 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("MKNOD %""l" "u""/%s (%s/%s) resolution failed" , state->finh->nodeid, state->resolve.bname, uuid_utoa (state->resolve.gfid), state->resolve.bname); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1397, GF_LOG_ERROR, "MKNOD %""l" "u""/%s (%s/%s) resolution failed" , state->finh->nodeid, state->resolve.bname, uuid_utoa (state->resolve.gfid), state->resolve.bname); } while ( 0) |
1395 | "MKNOD %"PRIu64"/%s (%s/%s) resolution failed",do { do { if (0) printf ("MKNOD %""l" "u""/%s (%s/%s) resolution failed" , state->finh->nodeid, state->resolve.bname, uuid_utoa (state->resolve.gfid), state->resolve.bname); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1397, GF_LOG_ERROR, "MKNOD %""l" "u""/%s (%s/%s) resolution failed" , state->finh->nodeid, state->resolve.bname, uuid_utoa (state->resolve.gfid), state->resolve.bname); } while ( 0) |
1396 | state->finh->nodeid, state->resolve.bname,do { do { if (0) printf ("MKNOD %""l" "u""/%s (%s/%s) resolution failed" , state->finh->nodeid, state->resolve.bname, uuid_utoa (state->resolve.gfid), state->resolve.bname); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1397, GF_LOG_ERROR, "MKNOD %""l" "u""/%s (%s/%s) resolution failed" , state->finh->nodeid, state->resolve.bname, uuid_utoa (state->resolve.gfid), state->resolve.bname); } while ( 0) |
1397 | uuid_utoa (state->resolve.gfid), state->resolve.bname)do { do { if (0) printf ("MKNOD %""l" "u""/%s (%s/%s) resolution failed" , state->finh->nodeid, state->resolve.bname, uuid_utoa (state->resolve.gfid), state->resolve.bname); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1397, GF_LOG_ERROR, "MKNOD %""l" "u""/%s (%s/%s) resolution failed" , state->finh->nodeid, state->resolve.bname, uuid_utoa (state->resolve.gfid), state->resolve.bname); } while ( 0); |
1398 | send_fuse_err (state->this, state->finh, ENOENT2); |
1399 | free_fuse_state (state); |
1400 | return; |
1401 | } |
1402 | |
1403 | if (state->resolve.op_errno == ENOENT2) { |
1404 | state->resolve.op_ret = 0; |
1405 | state->resolve.op_errno = 0; |
1406 | } |
1407 | |
1408 | if (state->loc.inode) { |
1409 | gf_log (state->this->name, GF_LOG_DEBUG, "inode already present")do { do { if (0) printf ("inode already present"); } while (0 ); _gf_log (state->this->name, "fuse-bridge.c", __FUNCTION__ , 1409, GF_LOG_DEBUG, "inode already present"); } while (0); |
1410 | inode_unref (state->loc.inode); |
1411 | state->loc.inode = NULL((void*)0); |
1412 | } |
1413 | |
1414 | state->loc.inode = inode_new (state->loc.parent->table); |
1415 | |
1416 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": MKNOD %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1418, GF_LOG_TRACE, "%""l" "u" ": MKNOD %s", state->finh->unique, state->loc.path); } while (0) |
1417 | "%"PRIu64": MKNOD %s", state->finh->unique,do { do { if (0) printf ("%""l" "u"": MKNOD %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1418, GF_LOG_TRACE, "%""l" "u" ": MKNOD %s", state->finh->unique, state->loc.path); } while (0) |
1418 | state->loc.path)do { do { if (0) printf ("%""l" "u"": MKNOD %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1418, GF_LOG_TRACE, "%""l" "u" ": MKNOD %s", state->finh->unique, state->loc.path); } while (0); |
1419 | |
1420 | FUSE_FOP (state, fuse_newentry_cbk, GF_FOP_MKNOD,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1422, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_MKNOD; frame->op = GF_FOP_MKNOD; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1422, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_MKNOD == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1422, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1422, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1422, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1422, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->mknod_cbk) tmp_cbk = fuse_newentry_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> mknod"; _new->unwind_to = "fuse_newentry_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> mknod); xl->fops->mknod (_new, xl, &state->loc, state ->mode, state->rdev, state->umask, state->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0) |
1421 | mknod, &state->loc, state->mode, state->rdev, state->umask,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1422, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_MKNOD; frame->op = GF_FOP_MKNOD; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1422, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_MKNOD == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1422, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1422, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1422, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1422, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->mknod_cbk) tmp_cbk = fuse_newentry_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> mknod"; _new->unwind_to = "fuse_newentry_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> mknod); xl->fops->mknod (_new, xl, &state->loc, state ->mode, state->rdev, state->umask, state->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0) |
1422 | state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1422, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_MKNOD; frame->op = GF_FOP_MKNOD; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1422, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_MKNOD == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1422, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1422, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1422, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1422, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->mknod_cbk) tmp_cbk = fuse_newentry_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> mknod"; _new->unwind_to = "fuse_newentry_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> mknod); xl->fops->mknod (_new, xl, &state->loc, state ->mode, state->rdev, state->umask, state->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0); |
1423 | } |
1424 | |
1425 | static void |
1426 | fuse_mknod (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1427 | { |
1428 | struct fuse_mknod_in *fmi = msg; |
1429 | char *name = (char *)(fmi + 1); |
1430 | |
1431 | fuse_state_t *state = NULL((void*)0); |
1432 | fuse_private_t *priv = NULL((void*)0); |
1433 | int32_t ret = -1; |
1434 | |
1435 | priv = this->private; |
1436 | #if FUSE_KERNEL_MINOR_VERSION22 >= 12 |
1437 | if (priv->proto_minor < 12) |
1438 | name = (char *)msg + FUSE_COMPAT_MKNOD_IN_SIZE8; |
1439 | #endif |
1440 | |
1441 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1441, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1442 | |
1443 | uuid_generate (state->gfid); |
1444 | |
1445 | fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, name); |
1446 | |
1447 | state->mode = fmi->mode; |
1448 | state->rdev = fmi->rdev; |
1449 | |
1450 | priv = this->private; |
1451 | #if FUSE_KERNEL_MINOR_VERSION22 >=12 |
1452 | FUSE_ENTRY_CREATE(this, priv, finh, state, fmi, "MKNOD")do { if (priv->proto_minor >= 12) state->mode &= ~fmi->umask; if (priv->proto_minor >= 12 && priv->acl) { state->xdata = dict_new (); if (!state-> xdata) { do { do { if (0) printf ("%s failed to allocate " "a param dictionary" , "MKNOD"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1452, GF_LOG_WARNING, "%s failed to allocate " "a param dictionary", "MKNOD"); } while (0); send_fuse_err ( this, finh, 12); free_fuse_state (state); return; } state-> umask = fmi->umask; ret = dict_set_int16 (state->xdata, "umask", fmi->umask); if (ret < 0) { do { do { if (0) printf ("%s Failed adding umask" " to request", "MKNOD"); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1452, GF_LOG_WARNING, "%s Failed adding umask" " to request" , "MKNOD"); } while (0); dict_destroy (state->xdata); send_fuse_err (this, finh, 12); free_fuse_state (state); return; } ret = dict_set_int16 (state->xdata, "mode", fmi->mode); if (ret < 0) { do { do { if (0) printf ("%s Failed adding mode " "to request", "MKNOD"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1452, GF_LOG_WARNING, "%s Failed adding mode " "to request", "MKNOD"); } while (0); dict_destroy (state-> xdata); send_fuse_err (this, finh, 12); free_fuse_state (state ); return; } } } while (0); |
1453 | #endif |
1454 | |
1455 | fuse_resolve_and_resume (state, fuse_mknod_resume); |
1456 | |
1457 | return; |
1458 | } |
1459 | |
1460 | void |
1461 | fuse_mkdir_resume (fuse_state_t *state) |
1462 | { |
1463 | if (!state->loc.parent) { |
1464 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("MKDIR %""l" "u"" (%s/%s) resolution failed" , state->finh->nodeid, uuid_utoa (state->resolve.gfid ), state->resolve.bname); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1467, GF_LOG_ERROR, "MKDIR %" "l" "u"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1465 | "MKDIR %"PRIu64" (%s/%s) resolution failed",do { do { if (0) printf ("MKDIR %""l" "u"" (%s/%s) resolution failed" , state->finh->nodeid, uuid_utoa (state->resolve.gfid ), state->resolve.bname); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1467, GF_LOG_ERROR, "MKDIR %" "l" "u"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1466 | state->finh->nodeid, uuid_utoa (state->resolve.gfid),do { do { if (0) printf ("MKDIR %""l" "u"" (%s/%s) resolution failed" , state->finh->nodeid, uuid_utoa (state->resolve.gfid ), state->resolve.bname); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1467, GF_LOG_ERROR, "MKDIR %" "l" "u"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1467 | state->resolve.bname)do { do { if (0) printf ("MKDIR %""l" "u"" (%s/%s) resolution failed" , state->finh->nodeid, uuid_utoa (state->resolve.gfid ), state->resolve.bname); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1467, GF_LOG_ERROR, "MKDIR %" "l" "u"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0); |
1468 | send_fuse_err (state->this, state->finh, ENOENT2); |
1469 | free_fuse_state (state); |
1470 | return; |
1471 | } |
1472 | |
1473 | if (state->resolve.op_errno == ENOENT2) { |
1474 | state->resolve.op_ret = 0; |
1475 | state->resolve.op_errno = 0; |
1476 | } |
1477 | |
1478 | if (state->loc.inode) { |
1479 | gf_log (state->this->name, GF_LOG_DEBUG, "inode already present")do { do { if (0) printf ("inode already present"); } while (0 ); _gf_log (state->this->name, "fuse-bridge.c", __FUNCTION__ , 1479, GF_LOG_DEBUG, "inode already present"); } while (0); |
1480 | inode_unref (state->loc.inode); |
1481 | state->loc.inode = NULL((void*)0); |
1482 | } |
1483 | |
1484 | state->loc.inode = inode_new (state->loc.parent->table); |
1485 | |
1486 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": MKDIR %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1488, GF_LOG_TRACE, "%""l" "u" ": MKDIR %s", state->finh->unique, state->loc.path); } while (0) |
1487 | "%"PRIu64": MKDIR %s", state->finh->unique,do { do { if (0) printf ("%""l" "u"": MKDIR %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1488, GF_LOG_TRACE, "%""l" "u" ": MKDIR %s", state->finh->unique, state->loc.path); } while (0) |
1488 | state->loc.path)do { do { if (0) printf ("%""l" "u"": MKDIR %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1488, GF_LOG_TRACE, "%""l" "u" ": MKDIR %s", state->finh->unique, state->loc.path); } while (0); |
1489 | |
1490 | FUSE_FOP (state, fuse_newentry_cbk, GF_FOP_MKDIR,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1491, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_MKDIR; frame->op = GF_FOP_MKDIR; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1491, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_MKDIR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1491, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1491, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1491, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1491, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->mkdir_cbk) tmp_cbk = fuse_newentry_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> mkdir"; _new->unwind_to = "fuse_newentry_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> mkdir); xl->fops->mkdir (_new, xl, &state->loc, state ->mode, state->umask, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0) |
1491 | mkdir, &state->loc, state->mode, state->umask, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1491, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_MKDIR; frame->op = GF_FOP_MKDIR; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1491, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_MKDIR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1491, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1491, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1491, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1491, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->mkdir_cbk) tmp_cbk = fuse_newentry_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> mkdir"; _new->unwind_to = "fuse_newentry_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> mkdir); xl->fops->mkdir (_new, xl, &state->loc, state ->mode, state->umask, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0); |
1492 | } |
1493 | |
1494 | static void |
1495 | fuse_mkdir (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1496 | { |
1497 | struct fuse_mkdir_in *fmi = msg; |
1498 | char *name = (char *)(fmi + 1); |
1499 | fuse_private_t *priv = NULL((void*)0); |
1500 | |
1501 | fuse_state_t *state; |
1502 | int32_t ret = -1; |
1503 | |
1504 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1504, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1505 | |
1506 | uuid_generate (state->gfid); |
1507 | |
1508 | fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, name); |
1509 | |
1510 | state->mode = fmi->mode; |
1511 | |
1512 | priv = this->private; |
1513 | #if FUSE_KERNEL_MINOR_VERSION22 >=12 |
1514 | FUSE_ENTRY_CREATE(this, priv, finh, state, fmi, "MKDIR")do { if (priv->proto_minor >= 12) state->mode &= ~fmi->umask; if (priv->proto_minor >= 12 && priv->acl) { state->xdata = dict_new (); if (!state-> xdata) { do { do { if (0) printf ("%s failed to allocate " "a param dictionary" , "MKDIR"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1514, GF_LOG_WARNING, "%s failed to allocate " "a param dictionary", "MKDIR"); } while (0); send_fuse_err ( this, finh, 12); free_fuse_state (state); return; } state-> umask = fmi->umask; ret = dict_set_int16 (state->xdata, "umask", fmi->umask); if (ret < 0) { do { do { if (0) printf ("%s Failed adding umask" " to request", "MKDIR"); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1514, GF_LOG_WARNING, "%s Failed adding umask" " to request" , "MKDIR"); } while (0); dict_destroy (state->xdata); send_fuse_err (this, finh, 12); free_fuse_state (state); return; } ret = dict_set_int16 (state->xdata, "mode", fmi->mode); if (ret < 0) { do { do { if (0) printf ("%s Failed adding mode " "to request", "MKDIR"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1514, GF_LOG_WARNING, "%s Failed adding mode " "to request", "MKDIR"); } while (0); dict_destroy (state-> xdata); send_fuse_err (this, finh, 12); free_fuse_state (state ); return; } } } while (0); |
1515 | #endif |
1516 | |
1517 | fuse_resolve_and_resume (state, fuse_mkdir_resume); |
1518 | |
1519 | return; |
1520 | } |
1521 | |
1522 | void |
1523 | fuse_unlink_resume (fuse_state_t *state) |
1524 | { |
1525 | if (!state->loc.parent || !state->loc.inode) { |
1526 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("UNLINK %""l" "u"" (%s/%s) resolution failed" , state->finh->nodeid, uuid_utoa (state->resolve.gfid ), state->resolve.bname); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1529, GF_LOG_ERROR, "UNLINK %" "l" "u"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1527 | "UNLINK %"PRIu64" (%s/%s) resolution failed",do { do { if (0) printf ("UNLINK %""l" "u"" (%s/%s) resolution failed" , state->finh->nodeid, uuid_utoa (state->resolve.gfid ), state->resolve.bname); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1529, GF_LOG_ERROR, "UNLINK %" "l" "u"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1528 | state->finh->nodeid, uuid_utoa (state->resolve.gfid),do { do { if (0) printf ("UNLINK %""l" "u"" (%s/%s) resolution failed" , state->finh->nodeid, uuid_utoa (state->resolve.gfid ), state->resolve.bname); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1529, GF_LOG_ERROR, "UNLINK %" "l" "u"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1529 | state->resolve.bname)do { do { if (0) printf ("UNLINK %""l" "u"" (%s/%s) resolution failed" , state->finh->nodeid, uuid_utoa (state->resolve.gfid ), state->resolve.bname); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1529, GF_LOG_ERROR, "UNLINK %" "l" "u"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0); |
1530 | send_fuse_err (state->this, state->finh, ENOENT2); |
1531 | free_fuse_state (state); |
1532 | return; |
1533 | } |
1534 | |
1535 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": UNLINK %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1537, GF_LOG_TRACE, "%""l" "u" ": UNLINK %s", state->finh->unique, state->loc.path) ; } while (0) |
1536 | "%"PRIu64": UNLINK %s", state->finh->unique,do { do { if (0) printf ("%""l" "u"": UNLINK %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1537, GF_LOG_TRACE, "%""l" "u" ": UNLINK %s", state->finh->unique, state->loc.path) ; } while (0) |
1537 | state->loc.path)do { do { if (0) printf ("%""l" "u"": UNLINK %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1537, GF_LOG_TRACE, "%""l" "u" ": UNLINK %s", state->finh->unique, state->loc.path) ; } while (0); |
1538 | |
1539 | FUSE_FOP (state, fuse_unlink_cbk, GF_FOP_UNLINK,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1540, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_UNLINK; frame->op = GF_FOP_UNLINK; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1540, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_UNLINK == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root-> unique, gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1540, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1540, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1540, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1540, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->unlink_cbk) tmp_cbk = fuse_unlink_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> unlink"; _new->unwind_to = "fuse_unlink_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> unlink); xl->fops->unlink (_new, xl, &state->loc , 0, state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0) |
1540 | unlink, &state->loc, 0, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1540, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_UNLINK; frame->op = GF_FOP_UNLINK; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1540, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_UNLINK == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root-> unique, gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1540, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1540, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1540, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1540, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->unlink_cbk) tmp_cbk = fuse_unlink_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> unlink"; _new->unwind_to = "fuse_unlink_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> unlink); xl->fops->unlink (_new, xl, &state->loc , 0, state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0); |
1541 | } |
1542 | |
1543 | static void |
1544 | fuse_unlink (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1545 | { |
1546 | char *name = msg; |
1547 | fuse_state_t *state = NULL((void*)0); |
1548 | |
1549 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1549, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1550 | |
1551 | fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, name); |
1552 | |
1553 | fuse_resolve_and_resume (state, fuse_unlink_resume); |
1554 | |
1555 | return; |
1556 | } |
1557 | |
1558 | void |
1559 | fuse_rmdir_resume (fuse_state_t *state) |
1560 | { |
1561 | if (!state->loc.parent || !state->loc.inode) { |
1562 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("RMDIR %""l" "u"" (%s/%s) resolution failed" , state->finh->nodeid, uuid_utoa (state->resolve.gfid ), state->resolve.bname); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1565, GF_LOG_ERROR, "RMDIR %" "l" "u"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1563 | "RMDIR %"PRIu64" (%s/%s) resolution failed",do { do { if (0) printf ("RMDIR %""l" "u"" (%s/%s) resolution failed" , state->finh->nodeid, uuid_utoa (state->resolve.gfid ), state->resolve.bname); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1565, GF_LOG_ERROR, "RMDIR %" "l" "u"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1564 | state->finh->nodeid, uuid_utoa (state->resolve.gfid),do { do { if (0) printf ("RMDIR %""l" "u"" (%s/%s) resolution failed" , state->finh->nodeid, uuid_utoa (state->resolve.gfid ), state->resolve.bname); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1565, GF_LOG_ERROR, "RMDIR %" "l" "u"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1565 | state->resolve.bname)do { do { if (0) printf ("RMDIR %""l" "u"" (%s/%s) resolution failed" , state->finh->nodeid, uuid_utoa (state->resolve.gfid ), state->resolve.bname); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1565, GF_LOG_ERROR, "RMDIR %" "l" "u"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0); |
1566 | send_fuse_err (state->this, state->finh, ENOENT2); |
1567 | free_fuse_state (state); |
1568 | return; |
1569 | } |
1570 | |
1571 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": RMDIR %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1573, GF_LOG_TRACE, "%""l" "u" ": RMDIR %s", state->finh->unique, state->loc.path); } while (0) |
1572 | "%"PRIu64": RMDIR %s", state->finh->unique,do { do { if (0) printf ("%""l" "u"": RMDIR %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1573, GF_LOG_TRACE, "%""l" "u" ": RMDIR %s", state->finh->unique, state->loc.path); } while (0) |
1573 | state->loc.path)do { do { if (0) printf ("%""l" "u"": RMDIR %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1573, GF_LOG_TRACE, "%""l" "u" ": RMDIR %s", state->finh->unique, state->loc.path); } while (0); |
1574 | |
1575 | FUSE_FOP (state, fuse_unlink_cbk, GF_FOP_RMDIR,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1576, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_RMDIR; frame->op = GF_FOP_RMDIR; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1576, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_RMDIR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1576, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1576, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1576, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1576, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->rmdir_cbk) tmp_cbk = fuse_unlink_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> rmdir"; _new->unwind_to = "fuse_unlink_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> rmdir); xl->fops->rmdir (_new, xl, &state->loc, 0 , state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0) |
1576 | rmdir, &state->loc, 0, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1576, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_RMDIR; frame->op = GF_FOP_RMDIR; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1576, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_RMDIR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1576, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1576, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1576, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1576, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->rmdir_cbk) tmp_cbk = fuse_unlink_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> rmdir"; _new->unwind_to = "fuse_unlink_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> rmdir); xl->fops->rmdir (_new, xl, &state->loc, 0 , state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0); |
1577 | } |
1578 | |
1579 | static void |
1580 | fuse_rmdir (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1581 | { |
1582 | char *name = msg; |
1583 | fuse_state_t *state = NULL((void*)0); |
1584 | |
1585 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1585, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1586 | |
1587 | fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, name); |
1588 | |
1589 | fuse_resolve_and_resume (state, fuse_rmdir_resume); |
1590 | |
1591 | return; |
1592 | } |
1593 | |
1594 | void |
1595 | fuse_symlink_resume (fuse_state_t *state) |
1596 | { |
1597 | if (!state->loc.parent) { |
1598 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("SYMLINK %""l" "u"" (%s/%s) -> %s resolution failed" , state->finh->nodeid, uuid_utoa (state->resolve.gfid ), state->resolve.bname, state->name); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1601, GF_LOG_ERROR , "SYMLINK %""l" "u"" (%s/%s) -> %s resolution failed", state ->finh->nodeid, uuid_utoa (state->resolve.gfid), state ->resolve.bname, state->name); } while (0) |
1599 | "SYMLINK %"PRIu64" (%s/%s) -> %s resolution failed",do { do { if (0) printf ("SYMLINK %""l" "u"" (%s/%s) -> %s resolution failed" , state->finh->nodeid, uuid_utoa (state->resolve.gfid ), state->resolve.bname, state->name); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1601, GF_LOG_ERROR , "SYMLINK %""l" "u"" (%s/%s) -> %s resolution failed", state ->finh->nodeid, uuid_utoa (state->resolve.gfid), state ->resolve.bname, state->name); } while (0) |
1600 | state->finh->nodeid, uuid_utoa (state->resolve.gfid),do { do { if (0) printf ("SYMLINK %""l" "u"" (%s/%s) -> %s resolution failed" , state->finh->nodeid, uuid_utoa (state->resolve.gfid ), state->resolve.bname, state->name); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1601, GF_LOG_ERROR , "SYMLINK %""l" "u"" (%s/%s) -> %s resolution failed", state ->finh->nodeid, uuid_utoa (state->resolve.gfid), state ->resolve.bname, state->name); } while (0) |
1601 | state->resolve.bname, state->name)do { do { if (0) printf ("SYMLINK %""l" "u"" (%s/%s) -> %s resolution failed" , state->finh->nodeid, uuid_utoa (state->resolve.gfid ), state->resolve.bname, state->name); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1601, GF_LOG_ERROR , "SYMLINK %""l" "u"" (%s/%s) -> %s resolution failed", state ->finh->nodeid, uuid_utoa (state->resolve.gfid), state ->resolve.bname, state->name); } while (0); |
1602 | send_fuse_err (state->this, state->finh, ENOENT2); |
1603 | free_fuse_state (state); |
1604 | return; |
1605 | } |
1606 | |
1607 | if (state->resolve.op_errno == ENOENT2) { |
1608 | state->resolve.op_ret = 0; |
1609 | state->resolve.op_errno = 0; |
1610 | } |
1611 | |
1612 | if (state->loc.inode) { |
1613 | gf_log (state->this->name, GF_LOG_DEBUG, "inode already present")do { do { if (0) printf ("inode already present"); } while (0 ); _gf_log (state->this->name, "fuse-bridge.c", __FUNCTION__ , 1613, GF_LOG_DEBUG, "inode already present"); } while (0); |
1614 | inode_unref (state->loc.inode); |
1615 | state->loc.inode = NULL((void*)0); |
1616 | } |
1617 | |
1618 | state->loc.inode = inode_new (state->loc.parent->table); |
1619 | |
1620 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": SYMLINK %s -> %s", state ->finh->unique, state->loc.path, state->name); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1622, GF_LOG_TRACE, "%""l" "u"": SYMLINK %s -> %s", state ->finh->unique, state->loc.path, state->name); } while (0) |
1621 | "%"PRIu64": SYMLINK %s -> %s", state->finh->unique,do { do { if (0) printf ("%""l" "u"": SYMLINK %s -> %s", state ->finh->unique, state->loc.path, state->name); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1622, GF_LOG_TRACE, "%""l" "u"": SYMLINK %s -> %s", state ->finh->unique, state->loc.path, state->name); } while (0) |
1622 | state->loc.path, state->name)do { do { if (0) printf ("%""l" "u"": SYMLINK %s -> %s", state ->finh->unique, state->loc.path, state->name); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1622, GF_LOG_TRACE, "%""l" "u"": SYMLINK %s -> %s", state ->finh->unique, state->loc.path, state->name); } while (0); |
1623 | |
1624 | FUSE_FOP (state, fuse_newentry_cbk, GF_FOP_SYMLINK,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1625, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_SYMLINK; frame->op = GF_FOP_SYMLINK; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1625, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_SYMLINK == GF_FOP_LOOKUP) { do { do { if (0 ) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1625, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1625, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1625, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1625, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->symlink_cbk) tmp_cbk = fuse_newentry_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> symlink"; _new->unwind_to = "fuse_newentry_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> symlink); xl->fops->symlink (_new, xl, state->name, & state->loc, state->umask, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0) |
1625 | symlink, state->name, &state->loc, state->umask, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1625, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_SYMLINK; frame->op = GF_FOP_SYMLINK; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1625, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_SYMLINK == GF_FOP_LOOKUP) { do { do { if (0 ) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1625, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1625, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1625, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1625, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->symlink_cbk) tmp_cbk = fuse_newentry_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> symlink"; _new->unwind_to = "fuse_newentry_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> symlink); xl->fops->symlink (_new, xl, state->name, & state->loc, state->umask, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0); |
1626 | } |
1627 | |
1628 | static void |
1629 | fuse_symlink (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1630 | { |
1631 | char *name = msg; |
1632 | char *linkname = name + strlen (name) + 1; |
1633 | fuse_state_t *state = NULL((void*)0); |
1634 | |
1635 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1635, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1636 | |
1637 | uuid_generate (state->gfid); |
1638 | |
1639 | fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, name); |
1640 | |
1641 | state->name = gf_strdup (linkname); |
1642 | |
1643 | fuse_resolve_and_resume (state, fuse_symlink_resume); |
1644 | |
1645 | return; |
1646 | } |
1647 | |
1648 | int |
1649 | fuse_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1650 | int32_t op_ret, int32_t op_errno, struct iatt *buf, |
1651 | struct iatt *preoldparent, struct iatt *postoldparent, |
1652 | struct iatt *prenewparent, struct iatt *postnewparent, |
1653 | dict_t *xdata) |
1654 | { |
1655 | fuse_state_t *state = NULL((void*)0); |
1656 | fuse_in_header_t *finh = NULL((void*)0); |
1657 | |
1658 | state = frame->root->state; |
1659 | finh = state->finh; |
1660 | |
1661 | fuse_log_eh (this, "op_ret: %d, op_errno: %d, %"PRIu64": %s() "do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"": %s() " "path: %s parent: %s ==> path: %s parent: %s" "gfid: %s", op_ret, op_errno, frame->root->unique, gf_fop_list [frame->root->op], state->loc.path, state->loc.parent ?uuid_utoa (state->loc.parent->gfid):"", state->loc2 .path, state->loc2.parent?uuid_utoa (state->loc2.parent ->gfid):"", state->loc.inode?uuid_utoa (state->loc.inode ->gfid):""); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, %" "l" "u"": %s() " "path: %s parent: %s ==> path: %s parent: %s" "gfid: %s", op_ret, op_errno, frame->root->unique, gf_fop_list [frame->root->op], state->loc.path, state->loc.parent ?uuid_utoa (state->loc.parent->gfid):"", state->loc2 .path, state->loc2.parent?uuid_utoa (state->loc2.parent ->gfid):"", state->loc.inode?uuid_utoa (state->loc.inode ->gfid):""); } while (0); } while (0) |
1662 | "path: %s parent: %s ==> path: %s parent: %s"do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"": %s() " "path: %s parent: %s ==> path: %s parent: %s" "gfid: %s", op_ret, op_errno, frame->root->unique, gf_fop_list [frame->root->op], state->loc.path, state->loc.parent ?uuid_utoa (state->loc.parent->gfid):"", state->loc2 .path, state->loc2.parent?uuid_utoa (state->loc2.parent ->gfid):"", state->loc.inode?uuid_utoa (state->loc.inode ->gfid):""); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, %" "l" "u"": %s() " "path: %s parent: %s ==> path: %s parent: %s" "gfid: %s", op_ret, op_errno, frame->root->unique, gf_fop_list [frame->root->op], state->loc.path, state->loc.parent ?uuid_utoa (state->loc.parent->gfid):"", state->loc2 .path, state->loc2.parent?uuid_utoa (state->loc2.parent ->gfid):"", state->loc.inode?uuid_utoa (state->loc.inode ->gfid):""); } while (0); } while (0) |
1663 | "gfid: %s", op_ret, op_errno, frame->root->unique,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"": %s() " "path: %s parent: %s ==> path: %s parent: %s" "gfid: %s", op_ret, op_errno, frame->root->unique, gf_fop_list [frame->root->op], state->loc.path, state->loc.parent ?uuid_utoa (state->loc.parent->gfid):"", state->loc2 .path, state->loc2.parent?uuid_utoa (state->loc2.parent ->gfid):"", state->loc.inode?uuid_utoa (state->loc.inode ->gfid):""); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, %" "l" "u"": %s() " "path: %s parent: %s ==> path: %s parent: %s" "gfid: %s", op_ret, op_errno, frame->root->unique, gf_fop_list [frame->root->op], state->loc.path, state->loc.parent ?uuid_utoa (state->loc.parent->gfid):"", state->loc2 .path, state->loc2.parent?uuid_utoa (state->loc2.parent ->gfid):"", state->loc.inode?uuid_utoa (state->loc.inode ->gfid):""); } while (0); } while (0) |
1664 | gf_fop_list[frame->root->op], state->loc.path,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"": %s() " "path: %s parent: %s ==> path: %s parent: %s" "gfid: %s", op_ret, op_errno, frame->root->unique, gf_fop_list [frame->root->op], state->loc.path, state->loc.parent ?uuid_utoa (state->loc.parent->gfid):"", state->loc2 .path, state->loc2.parent?uuid_utoa (state->loc2.parent ->gfid):"", state->loc.inode?uuid_utoa (state->loc.inode ->gfid):""); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, %" "l" "u"": %s() " "path: %s parent: %s ==> path: %s parent: %s" "gfid: %s", op_ret, op_errno, frame->root->unique, gf_fop_list [frame->root->op], state->loc.path, state->loc.parent ?uuid_utoa (state->loc.parent->gfid):"", state->loc2 .path, state->loc2.parent?uuid_utoa (state->loc2.parent ->gfid):"", state->loc.inode?uuid_utoa (state->loc.inode ->gfid):""); } while (0); } while (0) |
1665 | state->loc.parent?uuid_utoa (state->loc.parent->gfid):"",do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"": %s() " "path: %s parent: %s ==> path: %s parent: %s" "gfid: %s", op_ret, op_errno, frame->root->unique, gf_fop_list [frame->root->op], state->loc.path, state->loc.parent ?uuid_utoa (state->loc.parent->gfid):"", state->loc2 .path, state->loc2.parent?uuid_utoa (state->loc2.parent ->gfid):"", state->loc.inode?uuid_utoa (state->loc.inode ->gfid):""); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, %" "l" "u"": %s() " "path: %s parent: %s ==> path: %s parent: %s" "gfid: %s", op_ret, op_errno, frame->root->unique, gf_fop_list [frame->root->op], state->loc.path, state->loc.parent ?uuid_utoa (state->loc.parent->gfid):"", state->loc2 .path, state->loc2.parent?uuid_utoa (state->loc2.parent ->gfid):"", state->loc.inode?uuid_utoa (state->loc.inode ->gfid):""); } while (0); } while (0) |
1666 | state->loc2.path,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"": %s() " "path: %s parent: %s ==> path: %s parent: %s" "gfid: %s", op_ret, op_errno, frame->root->unique, gf_fop_list [frame->root->op], state->loc.path, state->loc.parent ?uuid_utoa (state->loc.parent->gfid):"", state->loc2 .path, state->loc2.parent?uuid_utoa (state->loc2.parent ->gfid):"", state->loc.inode?uuid_utoa (state->loc.inode ->gfid):""); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, %" "l" "u"": %s() " "path: %s parent: %s ==> path: %s parent: %s" "gfid: %s", op_ret, op_errno, frame->root->unique, gf_fop_list [frame->root->op], state->loc.path, state->loc.parent ?uuid_utoa (state->loc.parent->gfid):"", state->loc2 .path, state->loc2.parent?uuid_utoa (state->loc2.parent ->gfid):"", state->loc.inode?uuid_utoa (state->loc.inode ->gfid):""); } while (0); } while (0) |
1667 | state->loc2.parent?uuid_utoa (state->loc2.parent->gfid):"",do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"": %s() " "path: %s parent: %s ==> path: %s parent: %s" "gfid: %s", op_ret, op_errno, frame->root->unique, gf_fop_list [frame->root->op], state->loc.path, state->loc.parent ?uuid_utoa (state->loc.parent->gfid):"", state->loc2 .path, state->loc2.parent?uuid_utoa (state->loc2.parent ->gfid):"", state->loc.inode?uuid_utoa (state->loc.inode ->gfid):""); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, %" "l" "u"": %s() " "path: %s parent: %s ==> path: %s parent: %s" "gfid: %s", op_ret, op_errno, frame->root->unique, gf_fop_list [frame->root->op], state->loc.path, state->loc.parent ?uuid_utoa (state->loc.parent->gfid):"", state->loc2 .path, state->loc2.parent?uuid_utoa (state->loc2.parent ->gfid):"", state->loc.inode?uuid_utoa (state->loc.inode ->gfid):""); } while (0); } while (0) |
1668 | state->loc.inode?uuid_utoa (state->loc.inode->gfid):"")do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"": %s() " "path: %s parent: %s ==> path: %s parent: %s" "gfid: %s", op_ret, op_errno, frame->root->unique, gf_fop_list [frame->root->op], state->loc.path, state->loc.parent ?uuid_utoa (state->loc.parent->gfid):"", state->loc2 .path, state->loc2.parent?uuid_utoa (state->loc2.parent ->gfid):"", state->loc.inode?uuid_utoa (state->loc.inode ->gfid):""); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, %" "l" "u"": %s() " "path: %s parent: %s ==> path: %s parent: %s" "gfid: %s", op_ret, op_errno, frame->root->unique, gf_fop_list [frame->root->op], state->loc.path, state->loc.parent ?uuid_utoa (state->loc.parent->gfid):"", state->loc2 .path, state->loc2.parent?uuid_utoa (state->loc2.parent ->gfid):"", state->loc.inode?uuid_utoa (state->loc.inode ->gfid):""); } while (0); } while (0); |
1669 | |
1670 | if (op_ret == 0) { |
1671 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": %s -> %s => 0 (buf->ia_ino=%" "l" "u"")", frame->root->unique, state->loc.path, state ->loc2.path, buf->ia_ino); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1674, GF_LOG_TRACE, "%""l" "u" ": %s -> %s => 0 (buf->ia_ino=%""l" "u"")", frame-> root->unique, state->loc.path, state->loc2.path, buf ->ia_ino); } while (0) |
1672 | "%"PRIu64": %s -> %s => 0 (buf->ia_ino=%"PRIu64")",do { do { if (0) printf ("%""l" "u"": %s -> %s => 0 (buf->ia_ino=%" "l" "u"")", frame->root->unique, state->loc.path, state ->loc2.path, buf->ia_ino); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1674, GF_LOG_TRACE, "%""l" "u" ": %s -> %s => 0 (buf->ia_ino=%""l" "u"")", frame-> root->unique, state->loc.path, state->loc2.path, buf ->ia_ino); } while (0) |
1673 | frame->root->unique, state->loc.path, state->loc2.path,do { do { if (0) printf ("%""l" "u"": %s -> %s => 0 (buf->ia_ino=%" "l" "u"")", frame->root->unique, state->loc.path, state ->loc2.path, buf->ia_ino); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1674, GF_LOG_TRACE, "%""l" "u" ": %s -> %s => 0 (buf->ia_ino=%""l" "u"")", frame-> root->unique, state->loc.path, state->loc2.path, buf ->ia_ino); } while (0) |
1674 | buf->ia_ino)do { do { if (0) printf ("%""l" "u"": %s -> %s => 0 (buf->ia_ino=%" "l" "u"")", frame->root->unique, state->loc.path, state ->loc2.path, buf->ia_ino); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1674, GF_LOG_TRACE, "%""l" "u" ": %s -> %s => 0 (buf->ia_ino=%""l" "u"")", frame-> root->unique, state->loc.path, state->loc2.path, buf ->ia_ino); } while (0); |
1675 | |
1676 | { |
1677 | /* ugly ugly - to stay blind to situation where |
1678 | rename happens on a new inode |
1679 | */ |
1680 | buf->ia_type = state->loc.inode->ia_type; |
1681 | } |
1682 | buf->ia_blksize = this->ctx->page_size; |
1683 | |
1684 | inode_rename (state->loc.parent->table, |
1685 | state->loc.parent, state->loc.name, |
1686 | state->loc2.parent, state->loc2.name, |
1687 | state->loc.inode, buf); |
1688 | |
1689 | send_fuse_err (this, finh, 0); |
1690 | } else { |
1691 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": %s -> %s => -1 (%s)" , frame->root->unique, state->loc.path, state->loc2 .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1694, GF_LOG_WARNING, "%""l" "u"": %s -> %s => -1 (%s)", frame->root->unique, state->loc.path, state->loc2.path, strerror (op_errno) ); } while (0) |
1692 | "%"PRIu64": %s -> %s => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""l" "u"": %s -> %s => -1 (%s)" , frame->root->unique, state->loc.path, state->loc2 .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1694, GF_LOG_WARNING, "%""l" "u"": %s -> %s => -1 (%s)", frame->root->unique, state->loc.path, state->loc2.path, strerror (op_errno) ); } while (0) |
1693 | state->loc.path, state->loc2.path,do { do { if (0) printf ("%""l" "u"": %s -> %s => -1 (%s)" , frame->root->unique, state->loc.path, state->loc2 .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1694, GF_LOG_WARNING, "%""l" "u"": %s -> %s => -1 (%s)", frame->root->unique, state->loc.path, state->loc2.path, strerror (op_errno) ); } while (0) |
1694 | strerror (op_errno))do { do { if (0) printf ("%""l" "u"": %s -> %s => -1 (%s)" , frame->root->unique, state->loc.path, state->loc2 .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1694, GF_LOG_WARNING, "%""l" "u"": %s -> %s => -1 (%s)", frame->root->unique, state->loc.path, state->loc2.path, strerror (op_errno) ); } while (0); |
1695 | send_fuse_err (this, finh, op_errno); |
1696 | } |
1697 | |
1698 | free_fuse_state (state); |
1699 | STACK_DESTROY (frame->root); |
1700 | return 0; |
1701 | } |
1702 | |
1703 | void |
1704 | fuse_rename_resume (fuse_state_t *state) |
1705 | { |
1706 | char loc_uuid[64] = {0,}; |
1707 | char loc2_uuid[64] = {0,}; |
1708 | |
1709 | if (!state->loc.parent || !state->loc.inode) { |
1710 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("RENAME %""l" "u"" %s/%s -> %s/%s src resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1716, GF_LOG_ERROR, "RENAME %""l" "u"" %s/%s -> %s/%s src resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0) |
1711 | "RENAME %"PRIu64" %s/%s -> %s/%s src resolution failed",do { do { if (0) printf ("RENAME %""l" "u"" %s/%s -> %s/%s src resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1716, GF_LOG_ERROR, "RENAME %""l" "u"" %s/%s -> %s/%s src resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0) |
1712 | state->finh->unique,do { do { if (0) printf ("RENAME %""l" "u"" %s/%s -> %s/%s src resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1716, GF_LOG_ERROR, "RENAME %""l" "u"" %s/%s -> %s/%s src resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0) |
1713 | uuid_utoa_r (state->resolve.gfid, loc_uuid),do { do { if (0) printf ("RENAME %""l" "u"" %s/%s -> %s/%s src resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1716, GF_LOG_ERROR, "RENAME %""l" "u"" %s/%s -> %s/%s src resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0) |
1714 | state->resolve.bname,do { do { if (0) printf ("RENAME %""l" "u"" %s/%s -> %s/%s src resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1716, GF_LOG_ERROR, "RENAME %""l" "u"" %s/%s -> %s/%s src resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0) |
1715 | uuid_utoa_r (state->resolve2.gfid, loc2_uuid),do { do { if (0) printf ("RENAME %""l" "u"" %s/%s -> %s/%s src resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1716, GF_LOG_ERROR, "RENAME %""l" "u"" %s/%s -> %s/%s src resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0) |
1716 | state->resolve2.bname)do { do { if (0) printf ("RENAME %""l" "u"" %s/%s -> %s/%s src resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1716, GF_LOG_ERROR, "RENAME %""l" "u"" %s/%s -> %s/%s src resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0); |
1717 | |
1718 | send_fuse_err (state->this, state->finh, ENOENT2); |
1719 | free_fuse_state (state); |
1720 | return; |
1721 | } |
1722 | |
1723 | if (!state->loc2.parent) { |
1724 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("RENAME %""l" "u"" %s/%s -> %s/%s dst resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1730, GF_LOG_ERROR, "RENAME %""l" "u"" %s/%s -> %s/%s dst resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0) |
1725 | "RENAME %"PRIu64" %s/%s -> %s/%s dst resolution failed",do { do { if (0) printf ("RENAME %""l" "u"" %s/%s -> %s/%s dst resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1730, GF_LOG_ERROR, "RENAME %""l" "u"" %s/%s -> %s/%s dst resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0) |
1726 | state->finh->unique,do { do { if (0) printf ("RENAME %""l" "u"" %s/%s -> %s/%s dst resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1730, GF_LOG_ERROR, "RENAME %""l" "u"" %s/%s -> %s/%s dst resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0) |
1727 | uuid_utoa_r (state->resolve.gfid, loc_uuid),do { do { if (0) printf ("RENAME %""l" "u"" %s/%s -> %s/%s dst resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1730, GF_LOG_ERROR, "RENAME %""l" "u"" %s/%s -> %s/%s dst resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0) |
1728 | state->resolve.bname,do { do { if (0) printf ("RENAME %""l" "u"" %s/%s -> %s/%s dst resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1730, GF_LOG_ERROR, "RENAME %""l" "u"" %s/%s -> %s/%s dst resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0) |
1729 | uuid_utoa_r (state->resolve2.gfid, loc2_uuid),do { do { if (0) printf ("RENAME %""l" "u"" %s/%s -> %s/%s dst resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1730, GF_LOG_ERROR, "RENAME %""l" "u"" %s/%s -> %s/%s dst resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0) |
1730 | state->resolve2.bname)do { do { if (0) printf ("RENAME %""l" "u"" %s/%s -> %s/%s dst resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1730, GF_LOG_ERROR, "RENAME %""l" "u"" %s/%s -> %s/%s dst resolution failed" , state->finh->unique, uuid_utoa_r (state->resolve.gfid , loc_uuid), state->resolve.bname, uuid_utoa_r (state-> resolve2.gfid, loc2_uuid), state->resolve2.bname); } while (0); |
1731 | |
1732 | send_fuse_err (state->this, state->finh, ENOENT2); |
1733 | free_fuse_state (state); |
1734 | return; |
1735 | } |
1736 | |
1737 | state->resolve.op_ret = 0; |
1738 | state->resolve2.op_ret = 0; |
1739 | |
1740 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": RENAME `%s (%s)' -> `%s (%s)'" , state->finh->unique, state->loc.path, loc_uuid, state ->loc2.path, loc2_uuid); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1743, GF_LOG_TRACE, "%""l" "u" ": RENAME `%s (%s)' -> `%s (%s)'", state->finh->unique , state->loc.path, loc_uuid, state->loc2.path, loc2_uuid ); } while (0) |
1741 | "%"PRIu64": RENAME `%s (%s)' -> `%s (%s)'",do { do { if (0) printf ("%""l" "u"": RENAME `%s (%s)' -> `%s (%s)'" , state->finh->unique, state->loc.path, loc_uuid, state ->loc2.path, loc2_uuid); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1743, GF_LOG_TRACE, "%""l" "u" ": RENAME `%s (%s)' -> `%s (%s)'", state->finh->unique , state->loc.path, loc_uuid, state->loc2.path, loc2_uuid ); } while (0) |
1742 | state->finh->unique, state->loc.path, loc_uuid,do { do { if (0) printf ("%""l" "u"": RENAME `%s (%s)' -> `%s (%s)'" , state->finh->unique, state->loc.path, loc_uuid, state ->loc2.path, loc2_uuid); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1743, GF_LOG_TRACE, "%""l" "u" ": RENAME `%s (%s)' -> `%s (%s)'", state->finh->unique , state->loc.path, loc_uuid, state->loc2.path, loc2_uuid ); } while (0) |
1743 | state->loc2.path, loc2_uuid)do { do { if (0) printf ("%""l" "u"": RENAME `%s (%s)' -> `%s (%s)'" , state->finh->unique, state->loc.path, loc_uuid, state ->loc2.path, loc2_uuid); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1743, GF_LOG_TRACE, "%""l" "u" ": RENAME `%s (%s)' -> `%s (%s)'", state->finh->unique , state->loc.path, loc_uuid, state->loc2.path, loc2_uuid ); } while (0); |
1744 | |
1745 | FUSE_FOP (state, fuse_rename_cbk, GF_FOP_RENAME,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1746, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_RENAME; frame->op = GF_FOP_RENAME; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1746, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_RENAME == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root-> unique, gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1746, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1746, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1746, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1746, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->rename_cbk) tmp_cbk = fuse_rename_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> rename"; _new->unwind_to = "fuse_rename_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> rename); xl->fops->rename (_new, xl, &state->loc , &state->loc2, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0) |
1746 | rename, &state->loc, &state->loc2, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1746, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_RENAME; frame->op = GF_FOP_RENAME; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1746, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_RENAME == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root-> unique, gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1746, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1746, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1746, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1746, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->rename_cbk) tmp_cbk = fuse_rename_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> rename"; _new->unwind_to = "fuse_rename_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> rename); xl->fops->rename (_new, xl, &state->loc , &state->loc2, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0); |
1747 | } |
1748 | |
1749 | static void |
1750 | fuse_rename (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1751 | { |
1752 | struct fuse_rename_in *fri = msg; |
1753 | char *oldname = (char *)(fri + 1); |
1754 | char *newname = oldname + strlen (oldname) + 1; |
1755 | fuse_state_t *state = NULL((void*)0); |
1756 | |
1757 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1757, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1758 | |
1759 | fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, oldname); |
1760 | |
1761 | fuse_resolve_entry_init (state, &state->resolve2, fri->newdir, newname); |
1762 | |
1763 | fuse_resolve_and_resume (state, fuse_rename_resume); |
1764 | |
1765 | return; |
1766 | } |
1767 | |
1768 | void |
1769 | fuse_link_resume (fuse_state_t *state) |
1770 | { |
1771 | if (!state->loc2.inode || !state->loc.parent) { |
1772 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("fuse_loc_fill() failed %""l" "u"": LINK %s %s" , state->finh->unique, state->loc2.path, state->loc .path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1774, GF_LOG_WARNING, "fuse_loc_fill() failed %" "l" "u"": LINK %s %s", state->finh->unique, state->loc2 .path, state->loc.path); } while (0) |
1773 | "fuse_loc_fill() failed %"PRIu64": LINK %s %s",do { do { if (0) printf ("fuse_loc_fill() failed %""l" "u"": LINK %s %s" , state->finh->unique, state->loc2.path, state->loc .path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1774, GF_LOG_WARNING, "fuse_loc_fill() failed %" "l" "u"": LINK %s %s", state->finh->unique, state->loc2 .path, state->loc.path); } while (0) |
1774 | state->finh->unique, state->loc2.path, state->loc.path)do { do { if (0) printf ("fuse_loc_fill() failed %""l" "u"": LINK %s %s" , state->finh->unique, state->loc2.path, state->loc .path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1774, GF_LOG_WARNING, "fuse_loc_fill() failed %" "l" "u"": LINK %s %s", state->finh->unique, state->loc2 .path, state->loc.path); } while (0); |
1775 | send_fuse_err (state->this, state->finh, ENOENT2); |
1776 | free_fuse_state (state); |
1777 | return; |
1778 | } |
1779 | |
1780 | state->resolve.op_ret = 0; |
1781 | state->resolve2.op_ret = 0; |
1782 | |
1783 | if (state->loc.inode) { |
1784 | inode_unref (state->loc.inode); |
1785 | state->loc.inode = NULL((void*)0); |
1786 | } |
1787 | state->loc.inode = inode_ref (state->loc2.inode); |
1788 | |
1789 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": LINK() %s -> %s", state ->finh->unique, state->loc2.path, state->loc.path ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1792, GF_LOG_TRACE, "%""l" "u"": LINK() %s -> %s", state ->finh->unique, state->loc2.path, state->loc.path ); } while (0) |
1790 | "%"PRIu64": LINK() %s -> %s",do { do { if (0) printf ("%""l" "u"": LINK() %s -> %s", state ->finh->unique, state->loc2.path, state->loc.path ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1792, GF_LOG_TRACE, "%""l" "u"": LINK() %s -> %s", state ->finh->unique, state->loc2.path, state->loc.path ); } while (0) |
1791 | state->finh->unique, state->loc2.path,do { do { if (0) printf ("%""l" "u"": LINK() %s -> %s", state ->finh->unique, state->loc2.path, state->loc.path ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1792, GF_LOG_TRACE, "%""l" "u"": LINK() %s -> %s", state ->finh->unique, state->loc2.path, state->loc.path ); } while (0) |
1792 | state->loc.path)do { do { if (0) printf ("%""l" "u"": LINK() %s -> %s", state ->finh->unique, state->loc2.path, state->loc.path ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1792, GF_LOG_TRACE, "%""l" "u"": LINK() %s -> %s", state ->finh->unique, state->loc2.path, state->loc.path ); } while (0); |
1793 | |
1794 | FUSE_FOP (state, fuse_newentry_cbk, GF_FOP_LINK,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1795, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_LINK; frame->op = GF_FOP_LINK; if ( state->resolve_now ) { resolve = state-> resolve_now; } else { resolve = &(state->resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1795, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_LINK == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1795, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1795, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1795, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1795, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->link_cbk) tmp_cbk = fuse_newentry_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> link"; _new->unwind_to = "fuse_newentry_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> link); xl->fops->link (_new, xl, &state->loc2, & state->loc, state->xdata); (*__glusterfs_this_location( )) = old_THIS; } while (0); } } while (0) |
1795 | link, &state->loc2, &state->loc, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1795, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_LINK; frame->op = GF_FOP_LINK; if ( state->resolve_now ) { resolve = state-> resolve_now; } else { resolve = &(state->resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1795, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_LINK == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1795, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1795, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1795, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1795, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->link_cbk) tmp_cbk = fuse_newentry_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> link"; _new->unwind_to = "fuse_newentry_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> link); xl->fops->link (_new, xl, &state->loc2, & state->loc, state->xdata); (*__glusterfs_this_location( )) = old_THIS; } while (0); } } while (0); |
1796 | } |
1797 | |
1798 | static void |
1799 | fuse_link (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1800 | { |
1801 | struct fuse_link_in *fli = msg; |
1802 | char *name = (char *)(fli + 1); |
1803 | fuse_state_t *state = NULL((void*)0); |
1804 | |
1805 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1805, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1806 | |
1807 | fuse_resolve_inode_init (state, &state->resolve2, fli->oldnodeid); |
1808 | |
1809 | fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, name); |
1810 | |
1811 | fuse_resolve_and_resume (state, fuse_link_resume); |
1812 | |
1813 | return; |
1814 | } |
1815 | |
1816 | static int |
1817 | fuse_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1818 | int32_t op_ret, int32_t op_errno, |
1819 | fd_t *fd, inode_t *inode, struct iatt *buf, |
1820 | struct iatt *preparent, struct iatt *postparent, dict_t *xdata) |
1821 | { |
1822 | fuse_state_t *state = NULL((void*)0); |
1823 | fuse_in_header_t *finh = NULL((void*)0); |
1824 | fuse_private_t *priv = NULL((void*)0); |
1825 | struct fuse_out_header fouh = {0, }; |
1826 | struct fuse_entry_out feo = {0, }; |
1827 | struct fuse_open_out foo = {0, }; |
1828 | struct iovec iov_out[3]; |
1829 | inode_t *linked_inode = NULL((void*)0); |
1830 | |
1831 | state = frame->root->state; |
1832 | priv = this->private; |
1833 | finh = state->finh; |
1834 | foo.open_flags = 0; |
1835 | |
1836 | fuse_log_eh_fop(this, state, frame, op_ret, op_errno)do { if (this->history) { if (state->fd) do { do { if ( 0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->fd, uuid_utoa (state->fd-> inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->fd, uuid_utoa (state->fd->inode->gfid)); } while (0); else do { do { if (0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, uuid_utoa (state->loc.gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, uuid_utoa (state->loc .gfid)); } while (0); } } while(0); |
1837 | |
1838 | if (op_ret >= 0) { |
1839 | foo.fh = (uintptr_t) fd; |
1840 | |
1841 | if (((priv->direct_io_mode == 2) |
1842 | && ((state->flags & O_ACCMODE0003) != O_RDONLY00)) |
1843 | || (priv->direct_io_mode == 1)) |
1844 | foo.open_flags |= FOPEN_DIRECT_IO(1 << 0); |
1845 | |
1846 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": %s() %s => %p (ino=%" "l" "u"")", frame->root->unique, gf_fop_list[frame-> root->op], state->loc.path, fd, buf->ia_ino); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1849, GF_LOG_TRACE, "%""l" "u"": %s() %s => %p (ino=%""l" "u"")", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, fd, buf->ia_ino); } while (0 ) |
1847 | "%"PRIu64": %s() %s => %p (ino=%"PRIu64")",do { do { if (0) printf ("%""l" "u"": %s() %s => %p (ino=%" "l" "u"")", frame->root->unique, gf_fop_list[frame-> root->op], state->loc.path, fd, buf->ia_ino); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1849, GF_LOG_TRACE, "%""l" "u"": %s() %s => %p (ino=%""l" "u"")", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, fd, buf->ia_ino); } while (0 ) |
1848 | frame->root->unique, gf_fop_list[frame->root->op],do { do { if (0) printf ("%""l" "u"": %s() %s => %p (ino=%" "l" "u"")", frame->root->unique, gf_fop_list[frame-> root->op], state->loc.path, fd, buf->ia_ino); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1849, GF_LOG_TRACE, "%""l" "u"": %s() %s => %p (ino=%""l" "u"")", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, fd, buf->ia_ino); } while (0 ) |
1849 | state->loc.path, fd, buf->ia_ino)do { do { if (0) printf ("%""l" "u"": %s() %s => %p (ino=%" "l" "u"")", frame->root->unique, gf_fop_list[frame-> root->op], state->loc.path, fd, buf->ia_ino); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1849, GF_LOG_TRACE, "%""l" "u"": %s() %s => %p (ino=%""l" "u"")", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, fd, buf->ia_ino); } while (0 ); |
1850 | |
1851 | buf->ia_blksize = this->ctx->page_size; |
1852 | gf_fuse_stat2attr (buf, &feo.attr, priv->enable_ino32); |
1853 | |
1854 | linked_inode = inode_link (inode, state->loc.parent, |
1855 | state->loc.name, buf); |
1856 | |
1857 | if (linked_inode != inode) { |
1858 | /* |
1859 | VERY racy code (if used anywhere else) |
1860 | -- don't do this without understanding |
1861 | */ |
1862 | inode_unref (fd->inode); |
1863 | fd->inode = inode_ref (linked_inode); |
1864 | } |
1865 | |
1866 | inode_lookup (linked_inode); |
1867 | |
1868 | inode_unref (linked_inode); |
1869 | |
1870 | feo.nodeid = inode_to_fuse_nodeid (linked_inode); |
1871 | |
1872 | feo.entry_valid = calc_timeout_sec (priv->entry_timeout); |
1873 | feo.entry_valid_nsec = calc_timeout_nsec (priv->entry_timeout); |
1874 | feo.attr_valid = calc_timeout_sec (priv->attribute_timeout); |
1875 | feo.attr_valid_nsec = |
1876 | calc_timeout_nsec (priv->attribute_timeout); |
1877 | |
1878 | fouh.error = 0; |
1879 | iov_out[0].iov_base = &fouh; |
1880 | iov_out[1].iov_base = &feo; |
1881 | #if FUSE_KERNEL_MINOR_VERSION22 >= 9 |
1882 | iov_out[1].iov_len = priv->proto_minor >= 9 ? |
1883 | sizeof (feo) : |
1884 | FUSE_COMPAT_ENTRY_OUT_SIZE120; |
1885 | #else |
1886 | iov_out[1].iov_len = sizeof (feo); |
1887 | #endif |
1888 | iov_out[2].iov_base = &foo; |
1889 | iov_out[2].iov_len = sizeof (foo); |
1890 | |
1891 | if (send_fuse_iov (this, finh, iov_out, 3) == ENOENT2) { |
1892 | gf_log ("glusterfs-fuse", GF_LOG_DEBUG,do { do { if (0) printf ("create(%s) got EINTR", state->loc .path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1893, GF_LOG_DEBUG, "create(%s) got EINTR", state ->loc.path); } while (0) |
1893 | "create(%s) got EINTR", state->loc.path)do { do { if (0) printf ("create(%s) got EINTR", state->loc .path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1893, GF_LOG_DEBUG, "create(%s) got EINTR", state ->loc.path); } while (0); |
1894 | inode_forget (inode, 1); |
1895 | gf_fd_put (priv->fdtable, state->fd_no); |
1896 | goto out; |
1897 | } |
1898 | |
1899 | fd_bind (fd); |
1900 | } else { |
1901 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": %s => -1 (%s)", finh ->unique, state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1903, GF_LOG_WARNING, "%""l" "u"": %s => -1 (%s)", finh-> unique, state->loc.path, strerror (op_errno)); } while (0) |
1902 | "%"PRIu64": %s => -1 (%s)", finh->unique,do { do { if (0) printf ("%""l" "u"": %s => -1 (%s)", finh ->unique, state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1903, GF_LOG_WARNING, "%""l" "u"": %s => -1 (%s)", finh-> unique, state->loc.path, strerror (op_errno)); } while (0) |
1903 | state->loc.path, strerror (op_errno))do { do { if (0) printf ("%""l" "u"": %s => -1 (%s)", finh ->unique, state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1903, GF_LOG_WARNING, "%""l" "u"": %s => -1 (%s)", finh-> unique, state->loc.path, strerror (op_errno)); } while (0); |
1904 | send_fuse_err (this, finh, op_errno); |
1905 | gf_fd_put (priv->fdtable, state->fd_no); |
1906 | } |
1907 | out: |
1908 | free_fuse_state (state); |
1909 | STACK_DESTROY (frame->root); |
1910 | |
1911 | return 0; |
1912 | } |
1913 | |
1914 | void |
1915 | fuse_create_resume (fuse_state_t *state) |
1916 | { |
1917 | fd_t *fd = NULL((void*)0); |
1918 | fuse_private_t *priv = NULL((void*)0); |
1919 | fuse_fd_ctx_t *fdctx = NULL((void*)0); |
1920 | |
1921 | if (!state->loc.parent) { |
1922 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"" CREATE %s/%s resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid ), state->resolve.bname); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1925, GF_LOG_WARNING, "%""l" "u"" CREATE %s/%s resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1923 | "%"PRIu64" CREATE %s/%s resolution failed",do { do { if (0) printf ("%""l" "u"" CREATE %s/%s resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid ), state->resolve.bname); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1925, GF_LOG_WARNING, "%""l" "u"" CREATE %s/%s resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1924 | state->finh->unique, uuid_utoa (state->resolve.gfid),do { do { if (0) printf ("%""l" "u"" CREATE %s/%s resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid ), state->resolve.bname); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1925, GF_LOG_WARNING, "%""l" "u"" CREATE %s/%s resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1925 | state->resolve.bname)do { do { if (0) printf ("%""l" "u"" CREATE %s/%s resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid ), state->resolve.bname); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1925, GF_LOG_WARNING, "%""l" "u"" CREATE %s/%s resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0); |
1926 | send_fuse_err (state->this, state->finh, ENOENT2); |
1927 | free_fuse_state (state); |
1928 | return; |
1929 | } |
1930 | |
1931 | if (state->resolve.op_errno == ENOENT2) { |
1932 | state->resolve.op_ret = 0; |
1933 | state->resolve.op_errno = 0; |
1934 | } |
1935 | |
1936 | if (state->loc.inode) { |
1937 | gf_log (state->this->name, GF_LOG_DEBUG,do { do { if (0) printf ("inode already present"); } while (0 ); _gf_log (state->this->name, "fuse-bridge.c", __FUNCTION__ , 1938, GF_LOG_DEBUG, "inode already present"); } while (0) |
1938 | "inode already present")do { do { if (0) printf ("inode already present"); } while (0 ); _gf_log (state->this->name, "fuse-bridge.c", __FUNCTION__ , 1938, GF_LOG_DEBUG, "inode already present"); } while (0); |
1939 | inode_unref (state->loc.inode); |
1940 | } |
1941 | |
1942 | state->loc.inode = inode_new (state->loc.parent->table); |
1943 | |
1944 | fd = fd_create (state->loc.inode, state->finh->pid); |
1945 | if (fd == NULL((void*)0)) { |
1946 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"" CREATE cannot create a new fd" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1948, GF_LOG_WARNING, "%""l" "u"" CREATE cannot create a new fd", state->finh->unique ); } while (0) |
1947 | "%"PRIu64" CREATE cannot create a new fd",do { do { if (0) printf ("%""l" "u"" CREATE cannot create a new fd" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1948, GF_LOG_WARNING, "%""l" "u"" CREATE cannot create a new fd", state->finh->unique ); } while (0) |
1948 | state->finh->unique)do { do { if (0) printf ("%""l" "u"" CREATE cannot create a new fd" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1948, GF_LOG_WARNING, "%""l" "u"" CREATE cannot create a new fd", state->finh->unique ); } while (0); |
1949 | send_fuse_err (state->this, state->finh, ENOMEM12); |
1950 | free_fuse_state (state); |
1951 | return; |
1952 | } |
1953 | |
1954 | fdctx = fuse_fd_ctx_check_n_create (state->this, fd); |
1955 | if (fdctx == NULL((void*)0)) { |
1956 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"" CREATE creation of fdctx failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1958, GF_LOG_WARNING, "%""l" "u"" CREATE creation of fdctx failed", state->finh->unique ); } while (0) |
1957 | "%"PRIu64" CREATE creation of fdctx failed",do { do { if (0) printf ("%""l" "u"" CREATE creation of fdctx failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1958, GF_LOG_WARNING, "%""l" "u"" CREATE creation of fdctx failed", state->finh->unique ); } while (0) |
1958 | state->finh->unique)do { do { if (0) printf ("%""l" "u"" CREATE creation of fdctx failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1958, GF_LOG_WARNING, "%""l" "u"" CREATE creation of fdctx failed", state->finh->unique ); } while (0); |
1959 | fd_unref (fd); |
1960 | send_fuse_err (state->this, state->finh, ENOMEM12); |
1961 | free_fuse_state (state); |
1962 | return; |
1963 | } |
1964 | |
1965 | priv = state->this->private; |
1966 | |
1967 | state->fd_no = gf_fd_unused_get (priv->fdtable, fd); |
1968 | |
1969 | state->fd = fd_ref (fd); |
1970 | fd->flags = state->flags; |
1971 | |
1972 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": CREATE %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1974, GF_LOG_TRACE, "%""l" "u" ": CREATE %s", state->finh->unique, state->loc.path) ; } while (0) |
1973 | "%"PRIu64": CREATE %s", state->finh->unique,do { do { if (0) printf ("%""l" "u"": CREATE %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1974, GF_LOG_TRACE, "%""l" "u" ": CREATE %s", state->finh->unique, state->loc.path) ; } while (0) |
1974 | state->loc.path)do { do { if (0) printf ("%""l" "u"": CREATE %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1974, GF_LOG_TRACE, "%""l" "u" ": CREATE %s", state->finh->unique, state->loc.path) ; } while (0); |
1975 | |
1976 | FUSE_FOP (state, fuse_create_cbk, GF_FOP_CREATE,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1978, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_CREATE; frame->op = GF_FOP_CREATE; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1978, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_CREATE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root-> unique, gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1978, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1978, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1978, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1978, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->create_cbk) tmp_cbk = fuse_create_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> create"; _new->unwind_to = "fuse_create_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> create); xl->fops->create (_new, xl, &state->loc , state->flags, state->mode, state->umask, fd, state ->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0) |
1977 | create, &state->loc, state->flags, state->mode,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1978, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_CREATE; frame->op = GF_FOP_CREATE; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1978, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_CREATE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root-> unique, gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1978, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1978, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1978, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1978, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->create_cbk) tmp_cbk = fuse_create_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> create"; _new->unwind_to = "fuse_create_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> create); xl->fops->create (_new, xl, &state->loc , state->flags, state->mode, state->umask, fd, state ->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0) |
1978 | state->umask, fd, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1978, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_CREATE; frame->op = GF_FOP_CREATE; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1978, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_CREATE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root-> unique, gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1978, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1978, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1978, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 1978, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->create_cbk) tmp_cbk = fuse_create_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> create"; _new->unwind_to = "fuse_create_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> create); xl->fops->create (_new, xl, &state->loc , state->flags, state->mode, state->umask, fd, state ->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0); |
1979 | |
1980 | } |
1981 | |
1982 | static void |
1983 | fuse_create (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1984 | { |
1985 | #if FUSE_KERNEL_MINOR_VERSION22 >= 12 |
1986 | struct fuse_create_in *fci = msg; |
1987 | #else |
1988 | struct fuse_open_in *fci = msg; |
1989 | #endif |
1990 | char *name = (char *)(fci + 1); |
1991 | |
1992 | fuse_private_t *priv = NULL((void*)0); |
1993 | fuse_state_t *state = NULL((void*)0); |
1994 | int32_t ret = -1; |
1995 | |
1996 | priv = this->private; |
1997 | #if FUSE_KERNEL_MINOR_VERSION22 >= 12 |
1998 | if (priv->proto_minor < 12) |
1999 | name = (char *)((struct fuse_open_in *)msg + 1); |
2000 | #endif |
2001 | |
2002 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2002, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2003 | |
2004 | uuid_generate (state->gfid); |
2005 | |
2006 | fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, name); |
2007 | |
2008 | state->mode = fci->mode; |
2009 | state->flags = fci->flags; |
2010 | |
2011 | priv = this->private; |
2012 | #if FUSE_KERNEL_MINOR_VERSION22 >=12 |
2013 | FUSE_ENTRY_CREATE(this, priv, finh, state, fci, "CREATE")do { if (priv->proto_minor >= 12) state->mode &= ~fci->umask; if (priv->proto_minor >= 12 && priv->acl) { state->xdata = dict_new (); if (!state-> xdata) { do { do { if (0) printf ("%s failed to allocate " "a param dictionary" , "CREATE"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2013, GF_LOG_WARNING, "%s failed to allocate " "a param dictionary", "CREATE"); } while (0); send_fuse_err ( this, finh, 12); free_fuse_state (state); return; } state-> umask = fci->umask; ret = dict_set_int16 (state->xdata, "umask", fci->umask); if (ret < 0) { do { do { if (0) printf ("%s Failed adding umask" " to request", "CREATE"); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2013, GF_LOG_WARNING, "%s Failed adding umask" " to request" , "CREATE"); } while (0); dict_destroy (state->xdata); send_fuse_err (this, finh, 12); free_fuse_state (state); return; } ret = dict_set_int16 (state->xdata, "mode", fci->mode); if (ret < 0) { do { do { if (0) printf ("%s Failed adding mode " "to request", "CREATE"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2013, GF_LOG_WARNING, "%s Failed adding mode " "to request", "CREATE"); } while (0); dict_destroy (state-> xdata); send_fuse_err (this, finh, 12); free_fuse_state (state ); return; } } } while (0); |
2014 | #endif |
2015 | fuse_resolve_and_resume (state, fuse_create_resume); |
2016 | |
2017 | return; |
2018 | } |
2019 | |
2020 | void |
2021 | fuse_open_resume (fuse_state_t *state) |
2022 | { |
2023 | fd_t *fd = NULL((void*)0); |
2024 | fuse_private_t *priv = NULL((void*)0); |
2025 | fuse_fd_ctx_t *fdctx = NULL((void*)0); |
2026 | |
2027 | if (!state->loc.inode) { |
2028 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("%""l" "u"": OPEN %s resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2030, GF_LOG_ERROR, "%""l" "u"": OPEN %s resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0) |
2029 | "%"PRIu64": OPEN %s resolution failed",do { do { if (0) printf ("%""l" "u"": OPEN %s resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2030, GF_LOG_ERROR, "%""l" "u"": OPEN %s resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0) |
2030 | state->finh->unique, uuid_utoa (state->resolve.gfid))do { do { if (0) printf ("%""l" "u"": OPEN %s resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2030, GF_LOG_ERROR, "%""l" "u"": OPEN %s resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); |
2031 | |
2032 | send_fuse_err (state->this, state->finh, ENOENT2); |
2033 | free_fuse_state (state); |
2034 | return; |
2035 | } |
2036 | |
2037 | fd = fd_create (state->loc.inode, state->finh->pid); |
2038 | if (!fd) { |
2039 | gf_log ("fuse", GF_LOG_ERROR,do { do { if (0) printf ("fd is NULL"); } while (0); _gf_log ( "fuse", "fuse-bridge.c", __FUNCTION__, 2040, GF_LOG_ERROR, "fd is NULL" ); } while (0) |
2040 | "fd is NULL")do { do { if (0) printf ("fd is NULL"); } while (0); _gf_log ( "fuse", "fuse-bridge.c", __FUNCTION__, 2040, GF_LOG_ERROR, "fd is NULL" ); } while (0); |
2041 | send_fuse_err (state->this, state->finh, ENOENT2); |
2042 | free_fuse_state (state); |
2043 | return; |
2044 | } |
2045 | |
2046 | fdctx = fuse_fd_ctx_check_n_create (state->this, fd); |
2047 | if (fdctx == NULL((void*)0)) { |
2048 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": OPEN creation of fdctx failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2050, GF_LOG_WARNING, "%""l" "u"": OPEN creation of fdctx failed", state->finh->unique ); } while (0) |
2049 | "%"PRIu64": OPEN creation of fdctx failed",do { do { if (0) printf ("%""l" "u"": OPEN creation of fdctx failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2050, GF_LOG_WARNING, "%""l" "u"": OPEN creation of fdctx failed", state->finh->unique ); } while (0) |
2050 | state->finh->unique)do { do { if (0) printf ("%""l" "u"": OPEN creation of fdctx failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2050, GF_LOG_WARNING, "%""l" "u"": OPEN creation of fdctx failed", state->finh->unique ); } while (0); |
2051 | fd_unref (fd); |
2052 | send_fuse_err (state->this, state->finh, ENOMEM12); |
2053 | free_fuse_state (state); |
2054 | return; |
2055 | } |
2056 | |
2057 | priv = state->this->private; |
2058 | |
2059 | state->fd_no = gf_fd_unused_get (priv->fdtable, fd); |
2060 | state->fd = fd_ref (fd); |
2061 | fd->flags = state->flags; |
2062 | |
2063 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": OPEN %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2065, GF_LOG_TRACE, "%""l" "u" ": OPEN %s", state->finh->unique, state->loc.path); } while (0) |
2064 | "%"PRIu64": OPEN %s", state->finh->unique,do { do { if (0) printf ("%""l" "u"": OPEN %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2065, GF_LOG_TRACE, "%""l" "u" ": OPEN %s", state->finh->unique, state->loc.path); } while (0) |
2065 | state->loc.path)do { do { if (0) printf ("%""l" "u"": OPEN %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2065, GF_LOG_TRACE, "%""l" "u" ": OPEN %s", state->finh->unique, state->loc.path); } while (0); |
2066 | |
2067 | FUSE_FOP (state, fuse_fd_cbk, GF_FOP_OPEN,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2068, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_OPEN; frame->op = GF_FOP_OPEN; if ( state->resolve_now ) { resolve = state-> resolve_now; } else { resolve = &(state->resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2068, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_OPEN == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2068, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2068, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2068, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2068, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->open_cbk) tmp_cbk = fuse_fd_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> open"; _new->unwind_to = "fuse_fd_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> open); xl->fops->open (_new, xl, &state->loc, state ->flags, fd, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0) |
2068 | open, &state->loc, state->flags, fd, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2068, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_OPEN; frame->op = GF_FOP_OPEN; if ( state->resolve_now ) { resolve = state-> resolve_now; } else { resolve = &(state->resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2068, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_OPEN == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2068, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2068, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2068, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2068, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->open_cbk) tmp_cbk = fuse_fd_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> open"; _new->unwind_to = "fuse_fd_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> open); xl->fops->open (_new, xl, &state->loc, state ->flags, fd, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0); |
2069 | } |
2070 | |
2071 | static void |
2072 | fuse_open (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2073 | { |
2074 | struct fuse_open_in *foi = msg; |
2075 | fuse_state_t *state = NULL((void*)0); |
2076 | |
2077 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2077, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2078 | |
2079 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
2080 | |
2081 | state->flags = foi->flags; |
2082 | |
2083 | fuse_resolve_and_resume (state, fuse_open_resume); |
2084 | |
2085 | return; |
2086 | } |
2087 | |
2088 | static int |
2089 | fuse_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
2090 | int32_t op_ret, int32_t op_errno, |
2091 | struct iovec *vector, int32_t count, |
2092 | struct iatt *stbuf, struct iobref *iobref, dict_t *xdata) |
2093 | { |
2094 | fuse_state_t *state = NULL((void*)0); |
2095 | fuse_in_header_t *finh = NULL((void*)0); |
2096 | struct fuse_out_header fouh = {0, }; |
2097 | struct iovec *iov_out = NULL((void*)0); |
2098 | |
2099 | state = frame->root->state; |
2100 | finh = state->finh; |
2101 | |
2102 | fuse_log_eh_fop(this, state, frame, op_ret, op_errno)do { if (this->history) { if (state->fd) do { do { if ( 0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->fd, uuid_utoa (state->fd-> inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->fd, uuid_utoa (state->fd->inode->gfid)); } while (0); else do { do { if (0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, uuid_utoa (state->loc.gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, uuid_utoa (state->loc .gfid)); } while (0); } } while(0); |
2103 | |
2104 | if (op_ret >= 0) { |
2105 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": READ => %d/%""zu"",%" "l" "d""/%""l" "u", frame->root->unique, op_ret, state-> size, state->off, stbuf->ia_size); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2108, GF_LOG_TRACE , "%""l" "u"": READ => %d/%""zu"",%""l" "d""/%""l" "u", frame ->root->unique, op_ret, state->size, state->off, stbuf ->ia_size); } while (0) |
2106 | "%"PRIu64": READ => %d/%"GF_PRI_SIZET",%"PRId64"/%"PRIu64,do { do { if (0) printf ("%""l" "u"": READ => %d/%""zu"",%" "l" "d""/%""l" "u", frame->root->unique, op_ret, state-> size, state->off, stbuf->ia_size); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2108, GF_LOG_TRACE , "%""l" "u"": READ => %d/%""zu"",%""l" "d""/%""l" "u", frame ->root->unique, op_ret, state->size, state->off, stbuf ->ia_size); } while (0) |
2107 | frame->root->unique,do { do { if (0) printf ("%""l" "u"": READ => %d/%""zu"",%" "l" "d""/%""l" "u", frame->root->unique, op_ret, state-> size, state->off, stbuf->ia_size); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2108, GF_LOG_TRACE , "%""l" "u"": READ => %d/%""zu"",%""l" "d""/%""l" "u", frame ->root->unique, op_ret, state->size, state->off, stbuf ->ia_size); } while (0) |
2108 | op_ret, state->size, state->off, stbuf->ia_size)do { do { if (0) printf ("%""l" "u"": READ => %d/%""zu"",%" "l" "d""/%""l" "u", frame->root->unique, op_ret, state-> size, state->off, stbuf->ia_size); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2108, GF_LOG_TRACE , "%""l" "u"": READ => %d/%""zu"",%""l" "d""/%""l" "u", frame ->root->unique, op_ret, state->size, state->off, stbuf ->ia_size); } while (0); |
2109 | |
2110 | iov_out = GF_CALLOC (count + 1, sizeof (*iov_out),__gf_calloc (count + 1, sizeof (*iov_out), gf_fuse_mt_iovec) |
2111 | gf_fuse_mt_iovec)__gf_calloc (count + 1, sizeof (*iov_out), gf_fuse_mt_iovec); |
2112 | if (iov_out) { |
2113 | fouh.error = 0; |
2114 | iov_out[0].iov_base = &fouh; |
2115 | memcpy (iov_out + 1, vector, count * sizeof (*iov_out)); |
2116 | send_fuse_iov (this, finh, iov_out, count + 1); |
2117 | GF_FREE (iov_out)__gf_free (iov_out); |
2118 | } else |
2119 | send_fuse_err (this, finh, ENOMEM12); |
2120 | } else { |
2121 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": READ => %d (%s)", frame ->root->unique, op_ret, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2123, GF_LOG_WARNING, "%""l" "u"": READ => %d (%s)", frame ->root->unique, op_ret, strerror (op_errno)); } while ( 0) |
2122 | "%"PRIu64": READ => %d (%s)", frame->root->unique,do { do { if (0) printf ("%""l" "u"": READ => %d (%s)", frame ->root->unique, op_ret, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2123, GF_LOG_WARNING, "%""l" "u"": READ => %d (%s)", frame ->root->unique, op_ret, strerror (op_errno)); } while ( 0) |
2123 | op_ret, strerror (op_errno))do { do { if (0) printf ("%""l" "u"": READ => %d (%s)", frame ->root->unique, op_ret, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2123, GF_LOG_WARNING, "%""l" "u"": READ => %d (%s)", frame ->root->unique, op_ret, strerror (op_errno)); } while ( 0); |
2124 | |
2125 | send_fuse_err (this, finh, op_errno); |
2126 | } |
2127 | |
2128 | free_fuse_state (state); |
2129 | STACK_DESTROY (frame->root); |
2130 | |
2131 | return 0; |
2132 | } |
2133 | |
2134 | void |
2135 | fuse_readv_resume (fuse_state_t *state) |
2136 | { |
2137 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": READ (%p, size=%zu, offset=%" "l" "u"")", state->finh->unique, state->fd, state-> size, state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2139, GF_LOG_TRACE, "%""l" "u" ": READ (%p, size=%zu, offset=%""l" "u"")", state->finh-> unique, state->fd, state->size, state->off); } while (0) |
2138 | "%"PRIu64": READ (%p, size=%zu, offset=%"PRIu64")",do { do { if (0) printf ("%""l" "u"": READ (%p, size=%zu, offset=%" "l" "u"")", state->finh->unique, state->fd, state-> size, state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2139, GF_LOG_TRACE, "%""l" "u" ": READ (%p, size=%zu, offset=%""l" "u"")", state->finh-> unique, state->fd, state->size, state->off); } while (0) |
2139 | state->finh->unique, state->fd, state->size, state->off)do { do { if (0) printf ("%""l" "u"": READ (%p, size=%zu, offset=%" "l" "u"")", state->finh->unique, state->fd, state-> size, state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2139, GF_LOG_TRACE, "%""l" "u" ": READ (%p, size=%zu, offset=%""l" "u"")", state->finh-> unique, state->fd, state->size, state->off); } while (0); |
2140 | |
2141 | FUSE_FOP (state, fuse_readv_cbk, GF_FOP_READ, readv, state->fd,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2142, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_READ; frame->op = GF_FOP_READ; if ( state->resolve_now ) { resolve = state-> resolve_now; } else { resolve = &(state->resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2142, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_READ == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2142, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2142, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2142, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2142, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->readv_cbk) tmp_cbk = fuse_readv_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->readv"; _new->unwind_to = "fuse_readv_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> readv); xl->fops->readv (_new, xl, state->fd, state-> size, state->off, state->io_flags, state->xdata); (* __glusterfs_this_location()) = old_THIS; } while (0); } } while (0) |
2142 | state->size, state->off, state->io_flags, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2142, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_READ; frame->op = GF_FOP_READ; if ( state->resolve_now ) { resolve = state-> resolve_now; } else { resolve = &(state->resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2142, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_READ == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2142, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2142, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2142, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2142, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->readv_cbk) tmp_cbk = fuse_readv_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->readv"; _new->unwind_to = "fuse_readv_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> readv); xl->fops->readv (_new, xl, state->fd, state-> size, state->off, state->io_flags, state->xdata); (* __glusterfs_this_location()) = old_THIS; } while (0); } } while (0); |
2143 | } |
2144 | |
2145 | static void |
2146 | fuse_readv (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2147 | { |
2148 | struct fuse_read_in *fri = msg; |
2149 | |
2150 | fuse_private_t *priv = NULL((void*)0); |
2151 | fuse_state_t *state = NULL((void*)0); |
2152 | fd_t *fd = NULL((void*)0); |
2153 | |
2154 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2154, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2155 | |
2156 | fd = FH_TO_FD (fri->fh)((((fd_t *)(uintptr_t)(fri->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fri->fh)))):((fd_t *) 0)); |
2157 | state->fd = fd; |
2158 | |
2159 | fuse_resolve_fd_init (state, &state->resolve, fd); |
2160 | |
2161 | /* See comment by similar code in fuse_settatr */ |
2162 | priv = this->private; |
2163 | #if FUSE_KERNEL_MINOR_VERSION22 >= 9 |
2164 | if (priv->proto_minor >= 9 && fri->read_flags & FUSE_READ_LOCKOWNER(1 << 1)) |
2165 | state->lk_owner = fri->lock_owner; |
2166 | #endif |
2167 | |
2168 | state->size = fri->size; |
2169 | state->off = fri->offset; |
2170 | /* lets ignore 'fri->read_flags', but just consider 'fri->flags' */ |
2171 | state->io_flags = fri->flags; |
2172 | |
2173 | fuse_resolve_and_resume (state, fuse_readv_resume); |
2174 | } |
2175 | |
2176 | static int |
2177 | fuse_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
2178 | int32_t op_ret, int32_t op_errno, |
2179 | struct iatt *stbuf, struct iatt *postbuf, dict_t *xdata) |
2180 | { |
2181 | fuse_state_t *state = NULL((void*)0); |
2182 | fuse_in_header_t *finh = NULL((void*)0); |
2183 | struct fuse_write_out fwo = {0, }; |
2184 | |
2185 | state = frame->root->state; |
2186 | finh = state->finh; |
2187 | |
2188 | fuse_log_eh_fop(this, state, frame, op_ret, op_errno)do { if (this->history) { if (state->fd) do { do { if ( 0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->fd, uuid_utoa (state->fd-> inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->fd, uuid_utoa (state->fd->inode->gfid)); } while (0); else do { do { if (0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, uuid_utoa (state->loc.gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, uuid_utoa (state->loc .gfid)); } while (0); } } while(0); |
2189 | |
2190 | if (op_ret >= 0) { |
2191 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": WRITE => %d/%""zu"",%" "l" "d""/%""l" "u", frame->root->unique, op_ret, state-> size, state->off, stbuf->ia_size); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2194, GF_LOG_TRACE , "%""l" "u"": WRITE => %d/%""zu"",%""l" "d""/%""l" "u", frame ->root->unique, op_ret, state->size, state->off, stbuf ->ia_size); } while (0) |
2192 | "%"PRIu64": WRITE => %d/%"GF_PRI_SIZET",%"PRId64"/%"PRIu64,do { do { if (0) printf ("%""l" "u"": WRITE => %d/%""zu"",%" "l" "d""/%""l" "u", frame->root->unique, op_ret, state-> size, state->off, stbuf->ia_size); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2194, GF_LOG_TRACE , "%""l" "u"": WRITE => %d/%""zu"",%""l" "d""/%""l" "u", frame ->root->unique, op_ret, state->size, state->off, stbuf ->ia_size); } while (0) |
2193 | frame->root->unique,do { do { if (0) printf ("%""l" "u"": WRITE => %d/%""zu"",%" "l" "d""/%""l" "u", frame->root->unique, op_ret, state-> size, state->off, stbuf->ia_size); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2194, GF_LOG_TRACE , "%""l" "u"": WRITE => %d/%""zu"",%""l" "d""/%""l" "u", frame ->root->unique, op_ret, state->size, state->off, stbuf ->ia_size); } while (0) |
2194 | op_ret, state->size, state->off, stbuf->ia_size)do { do { if (0) printf ("%""l" "u"": WRITE => %d/%""zu"",%" "l" "d""/%""l" "u", frame->root->unique, op_ret, state-> size, state->off, stbuf->ia_size); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2194, GF_LOG_TRACE , "%""l" "u"": WRITE => %d/%""zu"",%""l" "d""/%""l" "u", frame ->root->unique, op_ret, state->size, state->off, stbuf ->ia_size); } while (0); |
2195 | |
2196 | fwo.size = op_ret; |
2197 | send_fuse_obj (this, finh, &fwo)send_fuse_data (this, finh, &fwo, sizeof (*(&fwo))); |
2198 | } else { |
2199 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": WRITE => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2201, GF_LOG_WARNING , "%""l" "u"": WRITE => -1 (%s)", frame->root->unique , strerror (op_errno)); } while (0) |
2200 | "%"PRIu64": WRITE => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""l" "u"": WRITE => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2201, GF_LOG_WARNING , "%""l" "u"": WRITE => -1 (%s)", frame->root->unique , strerror (op_errno)); } while (0) |
2201 | strerror (op_errno))do { do { if (0) printf ("%""l" "u"": WRITE => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2201, GF_LOG_WARNING , "%""l" "u"": WRITE => -1 (%s)", frame->root->unique , strerror (op_errno)); } while (0); |
2202 | |
2203 | send_fuse_err (this, finh, op_errno); |
2204 | } |
2205 | |
2206 | free_fuse_state (state); |
2207 | STACK_DESTROY (frame->root); |
2208 | |
2209 | return 0; |
2210 | } |
2211 | |
2212 | void |
2213 | fuse_write_resume (fuse_state_t *state) |
2214 | { |
2215 | struct iobref *iobref = NULL((void*)0); |
2216 | struct iobuf *iobuf = NULL((void*)0); |
2217 | |
2218 | |
2219 | iobref = iobref_new (); |
2220 | if (!iobref) { |
2221 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("%""l" "u"": WRITE iobref allocation failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2223, GF_LOG_ERROR, "%""l" "u" ": WRITE iobref allocation failed", state->finh->unique ); } while (0) |
2222 | "%"PRIu64": WRITE iobref allocation failed",do { do { if (0) printf ("%""l" "u"": WRITE iobref allocation failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2223, GF_LOG_ERROR, "%""l" "u" ": WRITE iobref allocation failed", state->finh->unique ); } while (0) |
2223 | state->finh->unique)do { do { if (0) printf ("%""l" "u"": WRITE iobref allocation failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2223, GF_LOG_ERROR, "%""l" "u" ": WRITE iobref allocation failed", state->finh->unique ); } while (0); |
2224 | send_fuse_err (state->this, state->finh, ENOMEM12); |
2225 | |
2226 | free_fuse_state (state); |
2227 | return; |
2228 | } |
2229 | |
2230 | iobuf = ((fuse_private_t *) (state->this->private))->iobuf; |
2231 | iobref_add (iobref, iobuf); |
2232 | |
2233 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": WRITE (%p, size=%""zu"", offset=%" "l" "d"")", state->finh->unique, state->fd, state-> size, state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2235, GF_LOG_TRACE, "%""l" "u" ": WRITE (%p, size=%""zu"", offset=%""l" "d"")", state->finh ->unique, state->fd, state->size, state->off); } while (0) |
2234 | "%"PRIu64": WRITE (%p, size=%"GF_PRI_SIZET", offset=%"PRId64")",do { do { if (0) printf ("%""l" "u"": WRITE (%p, size=%""zu"", offset=%" "l" "d"")", state->finh->unique, state->fd, state-> size, state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2235, GF_LOG_TRACE, "%""l" "u" ": WRITE (%p, size=%""zu"", offset=%""l" "d"")", state->finh ->unique, state->fd, state->size, state->off); } while (0) |
2235 | state->finh->unique, state->fd, state->size, state->off)do { do { if (0) printf ("%""l" "u"": WRITE (%p, size=%""zu"", offset=%" "l" "d"")", state->finh->unique, state->fd, state-> size, state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2235, GF_LOG_TRACE, "%""l" "u" ": WRITE (%p, size=%""zu"", offset=%""l" "d"")", state->finh ->unique, state->fd, state->size, state->off); } while (0); |
2236 | |
2237 | FUSE_FOP (state, fuse_writev_cbk, GF_FOP_WRITE, writev, state->fd,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2239, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_WRITE; frame->op = GF_FOP_WRITE; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2239, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_WRITE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2239, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2239, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2239, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2239, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->writev_cbk) tmp_cbk = fuse_writev_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->writev"; _new->unwind_to = "fuse_writev_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> writev); xl->fops->writev (_new, xl, state->fd, & state->vector, 1, state->off, state->io_flags, iobref , state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0) |
2238 | &state->vector, 1, state->off, state->io_flags, iobref,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2239, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_WRITE; frame->op = GF_FOP_WRITE; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2239, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_WRITE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2239, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2239, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2239, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2239, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->writev_cbk) tmp_cbk = fuse_writev_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->writev"; _new->unwind_to = "fuse_writev_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> writev); xl->fops->writev (_new, xl, state->fd, & state->vector, 1, state->off, state->io_flags, iobref , state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0) |
2239 | state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2239, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_WRITE; frame->op = GF_FOP_WRITE; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2239, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_WRITE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2239, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2239, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2239, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2239, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->writev_cbk) tmp_cbk = fuse_writev_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->writev"; _new->unwind_to = "fuse_writev_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> writev); xl->fops->writev (_new, xl, state->fd, & state->vector, 1, state->off, state->io_flags, iobref , state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0); |
2240 | |
2241 | iobref_unref (iobref); |
2242 | } |
2243 | |
2244 | static void |
2245 | fuse_write (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2246 | { |
2247 | /* WRITE is special, metadata is attached to in_header, |
2248 | * and msg is the payload as-is. |
2249 | */ |
2250 | struct fuse_write_in *fwi = (struct fuse_write_in *) |
2251 | (finh + 1); |
2252 | |
2253 | fuse_private_t *priv = NULL((void*)0); |
2254 | fuse_state_t *state = NULL((void*)0); |
2255 | fd_t *fd = NULL((void*)0); |
2256 | |
2257 | priv = this->private; |
2258 | |
2259 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2259, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2260 | fd = FH_TO_FD (fwi->fh)((((fd_t *)(uintptr_t)(fwi->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fwi->fh)))):((fd_t *) 0)); |
2261 | state->fd = fd; |
2262 | state->size = fwi->size; |
2263 | state->off = fwi->offset; |
2264 | |
2265 | /* lets ignore 'fwi->write_flags', but just consider 'fwi->flags' */ |
2266 | state->io_flags = fwi->flags; |
2267 | /* TODO: may need to handle below flag |
2268 | (fwi->write_flags & FUSE_WRITE_CACHE); |
2269 | */ |
2270 | |
2271 | |
2272 | fuse_resolve_fd_init (state, &state->resolve, fd); |
2273 | |
2274 | /* See comment by similar code in fuse_settatr */ |
2275 | priv = this->private; |
2276 | #if FUSE_KERNEL_MINOR_VERSION22 >= 9 |
2277 | if (priv->proto_minor >= 9 && fwi->write_flags & FUSE_WRITE_LOCKOWNER(1 << 1)) |
2278 | state->lk_owner = fwi->lock_owner; |
2279 | #endif |
2280 | |
2281 | state->vector.iov_base = msg; |
2282 | state->vector.iov_len = fwi->size; |
2283 | |
2284 | fuse_resolve_and_resume (state, fuse_write_resume); |
2285 | |
2286 | return; |
2287 | } |
2288 | |
2289 | void |
2290 | fuse_flush_resume (fuse_state_t *state) |
2291 | { |
2292 | FUSE_FOP (state, fuse_err_cbk, GF_FOP_FLUSH,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2293, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FLUSH; frame->op = GF_FOP_FLUSH; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2293, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_FLUSH == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2293, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2293, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2293, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2293, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->flush_cbk) tmp_cbk = fuse_err_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> flush"; _new->unwind_to = "fuse_err_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> flush); xl->fops->flush (_new, xl, state->fd, state-> xdata); (*__glusterfs_this_location()) = old_THIS; } while (0 ); } } while (0) |
2293 | flush, state->fd, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2293, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FLUSH; frame->op = GF_FOP_FLUSH; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2293, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_FLUSH == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2293, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2293, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2293, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2293, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->flush_cbk) tmp_cbk = fuse_err_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> flush"; _new->unwind_to = "fuse_err_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> flush); xl->fops->flush (_new, xl, state->fd, state-> xdata); (*__glusterfs_this_location()) = old_THIS; } while (0 ); } } while (0); |
2294 | } |
2295 | |
2296 | static void |
2297 | fuse_flush (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2298 | { |
2299 | struct fuse_flush_in *ffi = msg; |
2300 | |
2301 | fuse_state_t *state = NULL((void*)0); |
2302 | fd_t *fd = NULL((void*)0); |
2303 | |
2304 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2304, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2305 | fd = FH_TO_FD (ffi->fh)((((fd_t *)(uintptr_t)(ffi->fh)))?(fd_ref (((fd_t *)(uintptr_t )(ffi->fh)))):((fd_t *) 0)); |
2306 | state->fd = fd; |
2307 | |
2308 | fuse_resolve_fd_init (state, &state->resolve, fd); |
2309 | |
2310 | state->lk_owner = ffi->lock_owner; |
2311 | |
2312 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": FLUSH %p", finh->unique , fd); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2313, GF_LOG_TRACE, "%""l" "u"": FLUSH %p", finh ->unique, fd); } while (0) |
2313 | "%"PRIu64": FLUSH %p", finh->unique, fd)do { do { if (0) printf ("%""l" "u"": FLUSH %p", finh->unique , fd); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2313, GF_LOG_TRACE, "%""l" "u"": FLUSH %p", finh ->unique, fd); } while (0); |
2314 | |
2315 | fuse_resolve_and_resume (state, fuse_flush_resume); |
2316 | |
2317 | return; |
2318 | } |
2319 | |
2320 | int |
2321 | fuse_internal_release (xlator_t *this, fd_t *fd) |
2322 | { |
2323 | //This is a place holder function to prevent "xlator does not implement |
2324 | //release_cbk" Warning log. |
2325 | //Actual release happens as part of fuse_release which gets executed |
2326 | //when kernel fuse sends it. |
2327 | return 0; |
2328 | } |
2329 | |
2330 | static void |
2331 | fuse_release (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2332 | { |
2333 | struct fuse_release_in *fri = msg; |
2334 | fd_t *activefd = NULL((void*)0); |
2335 | fd_t *fd = NULL((void*)0); |
2336 | uint64_t val = 0; |
2337 | int ret = 0; |
2338 | fuse_state_t *state = NULL((void*)0); |
2339 | fuse_fd_ctx_t *fdctx = NULL((void*)0); |
2340 | fuse_private_t *priv = NULL((void*)0); |
2341 | |
2342 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2342, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2343 | fd = FH_TO_FD (fri->fh)((((fd_t *)(uintptr_t)(fri->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fri->fh)))):((fd_t *) 0)); |
2344 | state->fd = fd; |
2345 | |
2346 | priv = this->private; |
2347 | |
2348 | fuse_log_eh (this, "RELEASE(): %"PRIu64":, fd: %p, gfid: %s",do { if (this->history) do { do { if (0) printf ("RELEASE(): %" "l" "u"":, fd: %p, gfid: %s", finh->unique, fd, uuid_utoa ( fd->inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__ ,"RELEASE(): %""l" "u"":, fd: %p, gfid: %s", finh->unique, fd, uuid_utoa (fd->inode->gfid)); } while (0); } while (0) |
2349 | finh->unique, fd, uuid_utoa (fd->inode->gfid))do { if (this->history) do { do { if (0) printf ("RELEASE(): %" "l" "u"":, fd: %p, gfid: %s", finh->unique, fd, uuid_utoa ( fd->inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__ ,"RELEASE(): %""l" "u"":, fd: %p, gfid: %s", finh->unique, fd, uuid_utoa (fd->inode->gfid)); } while (0); } while (0); |
2350 | |
2351 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": RELEASE %p", finh->unique , state->fd); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2352, GF_LOG_TRACE, "%""l" "u"": RELEASE %p", finh->unique, state->fd); } while (0) |
2352 | "%"PRIu64": RELEASE %p", finh->unique, state->fd)do { do { if (0) printf ("%""l" "u"": RELEASE %p", finh->unique , state->fd); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2352, GF_LOG_TRACE, "%""l" "u"": RELEASE %p", finh->unique, state->fd); } while (0); |
2353 | |
2354 | ret = fd_ctx_del (fd, this, &val); |
2355 | if (!ret) { |
2356 | fdctx = (fuse_fd_ctx_t *)(unsigned long)val; |
2357 | if (fdctx) { |
2358 | activefd = fdctx->activefd; |
2359 | if (activefd) { |
2360 | fd_unref (activefd); |
2361 | } |
2362 | |
2363 | GF_FREE (fdctx)__gf_free (fdctx); |
2364 | } |
2365 | } |
2366 | fd_unref (fd); |
2367 | |
2368 | state->fd = NULL((void*)0); |
2369 | |
2370 | gf_fdptr_put (priv->fdtable, fd); |
2371 | |
2372 | send_fuse_err (this, finh, 0); |
2373 | |
2374 | free_fuse_state (state); |
2375 | return; |
2376 | } |
2377 | |
2378 | void |
2379 | fuse_fsync_resume (fuse_state_t *state) |
2380 | { |
2381 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": FSYNC %p", state->finh ->unique, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2383, GF_LOG_TRACE, "%""l" "u" ": FSYNC %p", state->finh->unique, state->fd); } while (0) |
2382 | "%"PRIu64": FSYNC %p", state->finh->unique,do { do { if (0) printf ("%""l" "u"": FSYNC %p", state->finh ->unique, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2383, GF_LOG_TRACE, "%""l" "u" ": FSYNC %p", state->finh->unique, state->fd); } while (0) |
2383 | state->fd)do { do { if (0) printf ("%""l" "u"": FSYNC %p", state->finh ->unique, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2383, GF_LOG_TRACE, "%""l" "u" ": FSYNC %p", state->finh->unique, state->fd); } while (0); |
2384 | |
2385 | /* fsync_flags: 1 means "datasync" (no defines for this) */ |
2386 | FUSE_FOP (state, fuse_fsync_cbk, GF_FOP_FSYNC,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2387, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FSYNC; frame->op = GF_FOP_FSYNC; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2387, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_FSYNC == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2387, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2387, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2387, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2387, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fsync_cbk) tmp_cbk = fuse_fsync_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> fsync"; _new->unwind_to = "fuse_fsync_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fsync); xl->fops->fsync (_new, xl, state->fd, (state ->flags & 1), state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0) |
2387 | fsync, state->fd, (state->flags & 1), state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2387, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FSYNC; frame->op = GF_FOP_FSYNC; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2387, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_FSYNC == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2387, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2387, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2387, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2387, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fsync_cbk) tmp_cbk = fuse_fsync_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> fsync"; _new->unwind_to = "fuse_fsync_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fsync); xl->fops->fsync (_new, xl, state->fd, (state ->flags & 1), state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0); |
2388 | } |
2389 | |
2390 | static void |
2391 | fuse_fsync (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2392 | { |
2393 | struct fuse_fsync_in *fsi = msg; |
2394 | |
2395 | fuse_state_t *state = NULL((void*)0); |
2396 | fd_t *fd = NULL((void*)0); |
2397 | |
2398 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2398, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2399 | fd = FH_TO_FD (fsi->fh)((((fd_t *)(uintptr_t)(fsi->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fsi->fh)))):((fd_t *) 0)); |
2400 | state->fd = fd; |
2401 | |
2402 | fuse_resolve_fd_init (state, &state->resolve, fd); |
2403 | |
2404 | state->flags = fsi->fsync_flags; |
2405 | fuse_resolve_and_resume (state, fuse_fsync_resume); |
2406 | return; |
2407 | } |
2408 | |
2409 | void |
2410 | fuse_opendir_resume (fuse_state_t *state) |
2411 | { |
2412 | fd_t *fd = NULL((void*)0); |
2413 | fuse_private_t *priv = NULL((void*)0); |
2414 | fuse_fd_ctx_t *fdctx = NULL((void*)0); |
2415 | |
2416 | priv = state->this->private; |
2417 | |
2418 | if (!state->loc.inode) { |
2419 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": OPENDIR (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2421, GF_LOG_WARNING, "%""l" "u"": OPENDIR (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0) |
2420 | "%"PRIu64": OPENDIR (%s) resolution failed",do { do { if (0) printf ("%""l" "u"": OPENDIR (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2421, GF_LOG_WARNING, "%""l" "u"": OPENDIR (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0) |
2421 | state->finh->unique, uuid_utoa (state->resolve.gfid))do { do { if (0) printf ("%""l" "u"": OPENDIR (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2421, GF_LOG_WARNING, "%""l" "u"": OPENDIR (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); |
2422 | send_fuse_err (state->this, state->finh, ENOENT2); |
2423 | free_fuse_state (state); |
2424 | return; |
2425 | } |
2426 | |
2427 | fd = fd_create (state->loc.inode, state->finh->pid); |
2428 | if (fd == NULL((void*)0)) { |
2429 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": OPENDIR fd creation failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2431, GF_LOG_WARNING, "%""l" "u"": OPENDIR fd creation failed", state->finh->unique ); } while (0) |
2430 | "%"PRIu64": OPENDIR fd creation failed",do { do { if (0) printf ("%""l" "u"": OPENDIR fd creation failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2431, GF_LOG_WARNING, "%""l" "u"": OPENDIR fd creation failed", state->finh->unique ); } while (0) |
2431 | state->finh->unique)do { do { if (0) printf ("%""l" "u"": OPENDIR fd creation failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2431, GF_LOG_WARNING, "%""l" "u"": OPENDIR fd creation failed", state->finh->unique ); } while (0); |
2432 | send_fuse_err (state->this, state->finh, ENOMEM12); |
2433 | free_fuse_state (state); |
2434 | } |
2435 | |
2436 | fdctx = fuse_fd_ctx_check_n_create (state->this, fd); |
2437 | if (fdctx == NULL((void*)0)) { |
2438 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": OPENDIR creation of fdctx failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2440, GF_LOG_WARNING, "%""l" "u"": OPENDIR creation of fdctx failed", state->finh-> unique); } while (0) |
2439 | "%"PRIu64": OPENDIR creation of fdctx failed",do { do { if (0) printf ("%""l" "u"": OPENDIR creation of fdctx failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2440, GF_LOG_WARNING, "%""l" "u"": OPENDIR creation of fdctx failed", state->finh-> unique); } while (0) |
2440 | state->finh->unique)do { do { if (0) printf ("%""l" "u"": OPENDIR creation of fdctx failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2440, GF_LOG_WARNING, "%""l" "u"": OPENDIR creation of fdctx failed", state->finh-> unique); } while (0); |
2441 | fd_unref (fd); |
2442 | send_fuse_err (state->this, state->finh, ENOMEM12); |
2443 | free_fuse_state (state); |
2444 | return; |
2445 | } |
2446 | |
2447 | state->fd = fd_ref (fd); |
2448 | state->fd_no = gf_fd_unused_get (priv->fdtable, fd); |
2449 | |
2450 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": OPENDIR %s", state-> finh->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2452, GF_LOG_TRACE, "%""l" "u" ": OPENDIR %s", state->finh->unique, state->loc.path ); } while (0) |
2451 | "%"PRIu64": OPENDIR %s", state->finh->unique,do { do { if (0) printf ("%""l" "u"": OPENDIR %s", state-> finh->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2452, GF_LOG_TRACE, "%""l" "u" ": OPENDIR %s", state->finh->unique, state->loc.path ); } while (0) |
2452 | state->loc.path)do { do { if (0) printf ("%""l" "u"": OPENDIR %s", state-> finh->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2452, GF_LOG_TRACE, "%""l" "u" ": OPENDIR %s", state->finh->unique, state->loc.path ); } while (0); |
2453 | |
2454 | FUSE_FOP (state, fuse_fd_cbk, GF_FOP_OPENDIR,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2455, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_OPENDIR; frame->op = GF_FOP_OPENDIR; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2455, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_OPENDIR == GF_FOP_LOOKUP) { do { do { if (0 ) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2455, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2455, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2455, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2455, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->opendir_cbk) tmp_cbk = fuse_fd_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> opendir"; _new->unwind_to = "fuse_fd_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> opendir); xl->fops->opendir (_new, xl, &state->loc , fd, state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0) |
2455 | opendir, &state->loc, fd, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2455, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_OPENDIR; frame->op = GF_FOP_OPENDIR; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2455, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_OPENDIR == GF_FOP_LOOKUP) { do { do { if (0 ) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2455, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2455, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2455, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2455, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->opendir_cbk) tmp_cbk = fuse_fd_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> opendir"; _new->unwind_to = "fuse_fd_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> opendir); xl->fops->opendir (_new, xl, &state->loc , fd, state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0); |
2456 | } |
2457 | |
2458 | static void |
2459 | fuse_opendir (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2460 | { |
2461 | /* |
2462 | struct fuse_open_in *foi = msg; |
2463 | */ |
2464 | |
2465 | fuse_state_t *state = NULL((void*)0); |
2466 | |
2467 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2467, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2468 | |
2469 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
2470 | |
2471 | fuse_resolve_and_resume (state, fuse_opendir_resume); |
2472 | } |
2473 | |
2474 | unsigned char |
2475 | d_type_from_stat (struct iatt *buf) |
2476 | { |
2477 | unsigned char d_type; |
2478 | |
2479 | if (IA_ISLNK (buf->ia_type)(buf->ia_type == IA_IFLNK)) { |
2480 | d_type = DT_LNKDT_LNK; |
2481 | |
2482 | } else if (IA_ISDIR (buf->ia_type)(buf->ia_type == IA_IFDIR)) { |
2483 | d_type = DT_DIRDT_DIR; |
2484 | |
2485 | } else if (IA_ISFIFO (buf->ia_type)(buf->ia_type == IA_IFIFO)) { |
2486 | d_type = DT_FIFODT_FIFO; |
2487 | |
2488 | } else if (IA_ISSOCK (buf->ia_type)(buf->ia_type == IA_IFSOCK)) { |
2489 | d_type = DT_SOCKDT_SOCK; |
2490 | |
2491 | } else if (IA_ISCHR (buf->ia_type)(buf->ia_type == IA_IFCHR)) { |
2492 | d_type = DT_CHRDT_CHR; |
2493 | |
2494 | } else if (IA_ISBLK (buf->ia_type)(buf->ia_type == IA_IFBLK)) { |
2495 | d_type = DT_BLKDT_BLK; |
2496 | |
2497 | } else if (IA_ISREG (buf->ia_type)(buf->ia_type == IA_IFREG)) { |
2498 | d_type = DT_REGDT_REG; |
2499 | |
2500 | } else { |
2501 | d_type = DT_UNKNOWNDT_UNKNOWN; |
2502 | } |
2503 | |
2504 | return d_type; |
2505 | } |
2506 | |
2507 | static int |
2508 | fuse_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
2509 | int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, |
2510 | dict_t *xdata) |
2511 | { |
2512 | fuse_state_t *state = NULL((void*)0); |
2513 | fuse_in_header_t *finh = NULL((void*)0); |
2514 | int size = 0; |
2515 | char *buf = NULL((void*)0); |
2516 | gf_dirent_t *entry = NULL((void*)0); |
2517 | struct fuse_dirent *fde = NULL((void*)0); |
2518 | fuse_private_t *priv = NULL((void*)0); |
2519 | |
2520 | state = frame->root->state; |
2521 | finh = state->finh; |
2522 | priv = state->this->private; |
2523 | |
2524 | fuse_log_eh_fop(this, state, frame, op_ret, op_errno)do { if (this->history) { if (state->fd) do { do { if ( 0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->fd, uuid_utoa (state->fd-> inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->fd, uuid_utoa (state->fd->inode->gfid)); } while (0); else do { do { if (0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, uuid_utoa (state->loc.gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, uuid_utoa (state->loc .gfid)); } while (0); } } while(0); |
2525 | |
2526 | if (op_ret < 0) { |
2527 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": READDIR => -1 (%s)", frame->root->unique, strerror (op_errno)); } while (0) ; _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2529 , GF_LOG_WARNING, "%""l" "u"": READDIR => -1 (%s)", frame-> root->unique, strerror (op_errno)); } while (0) |
2528 | "%"PRIu64": READDIR => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""l" "u"": READDIR => -1 (%s)", frame->root->unique, strerror (op_errno)); } while (0) ; _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2529 , GF_LOG_WARNING, "%""l" "u"": READDIR => -1 (%s)", frame-> root->unique, strerror (op_errno)); } while (0) |
2529 | strerror (op_errno))do { do { if (0) printf ("%""l" "u"": READDIR => -1 (%s)", frame->root->unique, strerror (op_errno)); } while (0) ; _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2529 , GF_LOG_WARNING, "%""l" "u"": READDIR => -1 (%s)", frame-> root->unique, strerror (op_errno)); } while (0); |
2530 | |
2531 | send_fuse_err (this, finh, op_errno); |
2532 | goto out; |
2533 | } |
2534 | |
2535 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": READDIR => %d/%""zu" ",%""l" "d", frame->root->unique, op_ret, state->size , state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2537, GF_LOG_TRACE, "%""l" "u"": READDIR => %d/%" "zu"",%""l" "d", frame->root->unique, op_ret, state-> size, state->off); } while (0) |
2536 | "%"PRIu64": READDIR => %d/%"GF_PRI_SIZET",%"PRId64,do { do { if (0) printf ("%""l" "u"": READDIR => %d/%""zu" ",%""l" "d", frame->root->unique, op_ret, state->size , state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2537, GF_LOG_TRACE, "%""l" "u"": READDIR => %d/%" "zu"",%""l" "d", frame->root->unique, op_ret, state-> size, state->off); } while (0) |
2537 | frame->root->unique, op_ret, state->size, state->off)do { do { if (0) printf ("%""l" "u"": READDIR => %d/%""zu" ",%""l" "d", frame->root->unique, op_ret, state->size , state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2537, GF_LOG_TRACE, "%""l" "u"": READDIR => %d/%" "zu"",%""l" "d", frame->root->unique, op_ret, state-> size, state->off); } while (0); |
2538 | |
2539 | list_for_each_entry (entry, &entries->list, list)for (entry = ((typeof(*entry) *)((char *)((&entries->list )->next)-(unsigned long)(&((typeof(*entry) *)0)->list ))); &entry->list != (&entries->list); entry = ( (typeof(*entry) *)((char *)(entry->list.next)-(unsigned long )(&((typeof(*entry) *)0)->list)))) { |
2540 | size += FUSE_DIRENT_ALIGN (FUSE_NAME_OFFSET +(((__builtin_offsetof(struct fuse_dirent, name) + strlen (entry ->d_name)) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t ) - 1)) |
2541 | strlen (entry->d_name))(((__builtin_offsetof(struct fuse_dirent, name) + strlen (entry ->d_name)) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t ) - 1)); |
2542 | } |
2543 | |
2544 | if (size <= 0) { |
2545 | send_fuse_data (this, finh, 0, 0); |
2546 | goto out; |
2547 | } |
2548 | |
2549 | buf = GF_CALLOC (1, size, gf_fuse_mt_char)__gf_calloc (1, size, gf_fuse_mt_char); |
2550 | if (!buf) { |
2551 | gf_log ("glusterfs-fuse", GF_LOG_DEBUG,do { do { if (0) printf ("%""l" "u"": READDIR => -1 (%s)", frame->root->unique, strerror (12)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2553, GF_LOG_DEBUG , "%""l" "u"": READDIR => -1 (%s)", frame->root->unique , strerror (12)); } while (0) |
2552 | "%"PRIu64": READDIR => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""l" "u"": READDIR => -1 (%s)", frame->root->unique, strerror (12)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2553, GF_LOG_DEBUG , "%""l" "u"": READDIR => -1 (%s)", frame->root->unique , strerror (12)); } while (0) |
2553 | strerror (ENOMEM))do { do { if (0) printf ("%""l" "u"": READDIR => -1 (%s)", frame->root->unique, strerror (12)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2553, GF_LOG_DEBUG , "%""l" "u"": READDIR => -1 (%s)", frame->root->unique , strerror (12)); } while (0); |
2554 | send_fuse_err (this, finh, ENOMEM12); |
2555 | goto out; |
2556 | } |
2557 | |
2558 | size = 0; |
2559 | list_for_each_entry (entry, &entries->list, list)for (entry = ((typeof(*entry) *)((char *)((&entries->list )->next)-(unsigned long)(&((typeof(*entry) *)0)->list ))); &entry->list != (&entries->list); entry = ( (typeof(*entry) *)((char *)(entry->list.next)-(unsigned long )(&((typeof(*entry) *)0)->list)))) { |
2560 | fde = (struct fuse_dirent *)(buf + size); |
2561 | gf_fuse_fill_dirent (entry, fde, priv->enable_ino32); |
2562 | size += FUSE_DIRENT_SIZE (fde)(((__builtin_offsetof(struct fuse_dirent, name) + (fde)->namelen ) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1)); |
2563 | } |
2564 | |
2565 | send_fuse_data (this, finh, buf, size); |
2566 | |
2567 | /* TODO: */ |
2568 | /* gf_link_inodes_from_dirent (this, state->fd->inode, entries); */ |
2569 | |
2570 | out: |
2571 | free_fuse_state (state); |
2572 | STACK_DESTROY (frame->root); |
2573 | GF_FREE (buf)__gf_free (buf); |
2574 | return 0; |
2575 | |
2576 | } |
2577 | |
2578 | void |
2579 | fuse_readdir_resume (fuse_state_t *state) |
2580 | { |
2581 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": READDIR (%p, size=%""zu" ", offset=%""l" "d"")", state->finh->unique, state-> fd, state->size, state->off); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2583, GF_LOG_TRACE, "%""l" "u" ": READDIR (%p, size=%""zu"", offset=%""l" "d"")", state-> finh->unique, state->fd, state->size, state->off) ; } while (0) |
2582 | "%"PRIu64": READDIR (%p, size=%"GF_PRI_SIZET", offset=%"PRId64")",do { do { if (0) printf ("%""l" "u"": READDIR (%p, size=%""zu" ", offset=%""l" "d"")", state->finh->unique, state-> fd, state->size, state->off); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2583, GF_LOG_TRACE, "%""l" "u" ": READDIR (%p, size=%""zu"", offset=%""l" "d"")", state-> finh->unique, state->fd, state->size, state->off) ; } while (0) |
2583 | state->finh->unique, state->fd, state->size, state->off)do { do { if (0) printf ("%""l" "u"": READDIR (%p, size=%""zu" ", offset=%""l" "d"")", state->finh->unique, state-> fd, state->size, state->off); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2583, GF_LOG_TRACE, "%""l" "u" ": READDIR (%p, size=%""zu"", offset=%""l" "d"")", state-> finh->unique, state->fd, state->size, state->off) ; } while (0); |
2584 | |
2585 | FUSE_FOP (state, fuse_readdir_cbk, GF_FOP_READDIR,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2586, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_READDIR; frame->op = GF_FOP_READDIR; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2586, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_READDIR == GF_FOP_LOOKUP) { do { do { if (0 ) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2586, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2586, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2586, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2586, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->readdir_cbk) tmp_cbk = fuse_readdir_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> readdir"; _new->unwind_to = "fuse_readdir_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> readdir); xl->fops->readdir (_new, xl, state->fd, state ->size, state->off, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0) |
2586 | readdir, state->fd, state->size, state->off, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2586, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_READDIR; frame->op = GF_FOP_READDIR; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2586, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_READDIR == GF_FOP_LOOKUP) { do { do { if (0 ) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2586, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2586, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2586, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2586, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->readdir_cbk) tmp_cbk = fuse_readdir_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> readdir"; _new->unwind_to = "fuse_readdir_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> readdir); xl->fops->readdir (_new, xl, state->fd, state ->size, state->off, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0); |
2587 | } |
2588 | |
2589 | static void |
2590 | fuse_readdir (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2591 | { |
2592 | struct fuse_read_in *fri = msg; |
2593 | |
2594 | fuse_state_t *state = NULL((void*)0); |
2595 | fd_t *fd = NULL((void*)0); |
2596 | |
2597 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2597, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2598 | state->size = fri->size; |
2599 | state->off = fri->offset; |
2600 | fd = FH_TO_FD (fri->fh)((((fd_t *)(uintptr_t)(fri->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fri->fh)))):((fd_t *) 0)); |
2601 | state->fd = fd; |
2602 | |
2603 | fuse_resolve_fd_init (state, &state->resolve, fd); |
2604 | |
2605 | fuse_resolve_and_resume (state, fuse_readdir_resume); |
2606 | } |
2607 | |
2608 | |
2609 | static int |
2610 | fuse_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
2611 | int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, |
2612 | dict_t *xdata) |
2613 | { |
2614 | fuse_state_t *state = NULL((void*)0); |
2615 | fuse_in_header_t *finh = NULL((void*)0); |
2616 | int size = 0; |
2617 | char *buf = NULL((void*)0); |
2618 | gf_dirent_t *entry = NULL((void*)0); |
2619 | struct fuse_direntplus *fde = NULL((void*)0); |
2620 | struct fuse_entry_out *feo = NULL((void*)0); |
2621 | fuse_private_t *priv = NULL((void*)0); |
2622 | |
2623 | state = frame->root->state; |
2624 | finh = state->finh; |
2625 | priv = this->private; |
2626 | |
2627 | if (op_ret < 0) { |
2628 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": READDIRP => -1 (%s)" , frame->root->unique, strerror (op_errno)); } while (0 ); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2630 , GF_LOG_WARNING, "%""l" "u"": READDIRP => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0) |
2629 | "%"PRIu64": READDIRP => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""l" "u"": READDIRP => -1 (%s)" , frame->root->unique, strerror (op_errno)); } while (0 ); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2630 , GF_LOG_WARNING, "%""l" "u"": READDIRP => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0) |
2630 | strerror (op_errno))do { do { if (0) printf ("%""l" "u"": READDIRP => -1 (%s)" , frame->root->unique, strerror (op_errno)); } while (0 ); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2630 , GF_LOG_WARNING, "%""l" "u"": READDIRP => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); |
2631 | |
2632 | send_fuse_err (this, finh, op_errno); |
2633 | goto out; |
2634 | } |
2635 | |
2636 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": READDIRP => %d/%""zu" ",%""l" "d", frame->root->unique, op_ret, state->size , state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2638, GF_LOG_TRACE, "%""l" "u"": READDIRP => %d/%" "zu"",%""l" "d", frame->root->unique, op_ret, state-> size, state->off); } while (0) |
2637 | "%"PRIu64": READDIRP => %d/%"GF_PRI_SIZET",%"PRId64,do { do { if (0) printf ("%""l" "u"": READDIRP => %d/%""zu" ",%""l" "d", frame->root->unique, op_ret, state->size , state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2638, GF_LOG_TRACE, "%""l" "u"": READDIRP => %d/%" "zu"",%""l" "d", frame->root->unique, op_ret, state-> size, state->off); } while (0) |
2638 | frame->root->unique, op_ret, state->size, state->off)do { do { if (0) printf ("%""l" "u"": READDIRP => %d/%""zu" ",%""l" "d", frame->root->unique, op_ret, state->size , state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2638, GF_LOG_TRACE, "%""l" "u"": READDIRP => %d/%" "zu"",%""l" "d", frame->root->unique, op_ret, state-> size, state->off); } while (0); |
2639 | |
2640 | list_for_each_entry (entry, &entries->list, list)for (entry = ((typeof(*entry) *)((char *)((&entries->list )->next)-(unsigned long)(&((typeof(*entry) *)0)->list ))); &entry->list != (&entries->list); entry = ( (typeof(*entry) *)((char *)(entry->list.next)-(unsigned long )(&((typeof(*entry) *)0)->list)))) { |
2641 | size += FUSE_DIRENT_ALIGN (FUSE_NAME_OFFSET_DIRENTPLUS +(((__builtin_offsetof(struct fuse_direntplus, dirent.name) + strlen (entry->d_name)) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t ) - 1)) |
2642 | strlen (entry->d_name))(((__builtin_offsetof(struct fuse_direntplus, dirent.name) + strlen (entry->d_name)) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t ) - 1)); |
2643 | } |
2644 | |
2645 | if (size <= 0) { |
2646 | send_fuse_data (this, finh, 0, 0); |
2647 | goto out; |
2648 | } |
2649 | |
2650 | buf = GF_CALLOC (1, size, gf_fuse_mt_char)__gf_calloc (1, size, gf_fuse_mt_char); |
2651 | if (!buf) { |
2652 | gf_log ("glusterfs-fuse", GF_LOG_DEBUG,do { do { if (0) printf ("%""l" "u"": READDIRP => -1 (%s)" , frame->root->unique, strerror (12)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2654, GF_LOG_DEBUG , "%""l" "u"": READDIRP => -1 (%s)", frame->root->unique , strerror (12)); } while (0) |
2653 | "%"PRIu64": READDIRP => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""l" "u"": READDIRP => -1 (%s)" , frame->root->unique, strerror (12)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2654, GF_LOG_DEBUG , "%""l" "u"": READDIRP => -1 (%s)", frame->root->unique , strerror (12)); } while (0) |
2654 | strerror (ENOMEM))do { do { if (0) printf ("%""l" "u"": READDIRP => -1 (%s)" , frame->root->unique, strerror (12)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2654, GF_LOG_DEBUG , "%""l" "u"": READDIRP => -1 (%s)", frame->root->unique , strerror (12)); } while (0); |
2655 | send_fuse_err (this, finh, ENOMEM12); |
2656 | goto out; |
2657 | } |
2658 | |
2659 | size = 0; |
2660 | list_for_each_entry (entry, &entries->list, list)for (entry = ((typeof(*entry) *)((char *)((&entries->list )->next)-(unsigned long)(&((typeof(*entry) *)0)->list ))); &entry->list != (&entries->list); entry = ( (typeof(*entry) *)((char *)(entry->list.next)-(unsigned long )(&((typeof(*entry) *)0)->list)))) { |
2661 | inode_t *linked_inode; |
2662 | |
2663 | fde = (struct fuse_direntplus *)(buf + size); |
2664 | feo = &fde->entry_out; |
2665 | fde->dirent.ino = entry->d_ino; |
2666 | fde->dirent.off = entry->d_off; |
2667 | fde->dirent.type = entry->d_type; |
2668 | fde->dirent.namelen = strlen (entry->d_name); |
2669 | strncpy (fde->dirent.name, entry->d_name, fde->dirent.namelen); |
2670 | size += FUSE_DIRENTPLUS_SIZE (fde)(((__builtin_offsetof(struct fuse_direntplus, dirent.name) + ( fde)->dirent.namelen) + sizeof(uint64_t) - 1) & ~(sizeof (uint64_t) - 1)); |
2671 | |
2672 | if (!entry->inode) |
2673 | continue; |
2674 | |
2675 | entry->d_stat.ia_blksize = this->ctx->page_size; |
2676 | gf_fuse_stat2attr (&entry->d_stat, &feo->attr, priv->enable_ino32); |
2677 | |
2678 | linked_inode = inode_link (entry->inode, state->fd->inode, |
2679 | entry->d_name, &entry->d_stat); |
2680 | if (!linked_inode) |
2681 | continue; |
2682 | |
2683 | inode_lookup (linked_inode); |
2684 | |
2685 | feo->nodeid = inode_to_fuse_nodeid (linked_inode); |
2686 | |
2687 | fuse_inode_set_need_lookup (linked_inode, this); |
2688 | |
2689 | inode_unref (linked_inode); |
2690 | |
2691 | feo->entry_valid = |
2692 | calc_timeout_sec (priv->entry_timeout); |
2693 | feo->entry_valid_nsec = |
2694 | calc_timeout_nsec (priv->entry_timeout); |
2695 | feo->attr_valid = |
2696 | calc_timeout_sec (priv->attribute_timeout); |
2697 | feo->attr_valid_nsec = |
2698 | calc_timeout_nsec (priv->attribute_timeout); |
2699 | } |
2700 | |
2701 | send_fuse_data (this, finh, buf, size); |
2702 | out: |
2703 | free_fuse_state (state); |
2704 | STACK_DESTROY (frame->root); |
2705 | GF_FREE (buf)__gf_free (buf); |
2706 | return 0; |
2707 | |
2708 | } |
2709 | |
2710 | |
2711 | void |
2712 | fuse_readdirp_resume (fuse_state_t *state) |
2713 | { |
2714 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": READDIRP (%p, size=%""zu" ", offset=%""l" "d"")", state->finh->unique, state-> fd, state->size, state->off); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2716, GF_LOG_TRACE, "%""l" "u" ": READDIRP (%p, size=%""zu"", offset=%""l" "d"")", state-> finh->unique, state->fd, state->size, state->off) ; } while (0) |
2715 | "%"PRIu64": READDIRP (%p, size=%"GF_PRI_SIZET", offset=%"PRId64")",do { do { if (0) printf ("%""l" "u"": READDIRP (%p, size=%""zu" ", offset=%""l" "d"")", state->finh->unique, state-> fd, state->size, state->off); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2716, GF_LOG_TRACE, "%""l" "u" ": READDIRP (%p, size=%""zu"", offset=%""l" "d"")", state-> finh->unique, state->fd, state->size, state->off) ; } while (0) |
2716 | state->finh->unique, state->fd, state->size, state->off)do { do { if (0) printf ("%""l" "u"": READDIRP (%p, size=%""zu" ", offset=%""l" "d"")", state->finh->unique, state-> fd, state->size, state->off); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2716, GF_LOG_TRACE, "%""l" "u" ": READDIRP (%p, size=%""zu"", offset=%""l" "d"")", state-> finh->unique, state->fd, state->size, state->off) ; } while (0); |
2717 | |
2718 | FUSE_FOP (state, fuse_readdirp_cbk, GF_FOP_READDIRP,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2719, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_READDIRP; frame-> op = GF_FOP_READDIRP; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state->resolve ); } xl = state->active_subvol; if (!xl) { do { do { if (0 ) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2719, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_READDIRP == GF_FOP_LOOKUP) { do { do { if ( 0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2719, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2719, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2719, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2719, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->readdirp_cbk) tmp_cbk = fuse_readdirp_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> readdirp"; _new->unwind_to = "fuse_readdirp_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> readdirp); xl->fops->readdirp (_new, xl, state->fd, state ->size, state->off, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0) |
2719 | readdirp, state->fd, state->size, state->off, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2719, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_READDIRP; frame-> op = GF_FOP_READDIRP; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state->resolve ); } xl = state->active_subvol; if (!xl) { do { do { if (0 ) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2719, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_READDIRP == GF_FOP_LOOKUP) { do { do { if ( 0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2719, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2719, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2719, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2719, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->readdirp_cbk) tmp_cbk = fuse_readdirp_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> readdirp"; _new->unwind_to = "fuse_readdirp_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> readdirp); xl->fops->readdirp (_new, xl, state->fd, state ->size, state->off, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0); |
2720 | } |
2721 | |
2722 | |
2723 | static void |
2724 | fuse_readdirp (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2725 | { |
2726 | struct fuse_read_in *fri = msg; |
2727 | |
2728 | fuse_state_t *state = NULL((void*)0); |
2729 | fd_t *fd = NULL((void*)0); |
2730 | |
2731 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2731, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2732 | state->size = fri->size; |
2733 | state->off = fri->offset; |
2734 | fd = FH_TO_FD (fri->fh)((((fd_t *)(uintptr_t)(fri->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fri->fh)))):((fd_t *) 0)); |
2735 | state->fd = fd; |
2736 | |
2737 | fuse_resolve_fd_init (state, &state->resolve, fd); |
2738 | |
2739 | fuse_resolve_and_resume (state, fuse_readdirp_resume); |
2740 | } |
2741 | |
2742 | #ifdef FALLOC_FL_KEEP_SIZE0x01 |
2743 | static int |
2744 | fuse_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this, |
2745 | int32_t op_ret, int32_t op_errno, struct iatt *prebuf, |
2746 | struct iatt *postbuf, dict_t *xdata) |
2747 | { |
2748 | return fuse_err_cbk(frame, cookie, this, op_ret, op_errno, xdata); |
2749 | } |
2750 | |
2751 | static void |
2752 | fuse_fallocate_resume(fuse_state_t *state) |
2753 | { |
2754 | gf_log("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": FALLOCATE (%p, flags=%d, size=%zu, offset=%" "l" "d"")", state->finh->unique, state->fd, state-> flags, state->size, state->off); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2757, GF_LOG_TRACE , "%""l" "u"": FALLOCATE (%p, flags=%d, size=%zu, offset=%""l" "d"")", state->finh->unique, state->fd, state->flags , state->size, state->off); } while (0) |
2755 | "%"PRIu64": FALLOCATE (%p, flags=%d, size=%zu, offset=%"PRId64")",do { do { if (0) printf ("%""l" "u"": FALLOCATE (%p, flags=%d, size=%zu, offset=%" "l" "d"")", state->finh->unique, state->fd, state-> flags, state->size, state->off); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2757, GF_LOG_TRACE , "%""l" "u"": FALLOCATE (%p, flags=%d, size=%zu, offset=%""l" "d"")", state->finh->unique, state->fd, state->flags , state->size, state->off); } while (0) |
2756 | state->finh->unique, state->fd, state->flags, state->size,do { do { if (0) printf ("%""l" "u"": FALLOCATE (%p, flags=%d, size=%zu, offset=%" "l" "d"")", state->finh->unique, state->fd, state-> flags, state->size, state->off); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2757, GF_LOG_TRACE , "%""l" "u"": FALLOCATE (%p, flags=%d, size=%zu, offset=%""l" "d"")", state->finh->unique, state->fd, state->flags , state->size, state->off); } while (0) |
2757 | state->off)do { do { if (0) printf ("%""l" "u"": FALLOCATE (%p, flags=%d, size=%zu, offset=%" "l" "d"")", state->finh->unique, state->fd, state-> flags, state->size, state->off); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2757, GF_LOG_TRACE , "%""l" "u"": FALLOCATE (%p, flags=%d, size=%zu, offset=%""l" "d"")", state->finh->unique, state->fd, state->flags , state->size, state->off); } while (0); |
2758 | |
2759 | if (state->flags & FALLOC_FL_PUNCH_HOLE0x02) |
2760 | FUSE_FOP(state, fuse_fallocate_cbk, GF_FOP_DISCARD, discard,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2761, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_DISCARD; frame->op = GF_FOP_DISCARD; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2761, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_DISCARD == GF_FOP_LOOKUP) { do { do { if (0 ) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2761, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2761, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2761, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2761, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->discard_cbk) tmp_cbk = fuse_fallocate_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->discard"; _new->unwind_to = "fuse_fallocate_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> discard); xl->fops->discard (_new, xl, state->fd, state ->off, state->size, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0) |
2761 | state->fd, state->off, state->size, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2761, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_DISCARD; frame->op = GF_FOP_DISCARD; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2761, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_DISCARD == GF_FOP_LOOKUP) { do { do { if (0 ) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2761, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2761, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2761, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2761, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->discard_cbk) tmp_cbk = fuse_fallocate_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->discard"; _new->unwind_to = "fuse_fallocate_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> discard); xl->fops->discard (_new, xl, state->fd, state ->off, state->size, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0); |
2762 | else |
2763 | FUSE_FOP(state, fuse_fallocate_cbk, GF_FOP_FALLOCATE, fallocate,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2765, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FALLOCATE; frame-> op = GF_FOP_FALLOCATE; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state-> resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2765, GF_LOG_ERROR , "xl is NULL"); } while (0); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno ; op_ret = -1; if (GF_FOP_FALLOCATE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame-> root->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2765, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2765, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2765, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2765, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fallocate_cbk) tmp_cbk = fuse_fallocate_cbk; _new->root = frame->root; _new-> this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "xl->fops->fallocate"; _new->unwind_to = "fuse_fallocate_cbk"; pthread_spin_init (&_new->lock , 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame->root->frames.next; _new->prev = &frame->root->frames; if (frame->root->frames .next) frame->root->frames.next->prev = _new; frame-> root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fallocate); xl->fops->fallocate (_new, xl, state->fd , (state->flags & 0x01), state->off, state->size , state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0) |
2764 | state->fd, (state->flags & FALLOC_FL_KEEP_SIZE),do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2765, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FALLOCATE; frame-> op = GF_FOP_FALLOCATE; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state-> resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2765, GF_LOG_ERROR , "xl is NULL"); } while (0); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno ; op_ret = -1; if (GF_FOP_FALLOCATE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame-> root->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2765, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2765, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2765, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2765, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fallocate_cbk) tmp_cbk = fuse_fallocate_cbk; _new->root = frame->root; _new-> this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "xl->fops->fallocate"; _new->unwind_to = "fuse_fallocate_cbk"; pthread_spin_init (&_new->lock , 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame->root->frames.next; _new->prev = &frame->root->frames; if (frame->root->frames .next) frame->root->frames.next->prev = _new; frame-> root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fallocate); xl->fops->fallocate (_new, xl, state->fd , (state->flags & 0x01), state->off, state->size , state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0) |
2765 | state->off, state->size, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2765, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FALLOCATE; frame-> op = GF_FOP_FALLOCATE; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state-> resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2765, GF_LOG_ERROR , "xl is NULL"); } while (0); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno ; op_ret = -1; if (GF_FOP_FALLOCATE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame-> root->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2765, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2765, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2765, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2765, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fallocate_cbk) tmp_cbk = fuse_fallocate_cbk; _new->root = frame->root; _new-> this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "xl->fops->fallocate"; _new->unwind_to = "fuse_fallocate_cbk"; pthread_spin_init (&_new->lock , 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame->root->frames.next; _new->prev = &frame->root->frames; if (frame->root->frames .next) frame->root->frames.next->prev = _new; frame-> root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fallocate); xl->fops->fallocate (_new, xl, state->fd , (state->flags & 0x01), state->off, state->size , state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0); |
2766 | } |
2767 | |
2768 | static void |
2769 | fuse_fallocate(xlator_t *this, fuse_in_header_t *finh, void *msg) |
2770 | { |
2771 | struct fuse_fallocate_in *ffi = msg; |
2772 | fuse_state_t *state = NULL((void*)0); |
2773 | |
2774 | GET_STATE(this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2774, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2775 | state->off = ffi->offset; |
2776 | state->size = ffi->length; |
2777 | state->flags = ffi->mode; |
2778 | state->fd = FH_TO_FD(ffi->fh)((((fd_t *)(uintptr_t)(ffi->fh)))?(fd_ref (((fd_t *)(uintptr_t )(ffi->fh)))):((fd_t *) 0)); |
2779 | |
2780 | fuse_resolve_fd_init(state, &state->resolve, state->fd); |
2781 | fuse_resolve_and_resume(state, fuse_fallocate_resume); |
2782 | } |
2783 | #endif /* FALLOC_FL_KEEP_SIZE */ |
2784 | |
2785 | |
2786 | static void |
2787 | fuse_releasedir (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2788 | { |
2789 | struct fuse_release_in *fri = msg; |
2790 | fd_t *activefd = NULL((void*)0); |
2791 | uint64_t val = 0; |
2792 | int ret = 0; |
2793 | fuse_state_t *state = NULL((void*)0); |
2794 | fuse_fd_ctx_t *fdctx = NULL((void*)0); |
2795 | fuse_private_t *priv = NULL((void*)0); |
2796 | |
2797 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2797, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2798 | state->fd = FH_TO_FD (fri->fh)((((fd_t *)(uintptr_t)(fri->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fri->fh)))):((fd_t *) 0)); |
2799 | |
2800 | priv = this->private; |
2801 | |
2802 | fuse_log_eh (this, "RELEASEDIR (): %"PRIu64": fd: %p, gfid: %s",do { if (this->history) do { do { if (0) printf ("RELEASEDIR (): %" "l" "u"": fd: %p, gfid: %s", finh->unique, state->fd, uuid_utoa (state->fd->inode->gfid)); } while (0); _gf_log_eh ( __FUNCTION__,"RELEASEDIR (): %""l" "u"": fd: %p, gfid: %s", finh ->unique, state->fd, uuid_utoa (state->fd->inode-> gfid)); } while (0); } while (0) |
2803 | finh->unique, state->fd,do { if (this->history) do { do { if (0) printf ("RELEASEDIR (): %" "l" "u"": fd: %p, gfid: %s", finh->unique, state->fd, uuid_utoa (state->fd->inode->gfid)); } while (0); _gf_log_eh ( __FUNCTION__,"RELEASEDIR (): %""l" "u"": fd: %p, gfid: %s", finh ->unique, state->fd, uuid_utoa (state->fd->inode-> gfid)); } while (0); } while (0) |
2804 | uuid_utoa (state->fd->inode->gfid))do { if (this->history) do { do { if (0) printf ("RELEASEDIR (): %" "l" "u"": fd: %p, gfid: %s", finh->unique, state->fd, uuid_utoa (state->fd->inode->gfid)); } while (0); _gf_log_eh ( __FUNCTION__,"RELEASEDIR (): %""l" "u"": fd: %p, gfid: %s", finh ->unique, state->fd, uuid_utoa (state->fd->inode-> gfid)); } while (0); } while (0); |
2805 | |
2806 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": RELEASEDIR %p", finh-> unique, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2807, GF_LOG_TRACE, "%""l" "u" ": RELEASEDIR %p", finh->unique, state->fd); } while (0 ) |
2807 | "%"PRIu64": RELEASEDIR %p", finh->unique, state->fd)do { do { if (0) printf ("%""l" "u"": RELEASEDIR %p", finh-> unique, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2807, GF_LOG_TRACE, "%""l" "u" ": RELEASEDIR %p", finh->unique, state->fd); } while (0 ); |
2808 | |
2809 | ret = fd_ctx_del (state->fd, this, &val); |
2810 | |
2811 | if (!ret) { |
2812 | fdctx = (fuse_fd_ctx_t *)(unsigned long)val; |
2813 | if (fdctx) { |
2814 | activefd = fdctx->activefd; |
2815 | if (activefd) { |
2816 | fd_unref (activefd); |
2817 | } |
2818 | |
2819 | GF_FREE (fdctx)__gf_free (fdctx); |
2820 | } |
2821 | } |
2822 | |
2823 | fd_unref (state->fd); |
2824 | |
2825 | gf_fdptr_put (priv->fdtable, state->fd); |
2826 | |
2827 | state->fd = NULL((void*)0); |
2828 | |
2829 | send_fuse_err (this, finh, 0); |
2830 | |
2831 | free_fuse_state (state); |
2832 | |
2833 | return; |
2834 | } |
2835 | |
2836 | void |
2837 | fuse_fsyncdir_resume (fuse_state_t *state) |
2838 | { |
2839 | FUSE_FOP (state, fuse_err_cbk, GF_FOP_FSYNCDIR,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2840, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FSYNCDIR; frame-> op = GF_FOP_FSYNCDIR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state->resolve ); } xl = state->active_subvol; if (!xl) { do { do { if (0 ) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2840, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_FSYNCDIR == GF_FOP_LOOKUP) { do { do { if ( 0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2840, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2840, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2840, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2840, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fsyncdir_cbk) tmp_cbk = fuse_err_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> fsyncdir"; _new->unwind_to = "fuse_err_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fsyncdir); xl->fops->fsyncdir (_new, xl, state->fd, ( state->flags & 1), state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0) |
2840 | fsyncdir, state->fd, (state->flags & 1), state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2840, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FSYNCDIR; frame-> op = GF_FOP_FSYNCDIR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state->resolve ); } xl = state->active_subvol; if (!xl) { do { do { if (0 ) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2840, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_FSYNCDIR == GF_FOP_LOOKUP) { do { do { if ( 0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2840, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2840, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2840, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2840, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fsyncdir_cbk) tmp_cbk = fuse_err_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> fsyncdir"; _new->unwind_to = "fuse_err_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fsyncdir); xl->fops->fsyncdir (_new, xl, state->fd, ( state->flags & 1), state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0); |
2841 | |
2842 | } |
2843 | |
2844 | static void |
2845 | fuse_fsyncdir (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2846 | { |
2847 | struct fuse_fsync_in *fsi = msg; |
2848 | |
2849 | fuse_state_t *state = NULL((void*)0); |
2850 | fd_t *fd = NULL((void*)0); |
2851 | |
2852 | fd = FH_TO_FD (fsi->fh)((((fd_t *)(uintptr_t)(fsi->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fsi->fh)))):((fd_t *) 0)); |
2853 | |
2854 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2854, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2855 | state->fd = fd; |
2856 | |
2857 | fuse_resolve_fd_init (state, &state->resolve, fd); |
2858 | |
2859 | state->flags = fsi->fsync_flags; |
2860 | fuse_resolve_and_resume (state, fuse_fsyncdir_resume); |
2861 | |
2862 | return; |
2863 | } |
2864 | |
2865 | static int |
2866 | fuse_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
2867 | int32_t op_ret, int32_t op_errno, struct statvfs *buf, |
2868 | dict_t *xdata) |
2869 | { |
2870 | fuse_state_t *state = NULL((void*)0); |
2871 | fuse_in_header_t *finh = NULL((void*)0); |
2872 | fuse_private_t *priv = NULL((void*)0); |
2873 | struct fuse_statfs_out fso = {{0, }, }; |
2874 | |
2875 | state = frame->root->state; |
2876 | priv = this->private; |
2877 | finh = state->finh; |
2878 | |
2879 | fuse_log_eh (this, "op_ret: %d, op_errno: %d, %"PRIu64": %s()",do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"": %s()", op_ret, op_errno, frame->root->unique, gf_fop_list[frame->root->op]); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, %""l" "u"": %s()", op_ret , op_errno, frame->root->unique, gf_fop_list[frame-> root->op]); } while (0); } while (0) |
2880 | op_ret, op_errno, frame->root->unique,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"": %s()", op_ret, op_errno, frame->root->unique, gf_fop_list[frame->root->op]); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, %""l" "u"": %s()", op_ret , op_errno, frame->root->unique, gf_fop_list[frame-> root->op]); } while (0); } while (0) |
2881 | gf_fop_list[frame->root->op])do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "l" "u"": %s()", op_ret, op_errno, frame->root->unique, gf_fop_list[frame->root->op]); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, %""l" "u"": %s()", op_ret , op_errno, frame->root->unique, gf_fop_list[frame-> root->op]); } while (0); } while (0); |
2882 | |
2883 | if (op_ret == 0) { |
2884 | #ifndef GF_DARWIN_HOST_OS |
2885 | /* MacFUSE doesn't respect anyof these tweaks */ |
2886 | buf->f_blocks *= buf->f_frsize; |
2887 | buf->f_blocks /= this->ctx->page_size; |
2888 | |
2889 | buf->f_bavail *= buf->f_frsize; |
2890 | buf->f_bavail /= this->ctx->page_size; |
2891 | |
2892 | buf->f_bfree *= buf->f_frsize; |
2893 | buf->f_bfree /= this->ctx->page_size; |
2894 | |
2895 | buf->f_frsize = buf->f_bsize =this->ctx->page_size; |
2896 | #endif /* GF_DARWIN_HOST_OS */ |
2897 | fso.st.bsize = buf->f_bsize; |
2898 | fso.st.frsize = buf->f_frsize; |
2899 | fso.st.blocks = buf->f_blocks; |
2900 | fso.st.bfree = buf->f_bfree; |
2901 | fso.st.bavail = buf->f_bavail; |
2902 | fso.st.files = buf->f_files; |
2903 | fso.st.ffree = buf->f_ffree; |
2904 | fso.st.namelen = buf->f_namemax; |
2905 | |
2906 | priv->proto_minor >= 4 ? |
2907 | send_fuse_obj (this, finh, &fso)send_fuse_data (this, finh, &fso, sizeof (*(&fso))) : |
2908 | send_fuse_data (this, finh, &fso, FUSE_COMPAT_STATFS_SIZE48); |
2909 | } else { |
2910 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": ERR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2912, GF_LOG_WARNING , "%""l" "u"": ERR => -1 (%s)", frame->root->unique, strerror (op_errno)); } while (0) |
2911 | "%"PRIu64": ERR => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""l" "u"": ERR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2912, GF_LOG_WARNING , "%""l" "u"": ERR => -1 (%s)", frame->root->unique, strerror (op_errno)); } while (0) |
2912 | strerror (op_errno))do { do { if (0) printf ("%""l" "u"": ERR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2912, GF_LOG_WARNING , "%""l" "u"": ERR => -1 (%s)", frame->root->unique, strerror (op_errno)); } while (0); |
2913 | send_fuse_err (this, finh, op_errno); |
2914 | } |
2915 | |
2916 | free_fuse_state (state); |
2917 | STACK_DESTROY (frame->root); |
2918 | |
2919 | return 0; |
2920 | } |
2921 | |
2922 | void |
2923 | fuse_statfs_resume (fuse_state_t *state) |
2924 | { |
2925 | if (!state->loc.inode) { |
2926 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": STATFS (%s) resolution fail" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2928, GF_LOG_WARNING, "%""l" "u"": STATFS (%s) resolution fail" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0) |
2927 | "%"PRIu64": STATFS (%s) resolution fail",do { do { if (0) printf ("%""l" "u"": STATFS (%s) resolution fail" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2928, GF_LOG_WARNING, "%""l" "u"": STATFS (%s) resolution fail" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0) |
2928 | state->finh->unique, uuid_utoa (state->resolve.gfid))do { do { if (0) printf ("%""l" "u"": STATFS (%s) resolution fail" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2928, GF_LOG_WARNING, "%""l" "u"": STATFS (%s) resolution fail" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); |
2929 | |
2930 | send_fuse_err (state->this, state->finh, ENOENT2); |
2931 | free_fuse_state (state); |
2932 | return; |
2933 | } |
2934 | |
2935 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": STATFS", state->finh ->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2936, GF_LOG_TRACE, "%""l" "u"": STATFS", state ->finh->unique); } while (0) |
2936 | "%"PRIu64": STATFS", state->finh->unique)do { do { if (0) printf ("%""l" "u"": STATFS", state->finh ->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2936, GF_LOG_TRACE, "%""l" "u"": STATFS", state ->finh->unique); } while (0); |
2937 | |
2938 | FUSE_FOP (state, fuse_statfs_cbk, GF_FOP_STATFS,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2939, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_STATFS; frame->op = GF_FOP_STATFS; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2939, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_STATFS == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root-> unique, gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2939, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2939, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2939, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2939, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->statfs_cbk) tmp_cbk = fuse_statfs_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> statfs"; _new->unwind_to = "fuse_statfs_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> statfs); xl->fops->statfs (_new, xl, &state->loc , state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0) |
2939 | statfs, &state->loc, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2939, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_STATFS; frame->op = GF_FOP_STATFS; if ( state->resolve_now ) { resolve = state ->resolve_now; } else { resolve = &(state->resolve) ; } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2939, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_STATFS == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root-> unique, gf_fop_list[frame->root->op], resolve->resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2939, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2939, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2939, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2939, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->statfs_cbk) tmp_cbk = fuse_statfs_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> statfs"; _new->unwind_to = "fuse_statfs_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> statfs); xl->fops->statfs (_new, xl, &state->loc , state->xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); } } while (0); |
2940 | } |
2941 | |
2942 | |
2943 | static void |
2944 | fuse_statfs (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2945 | { |
2946 | fuse_state_t *state = NULL((void*)0); |
2947 | |
2948 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2948, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2949 | |
2950 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
2951 | |
2952 | fuse_resolve_and_resume (state, fuse_statfs_resume); |
2953 | } |
2954 | |
2955 | |
2956 | void |
2957 | fuse_setxattr_resume (fuse_state_t *state) |
2958 | { |
2959 | if (!state->loc.inode) { |
2960 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": SETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2964, GF_LOG_WARNING, "%""l" "u"": SETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0) |
2961 | "%"PRIu64": SETXATTR %s/%"PRIu64" (%s) "do { do { if (0) printf ("%""l" "u"": SETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2964, GF_LOG_WARNING, "%""l" "u"": SETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0) |
2962 | "resolution failed",do { do { if (0) printf ("%""l" "u"": SETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2964, GF_LOG_WARNING, "%""l" "u"": SETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0) |
2963 | state->finh->unique, uuid_utoa (state->resolve.gfid),do { do { if (0) printf ("%""l" "u"": SETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2964, GF_LOG_WARNING, "%""l" "u"": SETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0) |
2964 | state->finh->nodeid, state->name)do { do { if (0) printf ("%""l" "u"": SETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2964, GF_LOG_WARNING, "%""l" "u"": SETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0); |
2965 | send_fuse_err (state->this, state->finh, ENOENT2); |
2966 | free_fuse_state (state); |
2967 | return; |
2968 | } |
2969 | |
2970 | #ifdef GF_TEST_FFOP |
2971 | state->fd = fd_lookup (state->loc.inode, state->finh->pid); |
2972 | #endif /* GF_TEST_FFOP */ |
2973 | |
2974 | if (state->fd) { |
2975 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": SETXATTR %p/%""l" "u"" (%s)" , state->finh->unique, state->fd, state->finh-> nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2977, GF_LOG_TRACE, "%""l" "u" ": SETXATTR %p/%""l" "u"" (%s)", state->finh->unique, state ->fd, state->finh->nodeid, state->name); } while ( 0) |
2976 | "%"PRIu64": SETXATTR %p/%"PRIu64" (%s)", state->finh->unique,do { do { if (0) printf ("%""l" "u"": SETXATTR %p/%""l" "u"" (%s)" , state->finh->unique, state->fd, state->finh-> nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2977, GF_LOG_TRACE, "%""l" "u" ": SETXATTR %p/%""l" "u"" (%s)", state->finh->unique, state ->fd, state->finh->nodeid, state->name); } while ( 0) |
2977 | state->fd, state->finh->nodeid, state->name)do { do { if (0) printf ("%""l" "u"": SETXATTR %p/%""l" "u"" (%s)" , state->finh->unique, state->fd, state->finh-> nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2977, GF_LOG_TRACE, "%""l" "u" ": SETXATTR %p/%""l" "u"" (%s)", state->finh->unique, state ->fd, state->finh->nodeid, state->name); } while ( 0); |
2978 | |
2979 | FUSE_FOP (state, fuse_setxattr_cbk, GF_FOP_FSETXATTR,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2981, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FSETXATTR; frame-> op = GF_FOP_FSETXATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state-> resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2981, GF_LOG_ERROR , "xl is NULL"); } while (0); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno ; op_ret = -1; if (GF_FOP_FSETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame-> root->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2981, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2981, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2981, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2981, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fsetxattr_cbk) tmp_cbk = fuse_setxattr_cbk; _new->root = frame->root; _new-> this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "xl->fops-> fsetxattr"; _new->unwind_to = "fuse_setxattr_cbk"; pthread_spin_init (&_new->lock , 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame->root->frames.next; _new->prev = &frame->root->frames; if (frame->root->frames .next) frame->root->frames.next->prev = _new; frame-> root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fsetxattr); xl->fops->fsetxattr (_new, xl, state->fd , state->xattr, state->flags, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0) |
2980 | fsetxattr, state->fd, state->xattr, state->flags,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2981, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FSETXATTR; frame-> op = GF_FOP_FSETXATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state-> resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2981, GF_LOG_ERROR , "xl is NULL"); } while (0); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno ; op_ret = -1; if (GF_FOP_FSETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame-> root->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2981, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2981, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2981, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2981, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fsetxattr_cbk) tmp_cbk = fuse_setxattr_cbk; _new->root = frame->root; _new-> this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "xl->fops-> fsetxattr"; _new->unwind_to = "fuse_setxattr_cbk"; pthread_spin_init (&_new->lock , 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame->root->frames.next; _new->prev = &frame->root->frames; if (frame->root->frames .next) frame->root->frames.next->prev = _new; frame-> root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fsetxattr); xl->fops->fsetxattr (_new, xl, state->fd , state->xattr, state->flags, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0) |
2981 | state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2981, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FSETXATTR; frame-> op = GF_FOP_FSETXATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state-> resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2981, GF_LOG_ERROR , "xl is NULL"); } while (0); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno ; op_ret = -1; if (GF_FOP_FSETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame-> root->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2981, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2981, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2981, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2981, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fsetxattr_cbk) tmp_cbk = fuse_setxattr_cbk; _new->root = frame->root; _new-> this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "xl->fops-> fsetxattr"; _new->unwind_to = "fuse_setxattr_cbk"; pthread_spin_init (&_new->lock , 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame->root->frames.next; _new->prev = &frame->root->frames; if (frame->root->frames .next) frame->root->frames.next->prev = _new; frame-> root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fsetxattr); xl->fops->fsetxattr (_new, xl, state->fd , state->xattr, state->flags, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0); |
2982 | } else { |
2983 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": SETXATTR %s/%""l" "u"" (%s)" , state->finh->unique, state->loc.path, state->finh ->nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2985, GF_LOG_TRACE, "%""l" "u" ": SETXATTR %s/%""l" "u"" (%s)", state->finh->unique, state ->loc.path, state->finh->nodeid, state->name); } while (0) |
2984 | "%"PRIu64": SETXATTR %s/%"PRIu64" (%s)", state->finh->unique,do { do { if (0) printf ("%""l" "u"": SETXATTR %s/%""l" "u"" (%s)" , state->finh->unique, state->loc.path, state->finh ->nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2985, GF_LOG_TRACE, "%""l" "u" ": SETXATTR %s/%""l" "u"" (%s)", state->finh->unique, state ->loc.path, state->finh->nodeid, state->name); } while (0) |
2985 | state->loc.path, state->finh->nodeid, state->name)do { do { if (0) printf ("%""l" "u"": SETXATTR %s/%""l" "u"" (%s)" , state->finh->unique, state->loc.path, state->finh ->nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2985, GF_LOG_TRACE, "%""l" "u" ": SETXATTR %s/%""l" "u"" (%s)", state->finh->unique, state ->loc.path, state->finh->nodeid, state->name); } while (0); |
2986 | |
2987 | FUSE_FOP (state, fuse_setxattr_cbk, GF_FOP_SETXATTR,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2989, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_SETXATTR; frame-> op = GF_FOP_SETXATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state->resolve ); } xl = state->active_subvol; if (!xl) { do { do { if (0 ) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2989, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_SETXATTR == GF_FOP_LOOKUP) { do { do { if ( 0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2989, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2989, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2989, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2989, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->setxattr_cbk) tmp_cbk = fuse_setxattr_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> setxattr"; _new->unwind_to = "fuse_setxattr_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> setxattr); xl->fops->setxattr (_new, xl, &state-> loc, state->xattr, state->flags, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0) |
2988 | setxattr, &state->loc, state->xattr, state->flags,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2989, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_SETXATTR; frame-> op = GF_FOP_SETXATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state->resolve ); } xl = state->active_subvol; if (!xl) { do { do { if (0 ) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2989, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_SETXATTR == GF_FOP_LOOKUP) { do { do { if ( 0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2989, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2989, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2989, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2989, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->setxattr_cbk) tmp_cbk = fuse_setxattr_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> setxattr"; _new->unwind_to = "fuse_setxattr_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> setxattr); xl->fops->setxattr (_new, xl, &state-> loc, state->xattr, state->flags, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0) |
2989 | state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2989, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_SETXATTR; frame-> op = GF_FOP_SETXATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state->resolve ); } xl = state->active_subvol; if (!xl) { do { do { if (0 ) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2989, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_SETXATTR == GF_FOP_LOOKUP) { do { do { if ( 0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2989, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2989, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2989, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 2989, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->setxattr_cbk) tmp_cbk = fuse_setxattr_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> setxattr"; _new->unwind_to = "fuse_setxattr_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> setxattr); xl->fops->setxattr (_new, xl, &state-> loc, state->xattr, state->flags, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0); |
2990 | } |
2991 | } |
2992 | |
2993 | |
2994 | static void |
2995 | fuse_setxattr (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2996 | { |
2997 | struct fuse_setxattr_in *fsi = msg; |
2998 | char *name = (char *)(fsi + 1); |
2999 | char *value = name + strlen (name) + 1; |
3000 | struct fuse_private *priv = NULL((void*)0); |
3001 | |
3002 | fuse_state_t *state = NULL((void*)0); |
3003 | char *dict_value = NULL((void*)0); |
3004 | int32_t ret = -1; |
3005 | char *newkey = NULL((void*)0); |
3006 | |
3007 | priv = this->private; |
3008 | |
3009 | #ifdef GF_DARWIN_HOST_OS |
3010 | if (fsi->position) { |
3011 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": SETXATTR %s/%""l" "u"" (%s):" "refusing positioned setxattr", finh->unique, state->loc .path, finh->nodeid, name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3014, GF_LOG_WARNING, "%""l" "u"": SETXATTR %s/%""l" "u"" (%s):" "refusing positioned setxattr" , finh->unique, state->loc.path, finh->nodeid, name) ; } while (0) |
3012 | "%"PRIu64": SETXATTR %s/%"PRIu64" (%s):"do { do { if (0) printf ("%""l" "u"": SETXATTR %s/%""l" "u"" (%s):" "refusing positioned setxattr", finh->unique, state->loc .path, finh->nodeid, name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3014, GF_LOG_WARNING, "%""l" "u"": SETXATTR %s/%""l" "u"" (%s):" "refusing positioned setxattr" , finh->unique, state->loc.path, finh->nodeid, name) ; } while (0) |
3013 | "refusing positioned setxattr",do { do { if (0) printf ("%""l" "u"": SETXATTR %s/%""l" "u"" (%s):" "refusing positioned setxattr", finh->unique, state->loc .path, finh->nodeid, name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3014, GF_LOG_WARNING, "%""l" "u"": SETXATTR %s/%""l" "u"" (%s):" "refusing positioned setxattr" , finh->unique, state->loc.path, finh->nodeid, name) ; } while (0) |
3014 | finh->unique, state->loc.path, finh->nodeid, name)do { do { if (0) printf ("%""l" "u"": SETXATTR %s/%""l" "u"" (%s):" "refusing positioned setxattr", finh->unique, state->loc .path, finh->nodeid, name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3014, GF_LOG_WARNING, "%""l" "u"": SETXATTR %s/%""l" "u"" (%s):" "refusing positioned setxattr" , finh->unique, state->loc.path, finh->nodeid, name) ; } while (0); |
3015 | send_fuse_err (this, finh, EINVAL22); |
3016 | FREE (finh)if (finh != ((void*)0)) { free ((void *)finh); finh = (void * )0xeeeeeeee; }; |
3017 | return; |
3018 | } |
3019 | #endif |
3020 | |
3021 | if (fuse_ignore_xattr_set (priv, name)) { |
3022 | (void) send_fuse_err (this, finh, 0); |
3023 | return; |
3024 | } |
3025 | |
3026 | if (!priv->acl) { |
3027 | if ((strcmp (name, POSIX_ACL_ACCESS_XATTR"system.posix_acl_access") == 0) || |
3028 | (strcmp (name, POSIX_ACL_DEFAULT_XATTR"system.posix_acl_default") == 0)) { |
3029 | send_fuse_err (this, finh, EOPNOTSUPP95); |
3030 | GF_FREE (finh)__gf_free (finh); |
3031 | return; |
3032 | } |
3033 | } |
3034 | |
3035 | if (!priv->selinux) { |
3036 | if (strncmp (name, "security.", 9) == 0) { |
3037 | send_fuse_err (this, finh, EOPNOTSUPP95); |
3038 | GF_FREE (finh)__gf_free (finh); |
3039 | return; |
3040 | } |
3041 | } |
3042 | |
3043 | /* Check if the command is for changing the log |
3044 | level of process or specific xlator */ |
3045 | ret = is_gf_log_command (this, name, value); |
3046 | if (ret >= 0) { |
3047 | send_fuse_err (this, finh, ret); |
3048 | GF_FREE (finh)__gf_free (finh); |
3049 | return; |
3050 | } |
3051 | |
3052 | if (!strcmp ("inode-invalidate", name)) { |
3053 | gf_log ("fuse", GF_LOG_TRACE,do { do { if (0) printf ("got request to invalidate %""l" "u" , finh->nodeid); } while (0); _gf_log ("fuse", "fuse-bridge.c" , __FUNCTION__, 3054, GF_LOG_TRACE, "got request to invalidate %" "l" "u", finh->nodeid); } while (0) |
3054 | "got request to invalidate %"PRIu64, finh->nodeid)do { do { if (0) printf ("got request to invalidate %""l" "u" , finh->nodeid); } while (0); _gf_log ("fuse", "fuse-bridge.c" , __FUNCTION__, 3054, GF_LOG_TRACE, "got request to invalidate %" "l" "u", finh->nodeid); } while (0); |
3055 | send_fuse_err (this, finh, 0); |
3056 | fuse_invalidate_entry (this, finh->nodeid); |
3057 | GF_FREE (finh)__gf_free (finh); |
3058 | return; |
3059 | } |
3060 | |
3061 | if (!strcmp (GFID_XATTR_KEY"trusted.gfid", name) || !strcmp (GF_XATTR_VOL_ID_KEY"trusted.glusterfs.volume-id", name)) { |
3062 | send_fuse_err (this, finh, EPERM1); |
3063 | GF_FREE (finh)__gf_free (finh); |
3064 | return; |
3065 | } |
3066 | |
3067 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3067, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
3068 | state->size = fsi->size; |
3069 | |
3070 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
3071 | |
3072 | state->xattr = get_new_dict (); |
3073 | if (!state->xattr) { |
3074 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("%""l" "u"": SETXATTR dict allocation failed" , finh->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3076, GF_LOG_ERROR, "%""l" "u"": SETXATTR dict allocation failed" , finh->unique); } while (0) |
3075 | "%"PRIu64": SETXATTR dict allocation failed",do { do { if (0) printf ("%""l" "u"": SETXATTR dict allocation failed" , finh->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3076, GF_LOG_ERROR, "%""l" "u"": SETXATTR dict allocation failed" , finh->unique); } while (0) |
3076 | finh->unique)do { do { if (0) printf ("%""l" "u"": SETXATTR dict allocation failed" , finh->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3076, GF_LOG_ERROR, "%""l" "u"": SETXATTR dict allocation failed" , finh->unique); } while (0); |
3077 | |
3078 | send_fuse_err (this, finh, ENOMEM12); |
3079 | free_fuse_state (state); |
3080 | return; |
3081 | } |
3082 | |
3083 | ret = fuse_flip_xattr_ns (priv, name, &newkey); |
3084 | if (ret) { |
3085 | send_fuse_err (this, finh, ENOMEM12); |
3086 | free_fuse_state (state); |
3087 | return; |
3088 | } |
3089 | |
3090 | if (fsi->size > 0) { |
3091 | dict_value = memdup (value, fsi->size); |
3092 | } else { |
3093 | gf_log (THIS->name, GF_LOG_ERROR, "value size zero")do { do { if (0) printf ("value size zero"); } while (0); _gf_log ((*__glusterfs_this_location())->name, "fuse-bridge.c", __FUNCTION__ , 3093, GF_LOG_ERROR, "value size zero"); } while (0); |
3094 | dict_value = NULL((void*)0); |
3095 | } |
3096 | dict_set (state->xattr, newkey, |
3097 | data_from_dynptr ((void *)dict_value, fsi->size)); |
3098 | dict_ref (state->xattr); |
3099 | |
3100 | state->flags = fsi->flags; |
3101 | state->name = newkey; |
3102 | |
3103 | fuse_resolve_and_resume (state, fuse_setxattr_resume); |
3104 | |
3105 | return; |
3106 | } |
3107 | |
3108 | |
3109 | static void |
3110 | send_fuse_xattr (xlator_t *this, fuse_in_header_t *finh, const char *value, |
3111 | size_t size, size_t expected) |
3112 | { |
3113 | struct fuse_getxattr_out fgxo; |
3114 | |
3115 | /* linux kernel limits the size of xattr value to 64k */ |
3116 | if (size > GLUSTERFS_XATTR_LEN_MAX65536) |
3117 | send_fuse_err (this, finh, E2BIG7); |
3118 | else if (expected) { |
3119 | /* if callback for getxattr and asks for value */ |
3120 | if (size > expected) |
3121 | /* reply would be bigger than |
3122 | * what was asked by kernel */ |
3123 | send_fuse_err (this, finh, ERANGE34); |
3124 | else |
3125 | send_fuse_data (this, finh, (void *)value, size); |
3126 | } else { |
3127 | fgxo.size = size; |
3128 | send_fuse_obj (this, finh, &fgxo)send_fuse_data (this, finh, &fgxo, sizeof (*(&fgxo))); |
3129 | } |
3130 | } |
3131 | |
3132 | /* filter out xattrs that need not be visible on the |
3133 | * mount point. this is _specifically_ for geo-rep |
3134 | * as of now, to prevent Rsync from crying out loud |
3135 | * when it tries to setxattr() for selinux xattrs |
3136 | */ |
3137 | static int |
3138 | fuse_filter_xattr(char *key) |
3139 | { |
3140 | int need_filter = 0; |
3141 | struct fuse_private *priv = THIS(*__glusterfs_this_location())->private; |
3142 | |
3143 | if ((priv->client_pid == GF_CLIENT_PID_GSYNCD) |
3144 | && fnmatch ("*.selinux*", key, FNM_PERIOD(1 << 2)) == 0) |
3145 | need_filter = 1; |
3146 | |
3147 | return need_filter; |
3148 | } |
3149 | |
3150 | |
3151 | static int |
3152 | fuse_xattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
3153 | int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata) |
3154 | { |
3155 | int need_to_free_dict = 0; |
3156 | char *value = ""; |
3157 | fuse_state_t *state = NULL((void*)0); |
3158 | fuse_in_header_t *finh = NULL((void*)0); |
3159 | data_t *value_data = NULL((void*)0); |
3160 | int ret = -1; |
3161 | int32_t len = 0; |
3162 | int32_t len_next = 0; |
3163 | |
3164 | state = frame->root->state; |
3165 | finh = state->finh; |
3166 | |
3167 | fuse_log_eh_fop(this, state, frame, op_ret, op_errno)do { if (this->history) { if (state->fd) do { do { if ( 0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->fd, uuid_utoa (state->fd-> inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->fd, uuid_utoa (state->fd->inode->gfid)); } while (0); else do { do { if (0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, uuid_utoa (state->loc.gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, uuid_utoa (state->loc .gfid)); } while (0); } } while(0); |
3168 | |
3169 | if (op_ret >= 0) { |
3170 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": %s() %s => %d", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, op_ret); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3172, GF_LOG_TRACE, "%""l" "u" ": %s() %s => %d", frame->root->unique, gf_fop_list[ frame->root->op], state->loc.path, op_ret); } while ( 0) |
3171 | "%"PRIu64": %s() %s => %d", frame->root->unique,do { do { if (0) printf ("%""l" "u"": %s() %s => %d", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, op_ret); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3172, GF_LOG_TRACE, "%""l" "u" ": %s() %s => %d", frame->root->unique, gf_fop_list[ frame->root->op], state->loc.path, op_ret); } while ( 0) |
3172 | gf_fop_list[frame->root->op], state->loc.path, op_ret)do { do { if (0) printf ("%""l" "u"": %s() %s => %d", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, op_ret); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3172, GF_LOG_TRACE, "%""l" "u" ": %s() %s => %d", frame->root->unique, gf_fop_list[ frame->root->op], state->loc.path, op_ret); } while ( 0); |
3173 | |
3174 | /* if successful */ |
3175 | if (state->name) { |
3176 | /* if callback for getxattr */ |
3177 | value_data = dict_get (dict, state->name); |
3178 | if (value_data) { |
3179 | |
3180 | ret = value_data->len; /* Don't return the value for '\0' */ |
3181 | value = value_data->data; |
3182 | |
3183 | send_fuse_xattr (this, finh, value, ret, state->size); |
3184 | /* if(ret >...)...else if...else */ |
3185 | } else { |
3186 | send_fuse_err (this, finh, ENODATA61); |
3187 | } /* if(value_data)...else */ |
3188 | } else { |
3189 | /* if callback for listxattr */ |
3190 | /* we need to invoke fuse_filter_xattr() twice. Once |
3191 | * while counting size and then while filling buffer |
3192 | */ |
3193 | len = dict_keys_join (NULL((void*)0), 0, dict, fuse_filter_xattr); |
3194 | if (len < 0) |
3195 | goto out; |
3196 | |
3197 | value = alloca (len + 1)__builtin_alloca (len + 1); |
3198 | if (!value) |
3199 | goto out; |
3200 | |
3201 | len_next = dict_keys_join (value, len, dict, |
3202 | fuse_filter_xattr); |
3203 | if (len_next != len) |
3204 | gf_log (THIS->name, GF_LOG_ERROR,do { do { if (0) printf ("sizes not equal %d != %d", len, len_next ); } while (0); _gf_log ((*__glusterfs_this_location())->name , "fuse-bridge.c", __FUNCTION__, 3206, GF_LOG_ERROR, "sizes not equal %d != %d" , len, len_next); } while (0) |
3205 | "sizes not equal %d != %d",do { do { if (0) printf ("sizes not equal %d != %d", len, len_next ); } while (0); _gf_log ((*__glusterfs_this_location())->name , "fuse-bridge.c", __FUNCTION__, 3206, GF_LOG_ERROR, "sizes not equal %d != %d" , len, len_next); } while (0) |
3206 | len, len_next)do { do { if (0) printf ("sizes not equal %d != %d", len, len_next ); } while (0); _gf_log ((*__glusterfs_this_location())->name , "fuse-bridge.c", __FUNCTION__, 3206, GF_LOG_ERROR, "sizes not equal %d != %d" , len, len_next); } while (0); |
3207 | |
3208 | send_fuse_xattr (this, finh, value, len, state->size); |
3209 | } /* if(state->name)...else */ |
3210 | } else { |
3211 | /* if failure - no need to check if listxattr or getxattr */ |
3212 | if (op_errno != ENODATA61) { |
3213 | if (op_errno == ENOTSUP95) { |
3214 | GF_LOG_OCCASIONALLY (gf_fuse_xattr_enotsup_log,if (!(gf_fuse_xattr_enotsup_log++%42)) { do { do { if (0) printf ("extended attribute not " "supported by the backend " "storage" ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3219, GF_LOG_ERROR, "extended attribute not " "supported by the backend " "storage"); } while (0); } |
3215 | "glusterfs-fuse",if (!(gf_fuse_xattr_enotsup_log++%42)) { do { do { if (0) printf ("extended attribute not " "supported by the backend " "storage" ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3219, GF_LOG_ERROR, "extended attribute not " "supported by the backend " "storage"); } while (0); } |
3216 | GF_LOG_ERROR,if (!(gf_fuse_xattr_enotsup_log++%42)) { do { do { if (0) printf ("extended attribute not " "supported by the backend " "storage" ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3219, GF_LOG_ERROR, "extended attribute not " "supported by the backend " "storage"); } while (0); } |
3217 | "extended attribute not "if (!(gf_fuse_xattr_enotsup_log++%42)) { do { do { if (0) printf ("extended attribute not " "supported by the backend " "storage" ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3219, GF_LOG_ERROR, "extended attribute not " "supported by the backend " "storage"); } while (0); } |
3218 | "supported by the backend "if (!(gf_fuse_xattr_enotsup_log++%42)) { do { do { if (0) printf ("extended attribute not " "supported by the backend " "storage" ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3219, GF_LOG_ERROR, "extended attribute not " "supported by the backend " "storage"); } while (0); } |
3219 | "storage")if (!(gf_fuse_xattr_enotsup_log++%42)) { do { do { if (0) printf ("extended attribute not " "supported by the backend " "storage" ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3219, GF_LOG_ERROR, "extended attribute not " "supported by the backend " "storage"); } while (0); }; |
3220 | } else { |
3221 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": %s(%s) %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->name, state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3225, GF_LOG_WARNING, "%""l" "u"": %s(%s) %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->name, state->loc.path, strerror (op_errno)); } while (0) |
3222 | "%"PRIu64": %s(%s) %s => -1 (%s)",do { do { if (0) printf ("%""l" "u"": %s(%s) %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->name, state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3225, GF_LOG_WARNING, "%""l" "u"": %s(%s) %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->name, state->loc.path, strerror (op_errno)); } while (0) |
3223 | frame->root->unique,do { do { if (0) printf ("%""l" "u"": %s(%s) %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->name, state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3225, GF_LOG_WARNING, "%""l" "u"": %s(%s) %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->name, state->loc.path, strerror (op_errno)); } while (0) |
3224 | gf_fop_list[frame->root->op], state->name,do { do { if (0) printf ("%""l" "u"": %s(%s) %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->name, state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3225, GF_LOG_WARNING, "%""l" "u"": %s(%s) %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->name, state->loc.path, strerror (op_errno)); } while (0) |
3225 | state->loc.path, strerror (op_errno))do { do { if (0) printf ("%""l" "u"": %s(%s) %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->name, state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3225, GF_LOG_WARNING, "%""l" "u"": %s(%s) %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->name, state->loc.path, strerror (op_errno)); } while (0); |
3226 | } |
3227 | } else { |
3228 | gf_log ("glusterfs-fuse", GF_LOG_DEBUG,do { do { if (0) printf ("%""l" "u"": %s(%s) %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->name, state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3232, GF_LOG_DEBUG, "%""l" "u"": %s(%s) %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->name, state->loc.path, strerror (op_errno)); } while ( 0) |
3229 | "%"PRIu64": %s(%s) %s => -1 (%s)",do { do { if (0) printf ("%""l" "u"": %s(%s) %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->name, state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3232, GF_LOG_DEBUG, "%""l" "u"": %s(%s) %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->name, state->loc.path, strerror (op_errno)); } while ( 0) |
3230 | frame->root->unique,do { do { if (0) printf ("%""l" "u"": %s(%s) %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->name, state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3232, GF_LOG_DEBUG, "%""l" "u"": %s(%s) %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->name, state->loc.path, strerror (op_errno)); } while ( 0) |
3231 | gf_fop_list[frame->root->op], state->name,do { do { if (0) printf ("%""l" "u"": %s(%s) %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->name, state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3232, GF_LOG_DEBUG, "%""l" "u"": %s(%s) %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->name, state->loc.path, strerror (op_errno)); } while ( 0) |
3232 | state->loc.path, strerror (op_errno))do { do { if (0) printf ("%""l" "u"": %s(%s) %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->name, state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3232, GF_LOG_DEBUG, "%""l" "u"": %s(%s) %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->name, state->loc.path, strerror (op_errno)); } while ( 0); |
3233 | } /* if(op_errno!= ENODATA)...else */ |
3234 | |
3235 | send_fuse_err (this, finh, op_errno); |
3236 | } /* if(op_ret>=0)...else */ |
3237 | |
3238 | out: |
3239 | if (need_to_free_dict) |
3240 | dict_unref (dict); |
3241 | |
3242 | free_fuse_state (state); |
3243 | STACK_DESTROY (frame->root); |
3244 | |
3245 | return 0; |
3246 | } |
3247 | |
3248 | |
3249 | void |
3250 | fuse_getxattr_resume (fuse_state_t *state) |
3251 | { |
3252 | char *value = NULL((void*)0); |
3253 | |
3254 | if (!state->loc.inode) { |
3255 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": GETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3260, GF_LOG_WARNING, "%""l" "u"": GETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0) |
3256 | "%"PRIu64": GETXATTR %s/%"PRIu64" (%s) "do { do { if (0) printf ("%""l" "u"": GETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3260, GF_LOG_WARNING, "%""l" "u"": GETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0) |
3257 | "resolution failed",do { do { if (0) printf ("%""l" "u"": GETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3260, GF_LOG_WARNING, "%""l" "u"": GETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0) |
3258 | state->finh->unique,do { do { if (0) printf ("%""l" "u"": GETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3260, GF_LOG_WARNING, "%""l" "u"": GETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0) |
3259 | uuid_utoa (state->resolve.gfid),do { do { if (0) printf ("%""l" "u"": GETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3260, GF_LOG_WARNING, "%""l" "u"": GETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0) |
3260 | state->finh->nodeid, state->name)do { do { if (0) printf ("%""l" "u"": GETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3260, GF_LOG_WARNING, "%""l" "u"": GETXATTR %s/%""l" "u"" (%s) " "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid, state->name ); } while (0); |
3261 | |
3262 | send_fuse_err (state->this, state->finh, ENOENT2); |
3263 | free_fuse_state (state); |
3264 | return; |
3265 | } |
3266 | |
3267 | #ifdef GF_TEST_FFOP |
3268 | state->fd = fd_lookup (state->loc.inode, state->finh->pid); |
3269 | #endif /* GF_TEST_FFOP */ |
3270 | |
3271 | if (state->name && |
3272 | (strcmp (state->name, VIRTUAL_GFID_XATTR_KEY"glusterfs.gfid") == 0)) { |
3273 | /* send glusterfs gfid in binary form */ |
3274 | |
3275 | value = GF_CALLOC (16 + 1, sizeof(char),__gf_calloc (16 + 1, sizeof(char), gf_common_mt_char) |
3276 | gf_common_mt_char)__gf_calloc (16 + 1, sizeof(char), gf_common_mt_char); |
3277 | if (!value) { |
3278 | send_fuse_err (state->this, state->finh, ENOMEM12); |
3279 | goto internal_out; |
3280 | } |
3281 | memcpy (value, state->loc.inode->gfid, 16); |
3282 | |
3283 | send_fuse_xattr (THIS(*__glusterfs_this_location()), state->finh, value, 16, state->size); |
3284 | GF_FREE (value)__gf_free (value); |
3285 | internal_out: |
3286 | free_fuse_state (state); |
3287 | return; |
3288 | } |
3289 | |
3290 | if (state->name && |
3291 | (strcmp (state->name, VIRTUAL_GFID_XATTR_KEY_STR"glusterfs.gfid.string") == 0)) { |
3292 | /* transform binary gfid to canonical form */ |
3293 | |
3294 | value = GF_CALLOC (UUID_CANONICAL_FORM_LEN + 1, sizeof(char),__gf_calloc (36 + 1, sizeof(char), gf_common_mt_char) |
3295 | gf_common_mt_char)__gf_calloc (36 + 1, sizeof(char), gf_common_mt_char); |
3296 | if (!value) { |
3297 | send_fuse_err (state->this, state->finh, ENOMEM12); |
3298 | goto internal_out1; |
3299 | } |
3300 | uuid_utoa_r (state->loc.inode->gfid, value); |
3301 | |
3302 | send_fuse_xattr (THIS(*__glusterfs_this_location()), state->finh, value, |
3303 | UUID_CANONICAL_FORM_LEN36, state->size); |
3304 | GF_FREE (value)__gf_free (value); |
3305 | internal_out1: |
3306 | free_fuse_state (state); |
3307 | return; |
3308 | } |
3309 | |
3310 | |
3311 | if (state->fd) { |
3312 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": GETXATTR %p/%""l" "u"" (%s)" , state->finh->unique, state->fd, state->finh-> nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3314, GF_LOG_TRACE, "%""l" "u" ": GETXATTR %p/%""l" "u"" (%s)", state->finh->unique, state ->fd, state->finh->nodeid, state->name); } while ( 0) |
3313 | "%"PRIu64": GETXATTR %p/%"PRIu64" (%s)", state->finh->unique,do { do { if (0) printf ("%""l" "u"": GETXATTR %p/%""l" "u"" (%s)" , state->finh->unique, state->fd, state->finh-> nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3314, GF_LOG_TRACE, "%""l" "u" ": GETXATTR %p/%""l" "u"" (%s)", state->finh->unique, state ->fd, state->finh->nodeid, state->name); } while ( 0) |
3314 | state->fd, state->finh->nodeid, state->name)do { do { if (0) printf ("%""l" "u"": GETXATTR %p/%""l" "u"" (%s)" , state->finh->unique, state->fd, state->finh-> nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3314, GF_LOG_TRACE, "%""l" "u" ": GETXATTR %p/%""l" "u"" (%s)", state->finh->unique, state ->fd, state->finh->nodeid, state->name); } while ( 0); |
3315 | |
3316 | FUSE_FOP (state, fuse_xattr_cbk, GF_FOP_FGETXATTR,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3317, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FGETXATTR; frame-> op = GF_FOP_FGETXATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state-> resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3317, GF_LOG_ERROR , "xl is NULL"); } while (0); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno ; op_ret = -1; if (GF_FOP_FGETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame-> root->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3317, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3317, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3317, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 3317, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fgetxattr_cbk) tmp_cbk = fuse_xattr_cbk; _new->root = frame->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame ; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new ->wind_to = "xl->fops-> fgetxattr"; _new->unwind_to = "fuse_xattr_cbk"; pthread_spin_init (&_new->lock, 0 ); pthread_spin_lock (&frame->root->stack_lock); { _new ->next = frame->root->frames.next; _new->prev = & frame->root->frames; if (frame->root->frames.next ) frame->root->frames.next->prev = _new; frame->root ->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fgetxattr); xl->fops->fgetxattr (_new, xl, state->fd , state->name, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0) |
3317 | fgetxattr, state->fd, state->name, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3317, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FGETXATTR; frame-> op = GF_FOP_FGETXATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state-> resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3317, GF_LOG_ERROR , "xl is NULL"); } while (0); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno ; op_ret = -1; if (GF_FOP_FGETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame-> root->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3317, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3317, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3317, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 3317, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fgetxattr_cbk) tmp_cbk = fuse_xattr_cbk; _new->root = frame->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame ; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new ->wind_to = "xl->fops-> fgetxattr"; _new->unwind_to = "fuse_xattr_cbk"; pthread_spin_init (&_new->lock, 0 ); pthread_spin_lock (&frame->root->stack_lock); { _new ->next = frame->root->frames.next; _new->prev = & frame->root->frames; if (frame->root->frames.next ) frame->root->frames.next->prev = _new; frame->root ->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fgetxattr); xl->fops->fgetxattr (_new, xl, state->fd , state->name, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0); |
3318 | } else { |
3319 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": GETXATTR %s/%""l" "u"" (%s)" , state->finh->unique, state->loc.path, state->finh ->nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3321, GF_LOG_TRACE, "%""l" "u" ": GETXATTR %s/%""l" "u"" (%s)", state->finh->unique, state ->loc.path, state->finh->nodeid, state->name); } while (0) |
3320 | "%"PRIu64": GETXATTR %s/%"PRIu64" (%s)", state->finh->unique,do { do { if (0) printf ("%""l" "u"": GETXATTR %s/%""l" "u"" (%s)" , state->finh->unique, state->loc.path, state->finh ->nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3321, GF_LOG_TRACE, "%""l" "u" ": GETXATTR %s/%""l" "u"" (%s)", state->finh->unique, state ->loc.path, state->finh->nodeid, state->name); } while (0) |
3321 | state->loc.path, state->finh->nodeid, state->name)do { do { if (0) printf ("%""l" "u"": GETXATTR %s/%""l" "u"" (%s)" , state->finh->unique, state->loc.path, state->finh ->nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3321, GF_LOG_TRACE, "%""l" "u" ": GETXATTR %s/%""l" "u"" (%s)", state->finh->unique, state ->loc.path, state->finh->nodeid, state->name); } while (0); |
3322 | |
3323 | FUSE_FOP (state, fuse_xattr_cbk, GF_FOP_GETXATTR,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3324, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_GETXATTR; frame-> op = GF_FOP_GETXATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state->resolve ); } xl = state->active_subvol; if (!xl) { do { do { if (0 ) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3324, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_GETXATTR == GF_FOP_LOOKUP) { do { do { if ( 0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3324, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3324, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3324, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 3324, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->getxattr_cbk) tmp_cbk = fuse_xattr_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> getxattr"; _new->unwind_to = "fuse_xattr_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> getxattr); xl->fops->getxattr (_new, xl, &state-> loc, state->name, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0) |
3324 | getxattr, &state->loc, state->name, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3324, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_GETXATTR; frame-> op = GF_FOP_GETXATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state->resolve ); } xl = state->active_subvol; if (!xl) { do { do { if (0 ) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3324, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_GETXATTR == GF_FOP_LOOKUP) { do { do { if ( 0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3324, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3324, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3324, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 3324, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->getxattr_cbk) tmp_cbk = fuse_xattr_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> getxattr"; _new->unwind_to = "fuse_xattr_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> getxattr); xl->fops->getxattr (_new, xl, &state-> loc, state->name, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0); |
3325 | } |
3326 | } |
3327 | |
3328 | |
3329 | static void |
3330 | fuse_getxattr (xlator_t *this, fuse_in_header_t *finh, void *msg) |
3331 | { |
3332 | struct fuse_getxattr_in *fgxi = msg; |
3333 | char *name = (char *)(fgxi + 1); |
3334 | fuse_state_t *state = NULL((void*)0); |
3335 | struct fuse_private *priv = NULL((void*)0); |
3336 | int rv = 0; |
3337 | int op_errno = EINVAL22; |
3338 | char *newkey = NULL((void*)0); |
3339 | |
3340 | priv = this->private; |
3341 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3341, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
3342 | |
3343 | #ifdef GF_DARWIN_HOST_OS |
3344 | if (fgxi->position) { |
3345 | /* position can be used only for |
3346 | * resource fork queries which we |
3347 | * don't support anyway... so handling |
3348 | * it separately is just sort of a |
3349 | * matter of aesthetics, not strictly |
3350 | * necessary. |
3351 | */ |
3352 | |
3353 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": GETXATTR %s/%""l" "u"" (%s):" "refusing positioned getxattr", finh->unique, state->loc .path, finh->nodeid, name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3356, GF_LOG_WARNING, "%""l" "u"": GETXATTR %s/%""l" "u"" (%s):" "refusing positioned getxattr" , finh->unique, state->loc.path, finh->nodeid, name) ; } while (0) |
3354 | "%"PRIu64": GETXATTR %s/%"PRIu64" (%s):"do { do { if (0) printf ("%""l" "u"": GETXATTR %s/%""l" "u"" (%s):" "refusing positioned getxattr", finh->unique, state->loc .path, finh->nodeid, name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3356, GF_LOG_WARNING, "%""l" "u"": GETXATTR %s/%""l" "u"" (%s):" "refusing positioned getxattr" , finh->unique, state->loc.path, finh->nodeid, name) ; } while (0) |
3355 | "refusing positioned getxattr",do { do { if (0) printf ("%""l" "u"": GETXATTR %s/%""l" "u"" (%s):" "refusing positioned getxattr", finh->unique, state->loc .path, finh->nodeid, name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3356, GF_LOG_WARNING, "%""l" "u"": GETXATTR %s/%""l" "u"" (%s):" "refusing positioned getxattr" , finh->unique, state->loc.path, finh->nodeid, name) ; } while (0) |
3356 | finh->unique, state->loc.path, finh->nodeid, name)do { do { if (0) printf ("%""l" "u"": GETXATTR %s/%""l" "u"" (%s):" "refusing positioned getxattr", finh->unique, state->loc .path, finh->nodeid, name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3356, GF_LOG_WARNING, "%""l" "u"": GETXATTR %s/%""l" "u"" (%s):" "refusing positioned getxattr" , finh->unique, state->loc.path, finh->nodeid, name) ; } while (0); |
3357 | op_errno = EINVAL22; |
3358 | goto err; |
3359 | } |
3360 | #endif |
3361 | |
3362 | if (!priv->acl) { |
3363 | if ((strcmp (name, POSIX_ACL_ACCESS_XATTR"system.posix_acl_access") == 0) || |
3364 | (strcmp (name, POSIX_ACL_DEFAULT_XATTR"system.posix_acl_default") == 0)) { |
3365 | op_errno = ENOTSUP95; |
3366 | goto err; |
3367 | } |
3368 | } |
3369 | |
3370 | if (!priv->selinux) { |
3371 | if (strncmp (name, "security.", 9) == 0) { |
3372 | op_errno = ENODATA61; |
3373 | goto err; |
3374 | } |
3375 | } |
3376 | |
3377 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
3378 | |
3379 | rv = fuse_flip_xattr_ns (priv, name, &newkey); |
3380 | if (rv) { |
3381 | op_errno = ENOMEM12; |
3382 | goto err; |
3383 | } |
3384 | |
3385 | state->size = fgxi->size; |
3386 | state->name = newkey; |
3387 | |
3388 | fuse_resolve_and_resume (state, fuse_getxattr_resume); |
3389 | |
3390 | return; |
3391 | err: |
3392 | send_fuse_err (this, finh, op_errno); |
3393 | free_fuse_state (state); |
3394 | return; |
3395 | } |
3396 | |
3397 | |
3398 | void |
3399 | fuse_listxattr_resume (fuse_state_t *state) |
3400 | { |
3401 | if (!state->loc.inode) { |
3402 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": LISTXATTR %s/%""l" "u" "resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid ), state->finh->nodeid); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3405, GF_LOG_WARNING, "%""l" "u"": LISTXATTR %s/%""l" "u" "resolution failed", state-> finh->unique, uuid_utoa (state->resolve.gfid), state-> finh->nodeid); } while (0) |
3403 | "%"PRIu64": LISTXATTR %s/%"PRIu64do { do { if (0) printf ("%""l" "u"": LISTXATTR %s/%""l" "u" "resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid ), state->finh->nodeid); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3405, GF_LOG_WARNING, "%""l" "u"": LISTXATTR %s/%""l" "u" "resolution failed", state-> finh->unique, uuid_utoa (state->resolve.gfid), state-> finh->nodeid); } while (0) |
3404 | "resolution failed", state->finh->unique,do { do { if (0) printf ("%""l" "u"": LISTXATTR %s/%""l" "u" "resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid ), state->finh->nodeid); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3405, GF_LOG_WARNING, "%""l" "u"": LISTXATTR %s/%""l" "u" "resolution failed", state-> finh->unique, uuid_utoa (state->resolve.gfid), state-> finh->nodeid); } while (0) |
3405 | uuid_utoa (state->resolve.gfid), state->finh->nodeid)do { do { if (0) printf ("%""l" "u"": LISTXATTR %s/%""l" "u" "resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid ), state->finh->nodeid); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3405, GF_LOG_WARNING, "%""l" "u"": LISTXATTR %s/%""l" "u" "resolution failed", state-> finh->unique, uuid_utoa (state->resolve.gfid), state-> finh->nodeid); } while (0); |
3406 | |
3407 | send_fuse_err (state->this, state->finh, ENOENT2); |
3408 | free_fuse_state (state); |
3409 | return; |
3410 | } |
3411 | |
3412 | #ifdef GF_TEST_FFOP |
3413 | state->fd = fd_lookup (state->loc.inode, state->finh->pid); |
3414 | #endif /* GF_TEST_FFOP */ |
3415 | |
3416 | if (state->fd) { |
3417 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": LISTXATTR %p/%""l" "u", state->finh->unique, state->fd, state->finh-> nodeid); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3419, GF_LOG_TRACE, "%""l" "u"": LISTXATTR %p/%" "l" "u", state->finh->unique, state->fd, state->finh ->nodeid); } while (0) |
3418 | "%"PRIu64": LISTXATTR %p/%"PRIu64, state->finh->unique,do { do { if (0) printf ("%""l" "u"": LISTXATTR %p/%""l" "u", state->finh->unique, state->fd, state->finh-> nodeid); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3419, GF_LOG_TRACE, "%""l" "u"": LISTXATTR %p/%" "l" "u", state->finh->unique, state->fd, state->finh ->nodeid); } while (0) |
3419 | state->fd, state->finh->nodeid)do { do { if (0) printf ("%""l" "u"": LISTXATTR %p/%""l" "u", state->finh->unique, state->fd, state->finh-> nodeid); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3419, GF_LOG_TRACE, "%""l" "u"": LISTXATTR %p/%" "l" "u", state->finh->unique, state->fd, state->finh ->nodeid); } while (0); |
3420 | |
3421 | FUSE_FOP (state, fuse_xattr_cbk, GF_FOP_FGETXATTR,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3422, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FGETXATTR; frame-> op = GF_FOP_FGETXATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state-> resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3422, GF_LOG_ERROR , "xl is NULL"); } while (0); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno ; op_ret = -1; if (GF_FOP_FGETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame-> root->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3422, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3422, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3422, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 3422, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fgetxattr_cbk) tmp_cbk = fuse_xattr_cbk; _new->root = frame->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame ; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new ->wind_to = "xl->fops-> fgetxattr"; _new->unwind_to = "fuse_xattr_cbk"; pthread_spin_init (&_new->lock, 0 ); pthread_spin_lock (&frame->root->stack_lock); { _new ->next = frame->root->frames.next; _new->prev = & frame->root->frames; if (frame->root->frames.next ) frame->root->frames.next->prev = _new; frame->root ->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fgetxattr); xl->fops->fgetxattr (_new, xl, state->fd , ((void*)0), state->xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); } } while (0) |
3422 | fgetxattr, state->fd, NULL, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3422, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FGETXATTR; frame-> op = GF_FOP_FGETXATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state-> resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3422, GF_LOG_ERROR , "xl is NULL"); } while (0); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno ; op_ret = -1; if (GF_FOP_FGETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame-> root->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3422, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3422, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3422, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 3422, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fgetxattr_cbk) tmp_cbk = fuse_xattr_cbk; _new->root = frame->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame ; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new ->wind_to = "xl->fops-> fgetxattr"; _new->unwind_to = "fuse_xattr_cbk"; pthread_spin_init (&_new->lock, 0 ); pthread_spin_lock (&frame->root->stack_lock); { _new ->next = frame->root->frames.next; _new->prev = & frame->root->frames; if (frame->root->frames.next ) frame->root->frames.next->prev = _new; frame->root ->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fgetxattr); xl->fops->fgetxattr (_new, xl, state->fd , ((void*)0), state->xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); } } while (0); |
3423 | } else { |
3424 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": LISTXATTR %s/%""l" "u", state->finh->unique, state->loc.path, state->finh ->nodeid); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3426, GF_LOG_TRACE, "%""l" "u"": LISTXATTR %s/%" "l" "u", state->finh->unique, state->loc.path, state ->finh->nodeid); } while (0) |
3425 | "%"PRIu64": LISTXATTR %s/%"PRIu64, state->finh->unique,do { do { if (0) printf ("%""l" "u"": LISTXATTR %s/%""l" "u", state->finh->unique, state->loc.path, state->finh ->nodeid); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3426, GF_LOG_TRACE, "%""l" "u"": LISTXATTR %s/%" "l" "u", state->finh->unique, state->loc.path, state ->finh->nodeid); } while (0) |
3426 | state->loc.path, state->finh->nodeid)do { do { if (0) printf ("%""l" "u"": LISTXATTR %s/%""l" "u", state->finh->unique, state->loc.path, state->finh ->nodeid); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3426, GF_LOG_TRACE, "%""l" "u"": LISTXATTR %s/%" "l" "u", state->finh->unique, state->loc.path, state ->finh->nodeid); } while (0); |
3427 | |
3428 | FUSE_FOP (state, fuse_xattr_cbk, GF_FOP_GETXATTR,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3429, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_GETXATTR; frame-> op = GF_FOP_GETXATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state->resolve ); } xl = state->active_subvol; if (!xl) { do { do { if (0 ) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3429, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_GETXATTR == GF_FOP_LOOKUP) { do { do { if ( 0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3429, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3429, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3429, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 3429, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->getxattr_cbk) tmp_cbk = fuse_xattr_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> getxattr"; _new->unwind_to = "fuse_xattr_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> getxattr); xl->fops->getxattr (_new, xl, &state-> loc, ((void*)0), state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0) |
3429 | getxattr, &state->loc, NULL, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3429, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_GETXATTR; frame-> op = GF_FOP_GETXATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state->resolve ); } xl = state->active_subvol; if (!xl) { do { do { if (0 ) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3429, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (resolve ->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_GETXATTR == GF_FOP_LOOKUP) { do { do { if ( 0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], resolve-> resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3429, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3429, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3429, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 3429, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->getxattr_cbk) tmp_cbk = fuse_xattr_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> getxattr"; _new->unwind_to = "fuse_xattr_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> getxattr); xl->fops->getxattr (_new, xl, &state-> loc, ((void*)0), state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0); |
3430 | } |
3431 | } |
3432 | |
3433 | |
3434 | static void |
3435 | fuse_listxattr (xlator_t *this, fuse_in_header_t *finh, void *msg) |
3436 | { |
3437 | struct fuse_getxattr_in *fgxi = msg; |
3438 | fuse_state_t *state = NULL((void*)0); |
3439 | |
3440 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3440, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
3441 | |
3442 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
3443 | |
3444 | state->size = fgxi->size; |
3445 | |
3446 | fuse_resolve_and_resume (state, fuse_listxattr_resume); |
3447 | |
3448 | return; |
3449 | } |
3450 | |
3451 | |
3452 | void |
3453 | fuse_removexattr_resume (fuse_state_t *state) |
3454 | { |
3455 | if (!state->loc.inode) { |
3456 | gf_log ("glusterfs-fuse", GF_LOG_DEBUG,do { do { if (0) printf ("%""l" "u"": REMOVEXATTR %s/%""l" "u" " (%s) " "resolution failed", state->finh->unique, uuid_utoa (state->resolve.gfid), state->finh->nodeid, state-> name); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3460, GF_LOG_DEBUG, "%""l" "u"": REMOVEXATTR %s/%" "l" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0) |
3457 | "%"PRIu64": REMOVEXATTR %s/%"PRIu64" (%s) "do { do { if (0) printf ("%""l" "u"": REMOVEXATTR %s/%""l" "u" " (%s) " "resolution failed", state->finh->unique, uuid_utoa (state->resolve.gfid), state->finh->nodeid, state-> name); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3460, GF_LOG_DEBUG, "%""l" "u"": REMOVEXATTR %s/%" "l" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0) |
3458 | "resolution failed",do { do { if (0) printf ("%""l" "u"": REMOVEXATTR %s/%""l" "u" " (%s) " "resolution failed", state->finh->unique, uuid_utoa (state->resolve.gfid), state->finh->nodeid, state-> name); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3460, GF_LOG_DEBUG, "%""l" "u"": REMOVEXATTR %s/%" "l" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0) |
3459 | state->finh->unique, uuid_utoa (state->resolve.gfid),do { do { if (0) printf ("%""l" "u"": REMOVEXATTR %s/%""l" "u" " (%s) " "resolution failed", state->finh->unique, uuid_utoa (state->resolve.gfid), state->finh->nodeid, state-> name); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3460, GF_LOG_DEBUG, "%""l" "u"": REMOVEXATTR %s/%" "l" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0) |
3460 | state->finh->nodeid, state->name)do { do { if (0) printf ("%""l" "u"": REMOVEXATTR %s/%""l" "u" " (%s) " "resolution failed", state->finh->unique, uuid_utoa (state->resolve.gfid), state->finh->nodeid, state-> name); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3460, GF_LOG_DEBUG, "%""l" "u"": REMOVEXATTR %s/%" "l" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0); |
3461 | |
3462 | send_fuse_err (state->this, state->finh, ENOENT2); |
3463 | free_fuse_state (state); |
3464 | return; |
3465 | } |
3466 | |
3467 | #ifdef GF_TEST_FFOP |
3468 | state->fd = fd_lookup (state->loc.inode, state->finh->pid); |
3469 | #endif /* GF_TEST_FFOP */ |
3470 | |
3471 | if (state->fd) { |
3472 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": REMOVEXATTR %p/%""l" "u" " (%s)", state->finh->unique, state->fd, state->finh ->nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3474, GF_LOG_TRACE, "%""l" "u" ": REMOVEXATTR %p/%""l" "u"" (%s)", state->finh->unique , state->fd, state->finh->nodeid, state->name); } while (0) |
3473 | "%"PRIu64": REMOVEXATTR %p/%"PRIu64" (%s)", state->finh->unique,do { do { if (0) printf ("%""l" "u"": REMOVEXATTR %p/%""l" "u" " (%s)", state->finh->unique, state->fd, state->finh ->nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3474, GF_LOG_TRACE, "%""l" "u" ": REMOVEXATTR %p/%""l" "u"" (%s)", state->finh->unique , state->fd, state->finh->nodeid, state->name); } while (0) |
3474 | state->fd, state->finh->nodeid, state->name)do { do { if (0) printf ("%""l" "u"": REMOVEXATTR %p/%""l" "u" " (%s)", state->finh->unique, state->fd, state->finh ->nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3474, GF_LOG_TRACE, "%""l" "u" ": REMOVEXATTR %p/%""l" "u"" (%s)", state->finh->unique , state->fd, state->finh->nodeid, state->name); } while (0); |
3475 | |
3476 | FUSE_FOP (state, fuse_err_cbk, GF_FOP_FREMOVEXATTR,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3477, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FREMOVEXATTR; frame-> op = GF_FOP_FREMOVEXATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state-> resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3477, GF_LOG_ERROR , "xl is NULL"); } while (0); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno ; op_ret = -1; if (GF_FOP_FREMOVEXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3477, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3477, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3477, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 3477, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fremovexattr_cbk) tmp_cbk = fuse_err_cbk; _new->root = frame->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame ; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new ->wind_to = "xl->fops-> fremovexattr"; _new->unwind_to = "fuse_err_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new ->next = frame->root->frames.next; _new->prev = & frame->root->frames; if (frame->root->frames.next ) frame->root->frames.next->prev = _new; frame->root ->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fremovexattr); xl->fops->fremovexattr (_new, xl, state-> fd, state->name, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0) |
3477 | fremovexattr, state->fd, state->name, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3477, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_FREMOVEXATTR; frame-> op = GF_FOP_FREMOVEXATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state-> resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3477, GF_LOG_ERROR , "xl is NULL"); } while (0); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno ; op_ret = -1; if (GF_FOP_FREMOVEXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3477, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3477, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3477, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 3477, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->fremovexattr_cbk) tmp_cbk = fuse_err_cbk; _new->root = frame->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame ; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new ->wind_to = "xl->fops-> fremovexattr"; _new->unwind_to = "fuse_err_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new ->next = frame->root->frames.next; _new->prev = & frame->root->frames; if (frame->root->frames.next ) frame->root->frames.next->prev = _new; frame->root ->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> fremovexattr); xl->fops->fremovexattr (_new, xl, state-> fd, state->name, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0); |
3478 | } else { |
3479 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": REMOVEXATTR %s/%""l" "u" " (%s)", state->finh->unique, state->loc.path, state ->finh->nodeid, state->name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3481, GF_LOG_TRACE , "%""l" "u"": REMOVEXATTR %s/%""l" "u"" (%s)", state->finh ->unique, state->loc.path, state->finh->nodeid, state ->name); } while (0) |
3480 | "%"PRIu64": REMOVEXATTR %s/%"PRIu64" (%s)", state->finh->unique,do { do { if (0) printf ("%""l" "u"": REMOVEXATTR %s/%""l" "u" " (%s)", state->finh->unique, state->loc.path, state ->finh->nodeid, state->name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3481, GF_LOG_TRACE , "%""l" "u"": REMOVEXATTR %s/%""l" "u"" (%s)", state->finh ->unique, state->loc.path, state->finh->nodeid, state ->name); } while (0) |
3481 | state->loc.path, state->finh->nodeid, state->name)do { do { if (0) printf ("%""l" "u"": REMOVEXATTR %s/%""l" "u" " (%s)", state->finh->unique, state->loc.path, state ->finh->nodeid, state->name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3481, GF_LOG_TRACE , "%""l" "u"": REMOVEXATTR %s/%""l" "u"" (%s)", state->finh ->unique, state->loc.path, state->finh->nodeid, state ->name); } while (0); |
3482 | |
3483 | FUSE_FOP (state, fuse_err_cbk, GF_FOP_REMOVEXATTR,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3484, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_REMOVEXATTR; frame-> op = GF_FOP_REMOVEXATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state-> resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3484, GF_LOG_ERROR , "xl is NULL"); } while (0); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno ; op_ret = -1; if (GF_FOP_REMOVEXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3484, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3484, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3484, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 3484, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->removexattr_cbk) tmp_cbk = fuse_err_cbk; _new->root = frame->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame ; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new ->wind_to = "xl->fops-> removexattr"; _new->unwind_to = "fuse_err_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new ->next = frame->root->frames.next; _new->prev = & frame->root->frames; if (frame->root->frames.next ) frame->root->frames.next->prev = _new; frame->root ->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> removexattr); xl->fops->removexattr (_new, xl, &state ->loc, state->name, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0) |
3484 | removexattr, &state->loc, state->name, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3484, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_REMOVEXATTR; frame-> op = GF_FOP_REMOVEXATTR; if ( state->resolve_now ) { resolve = state->resolve_now; } else { resolve = &(state-> resolve); } xl = state->active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL"); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3484, GF_LOG_ERROR , "xl is NULL"); } while (0); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno ; op_ret = -1; if (GF_FOP_REMOVEXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3484, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3484, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state->resolve2.op_errno; op_ret = - 1; do { do { if (0) printf ("%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3484, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 3484, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->removexattr_cbk) tmp_cbk = fuse_err_cbk; _new->root = frame->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame ; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new ->wind_to = "xl->fops-> removexattr"; _new->unwind_to = "fuse_err_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new ->next = frame->root->frames.next; _new->prev = & frame->root->frames; if (frame->root->frames.next ) frame->root->frames.next->prev = _new; frame->root ->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> removexattr); xl->fops->removexattr (_new, xl, &state ->loc, state->name, state->xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); } } while (0); |
3485 | } |
3486 | } |
3487 | |
3488 | |
3489 | static void |
3490 | fuse_removexattr (xlator_t *this, fuse_in_header_t *finh, void *msg) |
3491 | { |
3492 | char *name = msg; |
3493 | |
3494 | fuse_state_t *state = NULL((void*)0); |
3495 | fuse_private_t *priv = NULL((void*)0); |
3496 | int32_t ret = -1; |
3497 | char *newkey = NULL((void*)0); |
3498 | |
3499 | if (!strcmp (GFID_XATTR_KEY"trusted.gfid", name) || !strcmp (GF_XATTR_VOL_ID_KEY"trusted.glusterfs.volume-id", name)) { |
3500 | send_fuse_err (this, finh, EPERM1); |
3501 | GF_FREE (finh)__gf_free (finh); |
3502 | return; |
3503 | } |
3504 | |
3505 | priv = this->private; |
3506 | |
3507 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3507, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
3508 | |
3509 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
3510 | |
3511 | ret = fuse_flip_xattr_ns (priv, name, &newkey); |
3512 | if (ret) { |
3513 | send_fuse_err (this, finh, ENOMEM12); |
3514 | free_fuse_state (state); |
3515 | return; |
3516 | } |
3517 | |
3518 | state->name = newkey; |
3519 | |
3520 | fuse_resolve_and_resume (state, fuse_removexattr_resume); |
3521 | return; |
3522 | } |
3523 | |
3524 | |
3525 | static int gf_fuse_lk_enosys_log; |
3526 | |
3527 | static int |
3528 | fuse_getlk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
3529 | int32_t op_ret, int32_t op_errno, struct gf_flock *lock, |
3530 | dict_t *xdata) |
3531 | { |
3532 | fuse_state_t *state = NULL((void*)0); |
3533 | |
3534 | state = frame->root->state; |
3535 | struct fuse_lk_out flo = {{0, }, }; |
3536 | |
3537 | fuse_log_eh_fop(this, state, frame, op_ret, op_errno)do { if (this->history) { if (state->fd) do { do { if ( 0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->fd, uuid_utoa (state->fd-> inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->fd, uuid_utoa (state->fd->inode->gfid)); } while (0); else do { do { if (0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, uuid_utoa (state->loc.gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, uuid_utoa (state->loc .gfid)); } while (0); } } while(0); |
3538 | |
3539 | if (op_ret == 0) { |
3540 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": ERR => 0", frame-> root->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3541, GF_LOG_TRACE, "%""l" "u"": ERR => 0" , frame->root->unique); } while (0) |
3541 | "%"PRIu64": ERR => 0", frame->root->unique)do { do { if (0) printf ("%""l" "u"": ERR => 0", frame-> root->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3541, GF_LOG_TRACE, "%""l" "u"": ERR => 0" , frame->root->unique); } while (0); |
3542 | flo.lk.type = lock->l_type; |
3543 | flo.lk.pid = lock->l_pid; |
3544 | if (lock->l_type == F_UNLCK2) |
3545 | flo.lk.start = flo.lk.end = 0; |
3546 | else { |
3547 | flo.lk.start = lock->l_start; |
3548 | flo.lk.end = lock->l_len ? |
3549 | (lock->l_start + lock->l_len - 1) : |
3550 | OFFSET_MAX0x7fffffffffffffffLL; |
3551 | } |
3552 | send_fuse_obj (this, state->finh, &flo)send_fuse_data (this, state->finh, &flo, sizeof (*(& flo))); |
3553 | } else { |
3554 | if (op_errno == ENOSYS38) { |
3555 | gf_fuse_lk_enosys_log++; |
3556 | if (!(gf_fuse_lk_enosys_log % GF_UNIVERSAL_ANSWER42)) { |
3557 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("GETLK not supported. loading " "'features/posix-locks' on server side " "will add GETLK support."); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3560, GF_LOG_ERROR, "GETLK not supported. loading " "'features/posix-locks' on server side " "will add GETLK support." ); } while (0) |
3558 | "GETLK not supported. loading "do { do { if (0) printf ("GETLK not supported. loading " "'features/posix-locks' on server side " "will add GETLK support."); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3560, GF_LOG_ERROR, "GETLK not supported. loading " "'features/posix-locks' on server side " "will add GETLK support." ); } while (0) |
3559 | "'features/posix-locks' on server side "do { do { if (0) printf ("GETLK not supported. loading " "'features/posix-locks' on server side " "will add GETLK support."); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3560, GF_LOG_ERROR, "GETLK not supported. loading " "'features/posix-locks' on server side " "will add GETLK support." ); } while (0) |
3560 | "will add GETLK support.")do { do { if (0) printf ("GETLK not supported. loading " "'features/posix-locks' on server side " "will add GETLK support."); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3560, GF_LOG_ERROR, "GETLK not supported. loading " "'features/posix-locks' on server side " "will add GETLK support." ); } while (0); |
3561 | } |
3562 | } else { |
3563 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": ERR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3565, GF_LOG_WARNING , "%""l" "u"": ERR => -1 (%s)", frame->root->unique, strerror (op_errno)); } while (0) |
3564 | "%"PRIu64": ERR => -1 (%s)",do { do { if (0) printf ("%""l" "u"": ERR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3565, GF_LOG_WARNING , "%""l" "u"": ERR => -1 (%s)", frame->root->unique, strerror (op_errno)); } while (0) |
3565 | frame->root->unique, strerror (op_errno))do { do { if (0) printf ("%""l" "u"": ERR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3565, GF_LOG_WARNING , "%""l" "u"": ERR => -1 (%s)", frame->root->unique, strerror (op_errno)); } while (0); |
3566 | } |
3567 | send_fuse_err (this, state->finh, op_errno); |
3568 | } |
3569 | |
3570 | free_fuse_state (state); |
3571 | STACK_DESTROY (frame->root); |
3572 | |
3573 | return 0; |
3574 | } |
3575 | |
3576 | |
3577 | void |
3578 | fuse_getlk_resume (fuse_state_t *state) |
3579 | { |
3580 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": GETLK %p", state->finh ->unique, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3581, GF_LOG_TRACE, "%""l" "u" ": GETLK %p", state->finh->unique, state->fd); } while (0) |
3581 | "%"PRIu64": GETLK %p", state->finh->unique, state->fd)do { do { if (0) printf ("%""l" "u"": GETLK %p", state->finh ->unique, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3581, GF_LOG_TRACE, "%""l" "u" ": GETLK %p", state->finh->unique, state->fd); } while (0); |
3582 | |
3583 | FUSE_FOP (state, fuse_getlk_cbk, GF_FOP_LK,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3584, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_LK; frame->op = GF_FOP_LK ; if ( state->resolve_now ) { resolve = state->resolve_now ; } else { resolve = &(state->resolve); } xl = state-> active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL" ); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3584, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_LK == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3584, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3584, GF_LOG_WARNING , "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state ->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ( "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3584, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 3584, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->lk_cbk) tmp_cbk = fuse_getlk_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> lk"; _new->unwind_to = "fuse_getlk_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> lk); xl->fops->lk (_new, xl, state->fd, 5, &state ->lk_lock, state->xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); } } while (0) |
3584 | lk, state->fd, F_GETLK, &state->lk_lock, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3584, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_LK; frame->op = GF_FOP_LK ; if ( state->resolve_now ) { resolve = state->resolve_now ; } else { resolve = &(state->resolve); } xl = state-> active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL" ); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3584, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_LK == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3584, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3584, GF_LOG_WARNING , "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state ->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ( "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3584, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 3584, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->lk_cbk) tmp_cbk = fuse_getlk_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops-> lk"; _new->unwind_to = "fuse_getlk_cbk" ; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> lk); xl->fops->lk (_new, xl, state->fd, 5, &state ->lk_lock, state->xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); } } while (0); |
3585 | } |
3586 | |
3587 | |
3588 | static void |
3589 | fuse_getlk (xlator_t *this, fuse_in_header_t *finh, void *msg) |
3590 | { |
3591 | struct fuse_lk_in *fli = msg; |
3592 | |
3593 | fuse_state_t *state = NULL((void*)0); |
3594 | fd_t *fd = NULL((void*)0); |
3595 | |
3596 | fd = FH_TO_FD (fli->fh)((((fd_t *)(uintptr_t)(fli->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fli->fh)))):((fd_t *) 0)); |
3597 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3597, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
3598 | state->fd = fd; |
3599 | |
3600 | fuse_resolve_fd_init (state, &state->resolve, fd); |
3601 | |
3602 | convert_fuse_file_lock (&fli->lk, &state->lk_lock, |
3603 | fli->owner); |
3604 | |
3605 | state->lk_owner = fli->owner; |
3606 | |
3607 | fuse_resolve_and_resume (state, fuse_getlk_resume); |
3608 | |
3609 | return; |
3610 | } |
3611 | |
3612 | |
3613 | static int |
3614 | fuse_setlk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
3615 | int32_t op_ret, int32_t op_errno, struct gf_flock *lock, |
3616 | dict_t *xdata) |
3617 | { |
3618 | uint32_t op = 0; |
3619 | fuse_state_t *state = NULL((void*)0); |
3620 | |
3621 | state = frame->root->state; |
3622 | op = state->finh->opcode; |
3623 | |
3624 | fuse_log_eh_fop(this, state, frame, op_ret, op_errno)do { if (this->history) { if (state->fd) do { do { if ( 0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->fd, uuid_utoa (state->fd-> inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %p, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->fd, uuid_utoa (state->fd->inode->gfid)); } while (0); else do { do { if (0) printf ("op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s", op_ret, op_errno, frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path, uuid_utoa (state->loc.gfid)); } while (0); _gf_log_eh (__FUNCTION__,"op_ret: %d, op_errno: %d, " "%""l" "u"", %s () => %s, gfid: %s" , op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op], state->loc.path, uuid_utoa (state->loc .gfid)); } while (0); } } while(0); |
3625 | |
3626 | if (op_ret == 0) { |
3627 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": ERR => 0", frame-> root->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3628, GF_LOG_TRACE, "%""l" "u"": ERR => 0" , frame->root->unique); } while (0) |
3628 | "%"PRIu64": ERR => 0", frame->root->unique)do { do { if (0) printf ("%""l" "u"": ERR => 0", frame-> root->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3628, GF_LOG_TRACE, "%""l" "u"": ERR => 0" , frame->root->unique); } while (0); |
3629 | fd_lk_insert_and_merge (state->fd, |
3630 | (op == FUSE_SETLK) ? F_SETLK6 : F_SETLKW7, |
3631 | &state->lk_lock); |
3632 | |
3633 | send_fuse_err (this, state->finh, 0); |
3634 | } else { |
3635 | if (op_errno == ENOSYS38) { |
3636 | gf_fuse_lk_enosys_log++; |
3637 | if (!(gf_fuse_lk_enosys_log % GF_UNIVERSAL_ANSWER42)) { |
3638 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("SETLK not supported. loading " "'features/posix-locks' on server side " "will add SETLK support."); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3641, GF_LOG_ERROR, "SETLK not supported. loading " "'features/posix-locks' on server side " "will add SETLK support." ); } while (0) |
3639 | "SETLK not supported. loading "do { do { if (0) printf ("SETLK not supported. loading " "'features/posix-locks' on server side " "will add SETLK support."); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3641, GF_LOG_ERROR, "SETLK not supported. loading " "'features/posix-locks' on server side " "will add SETLK support." ); } while (0) |
3640 | "'features/posix-locks' on server side "do { do { if (0) printf ("SETLK not supported. loading " "'features/posix-locks' on server side " "will add SETLK support."); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3641, GF_LOG_ERROR, "SETLK not supported. loading " "'features/posix-locks' on server side " "will add SETLK support." ); } while (0) |
3641 | "will add SETLK support.")do { do { if (0) printf ("SETLK not supported. loading " "'features/posix-locks' on server side " "will add SETLK support."); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3641, GF_LOG_ERROR, "SETLK not supported. loading " "'features/posix-locks' on server side " "will add SETLK support." ); } while (0); |
3642 | } |
3643 | } else if (op_errno == EAGAIN11) { |
3644 | gf_log ("glusterfs-fuse", GF_LOG_DEBUG,do { do { if (0) printf ("Returning EAGAIN Flock: " "start=%llu, len=%llu, pid=%llu, lk-owner=%s" , (unsigned long long) state->lk_lock.l_start, (unsigned long long) state->lk_lock.l_len, (unsigned long long) state-> lk_lock.l_pid, lkowner_utoa (&frame->root->lk_owner )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3650, GF_LOG_DEBUG, "Returning EAGAIN Flock: " "start=%llu, len=%llu, pid=%llu, lk-owner=%s" , (unsigned long long) state->lk_lock.l_start, (unsigned long long) state->lk_lock.l_len, (unsigned long long) state-> lk_lock.l_pid, lkowner_utoa (&frame->root->lk_owner )); } while (0) |
3645 | "Returning EAGAIN Flock: "do { do { if (0) printf ("Returning EAGAIN Flock: " "start=%llu, len=%llu, pid=%llu, lk-owner=%s" , (unsigned long long) state->lk_lock.l_start, (unsigned long long) state->lk_lock.l_len, (unsigned long long) state-> lk_lock.l_pid, lkowner_utoa (&frame->root->lk_owner )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3650, GF_LOG_DEBUG, "Returning EAGAIN Flock: " "start=%llu, len=%llu, pid=%llu, lk-owner=%s" , (unsigned long long) state->lk_lock.l_start, (unsigned long long) state->lk_lock.l_len, (unsigned long long) state-> lk_lock.l_pid, lkowner_utoa (&frame->root->lk_owner )); } while (0) |
3646 | "start=%llu, len=%llu, pid=%llu, lk-owner=%s",do { do { if (0) printf ("Returning EAGAIN Flock: " "start=%llu, len=%llu, pid=%llu, lk-owner=%s" , (unsigned long long) state->lk_lock.l_start, (unsigned long long) state->lk_lock.l_len, (unsigned long long) state-> lk_lock.l_pid, lkowner_utoa (&frame->root->lk_owner )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3650, GF_LOG_DEBUG, "Returning EAGAIN Flock: " "start=%llu, len=%llu, pid=%llu, lk-owner=%s" , (unsigned long long) state->lk_lock.l_start, (unsigned long long) state->lk_lock.l_len, (unsigned long long) state-> lk_lock.l_pid, lkowner_utoa (&frame->root->lk_owner )); } while (0) |
3647 | (unsigned long long) state->lk_lock.l_start,do { do { if (0) printf ("Returning EAGAIN Flock: " "start=%llu, len=%llu, pid=%llu, lk-owner=%s" , (unsigned long long) state->lk_lock.l_start, (unsigned long long) state->lk_lock.l_len, (unsigned long long) state-> lk_lock.l_pid, lkowner_utoa (&frame->root->lk_owner )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3650, GF_LOG_DEBUG, "Returning EAGAIN Flock: " "start=%llu, len=%llu, pid=%llu, lk-owner=%s" , (unsigned long long) state->lk_lock.l_start, (unsigned long long) state->lk_lock.l_len, (unsigned long long) state-> lk_lock.l_pid, lkowner_utoa (&frame->root->lk_owner )); } while (0) |
3648 | (unsigned long long) state->lk_lock.l_len,do { do { if (0) printf ("Returning EAGAIN Flock: " "start=%llu, len=%llu, pid=%llu, lk-owner=%s" , (unsigned long long) state->lk_lock.l_start, (unsigned long long) state->lk_lock.l_len, (unsigned long long) state-> lk_lock.l_pid, lkowner_utoa (&frame->root->lk_owner )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3650, GF_LOG_DEBUG, "Returning EAGAIN Flock: " "start=%llu, len=%llu, pid=%llu, lk-owner=%s" , (unsigned long long) state->lk_lock.l_start, (unsigned long long) state->lk_lock.l_len, (unsigned long long) state-> lk_lock.l_pid, lkowner_utoa (&frame->root->lk_owner )); } while (0) |
3649 | (unsigned long long) state->lk_lock.l_pid,do { do { if (0) printf ("Returning EAGAIN Flock: " "start=%llu, len=%llu, pid=%llu, lk-owner=%s" , (unsigned long long) state->lk_lock.l_start, (unsigned long long) state->lk_lock.l_len, (unsigned long long) state-> lk_lock.l_pid, lkowner_utoa (&frame->root->lk_owner )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3650, GF_LOG_DEBUG, "Returning EAGAIN Flock: " "start=%llu, len=%llu, pid=%llu, lk-owner=%s" , (unsigned long long) state->lk_lock.l_start, (unsigned long long) state->lk_lock.l_len, (unsigned long long) state-> lk_lock.l_pid, lkowner_utoa (&frame->root->lk_owner )); } while (0) |
3650 | lkowner_utoa (&frame->root->lk_owner))do { do { if (0) printf ("Returning EAGAIN Flock: " "start=%llu, len=%llu, pid=%llu, lk-owner=%s" , (unsigned long long) state->lk_lock.l_start, (unsigned long long) state->lk_lock.l_len, (unsigned long long) state-> lk_lock.l_pid, lkowner_utoa (&frame->root->lk_owner )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3650, GF_LOG_DEBUG, "Returning EAGAIN Flock: " "start=%llu, len=%llu, pid=%llu, lk-owner=%s" , (unsigned long long) state->lk_lock.l_start, (unsigned long long) state->lk_lock.l_len, (unsigned long long) state-> lk_lock.l_pid, lkowner_utoa (&frame->root->lk_owner )); } while (0); |
3651 | } else { |
3652 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""l" "u"": ERR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3654, GF_LOG_WARNING , "%""l" "u"": ERR => -1 (%s)", frame->root->unique, strerror (op_errno)); } while (0) |
3653 | "%"PRIu64": ERR => -1 (%s)",do { do { if (0) printf ("%""l" "u"": ERR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3654, GF_LOG_WARNING , "%""l" "u"": ERR => -1 (%s)", frame->root->unique, strerror (op_errno)); } while (0) |
3654 | frame->root->unique, strerror (op_errno))do { do { if (0) printf ("%""l" "u"": ERR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3654, GF_LOG_WARNING , "%""l" "u"": ERR => -1 (%s)", frame->root->unique, strerror (op_errno)); } while (0); |
3655 | } |
3656 | |
3657 | send_fuse_err (this, state->finh, op_errno); |
3658 | } |
3659 | |
3660 | free_fuse_state (state); |
3661 | STACK_DESTROY (frame->root); |
3662 | |
3663 | return 0; |
3664 | } |
3665 | |
3666 | |
3667 | void |
3668 | fuse_setlk_resume (fuse_state_t *state) |
3669 | { |
3670 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""l" "u"": SETLK%s %p", state-> finh->unique, state->finh->opcode == FUSE_SETLK ? "" : "W", state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3672, GF_LOG_TRACE, "%""l" "u" ": SETLK%s %p", state->finh->unique, state->finh-> opcode == FUSE_SETLK ? "" : "W", state->fd); } while (0) |
3671 | "%"PRIu64": SETLK%s %p", state->finh->unique,do { do { if (0) printf ("%""l" "u"": SETLK%s %p", state-> finh->unique, state->finh->opcode == FUSE_SETLK ? "" : "W", state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3672, GF_LOG_TRACE, "%""l" "u" ": SETLK%s %p", state->finh->unique, state->finh-> opcode == FUSE_SETLK ? "" : "W", state->fd); } while (0) |
3672 | state->finh->opcode == FUSE_SETLK ? "" : "W", state->fd)do { do { if (0) printf ("%""l" "u"": SETLK%s %p", state-> finh->unique, state->finh->opcode == FUSE_SETLK ? "" : "W", state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3672, GF_LOG_TRACE, "%""l" "u" ": SETLK%s %p", state->finh->unique, state->finh-> opcode == FUSE_SETLK ? "" : "W", state->fd); } while (0); |
3673 | |
3674 | FUSE_FOP (state, fuse_setlk_cbk, GF_FOP_LK, lk, state->fd,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3676, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_LK; frame->op = GF_FOP_LK ; if ( state->resolve_now ) { resolve = state->resolve_now ; } else { resolve = &(state->resolve); } xl = state-> active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL" ); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3676, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_LK == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3676, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3676, GF_LOG_WARNING , "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state ->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ( "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3676, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 3676, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->lk_cbk) tmp_cbk = fuse_setlk_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->lk"; _new->unwind_to = "fuse_setlk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> lk); xl->fops->lk (_new, xl, state->fd, state->finh ->opcode == FUSE_SETLK ? 6 : 7, &state->lk_lock, state ->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0) |
3675 | state->finh->opcode == FUSE_SETLK ? F_SETLK : F_SETLKW,do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3676, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_LK; frame->op = GF_FOP_LK ; if ( state->resolve_now ) { resolve = state->resolve_now ; } else { resolve = &(state->resolve); } xl = state-> active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL" ); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3676, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_LK == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3676, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3676, GF_LOG_WARNING , "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state ->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ( "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3676, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 3676, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->lk_cbk) tmp_cbk = fuse_setlk_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->lk"; _new->unwind_to = "fuse_setlk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> lk); xl->fops->lk (_new, xl, state->fd, state->finh ->opcode == FUSE_SETLK ? 6 : 7, &state->lk_lock, state ->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0) |
3676 | &state->lk_lock, state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; fuse_resolve_t *resolve = ((void*)0); frame = get_call_frame_for_req (state); if (!frame ) { do { do { if (0) printf ("FUSE message" " unique %""l" "u" " opcode %d:" " frame allocation failed", state->finh-> unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3676, GF_LOG_ERROR , "FUSE message" " unique %""l" "u"" opcode %d:" " frame allocation failed" , state->finh->unique, state->finh->opcode); } while (0); free_fuse_state (state); break; } frame->root->state = state; frame->root->op = GF_FOP_LK; frame->op = GF_FOP_LK ; if ( state->resolve_now ) { resolve = state->resolve_now ; } else { resolve = &(state->resolve); } xl = state-> active_subvol; if (!xl) { do { do { if (0) printf ("xl is NULL" ); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3676, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (resolve->op_ret < 0) { op_errno = resolve->op_errno; op_ret = -1; if (GF_FOP_LK == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""l" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], resolve->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3676, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""l" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], resolve->resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3676, GF_LOG_WARNING , "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], resolve ->resolve_loc.path, strerror (op_errno)); } while (0); } } else if (state->resolve2.op_ret < 0) { op_errno = state ->resolve2.op_errno; op_ret = -1; do { do { if (0) printf ( "%""l" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3676, GF_LOG_WARNING, "%""l" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve2.resolve_loc.path, strerror (op_errno)); } while (0); } if (op_ret < 0) { send_fuse_err (state-> this, state->finh, op_errno); free_fuse_state (state); STACK_DESTROY (frame->root); } else { if (state->this->history) do { do { if (0) printf ("%""l" "u"", %s, path: (%s), gfid: " "(%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""l" "u"", %s, path: (%s), gfid: " "(%s)", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, (state->fd == ((void*)0))? uuid_utoa (state->loc.gfid): uuid_utoa (state->fd->inode-> gfid)); } while (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", "fuse-bridge.c" , __FUNCTION__, 3676, GF_LOG_ERROR, "alloc failed"); } while ( 0); break; } typeof( xl->fops->lk_cbk) tmp_cbk = fuse_setlk_cbk ; _new->root = frame->root; _new->this = xl; _new-> ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->lk"; _new->unwind_to = "fuse_setlk_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root->stack_lock); { _new->next = frame ->root->frames.next; _new->prev = &frame->root ->frames; if (frame->root->frames.next) frame->root ->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock (&frame ->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = xl; if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, xl->fops-> lk); xl->fops->lk (_new, xl, state->fd, state->finh ->opcode == FUSE_SETLK ? 6 : 7, &state->lk_lock, state ->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0); |
3677 | } |
3678 | |
3679 | |
3680 | static void |
3681 | fuse_setlk (xlator_t *this, fuse_in_header_t *finh, void *msg) |
3682 | { |
3683 | struct fuse_lk_in *fli = msg; |
3684 | |
3685 | fuse_state_t *state = NULL((void*)0); |
3686 | fd_t *fd = NULL((void*)0); |
3687 | |
3688 | fd = FH_TO_FD (fli->fh)((((fd_t *)(uintptr_t)(fli->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fli->fh)))):((fd_t *) 0)); |
3689 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3689, GF_LOG_ERROR, "FUSE message unique %""l" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
3690 | state->finh = finh; |
3691 | state->fd = fd; |
3692 | |
3693 | fuse_resolve_fd_init (state, &state->resolve, fd); |
3694 | |
3695 | convert_fuse_file_lock (&fli->lk, &state->lk_lock, |
3696 | fli->owner); |
3697 | |
3698 | state->lk_owner = fli->owner; |
3699 | |
3700 | fuse_resolve_and_resume (state, fuse_setlk_resume); |
3701 | |
3702 | return; |
3703 | } |
3704 | |
3705 | |
3706 | static void * |
3707 | notify_kernel_loop (void *data) |
3708 | { |
3709 | xlator_t *this = NULL((void*)0); |
3710 | fuse_private_t *priv = NULL((void*)0); |
3711 | struct fuse_out_header *fouh = NULL((void*)0); |
3712 | int rv = 0; |
3713 | |
3714 | char inval_buf[INVAL_BUF_SIZE(sizeof (struct fuse_out_header) + ((sizeof (struct fuse_notify_inval_inode_out ))>(sizeof (struct fuse_notify_inval_entry_out) + 255 + 1) ?(sizeof (struct fuse_notify_inval_inode_out)):(sizeof (struct fuse_notify_inval_entry_out) + 255 + 1)))] = {0,}; |
3715 | |
3716 | this = data; |
3717 | priv = this->private; |
3718 | |
3719 | for (;;) { |
3720 | rv = read (priv->revchan_in, inval_buf, sizeof (*fouh)); |
3721 | if (rv != sizeof (*fouh)) |
3722 | break; |
3723 | fouh = (struct fuse_out_header *)inval_buf; |
3724 | rv = read (priv->revchan_in, inval_buf + sizeof (*fouh), |
3725 | fouh->len - sizeof (*fouh)); |
3726 | if (rv != fouh->len - sizeof (*fouh)) |
3727 | break; |
3728 | rv = write (priv->fd, inval_buf, fouh->len); |
3729 | if (rv != fouh->len && !(rv == -1 && errno(*__errno_location ()) == ENOENT2)) |
3730 | break; |
3731 | } |
3732 | |
3733 | close (priv->revchan_in); |
3734 | close (priv->revchan_out); |
3735 | |
3736 | gf_log ("glusterfs-fuse", GF_LOG_INFO,do { do { if (0) printf ("kernel notifier loop terminated"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3737, GF_LOG_INFO, "kernel notifier loop terminated"); } while (0) |
3737 | "kernel notifier loop terminated")do { do { if (0) printf ("kernel notifier loop terminated"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3737, GF_LOG_INFO, "kernel notifier loop terminated"); } while (0); |
3738 | |
3739 | return NULL((void*)0); |
3740 | } |
3741 | |
3742 | |
3743 | static void |
3744 | fuse_init (xlator_t *this, fuse_in_header_t *finh, void *msg) |
3745 | { |
3746 | struct fuse_init_in *fini = msg; |
3747 | struct fuse_init_out fino = {0,}; |
3748 | fuse_private_t *priv = NULL((void*)0); |
3749 | int ret = 0; |
3750 | int pfd[2] = {0,}; |
3751 | pthread_t messenger; |
3752 | |
3753 | priv = this->private; |
3754 | |
3755 | if (priv->init_recvd) { |
3756 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("got INIT after first message"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3757, GF_LOG_ERROR, "got INIT after first message"); } while (0) |
3757 | "got INIT after first message")do { do { if (0) printf ("got INIT after first message"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3757, GF_LOG_ERROR, "got INIT after first message"); } while (0); |
3758 | |
3759 | close (priv->fd); |
3760 | goto out; |
3761 | } |
3762 | |
3763 | priv->init_recvd = 1; |
3764 | |
3765 | if (fini->major != FUSE_KERNEL_VERSION7) { |
3766 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("unsupported FUSE protocol version %d.%d" , fini->major, fini->minor); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3768, GF_LOG_ERROR, "unsupported FUSE protocol version %d.%d" , fini->major, fini->minor); } while (0) |
3767 | "unsupported FUSE protocol version %d.%d",do { do { if (0) printf ("unsupported FUSE protocol version %d.%d" , fini->major, fini->minor); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3768, GF_LOG_ERROR, "unsupported FUSE protocol version %d.%d" , fini->major, fini->minor); } while (0) |
3768 | fini->major, fini->minor)do { do { if (0) printf ("unsupported FUSE protocol version %d.%d" , fini->major, fini->minor); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3768, GF_LOG_ERROR, "unsupported FUSE protocol version %d.%d" , fini->major, fini->minor); } while (0); |
3769 | |
3770 | close (priv->fd); |
3771 | goto out; |
3772 | } |
3773 | priv->proto_minor = fini->minor; |
3774 | |
3775 | fino.major = FUSE_KERNEL_VERSION7; |
3776 | fino.minor = FUSE_KERNEL_MINOR_VERSION22; |
3777 | fino.max_readahead = 1 << 17; |
3778 | fino.max_write = 1 << 17; |
3779 | fino.flags = FUSE_ASYNC_READ(1 << 0) | FUSE_POSIX_LOCKS(1 << 1); |
3780 | #if FUSE_KERNEL_MINOR_VERSION22 >= 17 |
3781 | if (fini->minor >= 17) |
3782 | fino.flags |= FUSE_FLOCK_LOCKS(1 << 10); |
3783 | #endif |
3784 | #if FUSE_KERNEL_MINOR_VERSION22 >= 12 |
3785 | if (fini->minor >= 12) { |
3786 | /* let fuse leave the umask processing to us, so that it does not |
3787 | * break extended POSIX ACL defaults on server */ |
3788 | fino.flags |= FUSE_DONT_MASK(1 << 6); |
3789 | } |
3790 | #endif |
3791 | #if FUSE_KERNEL_MINOR_VERSION22 >= 9 |
3792 | if (fini->minor >= 6 /* fuse_init_in has flags */ && |
3793 | fini->flags & FUSE_BIG_WRITES(1 << 5)) { |
3794 | /* no need for direct I/O mode by default if big writes are supported */ |
3795 | if (priv->direct_io_mode == 2) |
3796 | priv->direct_io_mode = 0; |
3797 | fino.flags |= FUSE_BIG_WRITES(1 << 5); |
3798 | } |
3799 | |
3800 | /* Used for 'reverse invalidation of inode' */ |
3801 | if (fini->minor >= 12) { |
3802 | if (pipe(pfd) == -1) { |
3803 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("cannot create pipe pair (%s)", strerror ((*__errno_location ()))); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3805, GF_LOG_ERROR, "cannot create pipe pair (%s)" , strerror((*__errno_location ()))); } while (0) |
3804 | "cannot create pipe pair (%s)",do { do { if (0) printf ("cannot create pipe pair (%s)", strerror ((*__errno_location ()))); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3805, GF_LOG_ERROR, "cannot create pipe pair (%s)" , strerror((*__errno_location ()))); } while (0) |
3805 | strerror(errno))do { do { if (0) printf ("cannot create pipe pair (%s)", strerror ((*__errno_location ()))); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3805, GF_LOG_ERROR, "cannot create pipe pair (%s)" , strerror((*__errno_location ()))); } while (0); |
3806 | |
3807 | close (priv->fd); |
3808 | goto out; |
3809 | } |
3810 | priv->revchan_in = pfd[0]; |
3811 | priv->revchan_out = pfd[1]; |
3812 | ret = gf_thread_create (&messenger, NULL((void*)0), notify_kernel_loop, |
3813 | this); |
3814 | if (ret != 0) { |
3815 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("failed to start messenger daemon (%s)" , strerror((*__errno_location ()))); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3817, GF_LOG_ERROR, "failed to start messenger daemon (%s)" , strerror((*__errno_location ()))); } while (0) |
3816 | "failed to start messenger daemon (%s)",do { do { if (0) printf ("failed to start messenger daemon (%s)" , strerror((*__errno_location ()))); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3817, GF_LOG_ERROR, "failed to start messenger daemon (%s)" , strerror((*__errno_location ()))); } while (0) |
3817 | strerror(errno))do { do { if (0) printf ("failed to start messenger daemon (%s)" , strerror((*__errno_location ()))); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3817, GF_LOG_ERROR, "failed to start messenger daemon (%s)" , strerror((*__errno_location ()))); } while (0); |
3818 | |
3819 | close (priv->fd); |
3820 | goto out; |
3821 | } |
3822 | priv->reverse_fuse_thread_started = _gf_true; |
3823 | } else { |
3824 | /* |
3825 | * FUSE minor < 12 does not implement invalidate notifications. |
3826 | * This mechanism is required for fopen-keep-cache to operate |
3827 | * correctly. Disable and warn the user. |
3828 | */ |
3829 | if (priv->fopen_keep_cache) { |
3830 | gf_log("glusterfs-fuse", GF_LOG_WARNING, "FUSE version "do { do { if (0) printf ("FUSE version " "%d.%d does not support inval notifications. " "fopen-keep-cache disabled.", fini->major, fini->minor ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3833, GF_LOG_WARNING, "FUSE version " "%d.%d does not support inval notifications. " "fopen-keep-cache disabled.", fini->major, fini->minor ); } while (0) |
3831 | "%d.%d does not support inval notifications. "do { do { if (0) printf ("FUSE version " "%d.%d does not support inval notifications. " "fopen-keep-cache disabled.", fini->major, fini->minor ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3833, GF_LOG_WARNING, "FUSE version " "%d.%d does not support inval notifications. " "fopen-keep-cache disabled.", fini->major, fini->minor ); } while (0) |
3832 | "fopen-keep-cache disabled.", fini->major,do { do { if (0) printf ("FUSE version " "%d.%d does not support inval notifications. " "fopen-keep-cache disabled.", fini->major, fini->minor ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3833, GF_LOG_WARNING, "FUSE version " "%d.%d does not support inval notifications. " "fopen-keep-cache disabled.", fini->major, fini->minor ); } while (0) |
3833 | fini->minor)do { do { if (0) printf ("FUSE version " "%d.%d does not support inval notifications. " "fopen-keep-cache disabled.", fini->major, fini->minor ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3833, GF_LOG_WARNING, "FUSE version " "%d.%d does not support inval notifications. " "fopen-keep-cache disabled.", fini->major, fini->minor ); } while (0); |
3834 | priv->fopen_keep_cache = 0; |
3835 | } |
3836 | } |
3837 | |
3838 | if (fini->minor >= 13) { |
3839 | fino.max_background = priv->background_qlen; |
3840 | fino.congestion_threshold = priv->congestion_threshold; |
3841 | } |
3842 | if (fini->minor < 9) |
3843 | *priv->msg0_len_p = sizeof(*finh) + FUSE_COMPAT_WRITE_IN_SIZE24; |
3844 | #endif |
3845 | if (priv->use_readdirp) { |
3846 | if (fini->flags & FUSE_DO_READDIRPLUS(1 << 13)) |
3847 | fino.flags |= FUSE_DO_READDIRPLUS(1 << 13); |
3848 | } |
3849 | |
3850 | if (priv->fopen_keep_cache == 2) { |
3851 | /* If user did not explicitly set --fopen-keep-cache[=off], |
3852 | then check if kernel support FUSE_AUTO_INVAL_DATA and ... |
3853 | */ |
3854 | if (fini->flags & FUSE_AUTO_INVAL_DATA(1 << 12)) { |
3855 | /* ... enable fopen_keep_cache mode if supported. |
3856 | */ |
3857 | gf_log ("glusterfs-fuse", GF_LOG_DEBUG, "Detected "do { do { if (0) printf ("Detected " "support for FUSE_AUTO_INVAL_DATA. Enabling " "fopen_keep_cache automatically."); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3859, GF_LOG_DEBUG, "Detected " "support for FUSE_AUTO_INVAL_DATA. Enabling " "fopen_keep_cache automatically." ); } while (0) |
3858 | "support for FUSE_AUTO_INVAL_DATA. Enabling "do { do { if (0) printf ("Detected " "support for FUSE_AUTO_INVAL_DATA. Enabling " "fopen_keep_cache automatically."); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3859, GF_LOG_DEBUG, "Detected " "support for FUSE_AUTO_INVAL_DATA. Enabling " "fopen_keep_cache automatically." ); } while (0) |
3859 | "fopen_keep_cache automatically.")do { do { if (0) printf ("Detected " "support for FUSE_AUTO_INVAL_DATA. Enabling " "fopen_keep_cache automatically."); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3859, GF_LOG_DEBUG, "Detected " "support for FUSE_AUTO_INVAL_DATA. Enabling " "fopen_keep_cache automatically." ); } while (0); |
3860 | fino.flags |= FUSE_AUTO_INVAL_DATA(1 << 12); |
3861 | priv->fopen_keep_cache = 1; |
3862 | } else { |
3863 | gf_log ("glusterfs-fuse", GF_LOG_DEBUG, "No support "do { do { if (0) printf ("No support " "for FUSE_AUTO_INVAL_DATA. Disabling " "fopen_keep_cache."); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3865, GF_LOG_DEBUG, "No support " "for FUSE_AUTO_INVAL_DATA. Disabling " "fopen_keep_cache."); } while (0) |
3864 | "for FUSE_AUTO_INVAL_DATA. Disabling "do { do { if (0) printf ("No support " "for FUSE_AUTO_INVAL_DATA. Disabling " "fopen_keep_cache."); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3865, GF_LOG_DEBUG, "No support " "for FUSE_AUTO_INVAL_DATA. Disabling " "fopen_keep_cache."); } while (0) |
3865 | "fopen_keep_cache.")do { do { if (0) printf ("No support " "for FUSE_AUTO_INVAL_DATA. Disabling " "fopen_keep_cache."); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3865, GF_LOG_DEBUG, "No support " "for FUSE_AUTO_INVAL_DATA. Disabling " "fopen_keep_cache."); } while (0); |
3866 | /* ... else disable. */ |
3867 | priv->fopen_keep_cache = 0; |
3868 | } |
3869 | } else if (priv->fopen_keep_cache == 1) { |
3870 | /* If user explicitly set --fopen-keep-cache[=on], |
3871 | then enable FUSE_AUTO_INVAL_DATA if possible. |
3872 | */ |
3873 | if (fini->flags & FUSE_AUTO_INVAL_DATA(1 << 12)) { |
3874 | gf_log ("glusterfs-fuse", GF_LOG_DEBUG, "fopen_keep_cache "do { do { if (0) printf ("fopen_keep_cache " "is explicitly set. Enabling FUSE_AUTO_INVAL_DATA" ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3875, GF_LOG_DEBUG, "fopen_keep_cache " "is explicitly set. Enabling FUSE_AUTO_INVAL_DATA" ); } while (0) |
3875 | "is explicitly set. Enabling FUSE_AUTO_INVAL_DATA")do { do { if (0) printf ("fopen_keep_cache " "is explicitly set. Enabling FUSE_AUTO_INVAL_DATA" ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3875, GF_LOG_DEBUG, "fopen_keep_cache " "is explicitly set. Enabling FUSE_AUTO_INVAL_DATA" ); } while (0); |
3876 | fino.flags |= FUSE_AUTO_INVAL_DATA(1 << 12); |
3877 | } else { |
3878 | gf_log ("glusterfs-fuse", GF_LOG_WARNING, "fopen_keep_cache "do { do { if (0) printf ("fopen_keep_cache " "is explicitly set. Support for " "FUSE_AUTO_INVAL_DATA is missing"); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3880, GF_LOG_WARNING, "fopen_keep_cache " "is explicitly set. Support for " "FUSE_AUTO_INVAL_DATA is missing" ); } while (0) |
3879 | "is explicitly set. Support for "do { do { if (0) printf ("fopen_keep_cache " "is explicitly set. Support for " "FUSE_AUTO_INVAL_DATA is missing"); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3880, GF_LOG_WARNING, "fopen_keep_cache " "is explicitly set. Support for " "FUSE_AUTO_INVAL_DATA is missing" ); } while (0) |
3880 | "FUSE_AUTO_INVAL_DATA is missing")do { do { if (0) printf ("fopen_keep_cache " "is explicitly set. Support for " "FUSE_AUTO_INVAL_DATA is missing"); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3880, GF_LOG_WARNING, "fopen_keep_cache " "is explicitly set. Support for " "FUSE_AUTO_INVAL_DATA is missing" ); } while (0); |
3881 | } |
3882 | } |
3883 | |
3884 | if (fini->flags & FUSE_ASYNC_DIO(1 << 15)) |
3885 | fino.flags |= FUSE_ASYNC_DIO(1 << 15); |
3886 | |
3887 | ret = send_fuse_obj (this, finh, &fino)send_fuse_data (this, finh, &fino, sizeof (*(&fino))); |
3888 | if (ret == 0) |
3889 | gf_log ("glusterfs-fuse", GF_LOG_INFO,do { do { if (0) printf ("FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 22, fini->major, fini ->minor); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3893, GF_LOG_INFO, "FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 22, fini->major, fini ->minor); } while (0) |
3890 | "FUSE inited with protocol versions:"do { do { if (0) printf ("FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 22, fini->major, fini ->minor); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3893, GF_LOG_INFO, "FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 22, fini->major, fini ->minor); } while (0) |
3891 | " glusterfs %d.%d kernel %d.%d",do { do { if (0) printf ("FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 22, fini->major, fini ->minor); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3893, GF_LOG_INFO, "FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 22, fini->major, fini ->minor); } while (0) |
3892 | FUSE_KERNEL_VERSION, FUSE_KERNEL_MINOR_VERSION,do { do { if (0) printf ("FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 22, fini->major, fini ->minor); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3893, GF_LOG_INFO, "FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 22, fini->major, fini ->minor); } while (0) |
3893 | fini->major, fini->minor)do { do { if (0) printf ("FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 22, fini->major, fini ->minor); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3893, GF_LOG_INFO, "FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 22, fini->major, fini ->minor); } while (0); |
3894 | else { |
3895 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("FUSE init failed (%s)", strerror (ret )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3896, GF_LOG_ERROR, "FUSE init failed (%s)", strerror (ret) ); } while (0) |
3896 | "FUSE init failed (%s)", strerror (ret))do { do { if (0) printf ("FUSE init failed (%s)", strerror (ret )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3896, GF_LOG_ERROR, "FUSE init failed (%s)", strerror (ret) ); } while (0); |
3897 | |
3898 | close (priv->fd); |
3899 | } |
3900 | |
3901 | out: |
3902 | GF_FREE (finh)__gf_free (finh); |
3903 | } |
3904 | |
3905 | |
3906 | static void |
3907 | fuse_enosys (xlator_t *this, fuse_in_header_t *finh, void *msg) |
3908 | { |
3909 | send_fuse_err (this, finh, ENOSYS38); |
3910 | |
3911 | GF_FREE (finh)__gf_free (finh); |
3912 | } |
3913 | |
3914 | |
3915 | static void |
3916 | fuse_destroy (xlator_t *this, fuse_in_header_t *finh, void *msg) |
3917 | { |
3918 | send_fuse_err (this, finh, 0); |
3919 | |
3920 | GF_FREE (finh)__gf_free (finh); |
3921 | } |
3922 | |
3923 | |
3924 | |
3925 | struct fuse_first_lookup { |
3926 | pthread_mutex_t mutex; |
3927 | pthread_cond_t cond; |
3928 | char fin; |
3929 | }; |
3930 | |
3931 | int |
3932 | fuse_first_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
3933 | int32_t op_ret, int32_t op_errno, |
3934 | inode_t *inode, struct iatt *buf, dict_t *xattr, |
3935 | struct iatt *postparent) |
3936 | { |
3937 | struct fuse_first_lookup *stub = NULL((void*)0); |
3938 | |
3939 | stub = frame->local; |
3940 | |
3941 | if (op_ret == 0) { |
3942 | gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("first lookup on root succeeded."); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__ , 3943, GF_LOG_TRACE, "first lookup on root succeeded."); } while (0) |
3943 | "first lookup on root succeeded.")do { do { if (0) printf ("first lookup on root succeeded."); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__ , 3943, GF_LOG_TRACE, "first lookup on root succeeded."); } while (0); |
3944 | } else { |
3945 | gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("first lookup on root failed."); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__, 3946 , GF_LOG_DEBUG, "first lookup on root failed."); } while (0) |
3946 | "first lookup on root failed.")do { do { if (0) printf ("first lookup on root failed."); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__, 3946 , GF_LOG_DEBUG, "first lookup on root failed."); } while (0); |
3947 | } |
3948 | |
3949 | pthread_mutex_lock (&stub->mutex); |
3950 | { |
3951 | stub->fin = 1; |
3952 | pthread_cond_broadcast (&stub->cond); |
3953 | } |
3954 | pthread_mutex_unlock (&stub->mutex); |
3955 | |
3956 | return 0; |
3957 | } |
3958 | |
3959 | |
3960 | int |
3961 | fuse_first_lookup (xlator_t *this) |
3962 | { |
3963 | fuse_private_t *priv = NULL((void*)0); |
3964 | loc_t loc = {0, }; |
3965 | call_frame_t *frame = NULL((void*)0); |
3966 | xlator_t *xl = NULL((void*)0); |
3967 | dict_t *dict = NULL((void*)0); |
3968 | struct fuse_first_lookup stub; |
3969 | uuid_t gfid; |
3970 | int ret; |
3971 | |
3972 | priv = this->private; |
3973 | |
3974 | loc.path = "/"; |
3975 | loc.name = ""; |
3976 | loc.inode = fuse_ino_to_inode (1, this); |
3977 | uuid_copy (loc.gfid, loc.inode->gfid); |
3978 | loc.parent = NULL((void*)0); |
3979 | |
3980 | dict = dict_new (); |
3981 | frame = create_frame (this, this->ctx->pool); |
3982 | frame->root->type = GF_OP_TYPE_FOP; |
3983 | |
3984 | xl = priv->active_subvol; |
3985 | |
3986 | pthread_mutex_init (&stub.mutex, NULL((void*)0)); |
3987 | pthread_cond_init (&stub.cond, NULL((void*)0)); |
3988 | stub.fin = 0; |
3989 | |
3990 | frame->local = &stub; |
3991 | |
3992 | memset (gfid, 0, 16); |
3993 | gfid[15] = 1; |
3994 | ret = dict_set_static_bin (dict, "gfid-req", gfid, 16); |
3995 | if (ret) |
3996 | gf_log (xl->name, GF_LOG_ERROR, "failed to set 'gfid-req'")do { do { if (0) printf ("failed to set 'gfid-req'"); } while (0); _gf_log (xl->name, "fuse-bridge.c", __FUNCTION__, 3996 , GF_LOG_ERROR, "failed to set 'gfid-req'"); } while (0); |
3997 | |
3998 | STACK_WIND (frame, fuse_first_lookup_cbk, xl, xl->fops->lookup,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "fuse-bridge.c", __FUNCTION__, 3999, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> lookup_cbk) tmp_cbk = fuse_first_lookup_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->lookup"; _new->unwind_to = "fuse_first_lookup_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = xl; if (frame->this->ctx->measure_latency) gf_latency_begin (_new, xl->fops->lookup); xl->fops->lookup (_new , xl, &loc, dict); (*__glusterfs_this_location()) = old_THIS ; } while (0) |
3999 | &loc, dict)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "fuse-bridge.c", __FUNCTION__, 3999, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( xl->fops-> lookup_cbk) tmp_cbk = fuse_first_lookup_cbk; _new->root = frame ->root; _new->this = xl; _new->ret = (ret_fn_t) tmp_cbk ; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to = "xl->fops->lookup"; _new->unwind_to = "fuse_first_lookup_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = xl; if (frame->this->ctx->measure_latency) gf_latency_begin (_new, xl->fops->lookup); xl->fops->lookup (_new , xl, &loc, dict); (*__glusterfs_this_location()) = old_THIS ; } while (0); |
4000 | dict_unref (dict); |
4001 | |
4002 | pthread_mutex_lock (&stub.mutex); |
4003 | { |
4004 | while (!stub.fin) { |
4005 | pthread_cond_wait (&stub.cond, &stub.mutex); |
4006 | } |
4007 | } |
4008 | pthread_mutex_unlock (&stub.mutex); |
4009 | |
4010 | pthread_mutex_destroy (&stub.mutex); |
4011 | pthread_cond_destroy (&stub.cond); |
4012 | |
4013 | frame->local = NULL((void*)0); |
4014 | STACK_DESTROY (frame->root); |
4015 | |
4016 | return 0; |
4017 | } |
4018 | |
4019 | |
4020 | int |
4021 | fuse_nameless_lookup (xlator_t *xl, uuid_t gfid, loc_t *loc) |
4022 | { |
4023 | int ret = -1; |
4024 | dict_t *xattr_req = NULL((void*)0); |
4025 | struct iatt iatt = {0, }; |
4026 | inode_t *linked_inode = NULL((void*)0); |
4027 | |
4028 | if ((loc == NULL((void*)0)) || (xl == NULL((void*)0))) { |
4029 | goto out; |
4030 | } |
4031 | |
4032 | if (loc->inode == NULL((void*)0)) { |
4033 | loc->inode = inode_new (xl->itable); |
4034 | if (loc->inode == NULL((void*)0)) { |
4035 | goto out; |
4036 | } |
4037 | } |
4038 | |
4039 | uuid_copy (loc->gfid, gfid); |
4040 | |
4041 | xattr_req = dict_new (); |
4042 | if (xattr_req == NULL((void*)0)) { |
4043 | goto out; |
4044 | } |
4045 | |
4046 | ret = syncop_lookup (xl, loc, xattr_req, &iatt, NULL((void*)0), NULL((void*)0)); |
4047 | if (ret < 0) { |
4048 | goto out; |
4049 | } |
4050 | |
4051 | linked_inode = inode_link (loc->inode, NULL((void*)0), NULL((void*)0), &iatt); |
4052 | inode_unref (loc->inode); |
4053 | loc->inode = linked_inode; |
4054 | |
4055 | ret = 0; |
4056 | out: |
4057 | if (xattr_req != NULL((void*)0)) { |
4058 | dict_unref (xattr_req); |
4059 | } |
4060 | |
4061 | return ret; |
4062 | } |
4063 | |
4064 | |
4065 | int |
4066 | fuse_migrate_fd_open (xlator_t *this, fd_t *basefd, fd_t *oldfd, |
4067 | xlator_t *old_subvol, xlator_t *new_subvol) |
4068 | { |
4069 | loc_t loc = {0, }; |
4070 | fd_t *newfd = NULL((void*)0), *old_activefd = NULL((void*)0); |
4071 | fuse_fd_ctx_t *basefd_ctx = NULL((void*)0); |
4072 | fuse_fd_ctx_t *newfd_ctx = NULL((void*)0); |
4073 | int ret = 0, flags = 0; |
4074 | |
4075 | ret = inode_path (basefd->inode, NULL((void*)0), (char **)&loc.path); |
4076 | if (ret < 0) { |
4077 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("cannot construct path of gfid (%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), old_subvol->name, old_subvol->graph ->id, new_subvol->name, new_subvol->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 4082, GF_LOG_WARNING, "cannot construct path of gfid (%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), old_subvol->name, old_subvol->graph ->id, new_subvol->name, new_subvol->graph->id); } while (0) |
4078 | "cannot construct path of gfid (%s) failed"do { do { if (0) printf ("cannot construct path of gfid (%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), old_subvol->name, old_subvol->graph ->id, new_subvol->name, new_subvol->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 4082, GF_LOG_WARNING, "cannot construct path of gfid (%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), old_subvol->name, old_subvol->graph ->id, new_subvol->name, new_subvol->graph->id); } while (0) |
4079 | "(old-subvolume:%s-%d new-subvolume:%s-%d)",do { do { if (0) printf ("cannot construct path of gfid (%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), old_subvol->name, old_subvol->graph ->id, new_subvol->name, new_subvol->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 4082, GF_LOG_WARNING, "cannot construct path of gfid (%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), old_subvol->name, old_subvol->graph ->id, new_subvol->name, new_subvol->graph->id); } while (0) |
4080 | uuid_utoa (basefd->inode->gfid),do { do { if (0) printf ("cannot construct path of gfid (%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), old_subvol->name, old_subvol->graph ->id, new_subvol->name, new_subvol->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 4082, GF_LOG_WARNING, "cannot construct path of gfid (%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), old_subvol->name, old_subvol->graph ->id, new_subvol->name, new_subvol->graph->id); } while (0) |
4081 | old_subvol->name, old_subvol->graph->id,do { do { if (0) printf ("cannot construct path of gfid (%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), old_subvol->name, old_subvol->graph ->id, new_subvol->name, new_subvol->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 4082, GF_LOG_WARNING, "cannot construct path of gfid (%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), old_subvol->name, old_subvol->graph ->id, new_subvol->name, new_subvol->graph->id); } while (0) |
4082 | new_subvol->name, new_subvol->graph->id)do { do { if (0) printf ("cannot construct path of gfid (%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), old_subvol->name, old_subvol->graph ->id, new_subvol->name, new_subvol->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 4082, GF_LOG_WARNING, "cannot construct path of gfid (%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), old_subvol->name, old_subvol->graph ->id, new_subvol->name, new_subvol->graph->id); } while (0); |
4083 | goto out; |
4084 | } |
4085 | |
4086 | uuid_copy (loc.gfid, basefd->inode->gfid); |
4087 | |
4088 | loc.inode = inode_find (new_subvol->itable, basefd->inode->gfid); |
4089 | |
4090 | if (loc.inode == NULL((void*)0)) { |
4091 | ret = fuse_nameless_lookup (new_subvol, basefd->inode->gfid, |
4092 | &loc); |
4093 | if (ret < 0) { |
4094 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("name-less lookup of gfid (%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), strerror ((*__errno_location ())), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4100, GF_LOG_WARNING, "name-less lookup of gfid (%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), strerror ((*__errno_location ())), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4095 | "name-less lookup of gfid (%s) failed (%s)"do { do { if (0) printf ("name-less lookup of gfid (%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), strerror ((*__errno_location ())), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4100, GF_LOG_WARNING, "name-less lookup of gfid (%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), strerror ((*__errno_location ())), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4096 | "(old-subvolume:%s-%d new-subvolume:%s-%d)",do { do { if (0) printf ("name-less lookup of gfid (%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), strerror ((*__errno_location ())), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4100, GF_LOG_WARNING, "name-less lookup of gfid (%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), strerror ((*__errno_location ())), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4097 | uuid_utoa (basefd->inode->gfid),do { do { if (0) printf ("name-less lookup of gfid (%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), strerror ((*__errno_location ())), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4100, GF_LOG_WARNING, "name-less lookup of gfid (%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), strerror ((*__errno_location ())), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4098 | strerror (errno),do { do { if (0) printf ("name-less lookup of gfid (%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), strerror ((*__errno_location ())), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4100, GF_LOG_WARNING, "name-less lookup of gfid (%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), strerror ((*__errno_location ())), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4099 | old_subvol->name, old_subvol->graph->id,do { do { if (0) printf ("name-less lookup of gfid (%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), strerror ((*__errno_location ())), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4100, GF_LOG_WARNING, "name-less lookup of gfid (%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), strerror ((*__errno_location ())), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4100 | new_subvol->name, new_subvol->graph->id)do { do { if (0) printf ("name-less lookup of gfid (%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), strerror ((*__errno_location ())), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4100, GF_LOG_WARNING, "name-less lookup of gfid (%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", uuid_utoa (basefd ->inode->gfid), strerror ((*__errno_location ())), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); |
4101 | goto out; |
4102 | } |
4103 | |
4104 | } |
4105 | |
4106 | basefd_ctx = fuse_fd_ctx_get (this, basefd); |
4107 | GF_VALIDATE_OR_GOTO ("glusterfs-fuse", basefd_ctx, out)do { if (!basefd_ctx) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "basefd_ctx"); } while ( 0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 4107, GF_LOG_ERROR, "invalid argument: " "basefd_ctx"); } while (0); goto out; } } while (0); |
4108 | |
4109 | newfd = fd_create (loc.inode, basefd->pid); |
4110 | if (newfd == NULL((void*)0)) { |
4111 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("cannot create new fd, hence not migrating basefd " "(ptr:%p inode-gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (loc.inode->gfid), old_subvol->name , old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4117, GF_LOG_WARNING, "cannot create new fd, hence not migrating basefd " "(ptr:%p inode-gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (loc.inode->gfid), old_subvol->name , old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4112 | "cannot create new fd, hence not migrating basefd "do { do { if (0) printf ("cannot create new fd, hence not migrating basefd " "(ptr:%p inode-gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (loc.inode->gfid), old_subvol->name , old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4117, GF_LOG_WARNING, "cannot create new fd, hence not migrating basefd " "(ptr:%p inode-gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (loc.inode->gfid), old_subvol->name , old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4113 | "(ptr:%p inode-gfid:%s) "do { do { if (0) printf ("cannot create new fd, hence not migrating basefd " "(ptr:%p inode-gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (loc.inode->gfid), old_subvol->name , old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4117, GF_LOG_WARNING, "cannot create new fd, hence not migrating basefd " "(ptr:%p inode-gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (loc.inode->gfid), old_subvol->name , old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4114 | "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd,do { do { if (0) printf ("cannot create new fd, hence not migrating basefd " "(ptr:%p inode-gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (loc.inode->gfid), old_subvol->name , old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4117, GF_LOG_WARNING, "cannot create new fd, hence not migrating basefd " "(ptr:%p inode-gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (loc.inode->gfid), old_subvol->name , old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4115 | uuid_utoa (loc.inode->gfid),do { do { if (0) printf ("cannot create new fd, hence not migrating basefd " "(ptr:%p inode-gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (loc.inode->gfid), old_subvol->name , old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4117, GF_LOG_WARNING, "cannot create new fd, hence not migrating basefd " "(ptr:%p inode-gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (loc.inode->gfid), old_subvol->name , old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4116 | old_subvol->name, old_subvol->graph->id,do { do { if (0) printf ("cannot create new fd, hence not migrating basefd " "(ptr:%p inode-gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (loc.inode->gfid), old_subvol->name , old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4117, GF_LOG_WARNING, "cannot create new fd, hence not migrating basefd " "(ptr:%p inode-gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (loc.inode->gfid), old_subvol->name , old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4117 | new_subvol->name, new_subvol->graph->id)do { do { if (0) printf ("cannot create new fd, hence not migrating basefd " "(ptr:%p inode-gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (loc.inode->gfid), old_subvol->name , old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4117, GF_LOG_WARNING, "cannot create new fd, hence not migrating basefd " "(ptr:%p inode-gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (loc.inode->gfid), old_subvol->name , old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); |
4118 | goto out; |
4119 | } |
4120 | |
4121 | newfd->flags = basefd->flags; |
4122 | if (newfd->lk_ctx) |
4123 | fd_lk_ctx_unref (newfd->lk_ctx); |
4124 | |
4125 | newfd->lk_ctx = fd_lk_ctx_ref (oldfd->lk_ctx); |
4126 | |
4127 | newfd_ctx = fuse_fd_ctx_check_n_create (this, newfd); |
4128 | GF_VALIDATE_OR_GOTO ("glusterfs-fuse", newfd_ctx, out)do { if (!newfd_ctx) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "newfd_ctx"); } while (0 ); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 4128, GF_LOG_ERROR, "invalid argument: " "newfd_ctx"); } while (0); goto out; } } while (0); |
4129 | |
4130 | if (IA_ISDIR (basefd->inode->ia_type)(basefd->inode->ia_type == IA_IFDIR)) { |
4131 | ret = syncop_opendir (new_subvol, &loc, newfd); |
4132 | } else { |
4133 | flags = basefd->flags & ~(O_CREAT0100 | O_EXCL0200 | O_TRUNC01000); |
4134 | ret = syncop_open (new_subvol, &loc, flags, newfd); |
4135 | } |
4136 | |
4137 | if (ret < 0) { |
4138 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("open on basefd (ptr:%p inode-gfid:%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, uuid_utoa (basefd->inode->gfid), strerror ((*__errno_location () )), old_subvol->name, old_subvol->graph->id, new_subvol ->name, new_subvol->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4143, GF_LOG_WARNING , "open on basefd (ptr:%p inode-gfid:%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (basefd->inode->gfid), strerror ((* __errno_location ())), old_subvol->name, old_subvol->graph ->id, new_subvol->name, new_subvol->graph->id); } while (0) |
4139 | "open on basefd (ptr:%p inode-gfid:%s) failed (%s)"do { do { if (0) printf ("open on basefd (ptr:%p inode-gfid:%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, uuid_utoa (basefd->inode->gfid), strerror ((*__errno_location () )), old_subvol->name, old_subvol->graph->id, new_subvol ->name, new_subvol->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4143, GF_LOG_WARNING , "open on basefd (ptr:%p inode-gfid:%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (basefd->inode->gfid), strerror ((* __errno_location ())), old_subvol->name, old_subvol->graph ->id, new_subvol->name, new_subvol->graph->id); } while (0) |
4140 | "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd,do { do { if (0) printf ("open on basefd (ptr:%p inode-gfid:%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, uuid_utoa (basefd->inode->gfid), strerror ((*__errno_location () )), old_subvol->name, old_subvol->graph->id, new_subvol ->name, new_subvol->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4143, GF_LOG_WARNING , "open on basefd (ptr:%p inode-gfid:%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (basefd->inode->gfid), strerror ((* __errno_location ())), old_subvol->name, old_subvol->graph ->id, new_subvol->name, new_subvol->graph->id); } while (0) |
4141 | uuid_utoa (basefd->inode->gfid), strerror (errno),do { do { if (0) printf ("open on basefd (ptr:%p inode-gfid:%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, uuid_utoa (basefd->inode->gfid), strerror ((*__errno_location () )), old_subvol->name, old_subvol->graph->id, new_subvol ->name, new_subvol->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4143, GF_LOG_WARNING , "open on basefd (ptr:%p inode-gfid:%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (basefd->inode->gfid), strerror ((* __errno_location ())), old_subvol->name, old_subvol->graph ->id, new_subvol->name, new_subvol->graph->id); } while (0) |
4142 | old_subvol->name, old_subvol->graph->id,do { do { if (0) printf ("open on basefd (ptr:%p inode-gfid:%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, uuid_utoa (basefd->inode->gfid), strerror ((*__errno_location () )), old_subvol->name, old_subvol->graph->id, new_subvol ->name, new_subvol->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4143, GF_LOG_WARNING , "open on basefd (ptr:%p inode-gfid:%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (basefd->inode->gfid), strerror ((* __errno_location ())), old_subvol->name, old_subvol->graph ->id, new_subvol->name, new_subvol->graph->id); } while (0) |
4143 | new_subvol->name, new_subvol->graph->id)do { do { if (0) printf ("open on basefd (ptr:%p inode-gfid:%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, uuid_utoa (basefd->inode->gfid), strerror ((*__errno_location () )), old_subvol->name, old_subvol->graph->id, new_subvol ->name, new_subvol->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4143, GF_LOG_WARNING , "open on basefd (ptr:%p inode-gfid:%s) failed (%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)" , basefd, uuid_utoa (basefd->inode->gfid), strerror ((* __errno_location ())), old_subvol->name, old_subvol->graph ->id, new_subvol->name, new_subvol->graph->id); } while (0); |
4144 | goto out; |
4145 | } |
4146 | |
4147 | fd_bind (newfd); |
4148 | |
4149 | LOCK (&basefd->lock)pthread_spin_lock (&basefd->lock); |
4150 | { |
4151 | if (basefd_ctx->activefd != NULL((void*)0)) { |
4152 | old_activefd = basefd_ctx->activefd; |
4153 | } |
4154 | |
4155 | basefd_ctx->activefd = newfd; |
4156 | } |
4157 | UNLOCK (&basefd->lock)pthread_spin_unlock (&basefd->lock); |
4158 | |
4159 | if (old_activefd != NULL((void*)0)) { |
4160 | fd_unref (old_activefd); |
4161 | } |
4162 | |
4163 | gf_log ("glusterfs-fuse", GF_LOG_INFO,do { do { if (0) printf ("migrated basefd (%p) to newfd (%p) (inode-gfid:%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, newfd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4168, GF_LOG_INFO, "migrated basefd (%p) to newfd (%p) (inode-gfid:%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, newfd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4164 | "migrated basefd (%p) to newfd (%p) (inode-gfid:%s)"do { do { if (0) printf ("migrated basefd (%p) to newfd (%p) (inode-gfid:%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, newfd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4168, GF_LOG_INFO, "migrated basefd (%p) to newfd (%p) (inode-gfid:%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, newfd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4165 | "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, newfd,do { do { if (0) printf ("migrated basefd (%p) to newfd (%p) (inode-gfid:%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, newfd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4168, GF_LOG_INFO, "migrated basefd (%p) to newfd (%p) (inode-gfid:%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, newfd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4166 | uuid_utoa (basefd->inode->gfid),do { do { if (0) printf ("migrated basefd (%p) to newfd (%p) (inode-gfid:%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, newfd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4168, GF_LOG_INFO, "migrated basefd (%p) to newfd (%p) (inode-gfid:%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, newfd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4167 | old_subvol->name, old_subvol->graph->id,do { do { if (0) printf ("migrated basefd (%p) to newfd (%p) (inode-gfid:%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, newfd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4168, GF_LOG_INFO, "migrated basefd (%p) to newfd (%p) (inode-gfid:%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, newfd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4168 | new_subvol->name, new_subvol->graph->id)do { do { if (0) printf ("migrated basefd (%p) to newfd (%p) (inode-gfid:%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, newfd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4168, GF_LOG_INFO, "migrated basefd (%p) to newfd (%p) (inode-gfid:%s)" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, newfd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); |
4169 | |
4170 | ret = 0; |
4171 | |
4172 | out: |
4173 | loc_wipe (&loc); |
4174 | |
4175 | return ret; |
4176 | } |
4177 | |
4178 | int |
4179 | fuse_migrate_locks (xlator_t *this, fd_t *basefd, fd_t *oldfd, |
4180 | xlator_t *old_subvol, xlator_t *new_subvol) |
4181 | { |
4182 | int ret = -1; |
4183 | dict_t *lockinfo = NULL((void*)0); |
4184 | void *ptr = NULL((void*)0); |
4185 | fd_t *newfd = NULL((void*)0); |
4186 | fuse_fd_ctx_t *basefd_ctx = NULL((void*)0); |
4187 | |
4188 | |
4189 | if (!oldfd->lk_ctx || fd_lk_ctx_empty (oldfd->lk_ctx)) |
4190 | return 0; |
4191 | |
4192 | basefd_ctx = fuse_fd_ctx_get (this, basefd); |
4193 | GF_VALIDATE_OR_GOTO ("glusterfs-fuse", basefd_ctx, out)do { if (!basefd_ctx) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "basefd_ctx"); } while ( 0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 4193, GF_LOG_ERROR, "invalid argument: " "basefd_ctx"); } while (0); goto out; } } while (0); |
4194 | |
4195 | LOCK (&basefd->lock)pthread_spin_lock (&basefd->lock); |
4196 | { |
4197 | newfd = fd_ref (basefd_ctx->activefd); |
4198 | } |
4199 | UNLOCK (&basefd->lock)pthread_spin_unlock (&basefd->lock); |
4200 | |
4201 | ret = syncop_fgetxattr (old_subvol, oldfd, &lockinfo, |
4202 | GF_XATTR_LOCKINFO_KEY"trusted.glusterfs.lockinfo"); |
4203 | if (ret < 0) { |
4204 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("getting lockinfo failed while migrating locks" "(oldfd:%p newfd:%p inode-gfid:%s)" "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4210, GF_LOG_WARNING, "getting lockinfo failed while migrating locks" "(oldfd:%p newfd:%p inode-gfid:%s)" "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4205 | "getting lockinfo failed while migrating locks"do { do { if (0) printf ("getting lockinfo failed while migrating locks" "(oldfd:%p newfd:%p inode-gfid:%s)" "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4210, GF_LOG_WARNING, "getting lockinfo failed while migrating locks" "(oldfd:%p newfd:%p inode-gfid:%s)" "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4206 | "(oldfd:%p newfd:%p inode-gfid:%s)"do { do { if (0) printf ("getting lockinfo failed while migrating locks" "(oldfd:%p newfd:%p inode-gfid:%s)" "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4210, GF_LOG_WARNING, "getting lockinfo failed while migrating locks" "(oldfd:%p newfd:%p inode-gfid:%s)" "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4207 | "(old-subvol:%s-%d new-subvol:%s-%d)",do { do { if (0) printf ("getting lockinfo failed while migrating locks" "(oldfd:%p newfd:%p inode-gfid:%s)" "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4210, GF_LOG_WARNING, "getting lockinfo failed while migrating locks" "(oldfd:%p newfd:%p inode-gfid:%s)" "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4208 | oldfd, newfd, uuid_utoa (newfd->inode->gfid),do { do { if (0) printf ("getting lockinfo failed while migrating locks" "(oldfd:%p newfd:%p inode-gfid:%s)" "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4210, GF_LOG_WARNING, "getting lockinfo failed while migrating locks" "(oldfd:%p newfd:%p inode-gfid:%s)" "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4209 | old_subvol->name, old_subvol->graph->id,do { do { if (0) printf ("getting lockinfo failed while migrating locks" "(oldfd:%p newfd:%p inode-gfid:%s)" "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4210, GF_LOG_WARNING, "getting lockinfo failed while migrating locks" "(oldfd:%p newfd:%p inode-gfid:%s)" "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4210 | new_subvol->name, new_subvol->graph->id)do { do { if (0) printf ("getting lockinfo failed while migrating locks" "(oldfd:%p newfd:%p inode-gfid:%s)" "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4210, GF_LOG_WARNING, "getting lockinfo failed while migrating locks" "(oldfd:%p newfd:%p inode-gfid:%s)" "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); |
4211 | goto out; |
4212 | } |
4213 | |
4214 | ret = dict_get_ptr (lockinfo, GF_XATTR_LOCKINFO_KEY"trusted.glusterfs.lockinfo", &ptr); |
4215 | if (ptr == NULL((void*)0)) { |
4216 | ret = 0; |
4217 | gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("No lockinfo present on any of the bricks " "(oldfd: %p newfd:%p inode-gfid:%s) " "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4223, GF_LOG_INFO, "No lockinfo present on any of the bricks " "(oldfd: %p newfd:%p inode-gfid:%s) " "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4218 | "No lockinfo present on any of the bricks "do { do { if (0) printf ("No lockinfo present on any of the bricks " "(oldfd: %p newfd:%p inode-gfid:%s) " "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4223, GF_LOG_INFO, "No lockinfo present on any of the bricks " "(oldfd: %p newfd:%p inode-gfid:%s) " "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4219 | "(oldfd: %p newfd:%p inode-gfid:%s) "do { do { if (0) printf ("No lockinfo present on any of the bricks " "(oldfd: %p newfd:%p inode-gfid:%s) " "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4223, GF_LOG_INFO, "No lockinfo present on any of the bricks " "(oldfd: %p newfd:%p inode-gfid:%s) " "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4220 | "(old-subvol:%s-%d new-subvol:%s-%d)",do { do { if (0) printf ("No lockinfo present on any of the bricks " "(oldfd: %p newfd:%p inode-gfid:%s) " "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4223, GF_LOG_INFO, "No lockinfo present on any of the bricks " "(oldfd: %p newfd:%p inode-gfid:%s) " "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4221 | oldfd, newfd, uuid_utoa (newfd->inode->gfid),do { do { if (0) printf ("No lockinfo present on any of the bricks " "(oldfd: %p newfd:%p inode-gfid:%s) " "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4223, GF_LOG_INFO, "No lockinfo present on any of the bricks " "(oldfd: %p newfd:%p inode-gfid:%s) " "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4222 | old_subvol->name, old_subvol->graph->id,do { do { if (0) printf ("No lockinfo present on any of the bricks " "(oldfd: %p newfd:%p inode-gfid:%s) " "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4223, GF_LOG_INFO, "No lockinfo present on any of the bricks " "(oldfd: %p newfd:%p inode-gfid:%s) " "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4223 | new_subvol->name, new_subvol->graph->id)do { do { if (0) printf ("No lockinfo present on any of the bricks " "(oldfd: %p newfd:%p inode-gfid:%s) " "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4223, GF_LOG_INFO, "No lockinfo present on any of the bricks " "(oldfd: %p newfd:%p inode-gfid:%s) " "(old-subvol:%s-%d new-subvol:%s-%d)" , oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); |
4224 | |
4225 | goto out; |
4226 | } |
4227 | |
4228 | ret = syncop_fsetxattr (new_subvol, newfd, lockinfo, 0); |
4229 | if (ret < 0) { |
4230 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("migrating locks failed (oldfd:%p newfd:%p " "inode-gfid:%s) (old-subvol:%s-%d new-subvol:%s-%d)", oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol-> name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4235, GF_LOG_WARNING, "migrating locks failed (oldfd:%p newfd:%p " "inode-gfid:%s) (old-subvol:%s-%d new-subvol:%s-%d)", oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol-> name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4231 | "migrating locks failed (oldfd:%p newfd:%p "do { do { if (0) printf ("migrating locks failed (oldfd:%p newfd:%p " "inode-gfid:%s) (old-subvol:%s-%d new-subvol:%s-%d)", oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol-> name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4235, GF_LOG_WARNING, "migrating locks failed (oldfd:%p newfd:%p " "inode-gfid:%s) (old-subvol:%s-%d new-subvol:%s-%d)", oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol-> name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4232 | "inode-gfid:%s) (old-subvol:%s-%d new-subvol:%s-%d)",do { do { if (0) printf ("migrating locks failed (oldfd:%p newfd:%p " "inode-gfid:%s) (old-subvol:%s-%d new-subvol:%s-%d)", oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol-> name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4235, GF_LOG_WARNING, "migrating locks failed (oldfd:%p newfd:%p " "inode-gfid:%s) (old-subvol:%s-%d new-subvol:%s-%d)", oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol-> name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4233 | oldfd, newfd, uuid_utoa (newfd->inode->gfid),do { do { if (0) printf ("migrating locks failed (oldfd:%p newfd:%p " "inode-gfid:%s) (old-subvol:%s-%d new-subvol:%s-%d)", oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol-> name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4235, GF_LOG_WARNING, "migrating locks failed (oldfd:%p newfd:%p " "inode-gfid:%s) (old-subvol:%s-%d new-subvol:%s-%d)", oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol-> name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4234 | old_subvol->name, old_subvol->graph->id,do { do { if (0) printf ("migrating locks failed (oldfd:%p newfd:%p " "inode-gfid:%s) (old-subvol:%s-%d new-subvol:%s-%d)", oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol-> name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4235, GF_LOG_WARNING, "migrating locks failed (oldfd:%p newfd:%p " "inode-gfid:%s) (old-subvol:%s-%d new-subvol:%s-%d)", oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol-> name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4235 | new_subvol->name, new_subvol->graph->id)do { do { if (0) printf ("migrating locks failed (oldfd:%p newfd:%p " "inode-gfid:%s) (old-subvol:%s-%d new-subvol:%s-%d)", oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol-> name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4235, GF_LOG_WARNING, "migrating locks failed (oldfd:%p newfd:%p " "inode-gfid:%s) (old-subvol:%s-%d new-subvol:%s-%d)", oldfd, newfd, uuid_utoa (newfd->inode->gfid), old_subvol-> name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); |
4236 | goto out; |
4237 | } |
4238 | |
4239 | out: |
4240 | if (newfd) |
4241 | fd_unref (newfd); |
4242 | |
4243 | if (lockinfo != NULL((void*)0)) { |
4244 | dict_unref (lockinfo); |
4245 | } |
4246 | |
4247 | return ret; |
4248 | } |
4249 | |
4250 | |
4251 | int |
4252 | fuse_migrate_fd (xlator_t *this, fd_t *basefd, xlator_t *old_subvol, |
4253 | xlator_t *new_subvol) |
4254 | { |
4255 | int ret = -1; |
4256 | char create_in_progress = 0; |
4257 | fuse_fd_ctx_t *basefd_ctx = NULL((void*)0); |
4258 | fd_t *oldfd = NULL((void*)0); |
4259 | |
4260 | basefd_ctx = fuse_fd_ctx_get (this, basefd); |
4261 | GF_VALIDATE_OR_GOTO ("glusterfs-fuse", basefd_ctx, out)do { if (!basefd_ctx) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "basefd_ctx"); } while ( 0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 4261, GF_LOG_ERROR, "invalid argument: " "basefd_ctx"); } while (0); goto out; } } while (0); |
4262 | |
4263 | LOCK (&basefd->lock)pthread_spin_lock (&basefd->lock); |
4264 | { |
4265 | oldfd = basefd_ctx->activefd ? basefd_ctx->activefd |
4266 | : basefd; |
4267 | fd_ref (oldfd); |
4268 | } |
4269 | UNLOCK (&basefd->lock)pthread_spin_unlock (&basefd->lock); |
4270 | |
4271 | LOCK (&oldfd->inode->lock)pthread_spin_lock (&oldfd->inode->lock); |
4272 | { |
4273 | if (uuid_is_null (oldfd->inode->gfid)) { |
4274 | create_in_progress = 1; |
4275 | } else { |
4276 | create_in_progress = 0; |
4277 | } |
4278 | } |
4279 | UNLOCK (&oldfd->inode->lock)pthread_spin_unlock (&oldfd->inode->lock); |
4280 | |
4281 | if (create_in_progress) { |
4282 | gf_log ("glusterfs-fuse", GF_LOG_INFO,do { do { if (0) printf ("create call on fd (%p) is in progress " "(basefd-ptr:%p basefd-inode.gfid:%s), " "hence deferring migration till application does an " "fd based operation on this fd" "(old-subvolume:%s-%d, new-subvolume:%s-%d)" , oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4290, GF_LOG_INFO, "create call on fd (%p) is in progress " "(basefd-ptr:%p basefd-inode.gfid:%s), " "hence deferring migration till application does an " "fd based operation on this fd" "(old-subvolume:%s-%d, new-subvolume:%s-%d)" , oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4283 | "create call on fd (%p) is in progress "do { do { if (0) printf ("create call on fd (%p) is in progress " "(basefd-ptr:%p basefd-inode.gfid:%s), " "hence deferring migration till application does an " "fd based operation on this fd" "(old-subvolume:%s-%d, new-subvolume:%s-%d)" , oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4290, GF_LOG_INFO, "create call on fd (%p) is in progress " "(basefd-ptr:%p basefd-inode.gfid:%s), " "hence deferring migration till application does an " "fd based operation on this fd" "(old-subvolume:%s-%d, new-subvolume:%s-%d)" , oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4284 | "(basefd-ptr:%p basefd-inode.gfid:%s), "do { do { if (0) printf ("create call on fd (%p) is in progress " "(basefd-ptr:%p basefd-inode.gfid:%s), " "hence deferring migration till application does an " "fd based operation on this fd" "(old-subvolume:%s-%d, new-subvolume:%s-%d)" , oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4290, GF_LOG_INFO, "create call on fd (%p) is in progress " "(basefd-ptr:%p basefd-inode.gfid:%s), " "hence deferring migration till application does an " "fd based operation on this fd" "(old-subvolume:%s-%d, new-subvolume:%s-%d)" , oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4285 | "hence deferring migration till application does an "do { do { if (0) printf ("create call on fd (%p) is in progress " "(basefd-ptr:%p basefd-inode.gfid:%s), " "hence deferring migration till application does an " "fd based operation on this fd" "(old-subvolume:%s-%d, new-subvolume:%s-%d)" , oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4290, GF_LOG_INFO, "create call on fd (%p) is in progress " "(basefd-ptr:%p basefd-inode.gfid:%s), " "hence deferring migration till application does an " "fd based operation on this fd" "(old-subvolume:%s-%d, new-subvolume:%s-%d)" , oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4286 | "fd based operation on this fd"do { do { if (0) printf ("create call on fd (%p) is in progress " "(basefd-ptr:%p basefd-inode.gfid:%s), " "hence deferring migration till application does an " "fd based operation on this fd" "(old-subvolume:%s-%d, new-subvolume:%s-%d)" , oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4290, GF_LOG_INFO, "create call on fd (%p) is in progress " "(basefd-ptr:%p basefd-inode.gfid:%s), " "hence deferring migration till application does an " "fd based operation on this fd" "(old-subvolume:%s-%d, new-subvolume:%s-%d)" , oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4287 | "(old-subvolume:%s-%d, new-subvolume:%s-%d)",do { do { if (0) printf ("create call on fd (%p) is in progress " "(basefd-ptr:%p basefd-inode.gfid:%s), " "hence deferring migration till application does an " "fd based operation on this fd" "(old-subvolume:%s-%d, new-subvolume:%s-%d)" , oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4290, GF_LOG_INFO, "create call on fd (%p) is in progress " "(basefd-ptr:%p basefd-inode.gfid:%s), " "hence deferring migration till application does an " "fd based operation on this fd" "(old-subvolume:%s-%d, new-subvolume:%s-%d)" , oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4288 | oldfd, basefd, uuid_utoa (basefd->inode->gfid),do { do { if (0) printf ("create call on fd (%p) is in progress " "(basefd-ptr:%p basefd-inode.gfid:%s), " "hence deferring migration till application does an " "fd based operation on this fd" "(old-subvolume:%s-%d, new-subvolume:%s-%d)" , oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4290, GF_LOG_INFO, "create call on fd (%p) is in progress " "(basefd-ptr:%p basefd-inode.gfid:%s), " "hence deferring migration till application does an " "fd based operation on this fd" "(old-subvolume:%s-%d, new-subvolume:%s-%d)" , oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4289 | old_subvol->name, old_subvol->graph->id,do { do { if (0) printf ("create call on fd (%p) is in progress " "(basefd-ptr:%p basefd-inode.gfid:%s), " "hence deferring migration till application does an " "fd based operation on this fd" "(old-subvolume:%s-%d, new-subvolume:%s-%d)" , oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4290, GF_LOG_INFO, "create call on fd (%p) is in progress " "(basefd-ptr:%p basefd-inode.gfid:%s), " "hence deferring migration till application does an " "fd based operation on this fd" "(old-subvolume:%s-%d, new-subvolume:%s-%d)" , oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4290 | new_subvol->name, new_subvol->graph->id)do { do { if (0) printf ("create call on fd (%p) is in progress " "(basefd-ptr:%p basefd-inode.gfid:%s), " "hence deferring migration till application does an " "fd based operation on this fd" "(old-subvolume:%s-%d, new-subvolume:%s-%d)" , oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 4290, GF_LOG_INFO, "create call on fd (%p) is in progress " "(basefd-ptr:%p basefd-inode.gfid:%s), " "hence deferring migration till application does an " "fd based operation on this fd" "(old-subvolume:%s-%d, new-subvolume:%s-%d)" , oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); |
4291 | |
4292 | ret = 0; |
4293 | goto out; |
4294 | } |
4295 | |
4296 | if (oldfd->inode->table->xl == old_subvol) { |
4297 | ret = syncop_fsync (old_subvol, oldfd, 0); |
4298 | if (ret < 0) { |
4299 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("syncop_fsync failed (%s) on fd (%p)" "(basefd:%p basefd-inode.gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , strerror ((*__errno_location ())), oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4306, GF_LOG_WARNING, "syncop_fsync failed (%s) on fd (%p)" "(basefd:%p basefd-inode.gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , strerror ((*__errno_location ())), oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4300 | "syncop_fsync failed (%s) on fd (%p)"do { do { if (0) printf ("syncop_fsync failed (%s) on fd (%p)" "(basefd:%p basefd-inode.gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , strerror ((*__errno_location ())), oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4306, GF_LOG_WARNING, "syncop_fsync failed (%s) on fd (%p)" "(basefd:%p basefd-inode.gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , strerror ((*__errno_location ())), oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4301 | "(basefd:%p basefd-inode.gfid:%s) "do { do { if (0) printf ("syncop_fsync failed (%s) on fd (%p)" "(basefd:%p basefd-inode.gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , strerror ((*__errno_location ())), oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4306, GF_LOG_WARNING, "syncop_fsync failed (%s) on fd (%p)" "(basefd:%p basefd-inode.gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , strerror ((*__errno_location ())), oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4302 | "(old-subvolume:%s-%d new-subvolume:%s-%d)",do { do { if (0) printf ("syncop_fsync failed (%s) on fd (%p)" "(basefd:%p basefd-inode.gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , strerror ((*__errno_location ())), oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4306, GF_LOG_WARNING, "syncop_fsync failed (%s) on fd (%p)" "(basefd:%p basefd-inode.gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , strerror ((*__errno_location ())), oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4303 | strerror (errno), oldfd, basefd,do { do { if (0) printf ("syncop_fsync failed (%s) on fd (%p)" "(basefd:%p basefd-inode.gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , strerror ((*__errno_location ())), oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4306, GF_LOG_WARNING, "syncop_fsync failed (%s) on fd (%p)" "(basefd:%p basefd-inode.gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , strerror ((*__errno_location ())), oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4304 | uuid_utoa (basefd->inode->gfid),do { do { if (0) printf ("syncop_fsync failed (%s) on fd (%p)" "(basefd:%p basefd-inode.gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , strerror ((*__errno_location ())), oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4306, GF_LOG_WARNING, "syncop_fsync failed (%s) on fd (%p)" "(basefd:%p basefd-inode.gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , strerror ((*__errno_location ())), oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4305 | old_subvol->name, old_subvol->graph->id,do { do { if (0) printf ("syncop_fsync failed (%s) on fd (%p)" "(basefd:%p basefd-inode.gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , strerror ((*__errno_location ())), oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4306, GF_LOG_WARNING, "syncop_fsync failed (%s) on fd (%p)" "(basefd:%p basefd-inode.gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , strerror ((*__errno_location ())), oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4306 | new_subvol->name, new_subvol->graph->id)do { do { if (0) printf ("syncop_fsync failed (%s) on fd (%p)" "(basefd:%p basefd-inode.gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , strerror ((*__errno_location ())), oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4306, GF_LOG_WARNING, "syncop_fsync failed (%s) on fd (%p)" "(basefd:%p basefd-inode.gfid:%s) " "(old-subvolume:%s-%d new-subvolume:%s-%d)" , strerror ((*__errno_location ())), oldfd, basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); |
4307 | } |
4308 | } else { |
4309 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("basefd (ptr:%p inode-gfid:%s) was not " "migrated during previous graph switch" "(old-subvolume:%s-%d new-subvolume: %s-%d)" , basefd, basefd->inode->gfid, old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4315, GF_LOG_WARNING, "basefd (ptr:%p inode-gfid:%s) was not " "migrated during previous graph switch" "(old-subvolume:%s-%d new-subvolume: %s-%d)" , basefd, basefd->inode->gfid, old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4310 | "basefd (ptr:%p inode-gfid:%s) was not "do { do { if (0) printf ("basefd (ptr:%p inode-gfid:%s) was not " "migrated during previous graph switch" "(old-subvolume:%s-%d new-subvolume: %s-%d)" , basefd, basefd->inode->gfid, old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4315, GF_LOG_WARNING, "basefd (ptr:%p inode-gfid:%s) was not " "migrated during previous graph switch" "(old-subvolume:%s-%d new-subvolume: %s-%d)" , basefd, basefd->inode->gfid, old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4311 | "migrated during previous graph switch"do { do { if (0) printf ("basefd (ptr:%p inode-gfid:%s) was not " "migrated during previous graph switch" "(old-subvolume:%s-%d new-subvolume: %s-%d)" , basefd, basefd->inode->gfid, old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4315, GF_LOG_WARNING, "basefd (ptr:%p inode-gfid:%s) was not " "migrated during previous graph switch" "(old-subvolume:%s-%d new-subvolume: %s-%d)" , basefd, basefd->inode->gfid, old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4312 | "(old-subvolume:%s-%d new-subvolume: %s-%d)", basefd,do { do { if (0) printf ("basefd (ptr:%p inode-gfid:%s) was not " "migrated during previous graph switch" "(old-subvolume:%s-%d new-subvolume: %s-%d)" , basefd, basefd->inode->gfid, old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4315, GF_LOG_WARNING, "basefd (ptr:%p inode-gfid:%s) was not " "migrated during previous graph switch" "(old-subvolume:%s-%d new-subvolume: %s-%d)" , basefd, basefd->inode->gfid, old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4313 | basefd->inode->gfid,do { do { if (0) printf ("basefd (ptr:%p inode-gfid:%s) was not " "migrated during previous graph switch" "(old-subvolume:%s-%d new-subvolume: %s-%d)" , basefd, basefd->inode->gfid, old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4315, GF_LOG_WARNING, "basefd (ptr:%p inode-gfid:%s) was not " "migrated during previous graph switch" "(old-subvolume:%s-%d new-subvolume: %s-%d)" , basefd, basefd->inode->gfid, old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4314 | old_subvol->name, old_subvol->graph->id,do { do { if (0) printf ("basefd (ptr:%p inode-gfid:%s) was not " "migrated during previous graph switch" "(old-subvolume:%s-%d new-subvolume: %s-%d)" , basefd, basefd->inode->gfid, old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4315, GF_LOG_WARNING, "basefd (ptr:%p inode-gfid:%s) was not " "migrated during previous graph switch" "(old-subvolume:%s-%d new-subvolume: %s-%d)" , basefd, basefd->inode->gfid, old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4315 | new_subvol->name, new_subvol->graph->id)do { do { if (0) printf ("basefd (ptr:%p inode-gfid:%s) was not " "migrated during previous graph switch" "(old-subvolume:%s-%d new-subvolume: %s-%d)" , basefd, basefd->inode->gfid, old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4315, GF_LOG_WARNING, "basefd (ptr:%p inode-gfid:%s) was not " "migrated during previous graph switch" "(old-subvolume:%s-%d new-subvolume: %s-%d)" , basefd, basefd->inode->gfid, old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); |
4316 | } |
4317 | |
4318 | ret = fuse_migrate_fd_open (this, basefd, oldfd, old_subvol, |
4319 | new_subvol); |
4320 | if (ret < 0) { |
4321 | gf_log (this->name, GF_LOG_WARNING, "open corresponding to "do { do { if (0) printf ("open corresponding to " "basefd (ptr:%p inode-gfid:%s) in new graph failed " "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__ , 4326, GF_LOG_WARNING, "open corresponding to " "basefd (ptr:%p inode-gfid:%s) in new graph failed " "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4322 | "basefd (ptr:%p inode-gfid:%s) in new graph failed "do { do { if (0) printf ("open corresponding to " "basefd (ptr:%p inode-gfid:%s) in new graph failed " "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__ , 4326, GF_LOG_WARNING, "open corresponding to " "basefd (ptr:%p inode-gfid:%s) in new graph failed " "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4323 | "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd,do { do { if (0) printf ("open corresponding to " "basefd (ptr:%p inode-gfid:%s) in new graph failed " "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__ , 4326, GF_LOG_WARNING, "open corresponding to " "basefd (ptr:%p inode-gfid:%s) in new graph failed " "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4324 | uuid_utoa (basefd->inode->gfid), old_subvol->name,do { do { if (0) printf ("open corresponding to " "basefd (ptr:%p inode-gfid:%s) in new graph failed " "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__ , 4326, GF_LOG_WARNING, "open corresponding to " "basefd (ptr:%p inode-gfid:%s) in new graph failed " "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4325 | old_subvol->graph->id, new_subvol->name,do { do { if (0) printf ("open corresponding to " "basefd (ptr:%p inode-gfid:%s) in new graph failed " "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__ , 4326, GF_LOG_WARNING, "open corresponding to " "basefd (ptr:%p inode-gfid:%s) in new graph failed " "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0) |
4326 | new_subvol->graph->id)do { do { if (0) printf ("open corresponding to " "basefd (ptr:%p inode-gfid:%s) in new graph failed " "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__ , 4326, GF_LOG_WARNING, "open corresponding to " "basefd (ptr:%p inode-gfid:%s) in new graph failed " "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, uuid_utoa (basefd->inode->gfid), old_subvol->name, old_subvol ->graph->id, new_subvol->name, new_subvol->graph-> id); } while (0); |
4327 | goto out; |
4328 | } |
4329 | |
4330 | ret = fuse_migrate_locks (this, basefd, oldfd, old_subvol, |
4331 | new_subvol); |
4332 | if (ret < 0) { |
4333 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("migrating locks from old-subvolume (%s-%d) to " "new-subvolume (%s-%d) failed (inode-gfid:%s oldfd:%p " "basefd:%p)" , old_subvol->name, old_subvol->graph->id, new_subvol ->name, new_subvol->graph->id, uuid_utoa (basefd-> inode->gfid), oldfd, basefd); } while (0); _gf_log (this-> name, "fuse-bridge.c", __FUNCTION__, 4338, GF_LOG_WARNING, "migrating locks from old-subvolume (%s-%d) to " "new-subvolume (%s-%d) failed (inode-gfid:%s oldfd:%p " "basefd:%p)" , old_subvol->name, old_subvol->graph->id, new_subvol ->name, new_subvol->graph->id, uuid_utoa (basefd-> inode->gfid), oldfd, basefd); } while (0) |
4334 | "migrating locks from old-subvolume (%s-%d) to "do { do { if (0) printf ("migrating locks from old-subvolume (%s-%d) to " "new-subvolume (%s-%d) failed (inode-gfid:%s oldfd:%p " "basefd:%p)" , old_subvol->name, old_subvol->graph->id, new_subvol ->name, new_subvol->graph->id, uuid_utoa (basefd-> inode->gfid), oldfd, basefd); } while (0); _gf_log (this-> name, "fuse-bridge.c", __FUNCTION__, 4338, GF_LOG_WARNING, "migrating locks from old-subvolume (%s-%d) to " "new-subvolume (%s-%d) failed (inode-gfid:%s oldfd:%p " "basefd:%p)" , old_subvol->name, old_subvol->graph->id, new_subvol ->name, new_subvol->graph->id, uuid_utoa (basefd-> inode->gfid), oldfd, basefd); } while (0) |
4335 | "new-subvolume (%s-%d) failed (inode-gfid:%s oldfd:%p "do { do { if (0) printf ("migrating locks from old-subvolume (%s-%d) to " "new-subvolume (%s-%d) failed (inode-gfid:%s oldfd:%p " "basefd:%p)" , old_subvol->name, old_subvol->graph->id, new_subvol ->name, new_subvol->graph->id, uuid_utoa (basefd-> inode->gfid), oldfd, basefd); } while (0); _gf_log (this-> name, "fuse-bridge.c", __FUNCTION__, 4338, GF_LOG_WARNING, "migrating locks from old-subvolume (%s-%d) to " "new-subvolume (%s-%d) failed (inode-gfid:%s oldfd:%p " "basefd:%p)" , old_subvol->name, old_subvol->graph->id, new_subvol ->name, new_subvol->graph->id, uuid_utoa (basefd-> inode->gfid), oldfd, basefd); } while (0) |
4336 | "basefd:%p)", old_subvol->name, old_subvol->graph->id,do { do { if (0) printf ("migrating locks from old-subvolume (%s-%d) to " "new-subvolume (%s-%d) failed (inode-gfid:%s oldfd:%p " "basefd:%p)" , old_subvol->name, old_subvol->graph->id, new_subvol ->name, new_subvol->graph->id, uuid_utoa (basefd-> inode->gfid), oldfd, basefd); } while (0); _gf_log (this-> name, "fuse-bridge.c", __FUNCTION__, 4338, GF_LOG_WARNING, "migrating locks from old-subvolume (%s-%d) to " "new-subvolume (%s-%d) failed (inode-gfid:%s oldfd:%p " "basefd:%p)" , old_subvol->name, old_subvol->graph->id, new_subvol ->name, new_subvol->graph->id, uuid_utoa (basefd-> inode->gfid), oldfd, basefd); } while (0) |
4337 | new_subvol->name, new_subvol->graph->id,do { do { if (0) printf ("migrating locks from old-subvolume (%s-%d) to " "new-subvolume (%s-%d) failed (inode-gfid:%s oldfd:%p " "basefd:%p)" , old_subvol->name, old_subvol->graph->id, new_subvol ->name, new_subvol->graph->id, uuid_utoa (basefd-> inode->gfid), oldfd, basefd); } while (0); _gf_log (this-> name, "fuse-bridge.c", __FUNCTION__, 4338, GF_LOG_WARNING, "migrating locks from old-subvolume (%s-%d) to " "new-subvolume (%s-%d) failed (inode-gfid:%s oldfd:%p " "basefd:%p)" , old_subvol->name, old_subvol->graph->id, new_subvol ->name, new_subvol->graph->id, uuid_utoa (basefd-> inode->gfid), oldfd, basefd); } while (0) |
4338 | uuid_utoa (basefd->inode->gfid), oldfd, basefd)do { do { if (0) printf ("migrating locks from old-subvolume (%s-%d) to " "new-subvolume (%s-%d) failed (inode-gfid:%s oldfd:%p " "basefd:%p)" , old_subvol->name, old_subvol->graph->id, new_subvol ->name, new_subvol->graph->id, uuid_utoa (basefd-> inode->gfid), oldfd, basefd); } while (0); _gf_log (this-> name, "fuse-bridge.c", __FUNCTION__, 4338, GF_LOG_WARNING, "migrating locks from old-subvolume (%s-%d) to " "new-subvolume (%s-%d) failed (inode-gfid:%s oldfd:%p " "basefd:%p)" , old_subvol->name, old_subvol->graph->id, new_subvol ->name, new_subvol->graph->id, uuid_utoa (basefd-> inode->gfid), oldfd, basefd); } while (0); |
4339 | |
4340 | } |
4341 | out: |
4342 | if (ret < 0) { |
4343 | gf_log (this->name, GF_LOG_WARNING, "migration of basefd "do { do { if (0) printf ("migration of basefd " "(ptr:%p inode-gfid:%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, oldfd ? uuid_utoa (oldfd->inode->gfid) : ((void*)0), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4348, GF_LOG_WARNING, "migration of basefd " "(ptr:%p inode-gfid:%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, oldfd ? uuid_utoa (oldfd->inode->gfid) : ((void*)0), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4344 | "(ptr:%p inode-gfid:%s) failed"do { do { if (0) printf ("migration of basefd " "(ptr:%p inode-gfid:%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, oldfd ? uuid_utoa (oldfd->inode->gfid) : ((void*)0), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4348, GF_LOG_WARNING, "migration of basefd " "(ptr:%p inode-gfid:%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, oldfd ? uuid_utoa (oldfd->inode->gfid) : ((void*)0), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4345 | "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd,do { do { if (0) printf ("migration of basefd " "(ptr:%p inode-gfid:%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, oldfd ? uuid_utoa (oldfd->inode->gfid) : ((void*)0), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4348, GF_LOG_WARNING, "migration of basefd " "(ptr:%p inode-gfid:%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, oldfd ? uuid_utoa (oldfd->inode->gfid) : ((void*)0), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4346 | oldfd ? uuid_utoa (oldfd->inode->gfid) : NULL,do { do { if (0) printf ("migration of basefd " "(ptr:%p inode-gfid:%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, oldfd ? uuid_utoa (oldfd->inode->gfid) : ((void*)0), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4348, GF_LOG_WARNING, "migration of basefd " "(ptr:%p inode-gfid:%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, oldfd ? uuid_utoa (oldfd->inode->gfid) : ((void*)0), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4347 | old_subvol->name, old_subvol->graph->id,do { do { if (0) printf ("migration of basefd " "(ptr:%p inode-gfid:%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, oldfd ? uuid_utoa (oldfd->inode->gfid) : ((void*)0), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4348, GF_LOG_WARNING, "migration of basefd " "(ptr:%p inode-gfid:%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, oldfd ? uuid_utoa (oldfd->inode->gfid) : ((void*)0), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0) |
4348 | new_subvol->name, new_subvol->graph->id)do { do { if (0) printf ("migration of basefd " "(ptr:%p inode-gfid:%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, oldfd ? uuid_utoa (oldfd->inode->gfid) : ((void*)0), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); _gf_log (this->name, "fuse-bridge.c" , __FUNCTION__, 4348, GF_LOG_WARNING, "migration of basefd " "(ptr:%p inode-gfid:%s) failed" "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, oldfd ? uuid_utoa (oldfd->inode->gfid) : ((void*)0), old_subvol ->name, old_subvol->graph->id, new_subvol->name, new_subvol ->graph->id); } while (0); |
4349 | } |
4350 | |
4351 | fd_unref (oldfd); |
4352 | |
4353 | return ret; |
4354 | } |
4355 | |
4356 | |
4357 | int |
4358 | fuse_handle_opened_fds (xlator_t *this, xlator_t *old_subvol, |
4359 | xlator_t *new_subvol) |
4360 | { |
4361 | fuse_private_t *priv = NULL((void*)0); |
4362 | fdentry_t *fdentries = NULL((void*)0); |
4363 | uint32_t count = 0; |
4364 | fdtable_t *fdtable = NULL((void*)0); |
4365 | int i = 0; |
4366 | fd_t *fd = NULL((void*)0); |
4367 | int32_t ret = 0; |
4368 | fuse_fd_ctx_t *fdctx = NULL((void*)0); |
4369 | |
4370 | priv = this->private; |
4371 | |
4372 | fdtable = priv->fdtable; |
4373 | |
4374 | fdentries = gf_fd_fdtable_copy_all_fds (fdtable, &count); |
4375 | if (fdentries != NULL((void*)0)) { |
4376 | for (i = 0; i < count; i++) { |
4377 | fd = fdentries[i].fd; |
4378 | if (fd == NULL((void*)0)) |
4379 | continue; |
4380 | |
4381 | ret = fuse_migrate_fd (this, fd, old_subvol, |
4382 | new_subvol); |
4383 | |
4384 | fdctx = fuse_fd_ctx_get (this, fd); |
4385 | if (fdctx) { |
4386 | LOCK (&fd->lock)pthread_spin_lock (&fd->lock); |
4387 | { |
4388 | if (ret < 0) { |
4389 | fdctx->migration_failed = 1; |
4390 | } else { |
4391 | fdctx->migration_failed = 0; |
4392 | } |
4393 | } |
4394 | UNLOCK (&fd->lock)pthread_spin_unlock (&fd->lock); |
4395 | } |
4396 | } |
4397 | |
4398 | for (i = 0; i < count ; i++) { |
4399 | fd = fdentries[i].fd; |
4400 | if (fd) |
4401 | fd_unref (fd); |
4402 | } |
4403 | |
4404 | GF_FREE (fdentries)__gf_free (fdentries); |
4405 | } |
4406 | |
4407 | return 0; |
4408 | } |
4409 | |
4410 | |
4411 | static int |
4412 | fuse_handle_blocked_locks (xlator_t *this, xlator_t *old_subvol, |
4413 | xlator_t *new_subvol) |
4414 | { |
4415 | return 0; |
4416 | } |
4417 | |
4418 | |
4419 | static int |
4420 | fuse_graph_switch_task (void *data) |
4421 | { |
4422 | fuse_graph_switch_args_t *args = NULL((void*)0); |
4423 | |
4424 | args = data; |
4425 | if (args == NULL((void*)0)) { |
4426 | goto out; |
4427 | } |
4428 | |
4429 | /* don't change the order of handling open fds and blocked locks, since |
4430 | * the act of opening files also reacquires granted locks in new graph. |
4431 | */ |
4432 | fuse_handle_opened_fds (args->this, args->old_subvol, args->new_subvol); |
4433 | |
4434 | fuse_handle_blocked_locks (args->this, args->old_subvol, |
4435 | args->new_subvol); |
4436 | |
4437 | out: |
4438 | return 0; |
4439 | } |
4440 | |
4441 | |
4442 | fuse_graph_switch_args_t * |
4443 | fuse_graph_switch_args_alloc (void) |
4444 | { |
4445 | fuse_graph_switch_args_t *args = NULL((void*)0); |
4446 | |
4447 | args = GF_CALLOC (1, sizeof (*args), gf_fuse_mt_graph_switch_args_t)__gf_calloc (1, sizeof (*args), gf_fuse_mt_graph_switch_args_t ); |
4448 | if (args == NULL((void*)0)) { |
4449 | goto out; |
4450 | } |
4451 | |
4452 | out: |
4453 | return args; |
4454 | } |
4455 | |
4456 | |
4457 | void |
4458 | fuse_graph_switch_args_destroy (fuse_graph_switch_args_t *args) |
4459 | { |
4460 | if (args == NULL((void*)0)) { |
4461 | goto out; |
4462 | } |
4463 | |
4464 | GF_FREE (args)__gf_free (args); |
4465 | out: |
4466 | return; |
4467 | } |
4468 | |
4469 | |
4470 | int |
4471 | fuse_handle_graph_switch (xlator_t *this, xlator_t *old_subvol, |
4472 | xlator_t *new_subvol) |
4473 | { |
4474 | call_frame_t *frame = NULL((void*)0); |
4475 | int32_t ret = -1; |
4476 | fuse_graph_switch_args_t *args = NULL((void*)0); |
4477 | |
4478 | frame = create_frame (this, this->ctx->pool); |
4479 | if (frame == NULL((void*)0)) { |
4480 | goto out; |
4481 | } |
4482 | |
4483 | args = fuse_graph_switch_args_alloc (); |
4484 | if (args == NULL((void*)0)) { |
4485 | goto out; |
4486 | } |
4487 | |
4488 | args->this = this; |
4489 | args->old_subvol = old_subvol; |
4490 | args->new_subvol = new_subvol; |
4491 | |
4492 | ret = synctask_new (this->ctx->env, fuse_graph_switch_task, NULL((void*)0), frame, |
4493 | args); |
4494 | if (ret == -1) { |
4495 | gf_log (this->name, GF_LOG_WARNING, "starting sync-task to "do { do { if (0) printf ("starting sync-task to " "handle graph switch failed" ); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__ , 4496, GF_LOG_WARNING, "starting sync-task to " "handle graph switch failed" ); } while (0) |
4496 | "handle graph switch failed")do { do { if (0) printf ("starting sync-task to " "handle graph switch failed" ); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__ , 4496, GF_LOG_WARNING, "starting sync-task to " "handle graph switch failed" ); } while (0); |
4497 | goto out; |
4498 | } |
4499 | |
4500 | ret = 0; |
4501 | out: |
4502 | if (args != NULL((void*)0)) { |
4503 | fuse_graph_switch_args_destroy (args); |
4504 | } |
4505 | |
4506 | if (frame != NULL((void*)0)) { |
4507 | STACK_DESTROY (frame->root); |
4508 | } |
4509 | |
4510 | return ret; |
4511 | } |
4512 | |
4513 | |
4514 | int |
4515 | fuse_graph_sync (xlator_t *this) |
4516 | { |
4517 | fuse_private_t *priv = NULL((void*)0); |
4518 | int need_first_lookup = 0; |
4519 | int ret = 0; |
4520 | xlator_t *old_subvol = NULL((void*)0), *new_subvol = NULL((void*)0); |
4521 | uint64_t winds_on_old_subvol = 0; |
4522 | |
4523 | priv = this->private; |
4524 | |
4525 | pthread_mutex_lock (&priv->sync_mutex); |
4526 | { |
4527 | if (!priv->next_graph) |
4528 | goto unlock; |
4529 | |
4530 | old_subvol = priv->active_subvol; |
4531 | new_subvol = priv->active_subvol = priv->next_graph->top; |
4532 | priv->next_graph = NULL((void*)0); |
4533 | need_first_lookup = 1; |
4534 | |
4535 | while (!priv->event_recvd) { |
4536 | ret = pthread_cond_wait (&priv->sync_cond, |
4537 | &priv->sync_mutex); |
4538 | if (ret != 0) { |
4539 | gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("timedwait returned non zero value " "ret: %d errno: %d", ret, (*__errno_location ())); } while ( 0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__, 4541 , GF_LOG_DEBUG, "timedwait returned non zero value " "ret: %d errno: %d" , ret, (*__errno_location ())); } while (0) |
4540 | "timedwait returned non zero value "do { do { if (0) printf ("timedwait returned non zero value " "ret: %d errno: %d", ret, (*__errno_location ())); } while ( 0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__, 4541 , GF_LOG_DEBUG, "timedwait returned non zero value " "ret: %d errno: %d" , ret, (*__errno_location ())); } while (0) |
4541 | "ret: %d errno: %d", ret, errno)do { do { if (0) printf ("timedwait returned non zero value " "ret: %d errno: %d", ret, (*__errno_location ())); } while ( 0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__, 4541 , GF_LOG_DEBUG, "timedwait returned non zero value " "ret: %d errno: %d" , ret, (*__errno_location ())); } while (0); |
4542 | break; |
4543 | } |
4544 | } |
4545 | } |
4546 | unlock: |
4547 | pthread_mutex_unlock (&priv->sync_mutex); |
4548 | |
4549 | if (need_first_lookup) { |
4550 | fuse_first_lookup (this); |
4551 | } |
4552 | |
4553 | if ((old_subvol != NULL((void*)0)) && (new_subvol != NULL((void*)0))) { |
4554 | fuse_handle_graph_switch (this, old_subvol, new_subvol); |
4555 | |
4556 | pthread_mutex_lock (&priv->sync_mutex); |
4557 | { |
4558 | old_subvol->switched = 1; |
4559 | winds_on_old_subvol = old_subvol->winds; |
4560 | } |
4561 | pthread_mutex_unlock (&priv->sync_mutex); |
4562 | |
4563 | if (winds_on_old_subvol == 0) { |
4564 | xlator_notify (old_subvol, GF_EVENT_PARENT_DOWN, |
4565 | old_subvol, NULL((void*)0)); |
4566 | } |
4567 | } |
4568 | |
4569 | return 0; |
4570 | } |
4571 | |
4572 | int |
4573 | fuse_get_mount_status (xlator_t *this) |
4574 | { |
4575 | int kid_status = -1; |
4576 | fuse_private_t *priv = this->private; |
4577 | |
4578 | if (read(priv->status_pipe[0],&kid_status, sizeof(kid_status)) < 0) { |
4579 | gf_log (this->name, GF_LOG_ERROR, "could not get mount status")do { do { if (0) printf ("could not get mount status"); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__, 4579 , GF_LOG_ERROR, "could not get mount status"); } while (0); |
4580 | kid_status = -1; |
4581 | } |
4582 | gf_log (this->name, GF_LOG_DEBUG, "mount status is %d", kid_status)do { do { if (0) printf ("mount status is %d", kid_status); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__ , 4582, GF_LOG_DEBUG, "mount status is %d", kid_status); } while (0); |
4583 | |
4584 | close(priv->status_pipe[0]); |
4585 | close(priv->status_pipe[1]); |
4586 | return kid_status; |
4587 | } |
4588 | |
4589 | static void * |
4590 | fuse_thread_proc (void *data) |
4591 | { |
4592 | char *mount_point = NULL((void*)0); |
4593 | xlator_t *this = NULL((void*)0); |
4594 | fuse_private_t *priv = NULL((void*)0); |
4595 | ssize_t res = 0; |
4596 | struct iobuf *iobuf = NULL((void*)0); |
4597 | fuse_in_header_t *finh; |
4598 | struct iovec iov_in[2]; |
4599 | void *msg = NULL((void*)0); |
4600 | const size_t msg0_size = sizeof (*finh) + 128; |
4601 | fuse_handler_t **fuse_ops = NULL((void*)0); |
4602 | struct pollfd pfd[2] = {{0,}}; |
4603 | gf_boolean_t mount_finished = _gf_false; |
4604 | |
4605 | this = data; |
4606 | priv = this->private; |
4607 | fuse_ops = priv->fuse_ops; |
4608 | |
4609 | THIS(*__glusterfs_this_location()) = this; |
4610 | |
4611 | iov_in[0].iov_len = sizeof (*finh) + sizeof (struct fuse_write_in); |
4612 | iov_in[1].iov_len = ((struct iobuf_pool *)this->ctx->iobuf_pool) |
4613 | ->default_page_size; |
4614 | priv->msg0_len_p = &iov_in[0].iov_len; |
4615 | |
4616 | for (;;) { |
4617 | /* THIS has to be reset here */ |
4618 | THIS(*__glusterfs_this_location()) = this; |
4619 | |
4620 | if (!mount_finished) { |
4621 | memset(pfd,0,sizeof(pfd)); |
4622 | pfd[0].fd = priv->status_pipe[0]; |
4623 | pfd[0].events = POLLIN0x001 | POLLHUP0x010 | POLLERR0x008; |
4624 | pfd[1].fd = priv->fd; |
4625 | pfd[1].events = POLLIN0x001 | POLLHUP0x010 | POLLERR0x008; |
4626 | if (poll(pfd,2,-1) < 0) { |
4627 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("poll error %s", strerror((*__errno_location ()))); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__, 4628, GF_LOG_ERROR, "poll error %s", strerror( (*__errno_location ()))); } while (0) |
4628 | "poll error %s", strerror(errno))do { do { if (0) printf ("poll error %s", strerror((*__errno_location ()))); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__, 4628, GF_LOG_ERROR, "poll error %s", strerror( (*__errno_location ()))); } while (0); |
4629 | break; |
4630 | } |
4631 | if (pfd[0].revents & POLLIN0x001) { |
4632 | if (fuse_get_mount_status(this) != 0) { |
4633 | break; |
4634 | } |
4635 | mount_finished = _gf_true; |
4636 | } |
4637 | else if (pfd[0].revents) { |
4638 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("mount pipe closed without status"); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__ , 4639, GF_LOG_ERROR, "mount pipe closed without status"); } while (0) |
4639 | "mount pipe closed without status")do { do { if (0) printf ("mount pipe closed without status"); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__ , 4639, GF_LOG_ERROR, "mount pipe closed without status"); } while (0); |
4640 | break; |
4641 | } |
4642 | if (!pfd[1].revents) { |
4643 | continue; |
4644 | } |
4645 | } |
4646 | |
4647 | /* |
4648 | * We don't want to block on readv while we're still waiting |
4649 | * for mount status. That means we only want to get here if |
4650 | * mount_status is true (meaning that our wait completed |
4651 | * already) or if we already called poll(2) on priv->fd to |
4652 | * make sure it's ready. |
4653 | */ |
4654 | |
4655 | if (priv->init_recvd) |
4656 | fuse_graph_sync (this); |
4657 | |
4658 | /* TODO: This place should always get maximum supported buffer |
4659 | size from 'fuse', which is as of today 128KB. If we bring in |
4660 | support for higher block sizes support, then we should be |
4661 | changing this one too */ |
4662 | iobuf = iobuf_get (this->ctx->iobuf_pool); |
4663 | |
4664 | /* Add extra 128 byte to the first iov so that it can |
4665 | * accommodate "ordinary" non-write requests. It's not |
4666 | * guaranteed to be big enough, as SETXATTR and namespace |
4667 | * operations with very long names may grow behind it, |
4668 | * but it's good enough in most cases (and we can handle |
4669 | * rest via realloc). |
4670 | */ |
4671 | iov_in[0].iov_base = GF_CALLOC (1, msg0_size,__gf_calloc (1, msg0_size, gf_fuse_mt_iov_base) |
4672 | gf_fuse_mt_iov_base)__gf_calloc (1, msg0_size, gf_fuse_mt_iov_base); |
4673 | |
4674 | if (!iobuf || !iov_in[0].iov_base) { |
4675 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Out of memory"); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__, 4676, GF_LOG_ERROR , "Out of memory"); } while (0) |
4676 | "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__, 4676, GF_LOG_ERROR , "Out of memory"); } while (0); |
4677 | if (iobuf) |
4678 | iobuf_unref (iobuf); |
4679 | GF_FREE (iov_in[0].iov_base)__gf_free (iov_in[0].iov_base); |
4680 | sleep (10); |
4681 | continue; |
4682 | } |
4683 | |
4684 | iov_in[1].iov_base = iobuf->ptr; |
4685 | |
4686 | res = readv (priv->fd, iov_in, 2); |
4687 | |
4688 | if (res == -1) { |
4689 | if (errno(*__errno_location ()) == ENODEV19 || errno(*__errno_location ()) == EBADF9) { |
4690 | gf_log ("glusterfs-fuse", GF_LOG_DEBUG,do { do { if (0) printf ("terminating upon getting %s when " "reading /dev/fuse" , (*__errno_location ()) == 19 ? "ENODEV" : "EBADF"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 4693, GF_LOG_DEBUG, "terminating upon getting %s when " "reading /dev/fuse" , (*__errno_location ()) == 19 ? "ENODEV" : "EBADF"); } while (0) |
4691 | "terminating upon getting %s when "do { do { if (0) printf ("terminating upon getting %s when " "reading /dev/fuse" , (*__errno_location ()) == 19 ? "ENODEV" : "EBADF"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 4693, GF_LOG_DEBUG, "terminating upon getting %s when " "reading /dev/fuse" , (*__errno_location ()) == 19 ? "ENODEV" : "EBADF"); } while (0) |
4692 | "reading /dev/fuse",do { do { if (0) printf ("terminating upon getting %s when " "reading /dev/fuse" , (*__errno_location ()) == 19 ? "ENODEV" : "EBADF"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 4693, GF_LOG_DEBUG, "terminating upon getting %s when " "reading /dev/fuse" , (*__errno_location ()) == 19 ? "ENODEV" : "EBADF"); } while (0) |
4693 | errno == ENODEV ? "ENODEV" : "EBADF")do { do { if (0) printf ("terminating upon getting %s when " "reading /dev/fuse" , (*__errno_location ()) == 19 ? "ENODEV" : "EBADF"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 4693, GF_LOG_DEBUG, "terminating upon getting %s when " "reading /dev/fuse" , (*__errno_location ()) == 19 ? "ENODEV" : "EBADF"); } while (0); |
4694 | fuse_log_eh (this, "glusterfs-fuse: terminating"do { if (this->history) do { do { if (0) printf ("glusterfs-fuse: terminating" " upon getting %s when " "reading /dev/fuse", (*__errno_location ()) == 19 ? "ENODEV": "EBADF"); } while (0); _gf_log_eh (__FUNCTION__ ,"glusterfs-fuse: terminating" " upon getting %s when " "reading /dev/fuse" , (*__errno_location ()) == 19 ? "ENODEV": "EBADF"); } while ( 0); } while (0) |
4695 | " upon getting %s when "do { if (this->history) do { do { if (0) printf ("glusterfs-fuse: terminating" " upon getting %s when " "reading /dev/fuse", (*__errno_location ()) == 19 ? "ENODEV": "EBADF"); } while (0); _gf_log_eh (__FUNCTION__ ,"glusterfs-fuse: terminating" " upon getting %s when " "reading /dev/fuse" , (*__errno_location ()) == 19 ? "ENODEV": "EBADF"); } while ( 0); } while (0) |
4696 | "reading /dev/fuse",do { if (this->history) do { do { if (0) printf ("glusterfs-fuse: terminating" " upon getting %s when " "reading /dev/fuse", (*__errno_location ()) == 19 ? "ENODEV": "EBADF"); } while (0); _gf_log_eh (__FUNCTION__ ,"glusterfs-fuse: terminating" " upon getting %s when " "reading /dev/fuse" , (*__errno_location ()) == 19 ? "ENODEV": "EBADF"); } while ( 0); } while (0) |
4697 | errno == ENODEV ? "ENODEV":do { if (this->history) do { do { if (0) printf ("glusterfs-fuse: terminating" " upon getting %s when " "reading /dev/fuse", (*__errno_location ()) == 19 ? "ENODEV": "EBADF"); } while (0); _gf_log_eh (__FUNCTION__ ,"glusterfs-fuse: terminating" " upon getting %s when " "reading /dev/fuse" , (*__errno_location ()) == 19 ? "ENODEV": "EBADF"); } while ( 0); } while (0) |
4698 | "EBADF")do { if (this->history) do { do { if (0) printf ("glusterfs-fuse: terminating" " upon getting %s when " "reading /dev/fuse", (*__errno_location ()) == 19 ? "ENODEV": "EBADF"); } while (0); _gf_log_eh (__FUNCTION__ ,"glusterfs-fuse: terminating" " upon getting %s when " "reading /dev/fuse" , (*__errno_location ()) == 19 ? "ENODEV": "EBADF"); } while ( 0); } while (0); |
4699 | break; |
4700 | } |
4701 | if (errno(*__errno_location ()) != EINTR4) { |
4702 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("read from /dev/fuse returned -1 (%s)" , strerror ((*__errno_location ()))); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 4704, GF_LOG_WARNING, "read from /dev/fuse returned -1 (%s)" , strerror ((*__errno_location ()))); } while (0) |
4703 | "read from /dev/fuse returned -1 (%s)",do { do { if (0) printf ("read from /dev/fuse returned -1 (%s)" , strerror ((*__errno_location ()))); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 4704, GF_LOG_WARNING, "read from /dev/fuse returned -1 (%s)" , strerror ((*__errno_location ()))); } while (0) |
4704 | strerror (errno))do { do { if (0) printf ("read from /dev/fuse returned -1 (%s)" , strerror ((*__errno_location ()))); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 4704, GF_LOG_WARNING, "read from /dev/fuse returned -1 (%s)" , strerror ((*__errno_location ()))); } while (0); |
4705 | fuse_log_eh (this, "glusterfs-fuse: read from "do { if (this->history) do { do { if (0) printf ("glusterfs-fuse: read from " "/dev/fuse returned -1 (%s)", strerror ((*__errno_location ( )))); } while (0); _gf_log_eh (__FUNCTION__,"glusterfs-fuse: read from " "/dev/fuse returned -1 (%s)", strerror ((*__errno_location ( )))); } while (0); } while (0) |
4706 | "/dev/fuse returned -1 (%s)",do { if (this->history) do { do { if (0) printf ("glusterfs-fuse: read from " "/dev/fuse returned -1 (%s)", strerror ((*__errno_location ( )))); } while (0); _gf_log_eh (__FUNCTION__,"glusterfs-fuse: read from " "/dev/fuse returned -1 (%s)", strerror ((*__errno_location ( )))); } while (0); } while (0) |
4707 | strerror (errno))do { if (this->history) do { do { if (0) printf ("glusterfs-fuse: read from " "/dev/fuse returned -1 (%s)", strerror ((*__errno_location ( )))); } while (0); _gf_log_eh (__FUNCTION__,"glusterfs-fuse: read from " "/dev/fuse returned -1 (%s)", strerror ((*__errno_location ( )))); } while (0); } while (0); |
4708 | } |
4709 | |
4710 | goto cont_err; |
4711 | } |
4712 | if (res < sizeof (finh)) { |
4713 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("short read on /dev/fuse"); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4714, GF_LOG_WARNING, "short read on /dev/fuse"); } while (0 ) |
4714 | "short read on /dev/fuse")do { do { if (0) printf ("short read on /dev/fuse"); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4714, GF_LOG_WARNING, "short read on /dev/fuse"); } while (0 ); |
4715 | fuse_log_eh (this, "glusterfs-fuse: short read on "do { if (this->history) do { do { if (0) printf ("glusterfs-fuse: short read on " "/dev/fuse"); } while (0); _gf_log_eh (__FUNCTION__,"glusterfs-fuse: short read on " "/dev/fuse"); } while (0); } while (0) |
4716 | "/dev/fuse")do { if (this->history) do { do { if (0) printf ("glusterfs-fuse: short read on " "/dev/fuse"); } while (0); _gf_log_eh (__FUNCTION__,"glusterfs-fuse: short read on " "/dev/fuse"); } while (0); } while (0); |
4717 | break; |
4718 | } |
4719 | |
4720 | finh = (fuse_in_header_t *)iov_in[0].iov_base; |
4721 | |
4722 | if (res != finh->len |
4723 | #ifdef GF_DARWIN_HOST_OS |
4724 | /* work around fuse4bsd/MacFUSE msg size miscalculation bug, |
4725 | * that is, payload size is not taken into account for |
4726 | * buffered writes |
4727 | */ |
4728 | && !(finh->opcode == FUSE_WRITE && |
4729 | finh->len == sizeof(*finh) + sizeof(struct fuse_write_in) && |
4730 | res == finh->len + ((struct fuse_write_in *)(finh + 1))->size) |
4731 | #endif |
4732 | ) { |
4733 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("inconsistent read on /dev/fuse"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 4734, GF_LOG_WARNING, "inconsistent read on /dev/fuse"); } while (0) |
4734 | "inconsistent read on /dev/fuse")do { do { if (0) printf ("inconsistent read on /dev/fuse"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 4734, GF_LOG_WARNING, "inconsistent read on /dev/fuse"); } while (0); |
4735 | fuse_log_eh (this, "glusterfs-fuse: inconsistent read "do { if (this->history) do { do { if (0) printf ("glusterfs-fuse: inconsistent read " "on /dev/fuse"); } while (0); _gf_log_eh (__FUNCTION__,"glusterfs-fuse: inconsistent read " "on /dev/fuse"); } while (0); } while (0) |
4736 | "on /dev/fuse")do { if (this->history) do { do { if (0) printf ("glusterfs-fuse: inconsistent read " "on /dev/fuse"); } while (0); _gf_log_eh (__FUNCTION__,"glusterfs-fuse: inconsistent read " "on /dev/fuse"); } while (0); } while (0); |
4737 | break; |
4738 | } |
4739 | |
4740 | priv->iobuf = iobuf; |
4741 | |
4742 | if (finh->opcode == FUSE_WRITE) |
4743 | msg = iov_in[1].iov_base; |
4744 | else { |
4745 | if (res > msg0_size) { |
4746 | void *b = GF_REALLOC (iov_in[0].iov_base, res)__gf_realloc (iov_in[0].iov_base, res); |
4747 | if (b) { |
4748 | iov_in[0].iov_base = b; |
4749 | finh = (fuse_in_header_t *) |
4750 | iov_in[0].iov_base; |
4751 | } |
4752 | else { |
4753 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("Out of memory"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4754, GF_LOG_ERROR , "Out of memory"); } while (0) |
4754 | "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4754, GF_LOG_ERROR , "Out of memory"); } while (0); |
4755 | send_fuse_err (this, finh, ENOMEM12); |
4756 | |
4757 | goto cont_err; |
4758 | } |
4759 | } |
4760 | |
4761 | if (res > iov_in[0].iov_len) |
4762 | memcpy (iov_in[0].iov_base + iov_in[0].iov_len, |
4763 | iov_in[1].iov_base, |
4764 | res - iov_in[0].iov_len); |
4765 | |
4766 | msg = finh + 1; |
4767 | } |
4768 | if (priv->uid_map_root && |
4769 | finh->uid == priv->uid_map_root) |
4770 | finh->uid = 0; |
4771 | |
4772 | if (finh->opcode >= FUSE_OP_HIGH(FUSE_READDIRPLUS + 1)) |
4773 | /* turn down MacFUSE specific messages */ |
4774 | fuse_enosys (this, finh, msg); |
4775 | else |
4776 | fuse_ops[finh->opcode] (this, finh, msg); |
4777 | |
4778 | iobuf_unref (iobuf); |
4779 | continue; |
4780 | |
4781 | cont_err: |
4782 | iobuf_unref (iobuf); |
4783 | GF_FREE (iov_in[0].iov_base)__gf_free (iov_in[0].iov_base); |
4784 | } |
4785 | |
4786 | /* |
4787 | * We could be in all sorts of states with respect to iobuf and iov_in |
4788 | * by the time we get here, and it's just not worth untangling them if |
4789 | * we're about to kill ourselves anyway. |
4790 | */ |
4791 | |
4792 | if (dict_get (this->options, ZR_MOUNTPOINT_OPT"mountpoint")) |
4793 | mount_point = data_to_str (dict_get (this->options, |
4794 | ZR_MOUNTPOINT_OPT"mountpoint")); |
4795 | if (mount_point) { |
4796 | gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("unmounting %s", mount_point); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__, 4797 , GF_LOG_INFO, "unmounting %s", mount_point); } while (0) |
4797 | "unmounting %s", mount_point)do { do { if (0) printf ("unmounting %s", mount_point); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__, 4797 , GF_LOG_INFO, "unmounting %s", mount_point); } while (0); |
4798 | } |
4799 | |
4800 | /* Kill the whole process, not just this thread. */ |
4801 | kill (getpid(), SIGTERM15); |
4802 | return NULL((void*)0); |
4803 | } |
4804 | |
4805 | |
4806 | int32_t |
4807 | fuse_itable_dump (xlator_t *this) |
4808 | { |
4809 | if (!this) |
4810 | return -1; |
4811 | |
4812 | gf_proc_dump_add_section("xlator.mount.fuse.itable"); |
4813 | inode_table_dump(this->itable, "xlator.mount.fuse.itable"); |
4814 | |
4815 | return 0; |
4816 | } |
4817 | |
4818 | int32_t |
4819 | fuse_priv_dump (xlator_t *this) |
4820 | { |
4821 | fuse_private_t *private = NULL((void*)0); |
4822 | |
4823 | if (!this) |
4824 | return -1; |
4825 | |
4826 | private = this->private; |
4827 | |
4828 | if (!private) |
4829 | return -1; |
4830 | |
4831 | gf_proc_dump_add_section("xlator.mount.fuse.priv"); |
4832 | |
4833 | gf_proc_dump_write("fd", "%d", private->fd); |
4834 | gf_proc_dump_write("proto_minor", "%u", |
4835 | private->proto_minor); |
4836 | gf_proc_dump_write("volfile", "%s", |
4837 | private->volfile?private->volfile:"None"); |
4838 | gf_proc_dump_write("volfile_size", "%d", |
4839 | private->volfile_size); |
4840 | gf_proc_dump_write("mount_point", "%s", |
4841 | private->mount_point); |
4842 | gf_proc_dump_write("iobuf", "%u", |
4843 | private->iobuf); |
4844 | gf_proc_dump_write("fuse_thread_started", "%d", |
4845 | (int)private->fuse_thread_started); |
4846 | gf_proc_dump_write("direct_io_mode", "%d", |
4847 | private->direct_io_mode); |
4848 | gf_proc_dump_write("entry_timeout", "%lf", |
4849 | private->entry_timeout); |
4850 | gf_proc_dump_write("attribute_timeout", "%lf", |
4851 | private->attribute_timeout); |
4852 | gf_proc_dump_write("init_recvd", "%d", |
4853 | (int)private->init_recvd); |
4854 | gf_proc_dump_write("strict_volfile_check", "%d", |
4855 | (int)private->strict_volfile_check); |
4856 | gf_proc_dump_write("reverse_thread_started", "%d", |
4857 | (int)private->reverse_fuse_thread_started); |
4858 | gf_proc_dump_write("use_readdirp", "%d", private->use_readdirp); |
4859 | |
4860 | return 0; |
4861 | } |
4862 | |
4863 | int |
4864 | fuse_history_dump (xlator_t *this) |
4865 | { |
4866 | int ret = -1; |
4867 | char key_prefix[GF_DUMP_MAX_BUF_LEN4096] = {0,}; |
4868 | |
4869 | GF_VALIDATE_OR_GOTO ("fuse", this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if ( 0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn ("fuse", "fuse-bridge.c", __FUNCTION__, 4869, GF_LOG_ERROR, "invalid argument: " "this"); } while (0); goto out; } } while (0); |
4870 | GF_VALIDATE_OR_GOTO (this->name, this->history, out)do { if (!this->history) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "this->history" ); } while (0); _gf_log_callingfn (this->name, "fuse-bridge.c" , __FUNCTION__, 4870, GF_LOG_ERROR, "invalid argument: " "this->history" ); } while (0); goto out; } } while (0); |
4871 | |
4872 | gf_proc_dump_build_key (key_prefix, "xlator.mount.fuse",{ _gf_proc_dump_build_key(key_prefix, "xlator.mount.fuse", "history" ); } |
4873 | "history"){ _gf_proc_dump_build_key(key_prefix, "xlator.mount.fuse", "history" ); }; |
4874 | gf_proc_dump_add_section (key_prefix); |
4875 | eh_dump (this->history, NULL((void*)0), dump_history_fuse); |
4876 | |
4877 | ret = 0; |
4878 | out: |
4879 | return ret; |
4880 | } |
4881 | |
4882 | int |
4883 | dump_history_fuse (circular_buffer_t *cb, void *data) |
4884 | { |
4885 | char *string = NULL((void*)0); |
4886 | struct tm *tm = NULL((void*)0); |
4887 | char timestr[256] = {0,}; |
4888 | |
4889 | string = (char *)cb->data; |
4890 | tm = localtime (&cb->tv.tv_sec); |
4891 | |
4892 | if (tm) { |
4893 | strftime (timestr, 256, "%Y-%m-%d %H:%M:%S", tm); |
4894 | snprintf (timestr + strlen (timestr), 256 - strlen (timestr), |
4895 | ".%"GF_PRI_SUSECONDS"06ld", cb->tv.tv_usec); |
4896 | gf_proc_dump_write ("TIME", "%s", timestr); |
4897 | } |
4898 | |
4899 | gf_proc_dump_write ("message", "%s\n", string); |
4900 | |
4901 | return 0; |
4902 | } |
4903 | |
4904 | int |
4905 | fuse_graph_setup (xlator_t *this, glusterfs_graph_t *graph) |
4906 | { |
4907 | inode_table_t *itable = NULL((void*)0); |
4908 | int ret = 0, winds = 0; |
4909 | fuse_private_t *priv = NULL((void*)0); |
4910 | glusterfs_graph_t *prev_graph = NULL((void*)0); |
4911 | |
4912 | priv = this->private; |
4913 | |
4914 | /* handle the case of more than one CHILD_UP on same graph */ |
4915 | if (priv->active_subvol == graph->top) |
4916 | return 0; /* This is a valid case */ |
4917 | |
4918 | if (graph->used) |
4919 | return 0; |
4920 | |
4921 | graph->used = 1; |
4922 | |
4923 | itable = inode_table_new (0, graph->top); |
4924 | if (!itable) |
4925 | return -1; |
4926 | |
4927 | ((xlator_t *)graph->top)->itable = itable; |
4928 | |
4929 | pthread_mutex_lock (&priv->sync_mutex); |
4930 | { |
4931 | prev_graph = priv->next_graph; |
4932 | |
4933 | if ((prev_graph != NULL((void*)0)) && (prev_graph->id > graph->id)) { |
4934 | /* there was a race and an old graph was initialised |
4935 | * before new one. |
4936 | */ |
4937 | prev_graph = graph; |
4938 | } else { |
4939 | priv->next_graph = graph; |
4940 | priv->event_recvd = 0; |
4941 | |
4942 | pthread_cond_signal (&priv->sync_cond); |
4943 | } |
4944 | |
4945 | if (prev_graph != NULL((void*)0)) |
4946 | winds = ((xlator_t *)prev_graph->top)->winds; |
4947 | } |
4948 | pthread_mutex_unlock (&priv->sync_mutex); |
4949 | |
4950 | if ((prev_graph != NULL((void*)0)) && (winds == 0)) { |
4951 | xlator_notify (prev_graph->top, GF_EVENT_PARENT_DOWN, |
4952 | prev_graph->top, NULL((void*)0)); |
4953 | } |
4954 | |
4955 | gf_log ("fuse", GF_LOG_INFO, "switched to graph %d",do { do { if (0) printf ("switched to graph %d", ((graph) ? graph ->id : 0)); } while (0); _gf_log ("fuse", "fuse-bridge.c", __FUNCTION__, 4956, GF_LOG_INFO, "switched to graph %d", ((graph ) ? graph->id : 0)); } while (0) |
4956 | ((graph) ? graph->id : 0))do { do { if (0) printf ("switched to graph %d", ((graph) ? graph ->id : 0)); } while (0); _gf_log ("fuse", "fuse-bridge.c", __FUNCTION__, 4956, GF_LOG_INFO, "switched to graph %d", ((graph ) ? graph->id : 0)); } while (0); |
4957 | |
4958 | return ret; |
4959 | } |
4960 | |
4961 | |
4962 | int |
4963 | notify (xlator_t *this, int32_t event, void *data, ...) |
4964 | { |
4965 | int32_t ret = 0; |
4966 | fuse_private_t *private = NULL((void*)0); |
4967 | glusterfs_graph_t *graph = NULL((void*)0); |
4968 | |
4969 | private = this->private; |
4970 | |
4971 | graph = data; |
4972 | |
4973 | gf_log ("fuse", GF_LOG_DEBUG, "got event %d on graph %d",do { do { if (0) printf ("got event %d on graph %d", event, ( (graph) ? graph->id : 0)); } while (0); _gf_log ("fuse", "fuse-bridge.c" , __FUNCTION__, 4974, GF_LOG_DEBUG, "got event %d on graph %d" , event, ((graph) ? graph->id : 0)); } while (0) |
4974 | event, ((graph) ? graph->id : 0))do { do { if (0) printf ("got event %d on graph %d", event, ( (graph) ? graph->id : 0)); } while (0); _gf_log ("fuse", "fuse-bridge.c" , __FUNCTION__, 4974, GF_LOG_DEBUG, "got event %d on graph %d" , event, ((graph) ? graph->id : 0)); } while (0); |
4975 | |
4976 | switch (event) |
4977 | { |
4978 | case GF_EVENT_GRAPH_NEW: |
4979 | break; |
4980 | |
4981 | case GF_EVENT_CHILD_UP: |
4982 | case GF_EVENT_CHILD_DOWN: |
4983 | case GF_EVENT_CHILD_CONNECTING: |
4984 | { |
4985 | if (graph) { |
4986 | ret = fuse_graph_setup (this, graph); |
4987 | if (ret) |
4988 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("failed to setup the graph"); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__, 4989 , GF_LOG_WARNING, "failed to setup the graph"); } while (0) |
4989 | "failed to setup the graph")do { do { if (0) printf ("failed to setup the graph"); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__, 4989 , GF_LOG_WARNING, "failed to setup the graph"); } while (0); |
4990 | } |
4991 | |
4992 | if ((event == GF_EVENT_CHILD_UP) |
4993 | || (event == GF_EVENT_CHILD_DOWN)) { |
4994 | pthread_mutex_lock (&private->sync_mutex); |
4995 | { |
4996 | private->event_recvd = 1; |
4997 | pthread_cond_broadcast (&private->sync_cond); |
4998 | } |
4999 | pthread_mutex_unlock (&private->sync_mutex); |
5000 | } |
5001 | |
5002 | if (!private->fuse_thread_started) { |
5003 | private->fuse_thread_started = 1; |
5004 | |
5005 | ret = gf_thread_create (&private->fuse_thread, NULL((void*)0), |
5006 | fuse_thread_proc, this); |
5007 | if (ret != 0) { |
5008 | gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("pthread_create() failed (%s)", strerror ((*__errno_location ()))); } while (0); _gf_log (this->name , "fuse-bridge.c", __FUNCTION__, 5010, GF_LOG_DEBUG, "pthread_create() failed (%s)" , strerror ((*__errno_location ()))); } while (0) |
5009 | "pthread_create() failed (%s)",do { do { if (0) printf ("pthread_create() failed (%s)", strerror ((*__errno_location ()))); } while (0); _gf_log (this->name , "fuse-bridge.c", __FUNCTION__, 5010, GF_LOG_DEBUG, "pthread_create() failed (%s)" , strerror ((*__errno_location ()))); } while (0) |
5010 | strerror (errno))do { do { if (0) printf ("pthread_create() failed (%s)", strerror ((*__errno_location ()))); } while (0); _gf_log (this->name , "fuse-bridge.c", __FUNCTION__, 5010, GF_LOG_DEBUG, "pthread_create() failed (%s)" , strerror ((*__errno_location ()))); } while (0); |
5011 | break; |
5012 | } |
5013 | } |
5014 | |
5015 | break; |
5016 | } |
5017 | |
5018 | case GF_EVENT_AUTH_FAILED: |
5019 | { |
5020 | /* Authentication failure is an error and glusterfs should stop */ |
5021 | gf_log (this->name, GF_LOG_ERROR, "Server authenication failed. Shutting down.")do { do { if (0) printf ("Server authenication failed. Shutting down." ); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__ , 5021, GF_LOG_ERROR, "Server authenication failed. Shutting down." ); } while (0); |
5022 | fini (this); |
5023 | break; |
5024 | } |
5025 | |
5026 | default: |
5027 | break; |
5028 | } |
5029 | |
5030 | return ret; |
5031 | } |
5032 | |
5033 | int32_t |
5034 | mem_acct_init (xlator_t *this) |
5035 | { |
5036 | int ret = -1; |
5037 | |
5038 | if (!this) |
5039 | return ret; |
5040 | |
5041 | ret = xlator_mem_acct_init (this, gf_fuse_mt_end + 1); |
5042 | |
5043 | if (ret != 0) { |
5044 | gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"do { do { if (0) printf ("Memory accounting init" "failed"); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__ , 5045, GF_LOG_ERROR, "Memory accounting init" "failed"); } while (0) |
5045 | "failed")do { do { if (0) printf ("Memory accounting init" "failed"); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__ , 5045, GF_LOG_ERROR, "Memory accounting init" "failed"); } while (0); |
5046 | return ret; |
5047 | } |
5048 | |
5049 | return ret; |
5050 | } |
5051 | |
5052 | |
5053 | static fuse_handler_t *fuse_std_ops[FUSE_OP_HIGH(FUSE_READDIRPLUS + 1)] = { |
5054 | [FUSE_LOOKUP] = fuse_lookup, |
5055 | [FUSE_FORGET] = fuse_forget, |
5056 | [FUSE_GETATTR] = fuse_getattr, |
5057 | [FUSE_SETATTR] = fuse_setattr, |
5058 | [FUSE_READLINK] = fuse_readlink, |
5059 | [FUSE_SYMLINK] = fuse_symlink, |
5060 | [FUSE_MKNOD] = fuse_mknod, |
5061 | [FUSE_MKDIR] = fuse_mkdir, |
5062 | [FUSE_UNLINK] = fuse_unlink, |
5063 | [FUSE_RMDIR] = fuse_rmdir, |
5064 | [FUSE_RENAME] = fuse_rename, |
5065 | [FUSE_LINK] = fuse_link, |
5066 | [FUSE_OPEN] = fuse_open, |
5067 | [FUSE_READ] = fuse_readv, |
5068 | [FUSE_WRITE] = fuse_write, |
5069 | [FUSE_STATFS] = fuse_statfs, |
5070 | [FUSE_RELEASE] = fuse_release, |
5071 | [FUSE_FSYNC] = fuse_fsync, |
5072 | [FUSE_SETXATTR] = fuse_setxattr, |
5073 | [FUSE_GETXATTR] = fuse_getxattr, |
5074 | [FUSE_LISTXATTR] = fuse_listxattr, |
5075 | [FUSE_REMOVEXATTR] = fuse_removexattr, |
5076 | [FUSE_FLUSH] = fuse_flush, |
5077 | [FUSE_INIT] = fuse_init, |
5078 | [FUSE_OPENDIR] = fuse_opendir, |
5079 | [FUSE_READDIR] = fuse_readdir, |
5080 | [FUSE_RELEASEDIR] = fuse_releasedir, |
5081 | [FUSE_FSYNCDIR] = fuse_fsyncdir, |
5082 | [FUSE_GETLK] = fuse_getlk, |
5083 | [FUSE_SETLK] = fuse_setlk, |
5084 | [FUSE_SETLKW] = fuse_setlk, |
5085 | [FUSE_ACCESS] = fuse_access, |
5086 | [FUSE_CREATE] = fuse_create, |
5087 | /* [FUSE_INTERRUPT] */ |
5088 | /* [FUSE_BMAP] */ |
5089 | [FUSE_DESTROY] = fuse_destroy, |
5090 | /* [FUSE_IOCTL] */ |
5091 | /* [FUSE_POLL] */ |
5092 | /* [FUSE_NOTIFY_REPLY] */ |
5093 | [FUSE_BATCH_FORGET]= fuse_batch_forget, |
5094 | #ifdef FALLOC_FL_KEEP_SIZE0x01 |
5095 | [FUSE_FALLOCATE] = fuse_fallocate, |
5096 | #endif /* FALLOC_FL_KEEP_SIZE */ |
5097 | [FUSE_READDIRPLUS] = fuse_readdirp, |
5098 | }; |
5099 | |
5100 | |
5101 | static fuse_handler_t *fuse_dump_ops[FUSE_OP_HIGH(FUSE_READDIRPLUS + 1)]; |
5102 | |
5103 | |
5104 | static void |
5105 | fuse_dumper (xlator_t *this, fuse_in_header_t *finh, void *msg) |
5106 | { |
5107 | fuse_private_t *priv = NULL((void*)0); |
5108 | struct iovec diov[3]; |
5109 | char r = 'R'; |
5110 | int ret = 0; |
5111 | |
5112 | priv = this->private; |
5113 | |
5114 | diov[0].iov_base = &r; |
5115 | diov[0].iov_len = 1; |
5116 | diov[1].iov_base = finh; |
5117 | diov[1].iov_len = sizeof (*finh); |
5118 | diov[2].iov_base = msg; |
5119 | diov[2].iov_len = finh->len - sizeof (*finh); |
5120 | |
5121 | pthread_mutex_lock (&priv->fuse_dump_mutex); |
5122 | ret = writev (priv->fuse_dump_fd, diov, 3); |
5123 | pthread_mutex_unlock (&priv->fuse_dump_mutex); |
5124 | if (ret == -1) |
5125 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("failed to dump fuse message (R): %s" , strerror ((*__errno_location ()))); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 5127, GF_LOG_ERROR, "failed to dump fuse message (R): %s" , strerror ((*__errno_location ()))); } while (0) |
5126 | "failed to dump fuse message (R): %s",do { do { if (0) printf ("failed to dump fuse message (R): %s" , strerror ((*__errno_location ()))); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 5127, GF_LOG_ERROR, "failed to dump fuse message (R): %s" , strerror ((*__errno_location ()))); } while (0) |
5127 | strerror (errno))do { do { if (0) printf ("failed to dump fuse message (R): %s" , strerror ((*__errno_location ()))); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 5127, GF_LOG_ERROR, "failed to dump fuse message (R): %s" , strerror ((*__errno_location ()))); } while (0); |
5128 | |
5129 | priv->fuse_ops0[finh->opcode] (this, finh, msg); |
5130 | } |
5131 | |
5132 | |
5133 | int |
5134 | init (xlator_t *this_xl) |
5135 | { |
5136 | int ret = 0; |
5137 | dict_t *options = NULL((void*)0); |
5138 | char *value_string = NULL((void*)0); |
5139 | cmd_args_t *cmd_args = NULL((void*)0); |
5140 | char *fsname = NULL((void*)0); |
5141 | fuse_private_t *priv = NULL((void*)0); |
5142 | struct stat stbuf = {0,}; |
5143 | int i = 0; |
5144 | int xl_name_allocated = 0; |
5145 | int fsname_allocated = 0; |
5146 | glusterfs_ctx_t *ctx = NULL((void*)0); |
5147 | gf_boolean_t sync_to_mount = _gf_false; |
5148 | gf_boolean_t fopen_keep_cache = _gf_false; |
5149 | unsigned long mntflags = 0; |
5150 | char *mnt_args = NULL((void*)0); |
5151 | eh_t *event = NULL((void*)0); |
5152 | |
5153 | if (this_xl == NULL((void*)0)) |
5154 | return -1; |
5155 | |
5156 | if (this_xl->options == NULL((void*)0)) |
5157 | return -1; |
5158 | |
5159 | ctx = this_xl->ctx; |
5160 | if (!ctx) |
5161 | return -1; |
5162 | |
5163 | options = this_xl->options; |
5164 | |
5165 | if (this_xl->name == NULL((void*)0)) { |
5166 | this_xl->name = gf_strdup ("fuse"); |
5167 | if (!this_xl->name) { |
5168 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("Out of memory"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 5169, GF_LOG_ERROR , "Out of memory"); } while (0) |
5169 | "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 5169, GF_LOG_ERROR , "Out of memory"); } while (0); |
5170 | |
5171 | goto cleanup_exit; |
5172 | } |
5173 | xl_name_allocated = 1; |
5174 | } |
5175 | |
5176 | priv = GF_CALLOC (1, sizeof (*priv), gf_fuse_mt_fuse_private_t)__gf_calloc (1, sizeof (*priv), gf_fuse_mt_fuse_private_t); |
5177 | if (!priv) { |
5178 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("Out of memory"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 5179, GF_LOG_ERROR , "Out of memory"); } while (0) |
5179 | "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 5179, GF_LOG_ERROR , "Out of memory"); } while (0); |
5180 | |
5181 | goto cleanup_exit; |
5182 | } |
5183 | this_xl->private = (void *) priv; |
5184 | priv->mount_point = NULL((void*)0); |
5185 | priv->fd = -1; |
5186 | priv->revchan_in = -1; |
5187 | priv->revchan_out = -1; |
5188 | |
5189 | /* get options from option dictionary */ |
5190 | ret = dict_get_str (options, ZR_MOUNTPOINT_OPT"mountpoint", &value_string); |
5191 | if (ret == -1 || value_string == NULL((void*)0)) { |
5192 | gf_log ("fuse", GF_LOG_ERROR,do { do { if (0) printf ("Mandatory option 'mountpoint' is not specified." ); } while (0); _gf_log ("fuse", "fuse-bridge.c", __FUNCTION__ , 5193, GF_LOG_ERROR, "Mandatory option 'mountpoint' is not specified." ); } while (0) |
5193 | "Mandatory option 'mountpoint' is not specified.")do { do { if (0) printf ("Mandatory option 'mountpoint' is not specified." ); } while (0); _gf_log ("fuse", "fuse-bridge.c", __FUNCTION__ , 5193, GF_LOG_ERROR, "Mandatory option 'mountpoint' is not specified." ); } while (0); |
5194 | goto cleanup_exit; |
5195 | } |
5196 | |
5197 | if (stat (value_string, &stbuf) != 0) { |
5198 | if (errno(*__errno_location ()) == ENOENT2) { |
5199 | gf_log (this_xl->name, GF_LOG_ERROR,do { do { if (0) printf ("%s %s does not exist", "mountpoint" , value_string); } while (0); _gf_log (this_xl->name, "fuse-bridge.c" , __FUNCTION__, 5201, GF_LOG_ERROR, "%s %s does not exist", "mountpoint" , value_string); } while (0) |
5200 | "%s %s does not exist",do { do { if (0) printf ("%s %s does not exist", "mountpoint" , value_string); } while (0); _gf_log (this_xl->name, "fuse-bridge.c" , __FUNCTION__, 5201, GF_LOG_ERROR, "%s %s does not exist", "mountpoint" , value_string); } while (0) |
5201 | ZR_MOUNTPOINT_OPT, value_string)do { do { if (0) printf ("%s %s does not exist", "mountpoint" , value_string); } while (0); _gf_log (this_xl->name, "fuse-bridge.c" , __FUNCTION__, 5201, GF_LOG_ERROR, "%s %s does not exist", "mountpoint" , value_string); } while (0); |
5202 | } else if (errno(*__errno_location ()) == ENOTCONN107) { |
5203 | gf_log (this_xl->name, GF_LOG_ERROR,do { do { if (0) printf ("Mountpoint %s seems to have a stale " "mount, run 'umount %s' and try again.", value_string, value_string ); } while (0); _gf_log (this_xl->name, "fuse-bridge.c", __FUNCTION__ , 5206, GF_LOG_ERROR, "Mountpoint %s seems to have a stale " "mount, run 'umount %s' and try again." , value_string, value_string); } while (0) |
5204 | "Mountpoint %s seems to have a stale "do { do { if (0) printf ("Mountpoint %s seems to have a stale " "mount, run 'umount %s' and try again.", value_string, value_string ); } while (0); _gf_log (this_xl->name, "fuse-bridge.c", __FUNCTION__ , 5206, GF_LOG_ERROR, "Mountpoint %s seems to have a stale " "mount, run 'umount %s' and try again." , value_string, value_string); } while (0) |
5205 | "mount, run 'umount %s' and try again.",do { do { if (0) printf ("Mountpoint %s seems to have a stale " "mount, run 'umount %s' and try again.", value_string, value_string ); } while (0); _gf_log (this_xl->name, "fuse-bridge.c", __FUNCTION__ , 5206, GF_LOG_ERROR, "Mountpoint %s seems to have a stale " "mount, run 'umount %s' and try again." , value_string, value_string); } while (0) |
5206 | value_string, value_string)do { do { if (0) printf ("Mountpoint %s seems to have a stale " "mount, run 'umount %s' and try again.", value_string, value_string ); } while (0); _gf_log (this_xl->name, "fuse-bridge.c", __FUNCTION__ , 5206, GF_LOG_ERROR, "Mountpoint %s seems to have a stale " "mount, run 'umount %s' and try again." , value_string, value_string); } while (0); |
5207 | } else { |
5208 | gf_log (this_xl->name, GF_LOG_DEBUG,do { do { if (0) printf ("%s %s : stat returned %s", "mountpoint" , value_string, strerror ((*__errno_location ()))); } while ( 0); _gf_log (this_xl->name, "fuse-bridge.c", __FUNCTION__, 5211, GF_LOG_DEBUG, "%s %s : stat returned %s", "mountpoint" , value_string, strerror ((*__errno_location ()))); } while ( 0) |
5209 | "%s %s : stat returned %s",do { do { if (0) printf ("%s %s : stat returned %s", "mountpoint" , value_string, strerror ((*__errno_location ()))); } while ( 0); _gf_log (this_xl->name, "fuse-bridge.c", __FUNCTION__, 5211, GF_LOG_DEBUG, "%s %s : stat returned %s", "mountpoint" , value_string, strerror ((*__errno_location ()))); } while ( 0) |
5210 | ZR_MOUNTPOINT_OPT,do { do { if (0) printf ("%s %s : stat returned %s", "mountpoint" , value_string, strerror ((*__errno_location ()))); } while ( 0); _gf_log (this_xl->name, "fuse-bridge.c", __FUNCTION__, 5211, GF_LOG_DEBUG, "%s %s : stat returned %s", "mountpoint" , value_string, strerror ((*__errno_location ()))); } while ( 0) |
5211 | value_string, strerror (errno))do { do { if (0) printf ("%s %s : stat returned %s", "mountpoint" , value_string, strerror ((*__errno_location ()))); } while ( 0); _gf_log (this_xl->name, "fuse-bridge.c", __FUNCTION__, 5211, GF_LOG_DEBUG, "%s %s : stat returned %s", "mountpoint" , value_string, strerror ((*__errno_location ()))); } while ( 0); |
5212 | } |
5213 | goto cleanup_exit; |
5214 | } |
5215 | |
5216 | if (S_ISDIR (stbuf.st_mode)((((stbuf.st_mode)) & 0170000) == (0040000)) == 0) { |
5217 | gf_log (this_xl->name, GF_LOG_ERROR,do { do { if (0) printf ("%s %s is not a directory", "mountpoint" , value_string); } while (0); _gf_log (this_xl->name, "fuse-bridge.c" , __FUNCTION__, 5219, GF_LOG_ERROR, "%s %s is not a directory" , "mountpoint", value_string); } while (0) |
5218 | "%s %s is not a directory",do { do { if (0) printf ("%s %s is not a directory", "mountpoint" , value_string); } while (0); _gf_log (this_xl->name, "fuse-bridge.c" , __FUNCTION__, 5219, GF_LOG_ERROR, "%s %s is not a directory" , "mountpoint", value_string); } while (0) |
5219 | ZR_MOUNTPOINT_OPT, value_string)do { do { if (0) printf ("%s %s is not a directory", "mountpoint" , value_string); } while (0); _gf_log (this_xl->name, "fuse-bridge.c" , __FUNCTION__, 5219, GF_LOG_ERROR, "%s %s is not a directory" , "mountpoint", value_string); } while (0); |
5220 | goto cleanup_exit; |
5221 | } |
5222 | priv->mount_point = gf_strdup (value_string); |
5223 | if (!priv->mount_point) { |
5224 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("Out of memory"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 5225, GF_LOG_ERROR , "Out of memory"); } while (0) |
5225 | "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 5225, GF_LOG_ERROR , "Out of memory"); } while (0); |
5226 | |
5227 | goto cleanup_exit; |
5228 | } |
5229 | |
5230 | GF_OPTION_INIT ("attribute-timeout", priv->attribute_timeout, double,do { int val_ret = 0; val_ret = xlator_option_init_double ((* __glusterfs_this_location()), (*__glusterfs_this_location())-> options, "attribute-timeout", &(priv->attribute_timeout )); if (val_ret) goto cleanup_exit; } while (0) |
5231 | cleanup_exit)do { int val_ret = 0; val_ret = xlator_option_init_double ((* __glusterfs_this_location()), (*__glusterfs_this_location())-> options, "attribute-timeout", &(priv->attribute_timeout )); if (val_ret) goto cleanup_exit; } while (0); |
5232 | |
5233 | GF_OPTION_INIT ("entry-timeout", priv->entry_timeout, double,do { int val_ret = 0; val_ret = xlator_option_init_double ((* __glusterfs_this_location()), (*__glusterfs_this_location())-> options, "entry-timeout", &(priv->entry_timeout)); if ( val_ret) goto cleanup_exit; } while (0) |
5234 | cleanup_exit)do { int val_ret = 0; val_ret = xlator_option_init_double ((* __glusterfs_this_location()), (*__glusterfs_this_location())-> options, "entry-timeout", &(priv->entry_timeout)); if ( val_ret) goto cleanup_exit; } while (0); |
5235 | |
5236 | GF_OPTION_INIT ("negative-timeout", priv->negative_timeout, double,do { int val_ret = 0; val_ret = xlator_option_init_double ((* __glusterfs_this_location()), (*__glusterfs_this_location())-> options, "negative-timeout", &(priv->negative_timeout) ); if (val_ret) goto cleanup_exit; } while (0) |
5237 | cleanup_exit)do { int val_ret = 0; val_ret = xlator_option_init_double ((* __glusterfs_this_location()), (*__glusterfs_this_location())-> options, "negative-timeout", &(priv->negative_timeout) ); if (val_ret) goto cleanup_exit; } while (0); |
5238 | |
5239 | GF_OPTION_INIT ("client-pid", priv->client_pid, int32, cleanup_exit)do { int val_ret = 0; val_ret = xlator_option_init_int32 ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "client-pid" , &(priv->client_pid)); if (val_ret) goto cleanup_exit ; } while (0); |
5240 | /* have to check & register the presence of client-pid manually */ |
5241 | priv->client_pid_set = !!dict_get (this_xl->options, "client-pid"); |
5242 | |
5243 | GF_OPTION_INIT ("uid-map-root", priv->uid_map_root, uint32,do { int val_ret = 0; val_ret = xlator_option_init_uint32 ((* __glusterfs_this_location()), (*__glusterfs_this_location())-> options, "uid-map-root", &(priv->uid_map_root)); if (val_ret ) goto cleanup_exit; } while (0) |
5244 | cleanup_exit)do { int val_ret = 0; val_ret = xlator_option_init_uint32 ((* __glusterfs_this_location()), (*__glusterfs_this_location())-> options, "uid-map-root", &(priv->uid_map_root)); if (val_ret ) goto cleanup_exit; } while (0); |
5245 | |
5246 | priv->direct_io_mode = 2; |
5247 | ret = dict_get_str (options, ZR_DIRECT_IO_OPT"direct-io-mode", &value_string); |
5248 | if (ret == 0) { |
5249 | ret = gf_string2boolean (value_string, &priv->direct_io_mode); |
5250 | GF_ASSERT (ret == 0)do { if (!(ret == 0)) { do { do { if (0) printf ("Assertion failed: " "ret == 0"); } while (0); _gf_log_callingfn ("", "fuse-bridge.c" , __FUNCTION__, 5250, GF_LOG_ERROR, "Assertion failed: " "ret == 0" ); } while (0); } } while (0); |
5251 | } |
5252 | |
5253 | GF_OPTION_INIT (ZR_STRICT_VOLFILE_CHECK, priv->strict_volfile_check,do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "strict-volfile-check" , &(priv->strict_volfile_check)); if (val_ret) goto cleanup_exit ; } while (0) |
5254 | bool, cleanup_exit)do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "strict-volfile-check" , &(priv->strict_volfile_check)); if (val_ret) goto cleanup_exit ; } while (0); |
5255 | |
5256 | GF_OPTION_INIT ("acl", priv->acl, bool, cleanup_exit)do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "acl", & (priv->acl)); if (val_ret) goto cleanup_exit; } while (0); |
5257 | |
5258 | if (priv->uid_map_root) |
5259 | priv->acl = 1; |
5260 | |
5261 | GF_OPTION_INIT ("selinux", priv->selinux, bool, cleanup_exit)do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "selinux", & (priv->selinux)); if (val_ret) goto cleanup_exit; } while ( 0); |
5262 | |
5263 | GF_OPTION_INIT ("read-only", priv->read_only, bool, cleanup_exit)do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "read-only", &(priv->read_only)); if (val_ret) goto cleanup_exit; } while (0); |
5264 | |
5265 | GF_OPTION_INIT ("enable-ino32", priv->enable_ino32, bool, cleanup_exit)do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "enable-ino32" , &(priv->enable_ino32)); if (val_ret) goto cleanup_exit ; } while (0); |
5266 | |
5267 | GF_OPTION_INIT ("use-readdirp", priv->use_readdirp, bool, cleanup_exit)do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "use-readdirp" , &(priv->use_readdirp)); if (val_ret) goto cleanup_exit ; } while (0); |
5268 | |
5269 | priv->fuse_dump_fd = -1; |
5270 | ret = dict_get_str (options, "dump-fuse", &value_string); |
5271 | if (ret == 0) { |
5272 | ret = unlink (value_string); |
5273 | if (ret != -1 || errno(*__errno_location ()) == ENOENT2) |
5274 | ret = open (value_string, O_RDWR02|O_CREAT0100|O_EXCL0200, |
5275 | S_IRUSR0400|S_IWUSR0200); |
5276 | if (ret == -1) { |
5277 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("cannot open fuse dump file %s", value_string ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 5279, GF_LOG_ERROR, "cannot open fuse dump file %s", value_string ); } while (0) |
5278 | "cannot open fuse dump file %s",do { do { if (0) printf ("cannot open fuse dump file %s", value_string ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 5279, GF_LOG_ERROR, "cannot open fuse dump file %s", value_string ); } while (0) |
5279 | value_string)do { do { if (0) printf ("cannot open fuse dump file %s", value_string ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 5279, GF_LOG_ERROR, "cannot open fuse dump file %s", value_string ); } while (0); |
5280 | |
5281 | goto cleanup_exit; |
5282 | } |
5283 | priv->fuse_dump_fd = ret; |
5284 | } |
5285 | |
5286 | sync_to_mount = _gf_false; |
5287 | ret = dict_get_str (options, "sync-to-mount", &value_string); |
5288 | if (ret == 0) { |
5289 | ret = gf_string2boolean (value_string, |
5290 | &sync_to_mount); |
5291 | GF_ASSERT (ret == 0)do { if (!(ret == 0)) { do { do { if (0) printf ("Assertion failed: " "ret == 0"); } while (0); _gf_log_callingfn ("", "fuse-bridge.c" , __FUNCTION__, 5291, GF_LOG_ERROR, "Assertion failed: " "ret == 0" ); } while (0); } } while (0); |
5292 | } |
5293 | |
5294 | priv->fopen_keep_cache = 2; |
5295 | if (dict_get (options, "fopen-keep-cache")) { |
5296 | GF_OPTION_INIT("fopen-keep-cache", fopen_keep_cache, bool,do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "fopen-keep-cache" , &(fopen_keep_cache)); if (val_ret) goto cleanup_exit; } while (0) |
5297 | cleanup_exit)do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "fopen-keep-cache" , &(fopen_keep_cache)); if (val_ret) goto cleanup_exit; } while (0); |
5298 | priv->fopen_keep_cache = fopen_keep_cache; |
5299 | } |
5300 | |
5301 | GF_OPTION_INIT("gid-timeout", priv->gid_cache_timeout, int32,do { int val_ret = 0; val_ret = xlator_option_init_int32 ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "gid-timeout" , &(priv->gid_cache_timeout)); if (val_ret) goto cleanup_exit ; } while (0) |
5302 | cleanup_exit)do { int val_ret = 0; val_ret = xlator_option_init_int32 ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "gid-timeout" , &(priv->gid_cache_timeout)); if (val_ret) goto cleanup_exit ; } while (0); |
5303 | |
5304 | GF_OPTION_INIT ("fuse-mountopts", priv->fuse_mountopts, str, cleanup_exit)do { int val_ret = 0; val_ret = xlator_option_init_str ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "fuse-mountopts" , &(priv->fuse_mountopts)); if (val_ret) goto cleanup_exit ; } while (0); |
5305 | |
5306 | if (gid_cache_init(&priv->gid_cache, priv->gid_cache_timeout) < 0) { |
5307 | gf_log("glusterfs-fuse", GF_LOG_ERROR, "Failed to initialize "do { do { if (0) printf ("Failed to initialize " "group cache." ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 5308, GF_LOG_ERROR, "Failed to initialize " "group cache.") ; } while (0) |
5308 | "group cache.")do { do { if (0) printf ("Failed to initialize " "group cache." ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 5308, GF_LOG_ERROR, "Failed to initialize " "group cache.") ; } while (0); |
5309 | goto cleanup_exit; |
5310 | } |
5311 | |
5312 | /* default values seemed to work fine during testing */ |
5313 | GF_OPTION_INIT ("background-qlen", priv->background_qlen, int32,do { int val_ret = 0; val_ret = xlator_option_init_int32 ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "background-qlen" , &(priv->background_qlen)); if (val_ret) goto cleanup_exit ; } while (0) |
5314 | cleanup_exit)do { int val_ret = 0; val_ret = xlator_option_init_int32 ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "background-qlen" , &(priv->background_qlen)); if (val_ret) goto cleanup_exit ; } while (0); |
5315 | GF_OPTION_INIT ("congestion-threshold", priv->congestion_threshold,do { int val_ret = 0; val_ret = xlator_option_init_int32 ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "congestion-threshold" , &(priv->congestion_threshold)); if (val_ret) goto cleanup_exit ; } while (0) |
5316 | int32, cleanup_exit)do { int val_ret = 0; val_ret = xlator_option_init_int32 ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "congestion-threshold" , &(priv->congestion_threshold)); if (val_ret) goto cleanup_exit ; } while (0); |
5317 | |
5318 | /* user has set only background-qlen, not congestion-threshold, |
5319 | use the fuse kernel driver formula to set congestion. ie, 75% */ |
5320 | if (dict_get (this_xl->options, "background-qlen") && |
5321 | !dict_get (this_xl->options, "congestion-threshold")) { |
5322 | priv->congestion_threshold = (priv->background_qlen * 3) / 4; |
5323 | gf_log (this_xl->name, GF_LOG_INFO,do { do { if (0) printf ("setting congestion control as 75%% of " "background-queue length (ie, (.75 * %d) = %d", priv->background_qlen , priv->congestion_threshold); } while (0); _gf_log (this_xl ->name, "fuse-bridge.c", __FUNCTION__, 5326, GF_LOG_INFO, "setting congestion control as 75%% of " "background-queue length (ie, (.75 * %d) = %d", priv->background_qlen , priv->congestion_threshold); } while (0) |
5324 | "setting congestion control as 75%% of "do { do { if (0) printf ("setting congestion control as 75%% of " "background-queue length (ie, (.75 * %d) = %d", priv->background_qlen , priv->congestion_threshold); } while (0); _gf_log (this_xl ->name, "fuse-bridge.c", __FUNCTION__, 5326, GF_LOG_INFO, "setting congestion control as 75%% of " "background-queue length (ie, (.75 * %d) = %d", priv->background_qlen , priv->congestion_threshold); } while (0) |
5325 | "background-queue length (ie, (.75 * %d) = %d",do { do { if (0) printf ("setting congestion control as 75%% of " "background-queue length (ie, (.75 * %d) = %d", priv->background_qlen , priv->congestion_threshold); } while (0); _gf_log (this_xl ->name, "fuse-bridge.c", __FUNCTION__, 5326, GF_LOG_INFO, "setting congestion control as 75%% of " "background-queue length (ie, (.75 * %d) = %d", priv->background_qlen , priv->congestion_threshold); } while (0) |
5326 | priv->background_qlen, priv->congestion_threshold)do { do { if (0) printf ("setting congestion control as 75%% of " "background-queue length (ie, (.75 * %d) = %d", priv->background_qlen , priv->congestion_threshold); } while (0); _gf_log (this_xl ->name, "fuse-bridge.c", __FUNCTION__, 5326, GF_LOG_INFO, "setting congestion control as 75%% of " "background-queue length (ie, (.75 * %d) = %d", priv->background_qlen , priv->congestion_threshold); } while (0); |
5327 | } |
5328 | |
5329 | /* congestion should not be higher than background queue length */ |
5330 | if (priv->congestion_threshold > priv->background_qlen) { |
5331 | gf_log (this_xl->name, GF_LOG_INFO,do { do { if (0) printf ("setting congestion control same as " "background-queue length (%d)", priv->background_qlen); } while (0); _gf_log (this_xl->name, "fuse-bridge.c", __FUNCTION__ , 5334, GF_LOG_INFO, "setting congestion control same as " "background-queue length (%d)" , priv->background_qlen); } while (0) |
5332 | "setting congestion control same as "do { do { if (0) printf ("setting congestion control same as " "background-queue length (%d)", priv->background_qlen); } while (0); _gf_log (this_xl->name, "fuse-bridge.c", __FUNCTION__ , 5334, GF_LOG_INFO, "setting congestion control same as " "background-queue length (%d)" , priv->background_qlen); } while (0) |
5333 | "background-queue length (%d)",do { do { if (0) printf ("setting congestion control same as " "background-queue length (%d)", priv->background_qlen); } while (0); _gf_log (this_xl->name, "fuse-bridge.c", __FUNCTION__ , 5334, GF_LOG_INFO, "setting congestion control same as " "background-queue length (%d)" , priv->background_qlen); } while (0) |
5334 | priv->background_qlen)do { do { if (0) printf ("setting congestion control same as " "background-queue length (%d)", priv->background_qlen); } while (0); _gf_log (this_xl->name, "fuse-bridge.c", __FUNCTION__ , 5334, GF_LOG_INFO, "setting congestion control same as " "background-queue length (%d)" , priv->background_qlen); } while (0); |
5335 | priv->congestion_threshold = priv->background_qlen; |
5336 | } |
5337 | |
5338 | cmd_args = &this_xl->ctx->cmd_args; |
5339 | fsname = cmd_args->volfile; |
5340 | if (!fsname && cmd_args->volfile_server) { |
5341 | if (cmd_args->volfile_id) { |
5342 | fsname = GF_MALLOC (__gf_malloc (strlen (cmd_args->volfile_server) + 1 + strlen (cmd_args->volfile_id) + 1, gf_fuse_mt_fuse_private_t) |
5343 | strlen (cmd_args->volfile_server) + 1 +__gf_malloc (strlen (cmd_args->volfile_server) + 1 + strlen (cmd_args->volfile_id) + 1, gf_fuse_mt_fuse_private_t) |
5344 | strlen (cmd_args->volfile_id) + 1,__gf_malloc (strlen (cmd_args->volfile_server) + 1 + strlen (cmd_args->volfile_id) + 1, gf_fuse_mt_fuse_private_t) |
5345 | gf_fuse_mt_fuse_private_t)__gf_malloc (strlen (cmd_args->volfile_server) + 1 + strlen (cmd_args->volfile_id) + 1, gf_fuse_mt_fuse_private_t); |
5346 | if (!fsname) { |
5347 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("Out of memory"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 5348, GF_LOG_ERROR , "Out of memory"); } while (0) |
5348 | "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 5348, GF_LOG_ERROR , "Out of memory"); } while (0); |
5349 | goto cleanup_exit; |
5350 | } |
5351 | fsname_allocated = 1; |
5352 | strcpy (fsname, cmd_args->volfile_server); |
5353 | strcat (fsname, ":"); |
5354 | strcat (fsname, cmd_args->volfile_id); |
5355 | } else |
5356 | fsname = cmd_args->volfile_server; |
5357 | } |
5358 | if (!fsname) |
5359 | fsname = "glusterfs"; |
5360 | |
5361 | priv->fdtable = gf_fd_fdtable_alloc (); |
5362 | if (priv->fdtable == NULL((void*)0)) { |
5363 | gf_log ("glusterfs-fuse", GF_LOG_ERROR, "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 5363, GF_LOG_ERROR , "Out of memory"); } while (0); |
5364 | goto cleanup_exit; |
5365 | } |
5366 | |
5367 | if (priv->read_only) |
5368 | mntflags |= MS_RDONLYMS_RDONLY; |
5369 | gf_asprintf (&mnt_args, "%s%s%sallow_other,max_read=131072", |
5370 | priv->acl ? "" : "default_permissions,", |
5371 | priv->fuse_mountopts ? priv->fuse_mountopts : "", |
5372 | priv->fuse_mountopts ? "," : ""); |
5373 | if (!mnt_args) |
5374 | goto cleanup_exit; |
5375 | |
5376 | if (pipe(priv->status_pipe) < 0) { |
5377 | gf_log (this_xl->name, GF_LOG_ERROR,do { do { if (0) printf ("could not create pipe to separate mount process" ); } while (0); _gf_log (this_xl->name, "fuse-bridge.c", __FUNCTION__ , 5378, GF_LOG_ERROR, "could not create pipe to separate mount process" ); } while (0) |
5378 | "could not create pipe to separate mount process")do { do { if (0) printf ("could not create pipe to separate mount process" ); } while (0); _gf_log (this_xl->name, "fuse-bridge.c", __FUNCTION__ , 5378, GF_LOG_ERROR, "could not create pipe to separate mount process" ); } while (0); |
5379 | goto cleanup_exit; |
5380 | } |
5381 | |
5382 | priv->fd = gf_fuse_mount (priv->mount_point, fsname, mntflags, mnt_args, |
5383 | sync_to_mount ? &ctx->mnt_pid : NULL((void*)0), |
5384 | priv->status_pipe[1]); |
5385 | if (priv->fd == -1) |
5386 | goto cleanup_exit; |
5387 | |
5388 | event = eh_new (FUSE_EVENT_HISTORY_SIZE1024, _gf_false, NULL((void*)0)); |
5389 | if (!event) { |
5390 | gf_log (this_xl->name, GF_LOG_ERROR,do { do { if (0) printf ("could not create a new event history" ); } while (0); _gf_log (this_xl->name, "fuse-bridge.c", __FUNCTION__ , 5391, GF_LOG_ERROR, "could not create a new event history") ; } while (0) |
5391 | "could not create a new event history")do { do { if (0) printf ("could not create a new event history" ); } while (0); _gf_log (this_xl->name, "fuse-bridge.c", __FUNCTION__ , 5391, GF_LOG_ERROR, "could not create a new event history") ; } while (0); |
5392 | goto cleanup_exit; |
5393 | } |
5394 | |
5395 | this_xl->history = event; |
5396 | |
5397 | pthread_mutex_init (&priv->fuse_dump_mutex, NULL((void*)0)); |
5398 | pthread_cond_init (&priv->sync_cond, NULL((void*)0)); |
5399 | pthread_mutex_init (&priv->sync_mutex, NULL((void*)0)); |
5400 | priv->event_recvd = 0; |
5401 | |
5402 | for (i = 0; i < FUSE_OP_HIGH(FUSE_READDIRPLUS + 1); i++) { |
5403 | if (!fuse_std_ops[i]) |
5404 | fuse_std_ops[i] = fuse_enosys; |
5405 | if (!fuse_dump_ops[i]) |
5406 | fuse_dump_ops[i] = fuse_dumper; |
5407 | } |
5408 | priv->fuse_ops = fuse_std_ops; |
5409 | if (priv->fuse_dump_fd != -1) { |
5410 | priv->fuse_ops0 = priv->fuse_ops; |
5411 | priv->fuse_ops = fuse_dump_ops; |
5412 | } |
5413 | |
5414 | if (fsname_allocated) |
5415 | GF_FREE (fsname)__gf_free (fsname); |
5416 | GF_FREE (mnt_args)__gf_free (mnt_args); |
5417 | return 0; |
5418 | |
5419 | cleanup_exit: |
5420 | if (xl_name_allocated) |
5421 | GF_FREE (this_xl->name)__gf_free (this_xl->name); |
5422 | if (fsname_allocated) |
5423 | GF_FREE (fsname)__gf_free (fsname); |
5424 | if (priv) { |
5425 | GF_FREE (priv->mount_point)__gf_free (priv->mount_point); |
5426 | if (priv->fd != -1) |
5427 | close (priv->fd); |
5428 | if (priv->fuse_dump_fd != -1) |
5429 | close (priv->fuse_dump_fd); |
5430 | GF_FREE (priv)__gf_free (priv); |
5431 | } |
5432 | GF_FREE (mnt_args)__gf_free (mnt_args); |
5433 | return -1; |
5434 | } |
5435 | |
5436 | |
5437 | void |
5438 | fini (xlator_t *this_xl) |
5439 | { |
5440 | fuse_private_t *priv = NULL((void*)0); |
5441 | char *mount_point = NULL((void*)0); |
5442 | |
5443 | if (this_xl == NULL((void*)0)) |
5444 | return; |
5445 | |
5446 | if ((priv = this_xl->private) == NULL((void*)0)) |
5447 | return; |
5448 | |
5449 | if (dict_get (this_xl->options, ZR_MOUNTPOINT_OPT"mountpoint")) |
5450 | mount_point = data_to_str (dict_get (this_xl->options, |
5451 | ZR_MOUNTPOINT_OPT"mountpoint")); |
5452 | if (mount_point != NULL((void*)0)) { |
5453 | gf_log (this_xl->name, GF_LOG_INFO,do { do { if (0) printf ("Unmounting '%s'.", mount_point); } while (0); _gf_log (this_xl->name, "fuse-bridge.c", __FUNCTION__ , 5454, GF_LOG_INFO, "Unmounting '%s'.", mount_point); } while (0) |
5454 | "Unmounting '%s'.", mount_point)do { do { if (0) printf ("Unmounting '%s'.", mount_point); } while (0); _gf_log (this_xl->name, "fuse-bridge.c", __FUNCTION__ , 5454, GF_LOG_INFO, "Unmounting '%s'.", mount_point); } while (0); |
5455 | |
5456 | gf_fuse_unmount (mount_point, priv->fd); |
5457 | close (priv->fuse_dump_fd); |
5458 | dict_del (this_xl->options, ZR_MOUNTPOINT_OPT"mountpoint"); |
5459 | } |
5460 | /* Process should terminate once fuse xlator is finished. |
5461 | * Required for AUTH_FAILED event. |
5462 | */ |
5463 | kill (getpid (), SIGTERM15); |
5464 | } |
5465 | |
5466 | struct xlator_fops fops; |
5467 | |
5468 | struct xlator_cbks cbks = { |
5469 | .invalidate = fuse_invalidate, |
5470 | .forget = fuse_forget_cbk, |
5471 | .release = fuse_internal_release |
5472 | }; |
5473 | |
5474 | |
5475 | struct xlator_dumpops dumpops = { |
5476 | .priv = fuse_priv_dump, |
5477 | .inode = fuse_itable_dump, |
5478 | .history = fuse_history_dump, |
5479 | }; |
5480 | |
5481 | struct volume_options options[] = { |
5482 | { .key = {"direct-io-mode"}, |
5483 | .type = GF_OPTION_TYPE_BOOL |
5484 | }, |
5485 | { .key = {ZR_MOUNTPOINT_OPT"mountpoint", "mount-point"}, |
5486 | .type = GF_OPTION_TYPE_PATH |
5487 | }, |
5488 | { .key = {ZR_DUMP_FUSE"dump-fuse", "fuse-dumpfile"}, |
5489 | .type = GF_OPTION_TYPE_PATH |
5490 | }, |
5491 | { .key = {ZR_ATTR_TIMEOUT_OPT"attribute-timeout"}, |
5492 | .type = GF_OPTION_TYPE_DOUBLE, |
5493 | .default_value = "1.0" |
5494 | }, |
5495 | { .key = {ZR_ENTRY_TIMEOUT_OPT"entry-timeout"}, |
5496 | .type = GF_OPTION_TYPE_DOUBLE, |
5497 | .default_value = "1.0" |
5498 | }, |
5499 | { .key = {ZR_NEGATIVE_TIMEOUT_OPT"negative-timeout"}, |
5500 | .type = GF_OPTION_TYPE_DOUBLE, |
5501 | .default_value = "0.0" |
5502 | }, |
5503 | { .key = {ZR_STRICT_VOLFILE_CHECK"strict-volfile-check"}, |
5504 | .type = GF_OPTION_TYPE_BOOL, |
5505 | .default_value = "false" |
5506 | }, |
5507 | { .key = {"client-pid"}, |
5508 | .type = GF_OPTION_TYPE_INT |
5509 | }, |
5510 | { .key = {"uid-map-root"}, |
5511 | .type = GF_OPTION_TYPE_INT |
5512 | }, |
5513 | { .key = {"sync-to-mount"}, |
5514 | .type = GF_OPTION_TYPE_BOOL |
5515 | }, |
5516 | { .key = {"read-only"}, |
5517 | .type = GF_OPTION_TYPE_BOOL |
5518 | }, |
5519 | { .key = {"fopen-keep-cache"}, |
5520 | .type = GF_OPTION_TYPE_BOOL, |
5521 | .default_value = "false" |
5522 | }, |
5523 | { .key = {"gid-timeout"}, |
5524 | .type = GF_OPTION_TYPE_INT, |
5525 | .default_value = "2" |
5526 | }, |
5527 | { .key = {"acl"}, |
5528 | .type = GF_OPTION_TYPE_BOOL, |
5529 | .default_value = "false" |
5530 | }, |
5531 | { .key = {"selinux"}, |
5532 | .type = GF_OPTION_TYPE_BOOL, |
5533 | .default_value = "false" |
5534 | }, |
5535 | { .key = {"enable-ino32"}, |
5536 | .type = GF_OPTION_TYPE_BOOL, |
5537 | .default_value = "false" |
5538 | }, |
5539 | { .key = {"background-qlen"}, |
5540 | .type = GF_OPTION_TYPE_INT, |
5541 | .default_value = "64", |
5542 | .min = 16, |
5543 | .max = (64 * GF_UNIT_KB1024ULL), |
5544 | }, |
5545 | { .key = {"congestion-threshold"}, |
5546 | .type = GF_OPTION_TYPE_INT, |
5547 | .default_value = "48", |
5548 | .min = 12, |
5549 | .max = (64 * GF_UNIT_KB1024ULL), |
5550 | }, |
5551 | { .key = {"fuse-mountopts"}, |
5552 | .type = GF_OPTION_TYPE_STR |
5553 | }, |
5554 | { .key = {"use-readdirp"}, |
5555 | .type = GF_OPTION_TYPE_BOOL, |
5556 | .default_value = "yes" |
5557 | }, |
5558 | { .key = {NULL((void*)0)} }, |
5559 | }; |