File: | xlators/mount/fuse/src/fuse-bridge.c |
Location: | line 4000, 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 | |
15 | #ifdef __NetBSD__ |
16 | #undef open /* in perfuse.h, pulled from mount-gluster-compat.h */ |
17 | #endif |
18 | |
19 | static int gf_fuse_conn_err_log; |
20 | static int gf_fuse_xattr_enotsup_log; |
21 | |
22 | void fini (xlator_t *this_xl); |
23 | |
24 | static void fuse_invalidate_inode(xlator_t *this, uint64_t fuse_ino); |
25 | |
26 | /* |
27 | * Send an invalidate notification up to fuse to purge the file from local |
28 | * page cache. |
29 | */ |
30 | static int32_t |
31 | fuse_invalidate(xlator_t *this, inode_t *inode) |
32 | { |
33 | fuse_private_t *priv = this->private; |
34 | uint64_t nodeid; |
35 | |
36 | /* |
37 | * NOTE: We only invalidate at the moment if fopen_keep_cache is |
38 | * enabled because otherwise this is a departure from default |
39 | * behavior. Specifically, the performance/write-behind xlator |
40 | * causes unconditional invalidations on write requests. |
41 | */ |
42 | if (!priv->fopen_keep_cache) |
43 | return 0; |
44 | |
45 | nodeid = inode_to_fuse_nodeid(inode); |
46 | 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__ , 46, GF_LOG_DEBUG, "Invalidate inode id %lu.", nodeid); } while (0); |
47 | 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) |
48 | 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); |
49 | fuse_invalidate_inode(this, nodeid); |
50 | |
51 | return 0; |
52 | } |
53 | |
54 | fuse_fd_ctx_t * |
55 | __fuse_fd_ctx_check_n_create (xlator_t *this, fd_t *fd) |
56 | { |
57 | uint64_t val = 0; |
58 | int32_t ret = 0; |
59 | fuse_fd_ctx_t *fd_ctx = NULL((void*)0); |
60 | |
61 | ret = __fd_ctx_get (fd, this, &val); |
62 | |
63 | fd_ctx = (fuse_fd_ctx_t *)(unsigned long) val; |
64 | |
65 | if (fd_ctx == NULL((void*)0)) { |
66 | fd_ctx = GF_CALLOC (1, sizeof (*fd_ctx),__gf_calloc (1, sizeof (*fd_ctx), gf_fuse_mt_fd_ctx_t) |
67 | gf_fuse_mt_fd_ctx_t)__gf_calloc (1, sizeof (*fd_ctx), gf_fuse_mt_fd_ctx_t); |
68 | if (!fd_ctx) { |
69 | goto out; |
70 | } |
71 | ret = __fd_ctx_set (fd, this, |
72 | (uint64_t)(unsigned long)fd_ctx); |
73 | if (ret < 0) { |
74 | 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__, 75, GF_LOG_DEBUG , "fd-ctx-set failed"); } while (0) |
75 | "fd-ctx-set failed")do { do { if (0) printf ("fd-ctx-set failed"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 75, GF_LOG_DEBUG , "fd-ctx-set failed"); } while (0); |
76 | GF_FREE (fd_ctx)__gf_free (fd_ctx); |
77 | fd_ctx = NULL((void*)0); |
78 | } |
79 | } |
80 | out: |
81 | return fd_ctx; |
82 | } |
83 | |
84 | fuse_fd_ctx_t * |
85 | fuse_fd_ctx_check_n_create (xlator_t *this, fd_t *fd) |
86 | { |
87 | fuse_fd_ctx_t *fd_ctx = NULL((void*)0); |
88 | |
89 | if ((fd == NULL((void*)0)) || (this == NULL((void*)0))) { |
90 | goto out; |
91 | } |
92 | |
93 | LOCK (&fd->lock)pthread_spin_lock (&fd->lock); |
94 | { |
95 | fd_ctx = __fuse_fd_ctx_check_n_create (this, fd); |
96 | } |
97 | UNLOCK (&fd->lock)pthread_spin_unlock (&fd->lock); |
98 | |
99 | out: |
100 | return fd_ctx; |
101 | } |
102 | |
103 | fuse_fd_ctx_t * |
104 | fuse_fd_ctx_get (xlator_t *this, fd_t *fd) |
105 | { |
106 | fuse_fd_ctx_t *fdctx = NULL((void*)0); |
107 | uint64_t value = 0; |
108 | int ret = 0; |
109 | |
110 | ret = fd_ctx_get (fd, this, &value); |
111 | if (ret < 0) { |
112 | goto out; |
113 | } |
114 | |
115 | fdctx = (fuse_fd_ctx_t *) (unsigned long)value; |
116 | |
117 | out: |
118 | return fdctx; |
119 | } |
120 | |
121 | /* |
122 | * iov_out should contain a fuse_out_header at zeroth position. |
123 | * The error value of this header is sent to kernel. |
124 | */ |
125 | static int |
126 | send_fuse_iov (xlator_t *this, fuse_in_header_t *finh, struct iovec *iov_out, |
127 | int count) |
128 | { |
129 | fuse_private_t *priv = NULL((void*)0); |
130 | struct fuse_out_header *fouh = NULL((void*)0); |
131 | int res, i; |
132 | |
133 | if (!this || !finh || !iov_out) { |
134 | 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__, 134, GF_LOG_ERROR ,"Invalid arguments"); } while (0); |
135 | return EINVAL22; |
136 | } |
137 | priv = this->private; |
138 | |
139 | fouh = iov_out[0].iov_base; |
140 | iov_out[0].iov_len = sizeof (*fouh); |
141 | fouh->len = 0; |
142 | for (i = 0; i < count; i++) |
143 | fouh->len += iov_out[i].iov_len; |
144 | fouh->unique = finh->unique; |
145 | |
146 | res = writev (priv->fd, iov_out, count); |
147 | |
148 | if (res == -1) |
149 | return errno(*__errno_location ()); |
150 | if (res != fouh->len) |
151 | return EINVAL22; |
152 | |
153 | if (priv->fuse_dump_fd != -1) { |
154 | char w = 'W'; |
155 | |
156 | pthread_mutex_lock (&priv->fuse_dump_mutex); |
157 | res = write (priv->fuse_dump_fd, &w, 1); |
158 | if (res != -1) |
159 | res = writev (priv->fuse_dump_fd, iov_out, count); |
160 | pthread_mutex_unlock (&priv->fuse_dump_mutex); |
161 | |
162 | if (res == -1) |
163 | 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__, 165, GF_LOG_ERROR, "failed to dump fuse message (W): %s" , strerror ((*__errno_location ()))); } while (0) |
164 | "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__, 165, GF_LOG_ERROR, "failed to dump fuse message (W): %s" , strerror ((*__errno_location ()))); } while (0) |
165 | 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__, 165, GF_LOG_ERROR, "failed to dump fuse message (W): %s" , strerror ((*__errno_location ()))); } while (0); |
166 | } |
167 | |
168 | return 0; |
169 | } |
170 | |
171 | static int |
172 | send_fuse_data (xlator_t *this, fuse_in_header_t *finh, void *data, size_t size) |
173 | { |
174 | struct fuse_out_header fouh = {0, }; |
175 | struct iovec iov_out[2]; |
176 | |
177 | fouh.error = 0; |
178 | iov_out[0].iov_base = &fouh; |
179 | iov_out[1].iov_base = data; |
180 | iov_out[1].iov_len = size; |
181 | |
182 | return send_fuse_iov (this, finh, iov_out, 2); |
183 | } |
184 | |
185 | #define send_fuse_obj(this, finh, obj)send_fuse_data (this, finh, obj, sizeof (*(obj))) \ |
186 | send_fuse_data (this, finh, obj, sizeof (*(obj))) |
187 | |
188 | |
189 | static void |
190 | fuse_invalidate_entry (xlator_t *this, uint64_t fuse_ino) |
191 | { |
192 | struct fuse_out_header *fouh = NULL((void*)0); |
193 | struct fuse_notify_inval_entry_out *fnieo = NULL((void*)0); |
194 | fuse_private_t *priv = NULL((void*)0); |
195 | dentry_t *dentry = NULL((void*)0); |
196 | inode_t *inode = NULL((void*)0); |
197 | size_t nlen = 0; |
198 | int rv = 0; |
199 | 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,}; |
200 | |
201 | fouh = (struct fuse_out_header *)inval_buf; |
202 | fnieo = (struct fuse_notify_inval_entry_out *)(fouh + 1); |
203 | |
204 | priv = this->private; |
205 | if (priv->revchan_out == -1) |
206 | return; |
207 | |
208 | fouh->unique = 0; |
209 | fouh->error = FUSE_NOTIFY_INVAL_ENTRY; |
210 | |
211 | inode = fuse_ino_to_inode (fuse_ino, this); |
212 | |
213 | 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 )))) { |
214 | nlen = strlen (dentry->name); |
215 | fouh->len = sizeof (*fouh) + sizeof (*fnieo) + nlen + 1; |
216 | fnieo->parent = inode_to_fuse_nodeid (dentry->parent); |
217 | |
218 | fnieo->namelen = nlen; |
219 | strcpy (inval_buf + sizeof (*fouh) + sizeof (*fnieo), dentry->name); |
220 | |
221 | rv = write (priv->revchan_out, inval_buf, fouh->len); |
222 | if (rv != fouh->len) { |
223 | 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__ , 224, GF_LOG_ERROR, "kernel notification daemon defunct"); } while (0) |
224 | "kernel notification daemon defunct")do { do { if (0) printf ("kernel notification daemon defunct" ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 224, GF_LOG_ERROR, "kernel notification daemon defunct"); } while (0); |
225 | |
226 | close (priv->fd); |
227 | break; |
228 | } |
229 | |
230 | gf_log ("glusterfs-fuse", GF_LOG_TRACE, "INVALIDATE entry: "do { do { if (0) printf ("INVALIDATE entry: " "%""ll" "u""/%s" , fnieo->parent, dentry->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 231, GF_LOG_TRACE, "INVALIDATE entry: " "%""ll" "u""/%s", fnieo->parent, dentry->name); } while (0) |
231 | "%"PRIu64"/%s", fnieo->parent, dentry->name)do { do { if (0) printf ("INVALIDATE entry: " "%""ll" "u""/%s" , fnieo->parent, dentry->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 231, GF_LOG_TRACE, "INVALIDATE entry: " "%""ll" "u""/%s", fnieo->parent, dentry->name); } while (0); |
232 | |
233 | if (dentry->parent) { |
234 | 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) |
235 | 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) |
236 | 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); |
237 | } else { |
238 | 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) |
239 | 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); |
240 | } |
241 | } |
242 | |
243 | if (inode) |
244 | inode_unref (inode); |
245 | } |
246 | |
247 | /* |
248 | * Send an inval inode notification to fuse. This causes an invalidation of the |
249 | * entire page cache mapping on the inode. |
250 | */ |
251 | static void |
252 | fuse_invalidate_inode(xlator_t *this, uint64_t fuse_ino) |
253 | { |
254 | struct fuse_out_header *fouh = NULL((void*)0); |
255 | struct fuse_notify_inval_inode_out *fniio = NULL((void*)0); |
256 | fuse_private_t *priv = NULL((void*)0); |
257 | int rv = 0; |
258 | 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}; |
259 | inode_t *inode = NULL((void*)0); |
260 | |
261 | fouh = (struct fuse_out_header *) inval_buf; |
262 | fniio = (struct fuse_notify_inval_inode_out *) (fouh + 1); |
263 | |
264 | priv = this->private; |
265 | |
266 | if (priv->revchan_out < 0) |
267 | return; |
268 | |
269 | fouh->unique = 0; |
270 | fouh->error = FUSE_NOTIFY_INVAL_INODE; |
271 | fouh->len = sizeof(struct fuse_out_header) + |
272 | sizeof(struct fuse_notify_inval_inode_out); |
273 | |
274 | /* inval the entire mapping until we learn how to be more granular */ |
275 | fniio->ino = fuse_ino; |
276 | fniio->off = 0; |
277 | fniio->len = -1; |
278 | |
279 | inode = fuse_ino_to_inode (fuse_ino, this); |
280 | |
281 | rv = write(priv->revchan_out, inval_buf, fouh->len); |
282 | if (rv != fouh->len) { |
283 | 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__ , 284, GF_LOG_ERROR, "kernel notification " "daemon defunct") ; } while (0) |
284 | "daemon defunct")do { do { if (0) printf ("kernel notification " "daemon defunct" ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 284, GF_LOG_ERROR, "kernel notification " "daemon defunct") ; } while (0); |
285 | close(priv->fd); |
286 | } |
287 | |
288 | 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__ , 288, GF_LOG_TRACE, "INVALIDATE inode: %lu", fuse_ino); } while (0); |
289 | |
290 | if (inode) { |
291 | 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) |
292 | 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); |
293 | } else { |
294 | 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); |
295 | } |
296 | |
297 | if (inode) |
298 | inode_unref (inode); |
299 | } |
300 | |
301 | int |
302 | send_fuse_err (xlator_t *this, fuse_in_header_t *finh, int error) |
303 | { |
304 | struct fuse_out_header fouh = {0, }; |
305 | struct iovec iov_out; |
306 | inode_t *inode = NULL((void*)0); |
307 | |
308 | fouh.error = -error; |
309 | iov_out.iov_base = &fouh; |
310 | |
311 | inode = fuse_ino_to_inode (finh->nodeid, this); |
312 | |
313 | // filter out ENOENT |
314 | if (error != ENOENT2) { |
315 | if (inode) { |
316 | 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) |
317 | "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) |
318 | 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); |
319 | } else { |
320 | 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) |
321 | "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) |
322 | 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); |
323 | } |
324 | } |
325 | |
326 | if (inode) |
327 | inode_unref (inode); |
328 | |
329 | return send_fuse_iov (this, finh, &iov_out, 1); |
330 | } |
331 | |
332 | static int |
333 | fuse_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
334 | int32_t op_ret, int32_t op_errno, |
335 | inode_t *inode, struct iatt *buf, dict_t *xdata) |
336 | { |
337 | fuse_state_t *state = NULL((void*)0); |
338 | fuse_in_header_t *finh = NULL((void*)0); |
339 | struct fuse_entry_out feo = {0, }; |
340 | fuse_private_t *priv = NULL((void*)0); |
341 | inode_t *linked_inode = NULL((void*)0); |
342 | |
343 | priv = this->private; |
344 | state = frame->root->state; |
345 | finh = state->finh; |
346 | |
347 | if (op_ret == 0) { |
348 | if (__is_root_gfid (state->loc.inode->gfid)) |
349 | buf->ia_ino = 1; |
350 | if (uuid_is_null (buf->ia_gfid)) { |
351 | /* With a NULL gfid inode linking is |
352 | not possible. Let's not pretend this |
353 | call was a "success". |
354 | */ |
355 | 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__, 357, GF_LOG_WARNING, "Received NULL gfid for %s. Forcing EIO" , state->loc.path); } while (0) |
356 | "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__, 357, GF_LOG_WARNING, "Received NULL gfid for %s. Forcing EIO" , state->loc.path); } while (0) |
357 | 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__, 357, GF_LOG_WARNING, "Received NULL gfid for %s. Forcing EIO" , state->loc.path); } while (0); |
358 | op_ret = -1; |
359 | op_errno = EIO5; |
360 | } |
361 | } |
362 | |
363 | /* log into the event-history after the null uuid check is done, since |
364 | * the op_ret and op_errno are being changed if the gfid is NULL. |
365 | */ |
366 | 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 " "%""ll" "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 " "%""ll" "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) |
367 | "%"PRIu64": %s() %s => %s", op_ret, op_errno,do { if (this->history) do { do { if (0) printf ("op_ret: %d op_errno: %d " "%""ll" "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 " "%""ll" "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) |
368 | frame->root->unique, gf_fop_list[frame->root->op],do { if (this->history) do { do { if (0) printf ("op_ret: %d op_errno: %d " "%""ll" "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 " "%""ll" "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) |
369 | state->loc.path, (op_ret == 0)?do { if (this->history) do { do { if (0) printf ("op_ret: %d op_errno: %d " "%""ll" "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 " "%""ll" "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) |
370 | 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 " "%""ll" "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 " "%""ll" "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); |
371 | |
372 | if (op_ret == 0) { |
373 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": %s() %s => %""ll" "d" , 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__, 376, GF_LOG_TRACE , "%""ll" "u"": %s() %s => %""ll" "d", frame->root-> unique, gf_fop_list[frame->root->op], state->loc.path , buf->ia_ino); } while (0) |
374 | "%"PRIu64": %s() %s => %"PRId64,do { do { if (0) printf ("%""ll" "u"": %s() %s => %""ll" "d" , 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__, 376, GF_LOG_TRACE , "%""ll" "u"": %s() %s => %""ll" "d", frame->root-> unique, gf_fop_list[frame->root->op], state->loc.path , buf->ia_ino); } while (0) |
375 | frame->root->unique, gf_fop_list[frame->root->op],do { do { if (0) printf ("%""ll" "u"": %s() %s => %""ll" "d" , 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__, 376, GF_LOG_TRACE , "%""ll" "u"": %s() %s => %""ll" "d", frame->root-> unique, gf_fop_list[frame->root->op], state->loc.path , buf->ia_ino); } while (0) |
376 | state->loc.path, buf->ia_ino)do { do { if (0) printf ("%""ll" "u"": %s() %s => %""ll" "d" , 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__, 376, GF_LOG_TRACE , "%""ll" "u"": %s() %s => %""ll" "d", frame->root-> unique, gf_fop_list[frame->root->op], state->loc.path , buf->ia_ino); } while (0); |
377 | |
378 | buf->ia_blksize = this->ctx->page_size; |
379 | gf_fuse_stat2attr (buf, &feo.attr, priv->enable_ino32); |
380 | |
381 | if (!buf->ia_ino) { |
382 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "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__, 385, GF_LOG_WARNING, "%""ll" "u"": %s() %s returning inode 0", frame->root->unique, gf_fop_list[frame->root->op], state->loc.path); } while (0) |
383 | "%"PRIu64": %s() %s returning inode 0",do { do { if (0) printf ("%""ll" "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__, 385, GF_LOG_WARNING, "%""ll" "u"": %s() %s returning inode 0", frame->root->unique, gf_fop_list[frame->root->op], state->loc.path); } while (0) |
384 | frame->root->unique,do { do { if (0) printf ("%""ll" "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__, 385, GF_LOG_WARNING, "%""ll" "u"": %s() %s returning inode 0", frame->root->unique, gf_fop_list[frame->root->op], state->loc.path); } while (0) |
385 | gf_fop_list[frame->root->op], state->loc.path)do { do { if (0) printf ("%""ll" "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__, 385, GF_LOG_WARNING, "%""ll" "u"": %s() %s returning inode 0", frame->root->unique, gf_fop_list[frame->root->op], state->loc.path); } while (0); |
386 | } |
387 | |
388 | linked_inode = inode_link (inode, state->loc.parent, |
389 | state->loc.name, buf); |
390 | |
391 | if (linked_inode != inode) { |
392 | } |
393 | |
394 | inode_lookup (linked_inode); |
395 | |
396 | feo.nodeid = inode_to_fuse_nodeid (linked_inode); |
397 | |
398 | inode_unref (linked_inode); |
399 | |
400 | feo.entry_valid = |
401 | calc_timeout_sec (priv->entry_timeout); |
402 | feo.entry_valid_nsec = |
403 | calc_timeout_nsec (priv->entry_timeout); |
404 | feo.attr_valid = |
405 | calc_timeout_sec (priv->attribute_timeout); |
406 | feo.attr_valid_nsec = |
407 | calc_timeout_nsec (priv->attribute_timeout); |
408 | |
409 | #if FUSE_KERNEL_MINOR_VERSION13 >= 9 |
410 | priv->proto_minor >= 9 ? |
411 | send_fuse_obj (this, finh, &feo)send_fuse_data (this, finh, &feo, sizeof (*(&feo))) : |
412 | send_fuse_data (this, finh, &feo, |
413 | FUSE_COMPAT_ENTRY_OUT_SIZE120); |
414 | #else |
415 | send_fuse_obj (this, finh, &feo)send_fuse_data (this, finh, &feo, sizeof (*(&feo))); |
416 | #endif |
417 | } else { |
418 | gf_log ("glusterfs-fuse",do { do { if (0) printf ("%""ll" "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__, 422, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0) |
419 | (op_errno == ENOENT ? GF_LOG_TRACE : GF_LOG_WARNING),do { do { if (0) printf ("%""ll" "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__, 422, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0) |
420 | "%"PRIu64": %s() %s => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""ll" "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__, 422, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0) |
421 | gf_fop_list[frame->root->op], state->loc.path,do { do { if (0) printf ("%""ll" "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__, 422, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0) |
422 | strerror (op_errno))do { do { if (0) printf ("%""ll" "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__, 422, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0); |
423 | |
424 | if ((op_errno == ENOENT2) && (priv->negative_timeout != 0)) { |
425 | feo.entry_valid = |
426 | calc_timeout_sec (priv->negative_timeout); |
427 | feo.entry_valid_nsec = |
428 | calc_timeout_nsec (priv->negative_timeout); |
429 | send_fuse_obj (this, finh, &feo)send_fuse_data (this, finh, &feo, sizeof (*(&feo))); |
430 | } else { |
431 | send_fuse_err (this, state->finh, op_errno); |
432 | } |
433 | } |
434 | |
435 | free_fuse_state (state); |
436 | STACK_DESTROY (frame->root); |
437 | return 0; |
438 | } |
439 | |
440 | static int |
441 | fuse_newentry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
442 | int32_t op_ret, int32_t op_errno, |
443 | inode_t *inode, struct iatt *buf, struct iatt *preparent, |
444 | struct iatt *postparent, dict_t *xdata) |
445 | { |
446 | fuse_entry_cbk (frame, cookie, this, op_ret, op_errno, inode, buf, |
447 | xdata); |
448 | return 0; |
449 | } |
450 | |
451 | static int |
452 | fuse_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
453 | int32_t op_ret, int32_t op_errno, |
454 | inode_t *inode, struct iatt *stat, dict_t *dict, |
455 | struct iatt *postparent) |
456 | { |
457 | fuse_state_t *state = NULL((void*)0); |
458 | call_frame_t *prev = NULL((void*)0); |
459 | inode_table_t *itable = NULL((void*)0); |
460 | |
461 | state = frame->root->state; |
462 | prev = cookie; |
463 | |
464 | if (op_ret == -1 && state->is_revalidate == 1) { |
465 | itable = state->itable; |
466 | inode_unref (state->loc.inode); |
467 | state->loc.inode = inode_new (itable); |
468 | state->is_revalidate = 2; |
469 | if (uuid_is_null (state->gfid)) |
470 | uuid_generate (state->gfid); |
471 | fuse_gfid_set (state); |
472 | |
473 | 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__, 475, 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) |
474 | 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__, 475, 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) |
475 | &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__, 475, 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); |
476 | return 0; |
477 | } |
478 | |
479 | fuse_entry_cbk (frame, cookie, this, op_ret, op_errno, inode, stat, |
480 | dict); |
481 | return 0; |
482 | } |
483 | |
484 | void |
485 | fuse_lookup_resume (fuse_state_t *state) |
486 | { |
487 | if (!state->loc.parent && !state->loc.inode) { |
488 | 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__ , 489, GF_LOG_ERROR, "failed to resolve path %s", state->loc .path); } while (0) |
489 | 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__ , 489, GF_LOG_ERROR, "failed to resolve path %s", state->loc .path); } while (0); |
490 | send_fuse_err (state->this, state->finh, ENOENT2); |
491 | free_fuse_state (state); |
492 | return; |
493 | } |
494 | |
495 | /* parent was resolved, entry could not, may be a missing gfid? |
496 | * Hence try to do a regular lookup |
497 | */ |
498 | if ((state->resolve.op_ret == -1) |
499 | && (state->resolve.op_errno == ENODATA61)) { |
500 | state->resolve.op_ret = 0; |
501 | } |
502 | |
503 | if (state->loc.inode) { |
504 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "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__, 506, GF_LOG_TRACE, "%""ll" "u"": LOOKUP %s(%s)" , state->finh->unique, state->loc.path, uuid_utoa (state ->loc.inode->gfid)); } while (0) |
505 | "%"PRIu64": LOOKUP %s(%s)", state->finh->unique,do { do { if (0) printf ("%""ll" "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__, 506, GF_LOG_TRACE, "%""ll" "u"": LOOKUP %s(%s)" , state->finh->unique, state->loc.path, uuid_utoa (state ->loc.inode->gfid)); } while (0) |
506 | state->loc.path, uuid_utoa (state->loc.inode->gfid))do { do { if (0) printf ("%""ll" "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__, 506, GF_LOG_TRACE, "%""ll" "u"": LOOKUP %s(%s)" , state->finh->unique, state->loc.path, uuid_utoa (state ->loc.inode->gfid)); } while (0); |
507 | state->is_revalidate = 1; |
508 | } else { |
509 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": LOOKUP %s", state-> finh->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 511, GF_LOG_TRACE, "%""ll" "u" ": LOOKUP %s", state->finh->unique, state->loc.path) ; } while (0) |
510 | "%"PRIu64": LOOKUP %s", state->finh->unique,do { do { if (0) printf ("%""ll" "u"": LOOKUP %s", state-> finh->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 511, GF_LOG_TRACE, "%""ll" "u" ": LOOKUP %s", state->finh->unique, state->loc.path) ; } while (0) |
511 | state->loc.path)do { do { if (0) printf ("%""ll" "u"": LOOKUP %s", state-> finh->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 511, GF_LOG_TRACE, "%""ll" "u" ": LOOKUP %s", state->finh->unique, state->loc.path) ; } while (0); |
512 | state->loc.inode = inode_new (state->loc.parent->table); |
513 | if (uuid_is_null (state->gfid)) |
514 | uuid_generate (state->gfid); |
515 | fuse_gfid_set (state); |
516 | } |
517 | |
518 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 519, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 519, GF_LOG_ERROR, "xl is NULL"); } while (0) ; op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_LOOKUP == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 519, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 519, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 519, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 519, 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) |
519 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 519, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 519, GF_LOG_ERROR, "xl is NULL"); } while (0) ; op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_LOOKUP == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 519, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 519, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 519, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 519, 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); |
520 | } |
521 | |
522 | static void |
523 | fuse_lookup (xlator_t *this, fuse_in_header_t *finh, void *msg) |
524 | { |
525 | char *name = msg; |
526 | fuse_state_t *state = NULL((void*)0); |
527 | |
528 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 528, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
529 | |
530 | (void) fuse_resolve_entry_init (state, &state->resolve, |
531 | finh->nodeid, name); |
532 | |
533 | fuse_resolve_and_resume (state, fuse_lookup_resume); |
534 | } |
535 | |
536 | static void |
537 | fuse_forget (xlator_t *this, fuse_in_header_t *finh, void *msg) |
538 | |
539 | { |
540 | struct fuse_forget_in *ffi = msg; |
541 | |
542 | inode_t *fuse_inode; |
543 | |
544 | if (finh->nodeid == 1) { |
545 | GF_FREE (finh)__gf_free (finh); |
546 | return; |
547 | } |
548 | |
549 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": FORGET %""ll" "u""/%""ll" "u", finh->unique, finh->nodeid, ffi->nlookup); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 551, GF_LOG_TRACE, "%""ll" "u"": FORGET %""ll" "u""/%""ll" "u" , finh->unique, finh->nodeid, ffi->nlookup); } while (0) |
550 | "%"PRIu64": FORGET %"PRIu64"/%"PRIu64,do { do { if (0) printf ("%""ll" "u"": FORGET %""ll" "u""/%""ll" "u", finh->unique, finh->nodeid, ffi->nlookup); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 551, GF_LOG_TRACE, "%""ll" "u"": FORGET %""ll" "u""/%""ll" "u" , finh->unique, finh->nodeid, ffi->nlookup); } while (0) |
551 | finh->unique, finh->nodeid, ffi->nlookup)do { do { if (0) printf ("%""ll" "u"": FORGET %""ll" "u""/%""ll" "u", finh->unique, finh->nodeid, ffi->nlookup); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 551, GF_LOG_TRACE, "%""ll" "u"": FORGET %""ll" "u""/%""ll" "u" , finh->unique, finh->nodeid, ffi->nlookup); } while (0); |
552 | |
553 | fuse_inode = fuse_ino_to_inode (finh->nodeid, this); |
554 | |
555 | fuse_log_eh (this, "%"PRIu64": FORGET %"PRIu64"/%"PRIu64" gfid: (%s)",do { if (this->history) do { do { if (0) printf ("%""ll" "u" ": FORGET %""ll" "u""/%""ll" "u"" gfid: (%s)", finh->unique , finh->nodeid, ffi->nlookup, uuid_utoa (fuse_inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""ll" "u"": FORGET %" "ll" "u""/%""ll" "u"" gfid: (%s)", finh->unique, finh-> nodeid, ffi->nlookup, uuid_utoa (fuse_inode->gfid)); } while (0); } while (0) |
556 | finh->unique, finh->nodeid, ffi->nlookup,do { if (this->history) do { do { if (0) printf ("%""ll" "u" ": FORGET %""ll" "u""/%""ll" "u"" gfid: (%s)", finh->unique , finh->nodeid, ffi->nlookup, uuid_utoa (fuse_inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""ll" "u"": FORGET %" "ll" "u""/%""ll" "u"" gfid: (%s)", finh->unique, finh-> nodeid, ffi->nlookup, uuid_utoa (fuse_inode->gfid)); } while (0); } while (0) |
557 | uuid_utoa (fuse_inode->gfid))do { if (this->history) do { do { if (0) printf ("%""ll" "u" ": FORGET %""ll" "u""/%""ll" "u"" gfid: (%s)", finh->unique , finh->nodeid, ffi->nlookup, uuid_utoa (fuse_inode-> gfid)); } while (0); _gf_log_eh (__FUNCTION__,"%""ll" "u"": FORGET %" "ll" "u""/%""ll" "u"" gfid: (%s)", finh->unique, finh-> nodeid, ffi->nlookup, uuid_utoa (fuse_inode->gfid)); } while (0); } while (0); |
558 | |
559 | inode_forget (fuse_inode, ffi->nlookup); |
560 | inode_unref (fuse_inode); |
561 | |
562 | GF_FREE (finh)__gf_free (finh); |
563 | } |
564 | |
565 | static int |
566 | fuse_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
567 | int32_t op_ret, int32_t op_errno, struct iatt *prebuf, |
568 | struct iatt *postbuf, dict_t *xdata) |
569 | { |
570 | fuse_state_t *state; |
571 | fuse_in_header_t *finh; |
572 | fuse_private_t *priv = NULL((void*)0); |
573 | struct fuse_attr_out fao; |
574 | |
575 | priv = this->private; |
576 | state = frame->root->state; |
577 | finh = state->finh; |
578 | |
579 | 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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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); |
580 | |
581 | if (op_ret == 0) { |
582 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": %s() %s => %""ll" "d" , 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__, 586, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %" "ll" "d", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", prebuf ->ia_ino); } while (0) |
583 | "%"PRIu64": %s() %s => %"PRId64, frame->root->unique,do { do { if (0) printf ("%""ll" "u"": %s() %s => %""ll" "d" , 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__, 586, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %" "ll" "d", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", prebuf ->ia_ino); } while (0) |
584 | gf_fop_list[frame->root->op],do { do { if (0) printf ("%""ll" "u"": %s() %s => %""ll" "d" , 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__, 586, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %" "ll" "d", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", prebuf ->ia_ino); } while (0) |
585 | state->loc.path ? state->loc.path : "ERR",do { do { if (0) printf ("%""ll" "u"": %s() %s => %""ll" "d" , 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__, 586, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %" "ll" "d", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", prebuf ->ia_ino); } while (0) |
586 | prebuf->ia_ino)do { do { if (0) printf ("%""ll" "u"": %s() %s => %""ll" "d" , 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__, 586, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %" "ll" "d", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", prebuf ->ia_ino); } while (0); |
587 | |
588 | postbuf->ia_blksize = this->ctx->page_size; |
589 | gf_fuse_stat2attr (postbuf, &fao.attr, priv->enable_ino32); |
590 | |
591 | fao.attr_valid = calc_timeout_sec (priv->attribute_timeout); |
592 | fao.attr_valid_nsec = |
593 | calc_timeout_nsec (priv->attribute_timeout); |
594 | |
595 | #if FUSE_KERNEL_MINOR_VERSION13 >= 9 |
596 | priv->proto_minor >= 9 ? |
597 | send_fuse_obj (this, finh, &fao)send_fuse_data (this, finh, &fao, sizeof (*(&fao))) : |
598 | send_fuse_data (this, finh, &fao, |
599 | FUSE_COMPAT_ATTR_OUT_SIZE96); |
600 | #else |
601 | send_fuse_obj (this, finh, &fao)send_fuse_data (this, finh, &fao, sizeof (*(&fao))); |
602 | #endif |
603 | } else { |
604 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "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__, 608, GF_LOG_WARNING, "%""ll" "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) |
605 | "%"PRIu64": %s() %s => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""ll" "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__, 608, GF_LOG_WARNING, "%""ll" "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) |
606 | gf_fop_list[frame->root->op],do { do { if (0) printf ("%""ll" "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__, 608, GF_LOG_WARNING, "%""ll" "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) |
607 | state->loc.path ? state->loc.path : "ERR",do { do { if (0) printf ("%""ll" "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__, 608, GF_LOG_WARNING, "%""ll" "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) |
608 | strerror (op_errno))do { do { if (0) printf ("%""ll" "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__, 608, GF_LOG_WARNING, "%""ll" "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); |
609 | |
610 | send_fuse_err (this, finh, op_errno); |
611 | } |
612 | |
613 | free_fuse_state (state); |
614 | STACK_DESTROY (frame->root); |
615 | |
616 | return 0; |
617 | } |
618 | |
619 | static int |
620 | fuse_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
621 | int32_t op_ret, int32_t op_errno, struct iatt *buf, dict_t *xdata) |
622 | { |
623 | fuse_state_t *state; |
624 | fuse_in_header_t *finh; |
625 | fuse_private_t *priv = NULL((void*)0); |
626 | struct fuse_attr_out fao; |
627 | |
628 | priv = this->private; |
629 | state = frame->root->state; |
630 | finh = state->finh; |
631 | |
632 | 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, %" "ll" "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, %""ll" "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) |
633 | "gfid: %s", op_ret, op_errno, frame->root->unique,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "ll" "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, %""ll" "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) |
634 | gf_fop_list[frame->root->op], state->loc.path,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "ll" "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, %""ll" "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) |
635 | state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : "")do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "ll" "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, %""ll" "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); |
636 | if (op_ret == 0) { |
637 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": %s() %s => %""ll" "d" , 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__ , 641, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %""ll" "d", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path ? state->loc.path : "ERR", buf->ia_ino); } while (0) |
638 | "%"PRIu64": %s() %s => %"PRId64, frame->root->unique,do { do { if (0) printf ("%""ll" "u"": %s() %s => %""ll" "d" , 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__ , 641, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %""ll" "d", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path ? state->loc.path : "ERR", buf->ia_ino); } while (0) |
639 | gf_fop_list[frame->root->op],do { do { if (0) printf ("%""ll" "u"": %s() %s => %""ll" "d" , 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__ , 641, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %""ll" "d", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path ? state->loc.path : "ERR", buf->ia_ino); } while (0) |
640 | state->loc.path ? state->loc.path : "ERR",do { do { if (0) printf ("%""ll" "u"": %s() %s => %""ll" "d" , 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__ , 641, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %""ll" "d", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path ? state->loc.path : "ERR", buf->ia_ino); } while (0) |
641 | buf->ia_ino)do { do { if (0) printf ("%""ll" "u"": %s() %s => %""ll" "d" , 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__ , 641, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %""ll" "d", frame ->root->unique, gf_fop_list[frame->root->op], state ->loc.path ? state->loc.path : "ERR", buf->ia_ino); } while (0); |
642 | |
643 | buf->ia_blksize = this->ctx->page_size; |
644 | gf_fuse_stat2attr (buf, &fao.attr, priv->enable_ino32); |
645 | |
646 | fao.attr_valid = calc_timeout_sec (priv->attribute_timeout); |
647 | fao.attr_valid_nsec = |
648 | calc_timeout_nsec (priv->attribute_timeout); |
649 | |
650 | #if FUSE_KERNEL_MINOR_VERSION13 >= 9 |
651 | priv->proto_minor >= 9 ? |
652 | send_fuse_obj (this, finh, &fao)send_fuse_data (this, finh, &fao, sizeof (*(&fao))) : |
653 | send_fuse_data (this, finh, &fao, |
654 | FUSE_COMPAT_ATTR_OUT_SIZE96); |
655 | #else |
656 | send_fuse_obj (this, finh, &fao)send_fuse_data (this, finh, &fao, sizeof (*(&fao))); |
657 | #endif |
658 | } else { |
659 | GF_LOG_OCCASIONALLY ( gf_fuse_conn_err_log, "glusterfs-fuse",if (!(gf_fuse_conn_err_log++%42)) { do { do { if (0) printf ( "%""ll" "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__, 665, GF_LOG_WARNING , "%""ll" "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); } |
660 | GF_LOG_WARNING,if (!(gf_fuse_conn_err_log++%42)) { do { do { if (0) printf ( "%""ll" "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__, 665, GF_LOG_WARNING , "%""ll" "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); } |
661 | "%"PRIu64": %s() %s => -1 (%s)",if (!(gf_fuse_conn_err_log++%42)) { do { do { if (0) printf ( "%""ll" "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__, 665, GF_LOG_WARNING , "%""ll" "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); } |
662 | frame->root->unique,if (!(gf_fuse_conn_err_log++%42)) { do { do { if (0) printf ( "%""ll" "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__, 665, GF_LOG_WARNING , "%""ll" "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); } |
663 | gf_fop_list[frame->root->op],if (!(gf_fuse_conn_err_log++%42)) { do { do { if (0) printf ( "%""ll" "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__, 665, GF_LOG_WARNING , "%""ll" "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); } |
664 | state->loc.path ? state->loc.path : "ERR",if (!(gf_fuse_conn_err_log++%42)) { do { do { if (0) printf ( "%""ll" "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__, 665, GF_LOG_WARNING , "%""ll" "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); } |
665 | strerror (op_errno))if (!(gf_fuse_conn_err_log++%42)) { do { do { if (0) printf ( "%""ll" "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__, 665, GF_LOG_WARNING , "%""ll" "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); }; |
666 | |
667 | send_fuse_err (this, finh, op_errno); |
668 | } |
669 | |
670 | free_fuse_state (state); |
671 | STACK_DESTROY (frame->root); |
672 | |
673 | return 0; |
674 | } |
675 | |
676 | static int |
677 | fuse_root_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
678 | int32_t op_ret, int32_t op_errno, |
679 | inode_t *inode, struct iatt *stat, dict_t *dict, |
680 | struct iatt *postparent) |
681 | { |
682 | fuse_attr_cbk (frame, cookie, this, op_ret, op_errno, stat, dict); |
683 | |
684 | return 0; |
685 | } |
686 | |
687 | void |
688 | fuse_getattr_resume (fuse_state_t *state) |
689 | { |
690 | if (!state->loc.inode) { |
691 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("%""ll" "u"": GETATTR %""ll" "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__, 694, GF_LOG_ERROR, "%""ll" "u" ": GETATTR %""ll" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0) |
692 | "%"PRIu64": GETATTR %"PRIu64" (%s) resolution failed",do { do { if (0) printf ("%""ll" "u"": GETATTR %""ll" "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__, 694, GF_LOG_ERROR, "%""ll" "u" ": GETATTR %""ll" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0) |
693 | state->finh->unique, state->finh->nodeid,do { do { if (0) printf ("%""ll" "u"": GETATTR %""ll" "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__, 694, GF_LOG_ERROR, "%""ll" "u" ": GETATTR %""ll" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0) |
694 | uuid_utoa (state->resolve.gfid))do { do { if (0) printf ("%""ll" "u"": GETATTR %""ll" "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__, 694, GF_LOG_ERROR, "%""ll" "u" ": GETATTR %""ll" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0); |
695 | send_fuse_err (state->this, state->finh, ENOENT2); |
696 | free_fuse_state (state); |
697 | return; |
698 | } |
699 | |
700 | if (!IA_ISDIR (state->loc.inode->ia_type)(state->loc.inode->ia_type == IA_IFDIR)) { |
701 | state->fd = fd_lookup (state->loc.inode, state->finh->pid); |
702 | } |
703 | |
704 | if (!state->fd) { |
705 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": GETATTR %""ll" "u"" (%s)" , state->finh->unique, state->finh->nodeid, state ->loc.path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 708, GF_LOG_TRACE, "%""ll" "u"": GETATTR %""ll" "u"" (%s)", state->finh->unique, state->finh->nodeid , state->loc.path); } while (0) |
706 | "%"PRIu64": GETATTR %"PRIu64" (%s)",do { do { if (0) printf ("%""ll" "u"": GETATTR %""ll" "u"" (%s)" , state->finh->unique, state->finh->nodeid, state ->loc.path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 708, GF_LOG_TRACE, "%""ll" "u"": GETATTR %""ll" "u"" (%s)", state->finh->unique, state->finh->nodeid , state->loc.path); } while (0) |
707 | state->finh->unique, state->finh->nodeid,do { do { if (0) printf ("%""ll" "u"": GETATTR %""ll" "u"" (%s)" , state->finh->unique, state->finh->nodeid, state ->loc.path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 708, GF_LOG_TRACE, "%""ll" "u"": GETATTR %""ll" "u"" (%s)", state->finh->unique, state->finh->nodeid , state->loc.path); } while (0) |
708 | state->loc.path)do { do { if (0) printf ("%""ll" "u"": GETATTR %""ll" "u"" (%s)" , state->finh->unique, state->finh->nodeid, state ->loc.path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 708, GF_LOG_TRACE, "%""ll" "u"": GETATTR %""ll" "u"" (%s)", state->finh->unique, state->finh->nodeid , state->loc.path); } while (0); |
709 | |
710 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 711, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 711, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_STAT == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 711, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 711, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 711, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 711, 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) |
711 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 711, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 711, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_STAT == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 711, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 711, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 711, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 711, 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); |
712 | } else { |
713 | |
714 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": FGETATTR %""ll" "u"" (%s/%p)" , state->finh->unique, state->finh->nodeid, state ->loc.path, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 717, GF_LOG_TRACE, "%""ll" "u" ": FGETATTR %""ll" "u"" (%s/%p)", state->finh->unique, state ->finh->nodeid, state->loc.path, state->fd); } while (0) |
715 | "%"PRIu64": FGETATTR %"PRIu64" (%s/%p)",do { do { if (0) printf ("%""ll" "u"": FGETATTR %""ll" "u"" (%s/%p)" , state->finh->unique, state->finh->nodeid, state ->loc.path, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 717, GF_LOG_TRACE, "%""ll" "u" ": FGETATTR %""ll" "u"" (%s/%p)", state->finh->unique, state ->finh->nodeid, state->loc.path, state->fd); } while (0) |
716 | state->finh->unique, state->finh->nodeid,do { do { if (0) printf ("%""ll" "u"": FGETATTR %""ll" "u"" (%s/%p)" , state->finh->unique, state->finh->nodeid, state ->loc.path, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 717, GF_LOG_TRACE, "%""ll" "u" ": FGETATTR %""ll" "u"" (%s/%p)", state->finh->unique, state ->finh->nodeid, state->loc.path, state->fd); } while (0) |
717 | state->loc.path, state->fd)do { do { if (0) printf ("%""ll" "u"": FGETATTR %""ll" "u"" (%s/%p)" , state->finh->unique, state->finh->nodeid, state ->loc.path, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 717, GF_LOG_TRACE, "%""ll" "u" ": FGETATTR %""ll" "u"" (%s/%p)", state->finh->unique, state ->finh->nodeid, state->loc.path, state->fd); } while (0); |
718 | |
719 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 720, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 720, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_FSTAT == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 720, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 720, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 720, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 720, 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) |
720 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 720, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 720, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_FSTAT == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 720, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 720, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 720, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 720, 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); |
721 | } |
722 | } |
723 | |
724 | static void |
725 | fuse_getattr (xlator_t *this, fuse_in_header_t *finh, void *msg) |
726 | { |
727 | fuse_state_t *state; |
728 | int32_t ret = -1; |
729 | |
730 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 730, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
731 | |
732 | if (finh->nodeid == 1) { |
733 | state->gfid[15] = 1; |
734 | |
735 | ret = fuse_loc_fill (&state->loc, state, finh->nodeid, 0, NULL((void*)0)); |
736 | if (ret < 0) { |
737 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": GETATTR on / (fuse_loc_fill() failed)" , finh->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 739, GF_LOG_WARNING, "%""ll" "u"": GETATTR on / (fuse_loc_fill() failed)" , finh->unique); } while (0) |
738 | "%"PRIu64": GETATTR on / (fuse_loc_fill() failed)",do { do { if (0) printf ("%""ll" "u"": GETATTR on / (fuse_loc_fill() failed)" , finh->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 739, GF_LOG_WARNING, "%""ll" "u"": GETATTR on / (fuse_loc_fill() failed)" , finh->unique); } while (0) |
739 | finh->unique)do { do { if (0) printf ("%""ll" "u"": GETATTR on / (fuse_loc_fill() failed)" , finh->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 739, GF_LOG_WARNING, "%""ll" "u"": GETATTR on / (fuse_loc_fill() failed)" , finh->unique); } while (0); |
740 | send_fuse_err (this, finh, ENOENT2); |
741 | free_fuse_state (state); |
742 | return; |
743 | } |
744 | |
745 | fuse_gfid_set (state); |
746 | |
747 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 748, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 748, GF_LOG_ERROR, "xl is NULL"); } while (0) ; op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_LOOKUP == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 748, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 748, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 748, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 748, 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) |
748 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 748, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 748, GF_LOG_ERROR, "xl is NULL"); } while (0) ; op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_LOOKUP == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 748, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 748, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 748, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 748, 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); |
749 | return; |
750 | } |
751 | |
752 | fuse_resolve_inode_init (state, &state->resolve, state->finh->nodeid); |
753 | |
754 | fuse_resolve_and_resume (state, fuse_getattr_resume); |
755 | } |
756 | |
757 | static int32_t |
758 | fuse_fd_inherit_directio (xlator_t *this, fd_t *fd, struct fuse_open_out *foo) |
759 | { |
760 | int32_t ret = 0; |
761 | fuse_fd_ctx_t *fdctx = NULL((void*)0), *tmp_fdctx = NULL((void*)0); |
762 | fd_t *tmp_fd = NULL((void*)0); |
763 | |
764 | 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__, 765, GF_LOG_ERROR, "invalid argument: " "this" ); } while (0); goto out; } }while (0) |
765 | -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__, 765, GF_LOG_ERROR, "invalid argument: " "this" ); } while (0); goto out; } }while (0); |
766 | 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__, 767, GF_LOG_ERROR, "invalid argument: " "fd") ; } while (0); goto out; } }while (0) |
767 | -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__, 767, GF_LOG_ERROR, "invalid argument: " "fd") ; } while (0); goto out; } }while (0); |
768 | 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__, 769, GF_LOG_ERROR, "invalid argument: " "foo" ); } while (0); goto out; } }while (0) |
769 | -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__, 769, GF_LOG_ERROR, "invalid argument: " "foo" ); } while (0); goto out; } }while (0); |
770 | |
771 | fdctx = fuse_fd_ctx_get (this, fd); |
772 | if (!fdctx) { |
773 | ret = -ENOMEM12; |
774 | goto out; |
775 | } |
776 | |
777 | tmp_fd = fd_lookup (fd->inode, 0); |
778 | if (tmp_fd) { |
779 | tmp_fdctx = fuse_fd_ctx_get (this, tmp_fd); |
780 | if (tmp_fdctx) { |
781 | foo->open_flags &= ~FOPEN_DIRECT_IO(1 << 0); |
782 | foo->open_flags |= (tmp_fdctx->open_flags |
783 | & FOPEN_DIRECT_IO(1 << 0)); |
784 | } |
785 | } |
786 | |
787 | fdctx->open_flags |= (foo->open_flags & FOPEN_DIRECT_IO(1 << 0)); |
788 | |
789 | if (tmp_fd != NULL((void*)0)) { |
790 | fd_unref (tmp_fd); |
791 | } |
792 | |
793 | ret = 0; |
794 | out: |
795 | return ret; |
796 | } |
797 | |
798 | static int |
799 | fuse_fd_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
800 | int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) |
801 | { |
802 | fuse_state_t *state = NULL((void*)0); |
803 | fuse_in_header_t *finh = NULL((void*)0); |
804 | fuse_private_t *priv = NULL((void*)0); |
805 | int32_t ret = 0; |
806 | struct fuse_open_out foo = {0, }; |
807 | |
808 | priv = this->private; |
809 | state = frame->root->state; |
810 | finh = state->finh; |
811 | |
812 | 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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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); |
813 | |
814 | if (op_ret >= 0) { |
815 | foo.fh = (uintptr_t) fd; |
816 | foo.open_flags = 0; |
817 | |
818 | if (!IA_ISDIR (fd->inode->ia_type)(fd->inode->ia_type == IA_IFDIR)) { |
819 | if (((priv->direct_io_mode == 2) |
820 | && ((state->flags & O_ACCMODE0003) != O_RDONLY00)) |
821 | || (priv->direct_io_mode == 1)) |
822 | foo.open_flags |= FOPEN_DIRECT_IO(1 << 0); |
823 | #ifdef GF_DARWIN_HOST_OS |
824 | /* In Linux: by default, buffer cache |
825 | * is purged upon open, setting |
826 | * FOPEN_KEEP_CACHE implies no-purge |
827 | * |
828 | * In MacFUSE: by default, buffer cache |
829 | * is left intact upon open, setting |
830 | * FOPEN_PURGE_UBC implies purge |
831 | * |
832 | * [[Interesting...]] |
833 | */ |
834 | if (!priv->fopen_keep_cache) |
835 | foo.open_flags |= FOPEN_PURGE_UBC; |
836 | #else |
837 | /* |
838 | * If fopen-keep-cache is enabled, we set the associated |
839 | * flag here such that files are not invalidated on open. |
840 | * File invalidations occur either in fuse or explicitly |
841 | * when the cache is set invalid on the inode. |
842 | */ |
843 | if (priv->fopen_keep_cache) |
844 | foo.open_flags |= FOPEN_KEEP_CACHE(1 << 1); |
845 | #endif |
846 | } |
847 | |
848 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "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__, 850, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %p" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, fd); } while (0) |
849 | "%"PRIu64": %s() %s => %p", frame->root->unique,do { do { if (0) printf ("%""ll" "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__, 850, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %p" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, fd); } while (0) |
850 | gf_fop_list[frame->root->op], state->loc.path, fd)do { do { if (0) printf ("%""ll" "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__, 850, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %p" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, fd); } while (0); |
851 | |
852 | ret = fuse_fd_inherit_directio (this, fd, &foo); |
853 | if (ret < 0) { |
854 | op_errno = -ret; |
855 | 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__, 858, 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) |
856 | "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__, 858, 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) |
857 | "(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__, 858, 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) |
858 | "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__, 858, 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); |
859 | goto err; |
860 | } |
861 | |
862 | if (send_fuse_obj (this, finh, &foo)send_fuse_data (this, finh, &foo, sizeof (*(&foo))) == ENOENT2) { |
863 | 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__, 864, GF_LOG_DEBUG, "open(%s) got EINTR", state ->loc.path); } while (0) |
864 | "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__, 864, GF_LOG_DEBUG, "open(%s) got EINTR", state ->loc.path); } while (0); |
865 | gf_fd_put (priv->fdtable, state->fd_no); |
866 | goto out; |
867 | } |
868 | |
869 | fd_bind (fd); |
870 | } else { |
871 | err: |
872 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "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__, 875, GF_LOG_WARNING , "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path, strerror (op_errno)); } while (0) |
873 | "%"PRIu64": %s() %s => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""ll" "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__, 875, GF_LOG_WARNING , "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path, strerror (op_errno)); } while (0) |
874 | gf_fop_list[frame->root->op], state->loc.path,do { do { if (0) printf ("%""ll" "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__, 875, GF_LOG_WARNING , "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path, strerror (op_errno)); } while (0) |
875 | strerror (op_errno))do { do { if (0) printf ("%""ll" "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__, 875, GF_LOG_WARNING , "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->loc.path, strerror (op_errno)); } while (0); |
876 | |
877 | send_fuse_err (this, finh, op_errno); |
878 | gf_fd_put (priv->fdtable, state->fd_no); |
879 | } |
880 | out: |
881 | free_fuse_state (state); |
882 | STACK_DESTROY (frame->root); |
883 | return 0; |
884 | } |
885 | |
886 | static void |
887 | fuse_do_truncate (fuse_state_t *state, size_t size) |
888 | { |
889 | if (state->fd) { |
890 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 891, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 891, GF_LOG_ERROR, "xl is NULL"); } while (0) ; op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_FTRUNCATE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 891, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 891, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 891, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 891, 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) |
891 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 891, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 891, GF_LOG_ERROR, "xl is NULL"); } while (0) ; op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_FTRUNCATE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 891, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 891, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 891, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 891, 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); |
892 | } else { |
893 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 894, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 894, GF_LOG_ERROR, "xl is NULL"); } while (0) ; op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_TRUNCATE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 894, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 894, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 894, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 894, 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) |
894 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 894, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 894, GF_LOG_ERROR, "xl is NULL"); } while (0) ; op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_TRUNCATE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 894, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 894, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 894, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 894, 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); |
895 | } |
896 | |
897 | return; |
898 | } |
899 | |
900 | static int |
901 | fuse_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
902 | int32_t op_ret, int32_t op_errno, |
903 | struct iatt *statpre, struct iatt *statpost, dict_t *xdata) |
904 | { |
905 | fuse_state_t *state; |
906 | fuse_in_header_t *finh; |
907 | fuse_private_t *priv = NULL((void*)0); |
908 | struct fuse_attr_out fao; |
909 | |
910 | int op_done = 0; |
911 | |
912 | priv = this->private; |
913 | state = frame->root->state; |
914 | finh = state->finh; |
915 | |
916 | 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, %" "ll" "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, %""ll" "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) |
917 | "gfid: %s", op_ret, op_errno, frame->root->unique,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "ll" "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, %""ll" "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) |
918 | gf_fop_list[frame->root->op], state->loc.path,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "ll" "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, %""ll" "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) |
919 | state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : "")do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "ll" "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, %""ll" "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); |
920 | |
921 | if (op_ret == 0) { |
922 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": %s() %s => %""ll" "d" , 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__, 926, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %" "ll" "d", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", statpost ->ia_ino); } while (0) |
923 | "%"PRIu64": %s() %s => %"PRId64, frame->root->unique,do { do { if (0) printf ("%""ll" "u"": %s() %s => %""ll" "d" , 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__, 926, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %" "ll" "d", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", statpost ->ia_ino); } while (0) |
924 | gf_fop_list[frame->root->op],do { do { if (0) printf ("%""ll" "u"": %s() %s => %""ll" "d" , 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__, 926, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %" "ll" "d", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", statpost ->ia_ino); } while (0) |
925 | state->loc.path ? state->loc.path : "ERR",do { do { if (0) printf ("%""ll" "u"": %s() %s => %""ll" "d" , 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__, 926, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %" "ll" "d", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", statpost ->ia_ino); } while (0) |
926 | statpost->ia_ino)do { do { if (0) printf ("%""ll" "u"": %s() %s => %""ll" "d" , 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__, 926, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %" "ll" "d", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path ? state->loc.path : "ERR", statpost ->ia_ino); } while (0); |
927 | |
928 | statpost->ia_blksize = this->ctx->page_size; |
929 | gf_fuse_stat2attr (statpost, &fao.attr, priv->enable_ino32); |
930 | |
931 | fao.attr_valid = calc_timeout_sec (priv->attribute_timeout); |
932 | fao.attr_valid_nsec = |
933 | calc_timeout_nsec (priv->attribute_timeout); |
934 | |
935 | if (state->truncate_needed) { |
936 | fuse_do_truncate (state, state->size); |
937 | } else { |
938 | #if FUSE_KERNEL_MINOR_VERSION13 >= 9 |
939 | priv->proto_minor >= 9 ? |
940 | send_fuse_obj (this, finh, &fao)send_fuse_data (this, finh, &fao, sizeof (*(&fao))) : |
941 | send_fuse_data (this, finh, &fao, |
942 | FUSE_COMPAT_ATTR_OUT_SIZE96); |
943 | #else |
944 | send_fuse_obj (this, finh, &fao)send_fuse_data (this, finh, &fao, sizeof (*(&fao))); |
945 | #endif |
946 | op_done = 1; |
947 | } |
948 | } else { |
949 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "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__, 953, GF_LOG_WARNING, "%""ll" "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) |
950 | "%"PRIu64": %s() %s => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""ll" "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__, 953, GF_LOG_WARNING, "%""ll" "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) |
951 | gf_fop_list[frame->root->op],do { do { if (0) printf ("%""ll" "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__, 953, GF_LOG_WARNING, "%""ll" "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) |
952 | state->loc.path ? state->loc.path : "ERR",do { do { if (0) printf ("%""ll" "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__, 953, GF_LOG_WARNING, "%""ll" "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) |
953 | strerror (op_errno))do { do { if (0) printf ("%""ll" "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__, 953, GF_LOG_WARNING, "%""ll" "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); |
954 | |
955 | send_fuse_err (this, finh, op_errno); |
956 | op_done = 1; |
957 | } |
958 | |
959 | if (op_done) { |
960 | free_fuse_state (state); |
961 | } |
962 | |
963 | STACK_DESTROY (frame->root); |
964 | |
965 | return 0; |
966 | } |
967 | |
968 | static int32_t |
969 | fattr_to_gf_set_attr (int32_t valid) |
970 | { |
971 | int32_t gf_valid = 0; |
972 | |
973 | if (valid & FATTR_MODE(1 << 0)) |
974 | gf_valid |= GF_SET_ATTR_MODE0x1; |
975 | |
976 | if (valid & FATTR_UID(1 << 1)) |
977 | gf_valid |= GF_SET_ATTR_UID0x2; |
978 | |
979 | if (valid & FATTR_GID(1 << 2)) |
980 | gf_valid |= GF_SET_ATTR_GID0x4; |
981 | |
982 | if (valid & FATTR_ATIME(1 << 4)) |
983 | gf_valid |= GF_SET_ATTR_ATIME0x10; |
984 | |
985 | if (valid & FATTR_MTIME(1 << 5)) |
986 | gf_valid |= GF_SET_ATTR_MTIME0x20; |
987 | |
988 | if (valid & FATTR_SIZE(1 << 3)) |
989 | gf_valid |= GF_SET_ATTR_SIZE0x8; |
990 | |
991 | return gf_valid; |
992 | } |
993 | |
994 | #define FATTR_MASK((1 << 3) | (1 << 1) | (1 << 2) | (1 << 4) | (1 << 5) | (1 << 0)) (FATTR_SIZE(1 << 3) \ |
995 | | FATTR_UID(1 << 1) | FATTR_GID(1 << 2) \ |
996 | | FATTR_ATIME(1 << 4) | FATTR_MTIME(1 << 5) \ |
997 | | FATTR_MODE(1 << 0)) |
998 | |
999 | void |
1000 | fuse_setattr_resume (fuse_state_t *state) |
1001 | { |
1002 | if (!state->fd && !state->loc.inode) { |
1003 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("%""ll" "u"": SETATTR %""ll" "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__, 1006, GF_LOG_ERROR, "%""ll" "u" ": SETATTR %""ll" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0) |
1004 | "%"PRIu64": SETATTR %"PRIu64" (%s) resolution failed",do { do { if (0) printf ("%""ll" "u"": SETATTR %""ll" "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__, 1006, GF_LOG_ERROR, "%""ll" "u" ": SETATTR %""ll" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0) |
1005 | state->finh->unique, state->finh->nodeid,do { do { if (0) printf ("%""ll" "u"": SETATTR %""ll" "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__, 1006, GF_LOG_ERROR, "%""ll" "u" ": SETATTR %""ll" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0) |
1006 | uuid_utoa (state->resolve.gfid))do { do { if (0) printf ("%""ll" "u"": SETATTR %""ll" "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__, 1006, GF_LOG_ERROR, "%""ll" "u" ": SETATTR %""ll" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0); |
1007 | send_fuse_err (state->this, state->finh, ENOENT2); |
1008 | free_fuse_state (state); |
1009 | return; |
1010 | } |
1011 | |
1012 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": SETATTR (%""ll" "u"")%s" , state->finh->unique, state->finh->nodeid, state ->loc.path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1014, GF_LOG_TRACE, "%""ll" "u"": SETATTR (%" "ll" "u"")%s", state->finh->unique, state->finh-> nodeid, state->loc.path); } while (0) |
1013 | "%"PRIu64": SETATTR (%"PRIu64")%s", state->finh->unique,do { do { if (0) printf ("%""ll" "u"": SETATTR (%""ll" "u"")%s" , state->finh->unique, state->finh->nodeid, state ->loc.path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1014, GF_LOG_TRACE, "%""ll" "u"": SETATTR (%" "ll" "u"")%s", state->finh->unique, state->finh-> nodeid, state->loc.path); } while (0) |
1014 | state->finh->nodeid, state->loc.path)do { do { if (0) printf ("%""ll" "u"": SETATTR (%""ll" "u"")%s" , state->finh->unique, state->finh->nodeid, state ->loc.path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1014, GF_LOG_TRACE, "%""ll" "u"": SETATTR (%" "ll" "u"")%s", state->finh->unique, state->finh-> nodeid, state->loc.path); } while (0); |
1015 | |
1016 | #ifdef GF_TEST_FFOP |
1017 | /* this is for calls like 'fchmod()' */ |
1018 | if (!state->fd) |
1019 | state->fd = fd_lookup (state->loc.inode, state->finh->pid); |
1020 | #endif /* GF_TEST_FFOP */ |
1021 | |
1022 | if ((state->valid & (FATTR_MASK((1 << 3) | (1 << 1) | (1 << 2) | (1 << 4) | (1 << 5) | (1 << 0)))) != FATTR_SIZE(1 << 3)) { |
1023 | if (state->fd && |
1024 | !((state->valid & FATTR_ATIME(1 << 4)) || |
1025 | (state->valid & FATTR_MTIME(1 << 5)))) { |
1026 | /* |
1027 | there is no "futimes" call, so don't send |
1028 | fsetattr if ATIME or MTIME is set |
1029 | */ |
1030 | |
1031 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1034, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1034, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_FSETATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1034, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1034, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1034, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1034, 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) |
1032 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1034, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1034, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_FSETATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1034, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1034, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1034, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1034, 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) |
1033 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1034, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1034, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_FSETATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1034, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1034, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1034, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1034, 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) |
1034 | state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1034, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1034, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_FSETATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1034, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1034, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1034, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1034, 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); |
1035 | } else { |
1036 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1039, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1039, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_SETATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1039, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1039, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1039, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1039, 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) |
1037 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1039, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1039, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_SETATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1039, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1039, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1039, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1039, 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) |
1038 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1039, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1039, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_SETATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1039, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1039, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1039, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1039, 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) |
1039 | state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1039, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1039, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_SETATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1039, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1039, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1039, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1039, 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); |
1040 | } |
1041 | } else { |
1042 | fuse_do_truncate (state, state->size); |
1043 | } |
1044 | |
1045 | } |
1046 | |
1047 | static void |
1048 | fuse_setattr (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1049 | { |
1050 | struct fuse_setattr_in *fsi = msg; |
1051 | |
1052 | fuse_private_t *priv = NULL((void*)0); |
1053 | fuse_state_t *state = NULL((void*)0); |
1054 | |
1055 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1055, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1056 | |
1057 | if (fsi->valid & FATTR_FH(1 << 6) && |
1058 | !(fsi->valid & (FATTR_ATIME(1 << 4)|FATTR_MTIME(1 << 5)))) { |
1059 | /* We need no loc if kernel sent us an fd and |
1060 | * we are not fiddling with times */ |
1061 | state->fd = FH_TO_FD (fsi->fh)((((fd_t *)(uintptr_t)(fsi->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fsi->fh)))):((fd_t *) 0)); |
1062 | fuse_resolve_fd_init (state, &state->resolve, state->fd); |
1063 | } else { |
1064 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
1065 | } |
1066 | |
1067 | /* |
1068 | * This is just stub code demonstrating how to retrieve |
1069 | * lock_owner in setattr, according to the FUSE proto. |
1070 | * We do not make use of ATM. Its purpose is supporting |
1071 | * mandatory locking, but getting that right is further |
1072 | * down the road. Cf. |
1073 | * |
1074 | * http://thread.gmane.org/gmane.comp.file-systems.fuse.devel/ |
1075 | * 4962/focus=4982 |
1076 | * |
1077 | * http://git.kernel.org/?p=linux/kernel/git/torvalds/ |
1078 | * linux-2.6.git;a=commit;h=v2.6.23-5896-gf333211 |
1079 | */ |
1080 | priv = this->private; |
1081 | #if FUSE_KERNEL_MINOR_VERSION13 >= 9 |
1082 | if (priv->proto_minor >= 9 && fsi->valid & FATTR_LOCKOWNER(1 << 9)) |
1083 | state->lk_owner = fsi->lock_owner; |
1084 | #endif |
1085 | |
1086 | state->valid = fsi->valid; |
1087 | |
1088 | if ((fsi->valid & (FATTR_MASK((1 << 3) | (1 << 1) | (1 << 2) | (1 << 4) | (1 << 5) | (1 << 0)))) != FATTR_SIZE(1 << 3)) { |
1089 | if (fsi->valid & FATTR_SIZE(1 << 3)) { |
1090 | state->size = fsi->size; |
1091 | state->truncate_needed = _gf_true; |
1092 | } |
1093 | |
1094 | state->attr.ia_size = fsi->size; |
1095 | state->attr.ia_atime = fsi->atime; |
1096 | state->attr.ia_mtime = fsi->mtime; |
1097 | state->attr.ia_atime_nsec = fsi->atimensec; |
1098 | state->attr.ia_mtime_nsec = fsi->mtimensec; |
1099 | |
1100 | state->attr.ia_prot = ia_prot_from_st_mode (fsi->mode); |
1101 | state->attr.ia_uid = fsi->uid; |
1102 | state->attr.ia_gid = fsi->gid; |
1103 | } else { |
1104 | state->size = fsi->size; |
1105 | } |
1106 | |
1107 | fuse_resolve_and_resume (state, fuse_setattr_resume); |
1108 | } |
1109 | |
1110 | static int |
1111 | fuse_err_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1112 | int32_t op_ret, int32_t op_errno, dict_t *xdata) |
1113 | { |
1114 | fuse_state_t *state = frame->root->state; |
1115 | fuse_in_header_t *finh = state->finh; |
1116 | |
1117 | 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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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); |
1118 | |
1119 | if (op_ret == 0) { |
1120 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "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__, 1123, GF_LOG_TRACE , "%""ll" "u"": %s() %s => 0", frame->root->unique, gf_fop_list [frame->root->op], state->loc.path ? state->loc.path : "ERR"); } while (0) |
1121 | "%"PRIu64": %s() %s => 0", frame->root->unique,do { do { if (0) printf ("%""ll" "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__, 1123, GF_LOG_TRACE , "%""ll" "u"": %s() %s => 0", frame->root->unique, gf_fop_list [frame->root->op], state->loc.path ? state->loc.path : "ERR"); } while (0) |
1122 | gf_fop_list[frame->root->op],do { do { if (0) printf ("%""ll" "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__, 1123, GF_LOG_TRACE , "%""ll" "u"": %s() %s => 0", frame->root->unique, gf_fop_list [frame->root->op], state->loc.path ? state->loc.path : "ERR"); } while (0) |
1123 | state->loc.path ? state->loc.path : "ERR")do { do { if (0) printf ("%""ll" "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__, 1123, GF_LOG_TRACE , "%""ll" "u"": %s() %s => 0", frame->root->unique, gf_fop_list [frame->root->op], state->loc.path ? state->loc.path : "ERR"); } while (0); |
1124 | |
1125 | send_fuse_err (this, finh, 0); |
1126 | } else { |
1127 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "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__, 1132, GF_LOG_WARNING, "%""ll" "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) |
1128 | "%"PRIu64": %s() %s => -1 (%s)",do { do { if (0) printf ("%""ll" "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__, 1132, GF_LOG_WARNING, "%""ll" "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) |
1129 | frame->root->unique,do { do { if (0) printf ("%""ll" "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__, 1132, GF_LOG_WARNING, "%""ll" "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) |
1130 | gf_fop_list[frame->root->op],do { do { if (0) printf ("%""ll" "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__, 1132, GF_LOG_WARNING, "%""ll" "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) |
1131 | state->loc.path ? state->loc.path : "ERR",do { do { if (0) printf ("%""ll" "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__, 1132, GF_LOG_WARNING, "%""ll" "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) |
1132 | strerror (op_errno))do { do { if (0) printf ("%""ll" "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__, 1132, GF_LOG_WARNING, "%""ll" "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); |
1133 | |
1134 | send_fuse_err (this, finh, op_errno); |
1135 | } |
1136 | |
1137 | free_fuse_state (state); |
1138 | STACK_DESTROY (frame->root); |
1139 | |
1140 | return 0; |
1141 | } |
1142 | |
1143 | static int |
1144 | fuse_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1145 | int32_t op_ret, int32_t op_errno, struct iatt *prebuf, |
1146 | struct iatt *postbuf, dict_t *xdata) |
1147 | { |
1148 | return fuse_err_cbk (frame, cookie, this, op_ret, op_errno, xdata); |
1149 | } |
1150 | |
1151 | static int |
1152 | fuse_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1153 | int32_t op_ret, int32_t op_errno, dict_t *xdata) |
1154 | { |
1155 | if (op_ret == -1 && op_errno == ENOTSUP95) |
1156 | 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__ , 1159, GF_LOG_CRITICAL, "extended attribute not supported " "by the backend storage" ); } while (0); } |
1157 | "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__ , 1159, GF_LOG_CRITICAL, "extended attribute not supported " "by the backend storage" ); } while (0); } |
1158 | "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__ , 1159, GF_LOG_CRITICAL, "extended attribute not supported " "by the backend storage" ); } while (0); } |
1159 | "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__ , 1159, GF_LOG_CRITICAL, "extended attribute not supported " "by the backend storage" ); } while (0); }; |
1160 | |
1161 | return fuse_err_cbk (frame, cookie, this, op_ret, op_errno, xdata); |
1162 | } |
1163 | |
1164 | static int |
1165 | fuse_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1166 | int32_t op_ret, int32_t op_errno, struct iatt *preparent, |
1167 | struct iatt *postparent, dict_t *xdata) |
1168 | { |
1169 | fuse_state_t *state = NULL((void*)0); |
1170 | fuse_in_header_t *finh = NULL((void*)0); |
1171 | |
1172 | state = frame->root->state; |
1173 | finh = state->finh; |
1174 | |
1175 | 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, %" "ll" "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, %""ll" "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) |
1176 | "gfid: %s", op_ret, op_errno, frame->root->unique,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "ll" "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, %""ll" "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) |
1177 | gf_fop_list[frame->root->op], state->loc.path,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "ll" "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, %""ll" "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) |
1178 | state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : "")do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "ll" "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, %""ll" "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); |
1179 | |
1180 | if (op_ret == 0) { |
1181 | inode_unlink (state->loc.inode, state->loc.parent, |
1182 | state->loc.name); |
1183 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "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__, 1185, GF_LOG_TRACE, "%""ll" "u"": %s() %s => 0" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path); } while (0) |
1184 | "%"PRIu64": %s() %s => 0", frame->root->unique,do { do { if (0) printf ("%""ll" "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__, 1185, GF_LOG_TRACE, "%""ll" "u"": %s() %s => 0" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path); } while (0) |
1185 | gf_fop_list[frame->root->op], state->loc.path)do { do { if (0) printf ("%""ll" "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__, 1185, GF_LOG_TRACE, "%""ll" "u"": %s() %s => 0" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path); } while (0); |
1186 | |
1187 | send_fuse_err (this, finh, 0); |
1188 | } else { |
1189 | gf_log ("glusterfs-fuse",do { do { if (0) printf ("%""ll" "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__, 1193, op_errno == 39 ? GF_LOG_DEBUG : GF_LOG_WARNING, "%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0) |
1190 | op_errno == ENOTEMPTY ? GF_LOG_DEBUG : GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "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__, 1193, op_errno == 39 ? GF_LOG_DEBUG : GF_LOG_WARNING, "%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0) |
1191 | "%"PRIu64": %s() %s => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""ll" "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__, 1193, op_errno == 39 ? GF_LOG_DEBUG : GF_LOG_WARNING, "%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0) |
1192 | gf_fop_list[frame->root->op], state->loc.path,do { do { if (0) printf ("%""ll" "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__, 1193, op_errno == 39 ? GF_LOG_DEBUG : GF_LOG_WARNING, "%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0) |
1193 | strerror (op_errno))do { do { if (0) printf ("%""ll" "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__, 1193, op_errno == 39 ? GF_LOG_DEBUG : GF_LOG_WARNING, "%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->loc.path, strerror (op_errno)); } while (0); |
1194 | |
1195 | send_fuse_err (this, finh, op_errno); |
1196 | } |
1197 | |
1198 | free_fuse_state (state); |
1199 | STACK_DESTROY (frame->root); |
1200 | |
1201 | return 0; |
1202 | } |
1203 | |
1204 | void |
1205 | fuse_access_resume (fuse_state_t *state) |
1206 | { |
1207 | if (!state->loc.inode) { |
1208 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("%""ll" "u"": ACCESS %""ll" "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__, 1211, GF_LOG_ERROR, "%""ll" "u" ": ACCESS %""ll" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0) |
1209 | "%"PRIu64": ACCESS %"PRIu64" (%s) resolution failed",do { do { if (0) printf ("%""ll" "u"": ACCESS %""ll" "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__, 1211, GF_LOG_ERROR, "%""ll" "u" ": ACCESS %""ll" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0) |
1210 | state->finh->unique, state->finh->nodeid,do { do { if (0) printf ("%""ll" "u"": ACCESS %""ll" "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__, 1211, GF_LOG_ERROR, "%""ll" "u" ": ACCESS %""ll" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0) |
1211 | uuid_utoa (state->resolve.gfid))do { do { if (0) printf ("%""ll" "u"": ACCESS %""ll" "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__, 1211, GF_LOG_ERROR, "%""ll" "u" ": ACCESS %""ll" "u"" (%s) resolution failed", state->finh ->unique, state->finh->nodeid, uuid_utoa (state-> resolve.gfid)); } while (0); |
1212 | send_fuse_err (state->this, state->finh, ENOENT2); |
1213 | free_fuse_state (state); |
1214 | return; |
1215 | } |
1216 | |
1217 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"" ACCESS %s/%""ll" "u"" mask=%d" , state->finh->unique, state->loc.path, state->finh ->nodeid, state->mask); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1220, GF_LOG_TRACE, "%""ll" "u" " ACCESS %s/%""ll" "u"" mask=%d", state->finh->unique, state ->loc.path, state->finh->nodeid, state->mask); } while (0) |
1218 | "%"PRIu64" ACCESS %s/%"PRIu64" mask=%d",do { do { if (0) printf ("%""ll" "u"" ACCESS %s/%""ll" "u"" mask=%d" , state->finh->unique, state->loc.path, state->finh ->nodeid, state->mask); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1220, GF_LOG_TRACE, "%""ll" "u" " ACCESS %s/%""ll" "u"" mask=%d", state->finh->unique, state ->loc.path, state->finh->nodeid, state->mask); } while (0) |
1219 | state->finh->unique, state->loc.path,do { do { if (0) printf ("%""ll" "u"" ACCESS %s/%""ll" "u"" mask=%d" , state->finh->unique, state->loc.path, state->finh ->nodeid, state->mask); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1220, GF_LOG_TRACE, "%""ll" "u" " ACCESS %s/%""ll" "u"" mask=%d", state->finh->unique, state ->loc.path, state->finh->nodeid, state->mask); } while (0) |
1220 | state->finh->nodeid, state->mask)do { do { if (0) printf ("%""ll" "u"" ACCESS %s/%""ll" "u"" mask=%d" , state->finh->unique, state->loc.path, state->finh ->nodeid, state->mask); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1220, GF_LOG_TRACE, "%""ll" "u" " ACCESS %s/%""ll" "u"" mask=%d", state->finh->unique, state ->loc.path, state->finh->nodeid, state->mask); } while (0); |
1221 | |
1222 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1223, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1223, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_ACCESS == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1223, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1223, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1223, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1223, 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) |
1223 | &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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1223, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1223, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_ACCESS == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1223, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1223, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1223, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1223, 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); |
1224 | } |
1225 | |
1226 | static void |
1227 | fuse_access (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1228 | { |
1229 | struct fuse_access_in *fai = msg; |
1230 | fuse_state_t *state = NULL((void*)0); |
1231 | |
1232 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1232, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1233 | |
1234 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
1235 | |
1236 | state->mask = fai->mask; |
1237 | |
1238 | fuse_resolve_and_resume (state, fuse_access_resume); |
1239 | |
1240 | return; |
1241 | } |
1242 | |
1243 | static int |
1244 | fuse_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1245 | int32_t op_ret, int32_t op_errno, const char *linkname, |
1246 | struct iatt *buf, dict_t *xdata) |
1247 | { |
1248 | fuse_state_t *state = NULL((void*)0); |
1249 | fuse_in_header_t *finh = NULL((void*)0); |
1250 | |
1251 | state = frame->root->state; |
1252 | finh = state->finh; |
1253 | |
1254 | 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 %" "ll" "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 %" "ll" "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) |
1255 | " linkname: %s, gfid: %s", op_ret, op_errno,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d %" "ll" "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 %" "ll" "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) |
1256 | frame->root->unique, gf_fop_list[frame->root->op],do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d %" "ll" "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 %" "ll" "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) |
1257 | state->loc.gfid, linkname,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d %" "ll" "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 %" "ll" "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) |
1258 | uuid_utoa (state->loc.gfid))do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d %" "ll" "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 %" "ll" "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); |
1259 | |
1260 | if (op_ret > 0) { |
1261 | ((char *)linkname)[op_ret] = '\0'; |
1262 | |
1263 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": %s => %s", frame-> root->unique, state->loc.path, linkname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1265, GF_LOG_TRACE , "%""ll" "u"": %s => %s", frame->root->unique, state ->loc.path, linkname); } while (0) |
1264 | "%"PRIu64": %s => %s", frame->root->unique,do { do { if (0) printf ("%""ll" "u"": %s => %s", frame-> root->unique, state->loc.path, linkname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1265, GF_LOG_TRACE , "%""ll" "u"": %s => %s", frame->root->unique, state ->loc.path, linkname); } while (0) |
1265 | state->loc.path, linkname)do { do { if (0) printf ("%""ll" "u"": %s => %s", frame-> root->unique, state->loc.path, linkname); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1265, GF_LOG_TRACE , "%""ll" "u"": %s => %s", frame->root->unique, state ->loc.path, linkname); } while (0); |
1266 | |
1267 | send_fuse_data (this, finh, (void *)linkname, op_ret + 1); |
1268 | } else { |
1269 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": %s => -1 (%s)", frame ->root->unique, state->loc.path, strerror (op_errno) ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1271, GF_LOG_WARNING, "%""ll" "u"": %s => -1 (%s)", frame ->root->unique, state->loc.path, strerror (op_errno) ); } while (0) |
1270 | "%"PRIu64": %s => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""ll" "u"": %s => -1 (%s)", frame ->root->unique, state->loc.path, strerror (op_errno) ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1271, GF_LOG_WARNING, "%""ll" "u"": %s => -1 (%s)", frame ->root->unique, state->loc.path, strerror (op_errno) ); } while (0) |
1271 | state->loc.path, strerror (op_errno))do { do { if (0) printf ("%""ll" "u"": %s => -1 (%s)", frame ->root->unique, state->loc.path, strerror (op_errno) ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1271, GF_LOG_WARNING, "%""ll" "u"": %s => -1 (%s)", frame ->root->unique, state->loc.path, strerror (op_errno) ); } while (0); |
1272 | |
1273 | send_fuse_err (this, finh, op_errno); |
1274 | } |
1275 | |
1276 | free_fuse_state (state); |
1277 | STACK_DESTROY (frame->root); |
1278 | |
1279 | return 0; |
1280 | } |
1281 | |
1282 | void |
1283 | fuse_readlink_resume (fuse_state_t *state) |
1284 | { |
1285 | if (!state->loc.inode) { |
1286 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("READLINK %""ll" "u"" (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1288, GF_LOG_ERROR, "READLINK %""ll" "u"" (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0) |
1287 | "READLINK %"PRIu64" (%s) resolution failed",do { do { if (0) printf ("READLINK %""ll" "u"" (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1288, GF_LOG_ERROR, "READLINK %""ll" "u"" (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0) |
1288 | state->finh->unique, uuid_utoa (state->resolve.gfid))do { do { if (0) printf ("READLINK %""ll" "u"" (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1288, GF_LOG_ERROR, "READLINK %""ll" "u"" (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); |
1289 | send_fuse_err (state->this, state->finh, ENOENT2); |
1290 | free_fuse_state (state); |
1291 | return; |
1292 | } |
1293 | |
1294 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "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__, 1296, GF_LOG_TRACE, "%""ll" "u"" READLINK %s/%s" , state->finh->unique, state->loc.path, uuid_utoa (state ->loc.inode->gfid)); } while (0) |
1295 | "%"PRIu64" READLINK %s/%s", state->finh->unique,do { do { if (0) printf ("%""ll" "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__, 1296, GF_LOG_TRACE, "%""ll" "u"" READLINK %s/%s" , state->finh->unique, state->loc.path, uuid_utoa (state ->loc.inode->gfid)); } while (0) |
1296 | state->loc.path, uuid_utoa (state->loc.inode->gfid))do { do { if (0) printf ("%""ll" "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__, 1296, GF_LOG_TRACE, "%""ll" "u"" READLINK %s/%s" , state->finh->unique, state->loc.path, uuid_utoa (state ->loc.inode->gfid)); } while (0); |
1297 | |
1298 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1299, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1299, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_READLINK == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1299, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1299, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1299, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1299, 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) |
1299 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1299, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1299, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_READLINK == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1299, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1299, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1299, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1299, 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); |
1300 | } |
1301 | |
1302 | static void |
1303 | fuse_readlink (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1304 | { |
1305 | fuse_state_t *state = NULL((void*)0); |
1306 | |
1307 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1307, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1308 | |
1309 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
1310 | |
1311 | fuse_resolve_and_resume (state, fuse_readlink_resume); |
1312 | |
1313 | return; |
1314 | } |
1315 | |
1316 | void |
1317 | fuse_mknod_resume (fuse_state_t *state) |
1318 | { |
1319 | if (!state->loc.parent) { |
1320 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("MKNOD %""ll" "d""/%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__, 1323, GF_LOG_ERROR, "MKNOD %""ll" "d""/%s (%s/%s) resolution failed" , state->finh->nodeid, state->resolve.bname, uuid_utoa (state->resolve.gfid), state->resolve.bname); } while ( 0) |
1321 | "MKNOD %"PRId64"/%s (%s/%s) resolution failed",do { do { if (0) printf ("MKNOD %""ll" "d""/%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__, 1323, GF_LOG_ERROR, "MKNOD %""ll" "d""/%s (%s/%s) resolution failed" , state->finh->nodeid, state->resolve.bname, uuid_utoa (state->resolve.gfid), state->resolve.bname); } while ( 0) |
1322 | state->finh->nodeid, state->resolve.bname,do { do { if (0) printf ("MKNOD %""ll" "d""/%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__, 1323, GF_LOG_ERROR, "MKNOD %""ll" "d""/%s (%s/%s) resolution failed" , state->finh->nodeid, state->resolve.bname, uuid_utoa (state->resolve.gfid), state->resolve.bname); } while ( 0) |
1323 | uuid_utoa (state->resolve.gfid), state->resolve.bname)do { do { if (0) printf ("MKNOD %""ll" "d""/%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__, 1323, GF_LOG_ERROR, "MKNOD %""ll" "d""/%s (%s/%s) resolution failed" , state->finh->nodeid, state->resolve.bname, uuid_utoa (state->resolve.gfid), state->resolve.bname); } while ( 0); |
1324 | send_fuse_err (state->this, state->finh, ENOENT2); |
1325 | free_fuse_state (state); |
1326 | return; |
1327 | } |
1328 | |
1329 | if (state->resolve.op_errno == ENOENT2) { |
1330 | state->resolve.op_ret = 0; |
1331 | state->resolve.op_errno = 0; |
1332 | } |
1333 | |
1334 | if (state->loc.inode) { |
1335 | 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__ , 1335, GF_LOG_DEBUG, "inode already present"); } while (0); |
1336 | inode_unref (state->loc.inode); |
1337 | state->loc.inode = NULL((void*)0); |
1338 | } |
1339 | |
1340 | state->loc.inode = inode_new (state->loc.parent->table); |
1341 | |
1342 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": MKNOD %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1344, GF_LOG_TRACE, "%""ll" "u" ": MKNOD %s", state->finh->unique, state->loc.path); } while (0) |
1343 | "%"PRIu64": MKNOD %s", state->finh->unique,do { do { if (0) printf ("%""ll" "u"": MKNOD %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1344, GF_LOG_TRACE, "%""ll" "u" ": MKNOD %s", state->finh->unique, state->loc.path); } while (0) |
1344 | state->loc.path)do { do { if (0) printf ("%""ll" "u"": MKNOD %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1344, GF_LOG_TRACE, "%""ll" "u" ": MKNOD %s", state->finh->unique, state->loc.path); } while (0); |
1345 | |
1346 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1348, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 1348, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_MKNOD == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1348, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1348, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 1348, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1348, 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) |
1347 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1348, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 1348, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_MKNOD == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1348, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1348, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 1348, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1348, 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) |
1348 | state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1348, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 1348, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_MKNOD == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1348, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1348, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 1348, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1348, 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); |
1349 | } |
1350 | |
1351 | static void |
1352 | fuse_mknod (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1353 | { |
1354 | struct fuse_mknod_in *fmi = msg; |
1355 | char *name = (char *)(fmi + 1); |
1356 | |
1357 | fuse_state_t *state = NULL((void*)0); |
1358 | fuse_private_t *priv = NULL((void*)0); |
1359 | int32_t ret = -1; |
1360 | |
1361 | priv = this->private; |
1362 | #if FUSE_KERNEL_MINOR_VERSION13 >= 12 |
1363 | if (priv->proto_minor < 12) |
1364 | name = (char *)msg + FUSE_COMPAT_MKNOD_IN_SIZE8; |
1365 | #endif |
1366 | |
1367 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1367, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1368 | |
1369 | uuid_generate (state->gfid); |
1370 | |
1371 | fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, name); |
1372 | |
1373 | state->mode = fmi->mode; |
1374 | state->rdev = fmi->rdev; |
1375 | |
1376 | priv = this->private; |
1377 | #if FUSE_KERNEL_MINOR_VERSION13 >=12 |
1378 | 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__, 1378, 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__, 1378, 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__, 1378, 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); |
1379 | #endif |
1380 | |
1381 | fuse_resolve_and_resume (state, fuse_mknod_resume); |
1382 | |
1383 | return; |
1384 | } |
1385 | |
1386 | void |
1387 | fuse_mkdir_resume (fuse_state_t *state) |
1388 | { |
1389 | if (!state->loc.parent) { |
1390 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("MKDIR %""ll" "d"" (%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__, 1393, GF_LOG_ERROR, "MKDIR %" "ll" "d"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1391 | "MKDIR %"PRId64" (%s/%s) resolution failed",do { do { if (0) printf ("MKDIR %""ll" "d"" (%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__, 1393, GF_LOG_ERROR, "MKDIR %" "ll" "d"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1392 | state->finh->nodeid, uuid_utoa (state->resolve.gfid),do { do { if (0) printf ("MKDIR %""ll" "d"" (%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__, 1393, GF_LOG_ERROR, "MKDIR %" "ll" "d"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1393 | state->resolve.bname)do { do { if (0) printf ("MKDIR %""ll" "d"" (%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__, 1393, GF_LOG_ERROR, "MKDIR %" "ll" "d"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0); |
1394 | send_fuse_err (state->this, state->finh, ENOENT2); |
1395 | free_fuse_state (state); |
1396 | return; |
1397 | } |
1398 | |
1399 | if (state->resolve.op_errno == ENOENT2) { |
1400 | state->resolve.op_ret = 0; |
1401 | state->resolve.op_errno = 0; |
1402 | } |
1403 | |
1404 | if (state->loc.inode) { |
1405 | 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__ , 1405, GF_LOG_DEBUG, "inode already present"); } while (0); |
1406 | inode_unref (state->loc.inode); |
1407 | state->loc.inode = NULL((void*)0); |
1408 | } |
1409 | |
1410 | state->loc.inode = inode_new (state->loc.parent->table); |
1411 | |
1412 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": MKDIR %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1414, GF_LOG_TRACE, "%""ll" "u" ": MKDIR %s", state->finh->unique, state->loc.path); } while (0) |
1413 | "%"PRIu64": MKDIR %s", state->finh->unique,do { do { if (0) printf ("%""ll" "u"": MKDIR %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1414, GF_LOG_TRACE, "%""ll" "u" ": MKDIR %s", state->finh->unique, state->loc.path); } while (0) |
1414 | state->loc.path)do { do { if (0) printf ("%""ll" "u"": MKDIR %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1414, GF_LOG_TRACE, "%""ll" "u" ": MKDIR %s", state->finh->unique, state->loc.path); } while (0); |
1415 | |
1416 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1417, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 1417, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_MKDIR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1417, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1417, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 1417, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1417, 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) |
1417 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1417, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 1417, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_MKDIR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1417, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1417, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 1417, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1417, 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); |
1418 | } |
1419 | |
1420 | static void |
1421 | fuse_mkdir (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1422 | { |
1423 | struct fuse_mkdir_in *fmi = msg; |
1424 | char *name = (char *)(fmi + 1); |
1425 | fuse_private_t *priv = NULL((void*)0); |
1426 | |
1427 | fuse_state_t *state; |
1428 | int32_t ret = -1; |
1429 | |
1430 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1430, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1431 | |
1432 | uuid_generate (state->gfid); |
1433 | |
1434 | fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, name); |
1435 | |
1436 | state->mode = fmi->mode; |
1437 | |
1438 | priv = this->private; |
1439 | #if FUSE_KERNEL_MINOR_VERSION13 >=12 |
1440 | 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__, 1440, 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__, 1440, 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__, 1440, 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); |
1441 | #endif |
1442 | |
1443 | fuse_resolve_and_resume (state, fuse_mkdir_resume); |
1444 | |
1445 | return; |
1446 | } |
1447 | |
1448 | void |
1449 | fuse_unlink_resume (fuse_state_t *state) |
1450 | { |
1451 | if (!state->loc.parent || !state->loc.inode) { |
1452 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("UNLINK %""ll" "d"" (%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__, 1455, GF_LOG_ERROR, "UNLINK %" "ll" "d"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1453 | "UNLINK %"PRId64" (%s/%s) resolution failed",do { do { if (0) printf ("UNLINK %""ll" "d"" (%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__, 1455, GF_LOG_ERROR, "UNLINK %" "ll" "d"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1454 | state->finh->nodeid, uuid_utoa (state->resolve.gfid),do { do { if (0) printf ("UNLINK %""ll" "d"" (%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__, 1455, GF_LOG_ERROR, "UNLINK %" "ll" "d"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1455 | state->resolve.bname)do { do { if (0) printf ("UNLINK %""ll" "d"" (%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__, 1455, GF_LOG_ERROR, "UNLINK %" "ll" "d"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0); |
1456 | send_fuse_err (state->this, state->finh, ENOENT2); |
1457 | free_fuse_state (state); |
1458 | return; |
1459 | } |
1460 | |
1461 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": UNLINK %s", state-> finh->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1463, GF_LOG_TRACE, "%""ll" "u" ": UNLINK %s", state->finh->unique, state->loc.path) ; } while (0) |
1462 | "%"PRIu64": UNLINK %s", state->finh->unique,do { do { if (0) printf ("%""ll" "u"": UNLINK %s", state-> finh->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1463, GF_LOG_TRACE, "%""ll" "u" ": UNLINK %s", state->finh->unique, state->loc.path) ; } while (0) |
1463 | state->loc.path)do { do { if (0) printf ("%""ll" "u"": UNLINK %s", state-> finh->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1463, GF_LOG_TRACE, "%""ll" "u" ": UNLINK %s", state->finh->unique, state->loc.path) ; } while (0); |
1464 | |
1465 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1466, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1466, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_UNLINK == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1466, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1466, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1466, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1466, 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) |
1466 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1466, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1466, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_UNLINK == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1466, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1466, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1466, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1466, 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); |
1467 | } |
1468 | |
1469 | static void |
1470 | fuse_unlink (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1471 | { |
1472 | char *name = msg; |
1473 | fuse_state_t *state = NULL((void*)0); |
1474 | |
1475 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1475, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1476 | |
1477 | fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, name); |
1478 | |
1479 | fuse_resolve_and_resume (state, fuse_unlink_resume); |
1480 | |
1481 | return; |
1482 | } |
1483 | |
1484 | void |
1485 | fuse_rmdir_resume (fuse_state_t *state) |
1486 | { |
1487 | if (!state->loc.parent || !state->loc.inode) { |
1488 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("RMDIR %""ll" "d"" (%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__, 1491, GF_LOG_ERROR, "RMDIR %" "ll" "d"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1489 | "RMDIR %"PRId64" (%s/%s) resolution failed",do { do { if (0) printf ("RMDIR %""ll" "d"" (%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__, 1491, GF_LOG_ERROR, "RMDIR %" "ll" "d"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1490 | state->finh->nodeid, uuid_utoa (state->resolve.gfid),do { do { if (0) printf ("RMDIR %""ll" "d"" (%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__, 1491, GF_LOG_ERROR, "RMDIR %" "ll" "d"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1491 | state->resolve.bname)do { do { if (0) printf ("RMDIR %""ll" "d"" (%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__, 1491, GF_LOG_ERROR, "RMDIR %" "ll" "d"" (%s/%s) resolution failed", state->finh->nodeid , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0); |
1492 | send_fuse_err (state->this, state->finh, ENOENT2); |
1493 | free_fuse_state (state); |
1494 | return; |
1495 | } |
1496 | |
1497 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": RMDIR %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1499, GF_LOG_TRACE, "%""ll" "u" ": RMDIR %s", state->finh->unique, state->loc.path); } while (0) |
1498 | "%"PRIu64": RMDIR %s", state->finh->unique,do { do { if (0) printf ("%""ll" "u"": RMDIR %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1499, GF_LOG_TRACE, "%""ll" "u" ": RMDIR %s", state->finh->unique, state->loc.path); } while (0) |
1499 | state->loc.path)do { do { if (0) printf ("%""ll" "u"": RMDIR %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1499, GF_LOG_TRACE, "%""ll" "u" ": RMDIR %s", state->finh->unique, state->loc.path); } while (0); |
1500 | |
1501 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1502, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 1502, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_RMDIR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1502, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1502, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 1502, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1502, 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) |
1502 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1502, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 1502, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_RMDIR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1502, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1502, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 1502, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1502, 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); |
1503 | } |
1504 | |
1505 | static void |
1506 | fuse_rmdir (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1507 | { |
1508 | char *name = msg; |
1509 | fuse_state_t *state = NULL((void*)0); |
1510 | |
1511 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1511, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1512 | |
1513 | fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, name); |
1514 | |
1515 | fuse_resolve_and_resume (state, fuse_rmdir_resume); |
1516 | |
1517 | return; |
1518 | } |
1519 | |
1520 | void |
1521 | fuse_symlink_resume (fuse_state_t *state) |
1522 | { |
1523 | if (!state->loc.parent) { |
1524 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("SYMLINK %""ll" "d"" (%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__, 1527, GF_LOG_ERROR , "SYMLINK %""ll" "d"" (%s/%s) -> %s resolution failed", state ->finh->nodeid, uuid_utoa (state->resolve.gfid), state ->resolve.bname, state->name); } while (0) |
1525 | "SYMLINK %"PRId64" (%s/%s) -> %s resolution failed",do { do { if (0) printf ("SYMLINK %""ll" "d"" (%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__, 1527, GF_LOG_ERROR , "SYMLINK %""ll" "d"" (%s/%s) -> %s resolution failed", state ->finh->nodeid, uuid_utoa (state->resolve.gfid), state ->resolve.bname, state->name); } while (0) |
1526 | state->finh->nodeid, uuid_utoa (state->resolve.gfid),do { do { if (0) printf ("SYMLINK %""ll" "d"" (%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__, 1527, GF_LOG_ERROR , "SYMLINK %""ll" "d"" (%s/%s) -> %s resolution failed", state ->finh->nodeid, uuid_utoa (state->resolve.gfid), state ->resolve.bname, state->name); } while (0) |
1527 | state->resolve.bname, state->name)do { do { if (0) printf ("SYMLINK %""ll" "d"" (%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__, 1527, GF_LOG_ERROR , "SYMLINK %""ll" "d"" (%s/%s) -> %s resolution failed", state ->finh->nodeid, uuid_utoa (state->resolve.gfid), state ->resolve.bname, state->name); } while (0); |
1528 | send_fuse_err (state->this, state->finh, ENOENT2); |
1529 | free_fuse_state (state); |
1530 | return; |
1531 | } |
1532 | |
1533 | if (state->resolve.op_errno == ENOENT2) { |
1534 | state->resolve.op_ret = 0; |
1535 | state->resolve.op_errno = 0; |
1536 | } |
1537 | |
1538 | if (state->loc.inode) { |
1539 | 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__ , 1539, GF_LOG_DEBUG, "inode already present"); } while (0); |
1540 | inode_unref (state->loc.inode); |
1541 | state->loc.inode = NULL((void*)0); |
1542 | } |
1543 | |
1544 | state->loc.inode = inode_new (state->loc.parent->table); |
1545 | |
1546 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": SYMLINK %s -> %s", state ->finh->unique, state->loc.path, state->name); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1548, GF_LOG_TRACE, "%""ll" "u"": SYMLINK %s -> %s", state ->finh->unique, state->loc.path, state->name); } while (0) |
1547 | "%"PRIu64": SYMLINK %s -> %s", state->finh->unique,do { do { if (0) printf ("%""ll" "u"": SYMLINK %s -> %s", state ->finh->unique, state->loc.path, state->name); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1548, GF_LOG_TRACE, "%""ll" "u"": SYMLINK %s -> %s", state ->finh->unique, state->loc.path, state->name); } while (0) |
1548 | state->loc.path, state->name)do { do { if (0) printf ("%""ll" "u"": SYMLINK %s -> %s", state ->finh->unique, state->loc.path, state->name); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1548, GF_LOG_TRACE, "%""ll" "u"": SYMLINK %s -> %s", state ->finh->unique, state->loc.path, state->name); } while (0); |
1549 | |
1550 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1551, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1551, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_SYMLINK == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1551, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1551, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1551, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1551, 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) |
1551 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1551, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1551, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_SYMLINK == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1551, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1551, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1551, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1551, 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); |
1552 | } |
1553 | |
1554 | static void |
1555 | fuse_symlink (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1556 | { |
1557 | char *name = msg; |
1558 | char *linkname = name + strlen (name) + 1; |
1559 | fuse_state_t *state = NULL((void*)0); |
1560 | |
1561 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1561, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1562 | |
1563 | uuid_generate (state->gfid); |
1564 | |
1565 | fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, name); |
1566 | |
1567 | state->name = gf_strdup (linkname); |
1568 | |
1569 | fuse_resolve_and_resume (state, fuse_symlink_resume); |
1570 | |
1571 | return; |
1572 | } |
1573 | |
1574 | int |
1575 | fuse_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1576 | int32_t op_ret, int32_t op_errno, struct iatt *buf, |
1577 | struct iatt *preoldparent, struct iatt *postoldparent, |
1578 | struct iatt *prenewparent, struct iatt *postnewparent, |
1579 | dict_t *xdata) |
1580 | { |
1581 | fuse_state_t *state = NULL((void*)0); |
1582 | fuse_in_header_t *finh = NULL((void*)0); |
1583 | |
1584 | state = frame->root->state; |
1585 | finh = state->finh; |
1586 | |
1587 | 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, %" "ll" "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, %" "ll" "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) |
1588 | "path: %s parent: %s ==> path: %s parent: %s"do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "ll" "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, %" "ll" "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) |
1589 | "gfid: %s", op_ret, op_errno, frame->root->unique,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "ll" "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, %" "ll" "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) |
1590 | gf_fop_list[frame->root->op], state->loc.path,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "ll" "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, %" "ll" "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) |
1591 | state->loc.parent?uuid_utoa (state->loc.parent->gfid):"",do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "ll" "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, %" "ll" "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) |
1592 | state->loc2.path,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "ll" "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, %" "ll" "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) |
1593 | state->loc2.parent?uuid_utoa (state->loc2.parent->gfid):"",do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "ll" "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, %" "ll" "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) |
1594 | state->loc.inode?uuid_utoa (state->loc.inode->gfid):"")do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "ll" "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, %" "ll" "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); |
1595 | |
1596 | if (op_ret == 0) { |
1597 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": %s -> %s => 0 (buf->ia_ino=%" "ll" "d"")", frame->root->unique, state->loc.path, state ->loc2.path, buf->ia_ino); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1600, GF_LOG_TRACE, "%""ll" "u" ": %s -> %s => 0 (buf->ia_ino=%""ll" "d"")", frame-> root->unique, state->loc.path, state->loc2.path, buf ->ia_ino); } while (0) |
1598 | "%"PRIu64": %s -> %s => 0 (buf->ia_ino=%"PRId64")",do { do { if (0) printf ("%""ll" "u"": %s -> %s => 0 (buf->ia_ino=%" "ll" "d"")", frame->root->unique, state->loc.path, state ->loc2.path, buf->ia_ino); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1600, GF_LOG_TRACE, "%""ll" "u" ": %s -> %s => 0 (buf->ia_ino=%""ll" "d"")", frame-> root->unique, state->loc.path, state->loc2.path, buf ->ia_ino); } while (0) |
1599 | frame->root->unique, state->loc.path, state->loc2.path,do { do { if (0) printf ("%""ll" "u"": %s -> %s => 0 (buf->ia_ino=%" "ll" "d"")", frame->root->unique, state->loc.path, state ->loc2.path, buf->ia_ino); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1600, GF_LOG_TRACE, "%""ll" "u" ": %s -> %s => 0 (buf->ia_ino=%""ll" "d"")", frame-> root->unique, state->loc.path, state->loc2.path, buf ->ia_ino); } while (0) |
1600 | buf->ia_ino)do { do { if (0) printf ("%""ll" "u"": %s -> %s => 0 (buf->ia_ino=%" "ll" "d"")", frame->root->unique, state->loc.path, state ->loc2.path, buf->ia_ino); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1600, GF_LOG_TRACE, "%""ll" "u" ": %s -> %s => 0 (buf->ia_ino=%""ll" "d"")", frame-> root->unique, state->loc.path, state->loc2.path, buf ->ia_ino); } while (0); |
1601 | |
1602 | { |
1603 | /* ugly ugly - to stay blind to situation where |
1604 | rename happens on a new inode |
1605 | */ |
1606 | buf->ia_type = state->loc.inode->ia_type; |
1607 | } |
1608 | buf->ia_blksize = this->ctx->page_size; |
1609 | |
1610 | inode_rename (state->loc.parent->table, |
1611 | state->loc.parent, state->loc.name, |
1612 | state->loc2.parent, state->loc2.name, |
1613 | state->loc.inode, buf); |
1614 | |
1615 | send_fuse_err (this, finh, 0); |
1616 | } else { |
1617 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "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__, 1620, GF_LOG_WARNING, "%""ll" "u"": %s -> %s => -1 (%s)", frame->root->unique, state->loc.path, state->loc2.path, strerror (op_errno) ); } while (0) |
1618 | "%"PRIu64": %s -> %s => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""ll" "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__, 1620, GF_LOG_WARNING, "%""ll" "u"": %s -> %s => -1 (%s)", frame->root->unique, state->loc.path, state->loc2.path, strerror (op_errno) ); } while (0) |
1619 | state->loc.path, state->loc2.path,do { do { if (0) printf ("%""ll" "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__, 1620, GF_LOG_WARNING, "%""ll" "u"": %s -> %s => -1 (%s)", frame->root->unique, state->loc.path, state->loc2.path, strerror (op_errno) ); } while (0) |
1620 | strerror (op_errno))do { do { if (0) printf ("%""ll" "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__, 1620, GF_LOG_WARNING, "%""ll" "u"": %s -> %s => -1 (%s)", frame->root->unique, state->loc.path, state->loc2.path, strerror (op_errno) ); } while (0); |
1621 | send_fuse_err (this, finh, op_errno); |
1622 | } |
1623 | |
1624 | free_fuse_state (state); |
1625 | STACK_DESTROY (frame->root); |
1626 | return 0; |
1627 | } |
1628 | |
1629 | void |
1630 | fuse_rename_resume (fuse_state_t *state) |
1631 | { |
1632 | char loc_uuid[64] = {0,}; |
1633 | char loc2_uuid[64] = {0,}; |
1634 | |
1635 | if (!state->loc.parent || !state->loc.inode) { |
1636 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("RENAME %""ll" "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__ , 1642, GF_LOG_ERROR, "RENAME %""ll" "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) |
1637 | "RENAME %"PRIu64" %s/%s -> %s/%s src resolution failed",do { do { if (0) printf ("RENAME %""ll" "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__ , 1642, GF_LOG_ERROR, "RENAME %""ll" "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) |
1638 | state->finh->unique,do { do { if (0) printf ("RENAME %""ll" "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__ , 1642, GF_LOG_ERROR, "RENAME %""ll" "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) |
1639 | uuid_utoa_r (state->resolve.gfid, loc_uuid),do { do { if (0) printf ("RENAME %""ll" "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__ , 1642, GF_LOG_ERROR, "RENAME %""ll" "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) |
1640 | state->resolve.bname,do { do { if (0) printf ("RENAME %""ll" "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__ , 1642, GF_LOG_ERROR, "RENAME %""ll" "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) |
1641 | uuid_utoa_r (state->resolve2.gfid, loc2_uuid),do { do { if (0) printf ("RENAME %""ll" "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__ , 1642, GF_LOG_ERROR, "RENAME %""ll" "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) |
1642 | state->resolve2.bname)do { do { if (0) printf ("RENAME %""ll" "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__ , 1642, GF_LOG_ERROR, "RENAME %""ll" "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); |
1643 | |
1644 | send_fuse_err (state->this, state->finh, ENOENT2); |
1645 | free_fuse_state (state); |
1646 | return; |
1647 | } |
1648 | |
1649 | if (!state->loc2.parent) { |
1650 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("RENAME %""ll" "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__ , 1656, GF_LOG_ERROR, "RENAME %""ll" "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) |
1651 | "RENAME %"PRIu64" %s/%s -> %s/%s dst resolution failed",do { do { if (0) printf ("RENAME %""ll" "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__ , 1656, GF_LOG_ERROR, "RENAME %""ll" "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) |
1652 | state->finh->unique,do { do { if (0) printf ("RENAME %""ll" "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__ , 1656, GF_LOG_ERROR, "RENAME %""ll" "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) |
1653 | uuid_utoa_r (state->resolve.gfid, loc_uuid),do { do { if (0) printf ("RENAME %""ll" "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__ , 1656, GF_LOG_ERROR, "RENAME %""ll" "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) |
1654 | state->resolve.bname,do { do { if (0) printf ("RENAME %""ll" "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__ , 1656, GF_LOG_ERROR, "RENAME %""ll" "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) |
1655 | uuid_utoa_r (state->resolve2.gfid, loc2_uuid),do { do { if (0) printf ("RENAME %""ll" "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__ , 1656, GF_LOG_ERROR, "RENAME %""ll" "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) |
1656 | state->resolve2.bname)do { do { if (0) printf ("RENAME %""ll" "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__ , 1656, GF_LOG_ERROR, "RENAME %""ll" "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); |
1657 | |
1658 | send_fuse_err (state->this, state->finh, ENOENT2); |
1659 | free_fuse_state (state); |
1660 | return; |
1661 | } |
1662 | |
1663 | state->resolve.op_ret = 0; |
1664 | state->resolve2.op_ret = 0; |
1665 | |
1666 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "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__, 1669, GF_LOG_TRACE, "%""ll" "u" ": RENAME `%s (%s)' -> `%s (%s)'", state->finh->unique , state->loc.path, loc_uuid, state->loc2.path, loc2_uuid ); } while (0) |
1667 | "%"PRIu64": RENAME `%s (%s)' -> `%s (%s)'",do { do { if (0) printf ("%""ll" "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__, 1669, GF_LOG_TRACE, "%""ll" "u" ": RENAME `%s (%s)' -> `%s (%s)'", state->finh->unique , state->loc.path, loc_uuid, state->loc2.path, loc2_uuid ); } while (0) |
1668 | state->finh->unique, state->loc.path, loc_uuid,do { do { if (0) printf ("%""ll" "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__, 1669, GF_LOG_TRACE, "%""ll" "u" ": RENAME `%s (%s)' -> `%s (%s)'", state->finh->unique , state->loc.path, loc_uuid, state->loc2.path, loc2_uuid ); } while (0) |
1669 | state->loc2.path, loc2_uuid)do { do { if (0) printf ("%""ll" "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__, 1669, GF_LOG_TRACE, "%""ll" "u" ": RENAME `%s (%s)' -> `%s (%s)'", state->finh->unique , state->loc.path, loc_uuid, state->loc2.path, loc2_uuid ); } while (0); |
1670 | |
1671 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1672, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1672, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_RENAME == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1672, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1672, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1672, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1672, 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) |
1672 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1672, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1672, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_RENAME == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1672, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1672, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1672, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1672, 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); |
1673 | } |
1674 | |
1675 | static void |
1676 | fuse_rename (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1677 | { |
1678 | struct fuse_rename_in *fri = msg; |
1679 | char *oldname = (char *)(fri + 1); |
1680 | char *newname = oldname + strlen (oldname) + 1; |
1681 | fuse_state_t *state = NULL((void*)0); |
1682 | |
1683 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1683, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1684 | |
1685 | fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, oldname); |
1686 | |
1687 | fuse_resolve_entry_init (state, &state->resolve2, fri->newdir, newname); |
1688 | |
1689 | fuse_resolve_and_resume (state, fuse_rename_resume); |
1690 | |
1691 | return; |
1692 | } |
1693 | |
1694 | void |
1695 | fuse_link_resume (fuse_state_t *state) |
1696 | { |
1697 | if (!state->loc2.inode || !state->loc.parent) { |
1698 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("fuse_loc_fill() failed %""ll" "u"": LINK %s %s" , state->finh->unique, state->loc2.path, state->loc .path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1700, GF_LOG_WARNING, "fuse_loc_fill() failed %" "ll" "u"": LINK %s %s", state->finh->unique, state-> loc2.path, state->loc.path); } while (0) |
1699 | "fuse_loc_fill() failed %"PRIu64": LINK %s %s",do { do { if (0) printf ("fuse_loc_fill() failed %""ll" "u"": LINK %s %s" , state->finh->unique, state->loc2.path, state->loc .path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1700, GF_LOG_WARNING, "fuse_loc_fill() failed %" "ll" "u"": LINK %s %s", state->finh->unique, state-> loc2.path, state->loc.path); } while (0) |
1700 | state->finh->unique, state->loc2.path, state->loc.path)do { do { if (0) printf ("fuse_loc_fill() failed %""ll" "u"": LINK %s %s" , state->finh->unique, state->loc2.path, state->loc .path); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1700, GF_LOG_WARNING, "fuse_loc_fill() failed %" "ll" "u"": LINK %s %s", state->finh->unique, state-> loc2.path, state->loc.path); } while (0); |
1701 | send_fuse_err (state->this, state->finh, ENOENT2); |
1702 | free_fuse_state (state); |
1703 | return; |
1704 | } |
1705 | |
1706 | state->resolve.op_ret = 0; |
1707 | state->resolve2.op_ret = 0; |
1708 | |
1709 | if (state->loc.inode) { |
1710 | inode_unref (state->loc.inode); |
1711 | state->loc.inode = NULL((void*)0); |
1712 | } |
1713 | state->loc.inode = inode_ref (state->loc2.inode); |
1714 | |
1715 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": LINK() %s -> %s", state ->finh->unique, state->loc2.path, state->loc.path ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1718, GF_LOG_TRACE, "%""ll" "u"": LINK() %s -> %s", state ->finh->unique, state->loc2.path, state->loc.path ); } while (0) |
1716 | "%"PRIu64": LINK() %s -> %s",do { do { if (0) printf ("%""ll" "u"": LINK() %s -> %s", state ->finh->unique, state->loc2.path, state->loc.path ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1718, GF_LOG_TRACE, "%""ll" "u"": LINK() %s -> %s", state ->finh->unique, state->loc2.path, state->loc.path ); } while (0) |
1717 | state->finh->unique, state->loc2.path,do { do { if (0) printf ("%""ll" "u"": LINK() %s -> %s", state ->finh->unique, state->loc2.path, state->loc.path ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1718, GF_LOG_TRACE, "%""ll" "u"": LINK() %s -> %s", state ->finh->unique, state->loc2.path, state->loc.path ); } while (0) |
1718 | state->loc.path)do { do { if (0) printf ("%""ll" "u"": LINK() %s -> %s", state ->finh->unique, state->loc2.path, state->loc.path ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1718, GF_LOG_TRACE, "%""ll" "u"": LINK() %s -> %s", state ->finh->unique, state->loc2.path, state->loc.path ); } while (0); |
1719 | |
1720 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1721, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 1721, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_LINK == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1721, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1721, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 1721, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1721, 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) |
1721 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1721, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 1721, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_LINK == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1721, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1721, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 1721, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1721, 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); |
1722 | } |
1723 | |
1724 | static void |
1725 | fuse_link (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1726 | { |
1727 | struct fuse_link_in *fli = msg; |
1728 | char *name = (char *)(fli + 1); |
1729 | fuse_state_t *state = NULL((void*)0); |
1730 | |
1731 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1731, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1732 | |
1733 | fuse_resolve_inode_init (state, &state->resolve2, fli->oldnodeid); |
1734 | |
1735 | fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, name); |
1736 | |
1737 | fuse_resolve_and_resume (state, fuse_link_resume); |
1738 | |
1739 | return; |
1740 | } |
1741 | |
1742 | static int |
1743 | fuse_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
1744 | int32_t op_ret, int32_t op_errno, |
1745 | fd_t *fd, inode_t *inode, struct iatt *buf, |
1746 | struct iatt *preparent, struct iatt *postparent, dict_t *xdata) |
1747 | { |
1748 | fuse_state_t *state = NULL((void*)0); |
1749 | fuse_in_header_t *finh = NULL((void*)0); |
1750 | fuse_private_t *priv = NULL((void*)0); |
1751 | struct fuse_out_header fouh = {0, }; |
1752 | struct fuse_entry_out feo = {0, }; |
1753 | struct fuse_open_out foo = {0, }; |
1754 | struct iovec iov_out[3]; |
1755 | inode_t *linked_inode = NULL((void*)0); |
1756 | |
1757 | state = frame->root->state; |
1758 | priv = this->private; |
1759 | finh = state->finh; |
1760 | foo.open_flags = 0; |
1761 | |
1762 | 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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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); |
1763 | |
1764 | if (op_ret >= 0) { |
1765 | foo.fh = (uintptr_t) fd; |
1766 | |
1767 | if (((priv->direct_io_mode == 2) |
1768 | && ((state->flags & O_ACCMODE0003) != O_RDONLY00)) |
1769 | || (priv->direct_io_mode == 1)) |
1770 | foo.open_flags |= FOPEN_DIRECT_IO(1 << 0); |
1771 | |
1772 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": %s() %s => %p (ino=%" "ll" "d"")", 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__ , 1775, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %p (ino=%""ll" "d"")", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, fd, buf->ia_ino); } while (0 ) |
1773 | "%"PRIu64": %s() %s => %p (ino=%"PRId64")",do { do { if (0) printf ("%""ll" "u"": %s() %s => %p (ino=%" "ll" "d"")", 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__ , 1775, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %p (ino=%""ll" "d"")", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, fd, buf->ia_ino); } while (0 ) |
1774 | frame->root->unique, gf_fop_list[frame->root->op],do { do { if (0) printf ("%""ll" "u"": %s() %s => %p (ino=%" "ll" "d"")", 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__ , 1775, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %p (ino=%""ll" "d"")", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, fd, buf->ia_ino); } while (0 ) |
1775 | state->loc.path, fd, buf->ia_ino)do { do { if (0) printf ("%""ll" "u"": %s() %s => %p (ino=%" "ll" "d"")", 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__ , 1775, GF_LOG_TRACE, "%""ll" "u"": %s() %s => %p (ino=%""ll" "d"")", frame->root->unique, gf_fop_list[frame->root ->op], state->loc.path, fd, buf->ia_ino); } while (0 ); |
1776 | |
1777 | buf->ia_blksize = this->ctx->page_size; |
1778 | gf_fuse_stat2attr (buf, &feo.attr, priv->enable_ino32); |
1779 | |
1780 | linked_inode = inode_link (inode, state->loc.parent, |
1781 | state->loc.name, buf); |
1782 | |
1783 | if (linked_inode != inode) { |
1784 | /* |
1785 | VERY racy code (if used anywhere else) |
1786 | -- don't do this without understanding |
1787 | */ |
1788 | inode_unref (fd->inode); |
1789 | fd->inode = inode_ref (linked_inode); |
1790 | } |
1791 | |
1792 | inode_lookup (linked_inode); |
1793 | |
1794 | inode_unref (linked_inode); |
1795 | |
1796 | feo.nodeid = inode_to_fuse_nodeid (linked_inode); |
1797 | |
1798 | feo.entry_valid = calc_timeout_sec (priv->entry_timeout); |
1799 | feo.entry_valid_nsec = calc_timeout_nsec (priv->entry_timeout); |
1800 | feo.attr_valid = calc_timeout_sec (priv->attribute_timeout); |
1801 | feo.attr_valid_nsec = |
1802 | calc_timeout_nsec (priv->attribute_timeout); |
1803 | |
1804 | fouh.error = 0; |
1805 | iov_out[0].iov_base = &fouh; |
1806 | iov_out[1].iov_base = &feo; |
1807 | #if FUSE_KERNEL_MINOR_VERSION13 >= 9 |
1808 | iov_out[1].iov_len = priv->proto_minor >= 9 ? |
1809 | sizeof (feo) : |
1810 | FUSE_COMPAT_ENTRY_OUT_SIZE120; |
1811 | #else |
1812 | iov_out[1].iov_len = sizeof (feo); |
1813 | #endif |
1814 | iov_out[2].iov_base = &foo; |
1815 | iov_out[2].iov_len = sizeof (foo); |
1816 | |
1817 | if (send_fuse_iov (this, finh, iov_out, 3) == ENOENT2) { |
1818 | 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__, 1819, GF_LOG_DEBUG, "create(%s) got EINTR", state ->loc.path); } while (0) |
1819 | "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__, 1819, GF_LOG_DEBUG, "create(%s) got EINTR", state ->loc.path); } while (0); |
1820 | inode_forget (inode, 1); |
1821 | gf_fd_put (priv->fdtable, state->fd_no); |
1822 | goto out; |
1823 | } |
1824 | |
1825 | fd_bind (fd); |
1826 | } else { |
1827 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": %s => -1 (%s)", finh ->unique, state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1829, GF_LOG_WARNING, "%""ll" "u"": %s => -1 (%s)", finh ->unique, state->loc.path, strerror (op_errno)); } while (0) |
1828 | "%"PRIu64": %s => -1 (%s)", finh->unique,do { do { if (0) printf ("%""ll" "u"": %s => -1 (%s)", finh ->unique, state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1829, GF_LOG_WARNING, "%""ll" "u"": %s => -1 (%s)", finh ->unique, state->loc.path, strerror (op_errno)); } while (0) |
1829 | state->loc.path, strerror (op_errno))do { do { if (0) printf ("%""ll" "u"": %s => -1 (%s)", finh ->unique, state->loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1829, GF_LOG_WARNING, "%""ll" "u"": %s => -1 (%s)", finh ->unique, state->loc.path, strerror (op_errno)); } while (0); |
1830 | send_fuse_err (this, finh, op_errno); |
1831 | gf_fd_put (priv->fdtable, state->fd_no); |
1832 | } |
1833 | out: |
1834 | free_fuse_state (state); |
1835 | STACK_DESTROY (frame->root); |
1836 | |
1837 | return 0; |
1838 | } |
1839 | |
1840 | void |
1841 | fuse_create_resume (fuse_state_t *state) |
1842 | { |
1843 | fd_t *fd = NULL((void*)0); |
1844 | fuse_private_t *priv = NULL((void*)0); |
1845 | fuse_fd_ctx_t *fdctx = NULL((void*)0); |
1846 | |
1847 | if (!state->loc.parent) { |
1848 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "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__, 1851, GF_LOG_WARNING, "%""ll" "u"" CREATE %s/%s resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1849 | "%"PRIu64" CREATE %s/%s resolution failed",do { do { if (0) printf ("%""ll" "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__, 1851, GF_LOG_WARNING, "%""ll" "u"" CREATE %s/%s resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1850 | state->finh->unique, uuid_utoa (state->resolve.gfid),do { do { if (0) printf ("%""ll" "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__, 1851, GF_LOG_WARNING, "%""ll" "u"" CREATE %s/%s resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0) |
1851 | state->resolve.bname)do { do { if (0) printf ("%""ll" "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__, 1851, GF_LOG_WARNING, "%""ll" "u"" CREATE %s/%s resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->resolve.bname ); } while (0); |
1852 | send_fuse_err (state->this, state->finh, ENOENT2); |
1853 | free_fuse_state (state); |
1854 | return; |
1855 | } |
1856 | |
1857 | if (state->resolve.op_errno == ENOENT2) { |
1858 | state->resolve.op_ret = 0; |
1859 | state->resolve.op_errno = 0; |
1860 | } |
1861 | |
1862 | if (state->loc.inode) { |
1863 | 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__ , 1864, GF_LOG_DEBUG, "inode already present"); } while (0) |
1864 | "inode already present")do { do { if (0) printf ("inode already present"); } while (0 ); _gf_log (state->this->name, "fuse-bridge.c", __FUNCTION__ , 1864, GF_LOG_DEBUG, "inode already present"); } while (0); |
1865 | inode_unref (state->loc.inode); |
1866 | } |
1867 | |
1868 | state->loc.inode = inode_new (state->loc.parent->table); |
1869 | |
1870 | fd = fd_create (state->loc.inode, state->finh->pid); |
1871 | if (fd == NULL((void*)0)) { |
1872 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"" CREATE cannot create a new fd" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1874, GF_LOG_WARNING, "%""ll" "u"" CREATE cannot create a new fd", state->finh->unique ); } while (0) |
1873 | "%"PRIu64" CREATE cannot create a new fd",do { do { if (0) printf ("%""ll" "u"" CREATE cannot create a new fd" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1874, GF_LOG_WARNING, "%""ll" "u"" CREATE cannot create a new fd", state->finh->unique ); } while (0) |
1874 | state->finh->unique)do { do { if (0) printf ("%""ll" "u"" CREATE cannot create a new fd" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1874, GF_LOG_WARNING, "%""ll" "u"" CREATE cannot create a new fd", state->finh->unique ); } while (0); |
1875 | send_fuse_err (state->this, state->finh, ENOMEM12); |
1876 | free_fuse_state (state); |
1877 | return; |
1878 | } |
1879 | |
1880 | fdctx = fuse_fd_ctx_check_n_create (state->this, fd); |
1881 | if (fdctx == NULL((void*)0)) { |
1882 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"" CREATE creation of fdctx failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1884, GF_LOG_WARNING, "%""ll" "u"" CREATE creation of fdctx failed", state->finh->unique ); } while (0) |
1883 | "%"PRIu64" CREATE creation of fdctx failed",do { do { if (0) printf ("%""ll" "u"" CREATE creation of fdctx failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1884, GF_LOG_WARNING, "%""ll" "u"" CREATE creation of fdctx failed", state->finh->unique ); } while (0) |
1884 | state->finh->unique)do { do { if (0) printf ("%""ll" "u"" CREATE creation of fdctx failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1884, GF_LOG_WARNING, "%""ll" "u"" CREATE creation of fdctx failed", state->finh->unique ); } while (0); |
1885 | fd_unref (fd); |
1886 | send_fuse_err (state->this, state->finh, ENOMEM12); |
1887 | free_fuse_state (state); |
1888 | return; |
1889 | } |
1890 | |
1891 | priv = state->this->private; |
1892 | |
1893 | state->fd_no = gf_fd_unused_get (priv->fdtable, fd); |
1894 | |
1895 | state->fd = fd_ref (fd); |
1896 | fd->flags = state->flags; |
1897 | |
1898 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": CREATE %s", state-> finh->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1900, GF_LOG_TRACE, "%""ll" "u" ": CREATE %s", state->finh->unique, state->loc.path) ; } while (0) |
1899 | "%"PRIu64": CREATE %s", state->finh->unique,do { do { if (0) printf ("%""ll" "u"": CREATE %s", state-> finh->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1900, GF_LOG_TRACE, "%""ll" "u" ": CREATE %s", state->finh->unique, state->loc.path) ; } while (0) |
1900 | state->loc.path)do { do { if (0) printf ("%""ll" "u"": CREATE %s", state-> finh->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1900, GF_LOG_TRACE, "%""ll" "u" ": CREATE %s", state->finh->unique, state->loc.path) ; } while (0); |
1901 | |
1902 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1904, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1904, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_CREATE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1904, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1904, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1904, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1904, 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) |
1903 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1904, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1904, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_CREATE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1904, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1904, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1904, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1904, 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) |
1904 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1904, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 1904, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_CREATE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1904, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 1904, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 1904, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1904, 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); |
1905 | |
1906 | } |
1907 | |
1908 | static void |
1909 | fuse_create (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1910 | { |
1911 | #if FUSE_KERNEL_MINOR_VERSION13 >= 12 |
1912 | struct fuse_create_in *fci = msg; |
1913 | #else |
1914 | struct fuse_open_in *fci = msg; |
1915 | #endif |
1916 | char *name = (char *)(fci + 1); |
1917 | |
1918 | fuse_private_t *priv = NULL((void*)0); |
1919 | fuse_state_t *state = NULL((void*)0); |
1920 | int32_t ret = -1; |
1921 | |
1922 | priv = this->private; |
1923 | #if FUSE_KERNEL_MINOR_VERSION13 >= 12 |
1924 | if (priv->proto_minor < 12) |
1925 | name = (char *)((struct fuse_open_in *)msg + 1); |
1926 | #endif |
1927 | |
1928 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1928, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
1929 | |
1930 | uuid_generate (state->gfid); |
1931 | |
1932 | fuse_resolve_entry_init (state, &state->resolve, finh->nodeid, name); |
1933 | |
1934 | state->mode = fci->mode; |
1935 | state->flags = fci->flags; |
1936 | |
1937 | priv = this->private; |
1938 | #if FUSE_KERNEL_MINOR_VERSION13 >=12 |
1939 | 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__, 1939, 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__, 1939, 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__, 1939, 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); |
1940 | #endif |
1941 | fuse_resolve_and_resume (state, fuse_create_resume); |
1942 | |
1943 | return; |
1944 | } |
1945 | |
1946 | void |
1947 | fuse_open_resume (fuse_state_t *state) |
1948 | { |
1949 | fd_t *fd = NULL((void*)0); |
1950 | fuse_private_t *priv = NULL((void*)0); |
1951 | fuse_fd_ctx_t *fdctx = NULL((void*)0); |
1952 | |
1953 | if (!state->loc.inode) { |
1954 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("%""ll" "u"": OPEN %s resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1956, GF_LOG_ERROR, "%""ll" "u"": OPEN %s resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0) |
1955 | "%"PRIu64": OPEN %s resolution failed",do { do { if (0) printf ("%""ll" "u"": OPEN %s resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1956, GF_LOG_ERROR, "%""ll" "u"": OPEN %s resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0) |
1956 | state->finh->unique, uuid_utoa (state->resolve.gfid))do { do { if (0) printf ("%""ll" "u"": OPEN %s resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1956, GF_LOG_ERROR, "%""ll" "u"": OPEN %s resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); |
1957 | |
1958 | send_fuse_err (state->this, state->finh, ENOENT2); |
1959 | free_fuse_state (state); |
1960 | return; |
1961 | } |
1962 | |
1963 | fd = fd_create (state->loc.inode, state->finh->pid); |
1964 | if (!fd) { |
1965 | gf_log ("fuse", GF_LOG_ERROR,do { do { if (0) printf ("fd is NULL"); } while (0); _gf_log ( "fuse", "fuse-bridge.c", __FUNCTION__, 1966, GF_LOG_ERROR, "fd is NULL" ); } while (0) |
1966 | "fd is NULL")do { do { if (0) printf ("fd is NULL"); } while (0); _gf_log ( "fuse", "fuse-bridge.c", __FUNCTION__, 1966, GF_LOG_ERROR, "fd is NULL" ); } while (0); |
1967 | send_fuse_err (state->this, state->finh, ENOENT2); |
1968 | free_fuse_state (state); |
1969 | return; |
1970 | } |
1971 | |
1972 | fdctx = fuse_fd_ctx_check_n_create (state->this, fd); |
1973 | if (fdctx == NULL((void*)0)) { |
1974 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": OPEN creation of fdctx failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1976, GF_LOG_WARNING, "%""ll" "u"": OPEN creation of fdctx failed", state->finh->unique ); } while (0) |
1975 | "%"PRIu64": OPEN creation of fdctx failed",do { do { if (0) printf ("%""ll" "u"": OPEN creation of fdctx failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1976, GF_LOG_WARNING, "%""ll" "u"": OPEN creation of fdctx failed", state->finh->unique ); } while (0) |
1976 | state->finh->unique)do { do { if (0) printf ("%""ll" "u"": OPEN creation of fdctx failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1976, GF_LOG_WARNING, "%""ll" "u"": OPEN creation of fdctx failed", state->finh->unique ); } while (0); |
1977 | fd_unref (fd); |
1978 | send_fuse_err (state->this, state->finh, ENOMEM12); |
1979 | free_fuse_state (state); |
1980 | return; |
1981 | } |
1982 | |
1983 | priv = state->this->private; |
1984 | |
1985 | state->fd_no = gf_fd_unused_get (priv->fdtable, fd); |
1986 | state->fd = fd_ref (fd); |
1987 | fd->flags = state->flags; |
1988 | |
1989 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": OPEN %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1991, GF_LOG_TRACE, "%""ll" "u" ": OPEN %s", state->finh->unique, state->loc.path); } while (0) |
1990 | "%"PRIu64": OPEN %s", state->finh->unique,do { do { if (0) printf ("%""ll" "u"": OPEN %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1991, GF_LOG_TRACE, "%""ll" "u" ": OPEN %s", state->finh->unique, state->loc.path); } while (0) |
1991 | state->loc.path)do { do { if (0) printf ("%""ll" "u"": OPEN %s", state->finh ->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 1991, GF_LOG_TRACE, "%""ll" "u" ": OPEN %s", state->finh->unique, state->loc.path); } while (0); |
1992 | |
1993 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1994, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 1994, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_OPEN == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1994, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1994, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 1994, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1994, 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) |
1994 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1994, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 1994, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_OPEN == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 1994, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 1994, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 1994, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 1994, 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); |
1995 | } |
1996 | |
1997 | static void |
1998 | fuse_open (xlator_t *this, fuse_in_header_t *finh, void *msg) |
1999 | { |
2000 | struct fuse_open_in *foi = msg; |
2001 | fuse_state_t *state = NULL((void*)0); |
2002 | |
2003 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2003, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2004 | |
2005 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
2006 | |
2007 | state->flags = foi->flags; |
2008 | |
2009 | fuse_resolve_and_resume (state, fuse_open_resume); |
2010 | |
2011 | return; |
2012 | } |
2013 | |
2014 | static int |
2015 | fuse_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
2016 | int32_t op_ret, int32_t op_errno, |
2017 | struct iovec *vector, int32_t count, |
2018 | struct iatt *stbuf, struct iobref *iobref, dict_t *xdata) |
2019 | { |
2020 | fuse_state_t *state = NULL((void*)0); |
2021 | fuse_in_header_t *finh = NULL((void*)0); |
2022 | struct fuse_out_header fouh = {0, }; |
2023 | struct iovec *iov_out = NULL((void*)0); |
2024 | |
2025 | state = frame->root->state; |
2026 | finh = state->finh; |
2027 | |
2028 | 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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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); |
2029 | |
2030 | if (op_ret >= 0) { |
2031 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": READ => %d/%""zu"",%" "ll" "d""/%""ll" "d", frame->root->unique, op_ret, state ->size, state->off, stbuf->ia_size); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2034, GF_LOG_TRACE , "%""ll" "u"": READ => %d/%""zu"",%""ll" "d""/%""ll" "d", frame->root->unique, op_ret, state->size, state-> off, stbuf->ia_size); } while (0) |
2032 | "%"PRIu64": READ => %d/%"GF_PRI_SIZET",%"PRId64"/%"PRId64,do { do { if (0) printf ("%""ll" "u"": READ => %d/%""zu"",%" "ll" "d""/%""ll" "d", frame->root->unique, op_ret, state ->size, state->off, stbuf->ia_size); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2034, GF_LOG_TRACE , "%""ll" "u"": READ => %d/%""zu"",%""ll" "d""/%""ll" "d", frame->root->unique, op_ret, state->size, state-> off, stbuf->ia_size); } while (0) |
2033 | frame->root->unique,do { do { if (0) printf ("%""ll" "u"": READ => %d/%""zu"",%" "ll" "d""/%""ll" "d", frame->root->unique, op_ret, state ->size, state->off, stbuf->ia_size); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2034, GF_LOG_TRACE , "%""ll" "u"": READ => %d/%""zu"",%""ll" "d""/%""ll" "d", frame->root->unique, op_ret, state->size, state-> off, stbuf->ia_size); } while (0) |
2034 | op_ret, state->size, state->off, stbuf->ia_size)do { do { if (0) printf ("%""ll" "u"": READ => %d/%""zu"",%" "ll" "d""/%""ll" "d", frame->root->unique, op_ret, state ->size, state->off, stbuf->ia_size); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2034, GF_LOG_TRACE , "%""ll" "u"": READ => %d/%""zu"",%""ll" "d""/%""ll" "d", frame->root->unique, op_ret, state->size, state-> off, stbuf->ia_size); } while (0); |
2035 | |
2036 | iov_out = GF_CALLOC (count + 1, sizeof (*iov_out),__gf_calloc (count + 1, sizeof (*iov_out), gf_fuse_mt_iovec) |
2037 | gf_fuse_mt_iovec)__gf_calloc (count + 1, sizeof (*iov_out), gf_fuse_mt_iovec); |
2038 | if (iov_out) { |
2039 | fouh.error = 0; |
2040 | iov_out[0].iov_base = &fouh; |
2041 | memcpy (iov_out + 1, vector, count * sizeof (*iov_out)); |
2042 | send_fuse_iov (this, finh, iov_out, count + 1); |
2043 | GF_FREE (iov_out)__gf_free (iov_out); |
2044 | } else |
2045 | send_fuse_err (this, finh, ENOMEM12); |
2046 | } else { |
2047 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": READ => %d (%s)", frame ->root->unique, op_ret, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2049, GF_LOG_WARNING, "%""ll" "u"": READ => %d (%s)", frame ->root->unique, op_ret, strerror (op_errno)); } while ( 0) |
2048 | "%"PRIu64": READ => %d (%s)", frame->root->unique,do { do { if (0) printf ("%""ll" "u"": READ => %d (%s)", frame ->root->unique, op_ret, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2049, GF_LOG_WARNING, "%""ll" "u"": READ => %d (%s)", frame ->root->unique, op_ret, strerror (op_errno)); } while ( 0) |
2049 | op_ret, strerror (op_errno))do { do { if (0) printf ("%""ll" "u"": READ => %d (%s)", frame ->root->unique, op_ret, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2049, GF_LOG_WARNING, "%""ll" "u"": READ => %d (%s)", frame ->root->unique, op_ret, strerror (op_errno)); } while ( 0); |
2050 | |
2051 | send_fuse_err (this, finh, op_errno); |
2052 | } |
2053 | |
2054 | free_fuse_state (state); |
2055 | STACK_DESTROY (frame->root); |
2056 | |
2057 | return 0; |
2058 | } |
2059 | |
2060 | void |
2061 | fuse_readv_resume (fuse_state_t *state) |
2062 | { |
2063 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": READ (%p, size=%zu, offset=%" "ll" "u"")", state->finh->unique, state->fd, state-> size, state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2065, GF_LOG_TRACE, "%""ll" "u" ": READ (%p, size=%zu, offset=%""ll" "u"")", state->finh-> unique, state->fd, state->size, state->off); } while (0) |
2064 | "%"PRIu64": READ (%p, size=%zu, offset=%"PRIu64")",do { do { if (0) printf ("%""ll" "u"": READ (%p, size=%zu, offset=%" "ll" "u"")", state->finh->unique, state->fd, state-> size, state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2065, GF_LOG_TRACE, "%""ll" "u" ": READ (%p, size=%zu, offset=%""ll" "u"")", state->finh-> unique, state->fd, state->size, state->off); } while (0) |
2065 | state->finh->unique, state->fd, state->size, state->off)do { do { if (0) printf ("%""ll" "u"": READ (%p, size=%zu, offset=%" "ll" "u"")", state->finh->unique, state->fd, state-> size, state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2065, GF_LOG_TRACE, "%""ll" "u" ": READ (%p, size=%zu, offset=%""ll" "u"")", state->finh-> unique, state->fd, state->size, state->off); } while (0); |
2066 | |
2067 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "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 %""ll" "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; 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 (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_READ == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2068, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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, "%""ll" "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 ("%""ll" "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__,"%""ll" "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->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) |
2068 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "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 %""ll" "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; 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 (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_READ == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2068, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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, "%""ll" "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 ("%""ll" "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__,"%""ll" "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->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); |
2069 | } |
2070 | |
2071 | static void |
2072 | fuse_readv (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2073 | { |
2074 | struct fuse_read_in *fri = msg; |
2075 | |
2076 | fuse_private_t *priv = NULL((void*)0); |
2077 | fuse_state_t *state = NULL((void*)0); |
2078 | fd_t *fd = NULL((void*)0); |
2079 | |
2080 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2080, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2081 | |
2082 | fd = FH_TO_FD (fri->fh)((((fd_t *)(uintptr_t)(fri->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fri->fh)))):((fd_t *) 0)); |
2083 | state->fd = fd; |
2084 | |
2085 | fuse_resolve_fd_init (state, &state->resolve, fd); |
2086 | |
2087 | /* See comment by similar code in fuse_settatr */ |
2088 | priv = this->private; |
2089 | #if FUSE_KERNEL_MINOR_VERSION13 >= 9 |
2090 | if (priv->proto_minor >= 9 && fri->read_flags & FUSE_READ_LOCKOWNER(1 << 1)) |
2091 | state->lk_owner = fri->lock_owner; |
2092 | #endif |
2093 | |
2094 | state->size = fri->size; |
2095 | state->off = fri->offset; |
2096 | /* lets ignore 'fri->read_flags', but just consider 'fri->flags' */ |
2097 | state->io_flags = fri->flags; |
2098 | |
2099 | fuse_resolve_and_resume (state, fuse_readv_resume); |
2100 | } |
2101 | |
2102 | static int |
2103 | fuse_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
2104 | int32_t op_ret, int32_t op_errno, |
2105 | struct iatt *stbuf, struct iatt *postbuf, dict_t *xdata) |
2106 | { |
2107 | fuse_state_t *state = NULL((void*)0); |
2108 | fuse_in_header_t *finh = NULL((void*)0); |
2109 | struct fuse_write_out fwo = {0, }; |
2110 | |
2111 | state = frame->root->state; |
2112 | finh = state->finh; |
2113 | |
2114 | 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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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); |
2115 | |
2116 | if (op_ret >= 0) { |
2117 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": WRITE => %d/%""zu"",%" "ll" "d""/%""ll" "d", frame->root->unique, op_ret, state ->size, state->off, stbuf->ia_size); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2120, GF_LOG_TRACE , "%""ll" "u"": WRITE => %d/%""zu"",%""ll" "d""/%""ll" "d" , frame->root->unique, op_ret, state->size, state-> off, stbuf->ia_size); } while (0) |
2118 | "%"PRIu64": WRITE => %d/%"GF_PRI_SIZET",%"PRId64"/%"PRId64,do { do { if (0) printf ("%""ll" "u"": WRITE => %d/%""zu"",%" "ll" "d""/%""ll" "d", frame->root->unique, op_ret, state ->size, state->off, stbuf->ia_size); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2120, GF_LOG_TRACE , "%""ll" "u"": WRITE => %d/%""zu"",%""ll" "d""/%""ll" "d" , frame->root->unique, op_ret, state->size, state-> off, stbuf->ia_size); } while (0) |
2119 | frame->root->unique,do { do { if (0) printf ("%""ll" "u"": WRITE => %d/%""zu"",%" "ll" "d""/%""ll" "d", frame->root->unique, op_ret, state ->size, state->off, stbuf->ia_size); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2120, GF_LOG_TRACE , "%""ll" "u"": WRITE => %d/%""zu"",%""ll" "d""/%""ll" "d" , frame->root->unique, op_ret, state->size, state-> off, stbuf->ia_size); } while (0) |
2120 | op_ret, state->size, state->off, stbuf->ia_size)do { do { if (0) printf ("%""ll" "u"": WRITE => %d/%""zu"",%" "ll" "d""/%""ll" "d", frame->root->unique, op_ret, state ->size, state->off, stbuf->ia_size); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2120, GF_LOG_TRACE , "%""ll" "u"": WRITE => %d/%""zu"",%""ll" "d""/%""ll" "d" , frame->root->unique, op_ret, state->size, state-> off, stbuf->ia_size); } while (0); |
2121 | |
2122 | fwo.size = op_ret; |
2123 | send_fuse_obj (this, finh, &fwo)send_fuse_data (this, finh, &fwo, sizeof (*(&fwo))); |
2124 | } else { |
2125 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": WRITE => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2127, GF_LOG_WARNING , "%""ll" "u"": WRITE => -1 (%s)", frame->root->unique , strerror (op_errno)); } while (0) |
2126 | "%"PRIu64": WRITE => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""ll" "u"": WRITE => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2127, GF_LOG_WARNING , "%""ll" "u"": WRITE => -1 (%s)", frame->root->unique , strerror (op_errno)); } while (0) |
2127 | strerror (op_errno))do { do { if (0) printf ("%""ll" "u"": WRITE => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2127, GF_LOG_WARNING , "%""ll" "u"": WRITE => -1 (%s)", frame->root->unique , strerror (op_errno)); } while (0); |
2128 | |
2129 | send_fuse_err (this, finh, op_errno); |
2130 | } |
2131 | |
2132 | free_fuse_state (state); |
2133 | STACK_DESTROY (frame->root); |
2134 | |
2135 | return 0; |
2136 | } |
2137 | |
2138 | void |
2139 | fuse_write_resume (fuse_state_t *state) |
2140 | { |
2141 | struct iobref *iobref = NULL((void*)0); |
2142 | struct iobuf *iobuf = NULL((void*)0); |
2143 | |
2144 | |
2145 | iobref = iobref_new (); |
2146 | if (!iobref) { |
2147 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("%""ll" "u"": WRITE iobref allocation failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2149, GF_LOG_ERROR, "%""ll" "u" ": WRITE iobref allocation failed", state->finh->unique ); } while (0) |
2148 | "%"PRIu64": WRITE iobref allocation failed",do { do { if (0) printf ("%""ll" "u"": WRITE iobref allocation failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2149, GF_LOG_ERROR, "%""ll" "u" ": WRITE iobref allocation failed", state->finh->unique ); } while (0) |
2149 | state->finh->unique)do { do { if (0) printf ("%""ll" "u"": WRITE iobref allocation failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2149, GF_LOG_ERROR, "%""ll" "u" ": WRITE iobref allocation failed", state->finh->unique ); } while (0); |
2150 | send_fuse_err (state->this, state->finh, ENOMEM12); |
2151 | |
2152 | free_fuse_state (state); |
2153 | return; |
2154 | } |
2155 | |
2156 | iobuf = ((fuse_private_t *) (state->this->private))->iobuf; |
2157 | iobref_add (iobref, iobuf); |
2158 | |
2159 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": WRITE (%p, size=%""ll" "d"", offset=%""ll" "d"")", state->finh->unique, state ->fd, state->size, state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2161, GF_LOG_TRACE , "%""ll" "u"": WRITE (%p, size=%""ll" "d"", offset=%""ll" "d" ")", state->finh->unique, state->fd, state->size, state->off); } while (0) |
2160 | "%"PRIu64": WRITE (%p, size=%"PRId64", offset=%"PRId64")",do { do { if (0) printf ("%""ll" "u"": WRITE (%p, size=%""ll" "d"", offset=%""ll" "d"")", state->finh->unique, state ->fd, state->size, state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2161, GF_LOG_TRACE , "%""ll" "u"": WRITE (%p, size=%""ll" "d"", offset=%""ll" "d" ")", state->finh->unique, state->fd, state->size, state->off); } while (0) |
2161 | state->finh->unique, state->fd, state->size, state->off)do { do { if (0) printf ("%""ll" "u"": WRITE (%p, size=%""ll" "d"", offset=%""ll" "d"")", state->finh->unique, state ->fd, state->size, state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2161, GF_LOG_TRACE , "%""ll" "u"": WRITE (%p, size=%""ll" "d"", offset=%""ll" "d" ")", state->finh->unique, state->fd, state->size, state->off); } while (0); |
2162 | |
2163 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2165, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 2165, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_WRITE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2165, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2165, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 2165, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2165, 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) |
2164 | &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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2165, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 2165, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_WRITE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2165, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2165, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 2165, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2165, 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) |
2165 | state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2165, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 2165, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_WRITE == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2165, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2165, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 2165, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2165, 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); |
2166 | |
2167 | iobref_unref (iobref); |
2168 | } |
2169 | |
2170 | static void |
2171 | fuse_write (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2172 | { |
2173 | /* WRITE is special, metadata is attached to in_header, |
2174 | * and msg is the payload as-is. |
2175 | */ |
2176 | struct fuse_write_in *fwi = (struct fuse_write_in *) |
2177 | (finh + 1); |
2178 | |
2179 | fuse_private_t *priv = NULL((void*)0); |
2180 | fuse_state_t *state = NULL((void*)0); |
2181 | fd_t *fd = NULL((void*)0); |
2182 | |
2183 | priv = this->private; |
2184 | |
2185 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2185, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2186 | fd = FH_TO_FD (fwi->fh)((((fd_t *)(uintptr_t)(fwi->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fwi->fh)))):((fd_t *) 0)); |
2187 | state->fd = fd; |
2188 | state->size = fwi->size; |
2189 | state->off = fwi->offset; |
2190 | |
2191 | /* lets ignore 'fwi->write_flags', but just consider 'fwi->flags' */ |
2192 | state->io_flags = fwi->flags; |
2193 | /* TODO: may need to handle below flag |
2194 | (fwi->write_flags & FUSE_WRITE_CACHE); |
2195 | */ |
2196 | |
2197 | |
2198 | fuse_resolve_fd_init (state, &state->resolve, fd); |
2199 | |
2200 | /* See comment by similar code in fuse_settatr */ |
2201 | priv = this->private; |
2202 | #if FUSE_KERNEL_MINOR_VERSION13 >= 9 |
2203 | if (priv->proto_minor >= 9 && fwi->write_flags & FUSE_WRITE_LOCKOWNER(1 << 1)) |
2204 | state->lk_owner = fwi->lock_owner; |
2205 | #endif |
2206 | |
2207 | state->vector.iov_base = msg; |
2208 | state->vector.iov_len = fwi->size; |
2209 | |
2210 | fuse_resolve_and_resume (state, fuse_write_resume); |
2211 | |
2212 | return; |
2213 | } |
2214 | |
2215 | void |
2216 | fuse_flush_resume (fuse_state_t *state) |
2217 | { |
2218 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2219, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 2219, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_FLUSH == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2219, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2219, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 2219, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2219, 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) |
2219 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2219, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 2219, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_FLUSH == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2219, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2219, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 2219, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2219, 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); |
2220 | } |
2221 | |
2222 | static void |
2223 | fuse_flush (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2224 | { |
2225 | struct fuse_flush_in *ffi = msg; |
2226 | |
2227 | fuse_state_t *state = NULL((void*)0); |
2228 | fd_t *fd = NULL((void*)0); |
2229 | |
2230 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2230, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2231 | fd = FH_TO_FD (ffi->fh)((((fd_t *)(uintptr_t)(ffi->fh)))?(fd_ref (((fd_t *)(uintptr_t )(ffi->fh)))):((fd_t *) 0)); |
2232 | state->fd = fd; |
2233 | |
2234 | fuse_resolve_fd_init (state, &state->resolve, fd); |
2235 | |
2236 | state->lk_owner = ffi->lock_owner; |
2237 | |
2238 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": FLUSH %p", finh->unique , fd); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2239, GF_LOG_TRACE, "%""ll" "u"": FLUSH %p", finh ->unique, fd); } while (0) |
2239 | "%"PRIu64": FLUSH %p", finh->unique, fd)do { do { if (0) printf ("%""ll" "u"": FLUSH %p", finh->unique , fd); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2239, GF_LOG_TRACE, "%""ll" "u"": FLUSH %p", finh ->unique, fd); } while (0); |
2240 | |
2241 | fuse_resolve_and_resume (state, fuse_flush_resume); |
2242 | |
2243 | return; |
2244 | } |
2245 | |
2246 | static void |
2247 | fuse_release (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2248 | { |
2249 | struct fuse_release_in *fri = msg; |
2250 | fd_t *activefd = NULL((void*)0); |
2251 | fd_t *fd = NULL((void*)0); |
2252 | uint64_t val = 0; |
2253 | int ret = 0; |
2254 | fuse_state_t *state = NULL((void*)0); |
2255 | fuse_fd_ctx_t *fdctx = NULL((void*)0); |
2256 | fuse_private_t *priv = NULL((void*)0); |
2257 | |
2258 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2258, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2259 | fd = FH_TO_FD (fri->fh)((((fd_t *)(uintptr_t)(fri->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fri->fh)))):((fd_t *) 0)); |
2260 | state->fd = fd; |
2261 | |
2262 | priv = this->private; |
2263 | |
2264 | fuse_log_eh (this, "RELEASE(): %"PRIu64":, fd: %p, gfid: %s",do { if (this->history) do { do { if (0) printf ("RELEASE(): %" "ll" "u"":, fd: %p, gfid: %s", finh->unique, fd, uuid_utoa (fd->inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__ ,"RELEASE(): %""ll" "u"":, fd: %p, gfid: %s", finh->unique , fd, uuid_utoa (fd->inode->gfid)); } while (0); } while (0) |
2265 | finh->unique, fd, uuid_utoa (fd->inode->gfid))do { if (this->history) do { do { if (0) printf ("RELEASE(): %" "ll" "u"":, fd: %p, gfid: %s", finh->unique, fd, uuid_utoa (fd->inode->gfid)); } while (0); _gf_log_eh (__FUNCTION__ ,"RELEASE(): %""ll" "u"":, fd: %p, gfid: %s", finh->unique , fd, uuid_utoa (fd->inode->gfid)); } while (0); } while (0); |
2266 | |
2267 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": RELEASE %p", finh-> unique, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2268, GF_LOG_TRACE, "%""ll" "u" ": RELEASE %p", finh->unique, state->fd); } while (0) |
2268 | "%"PRIu64": RELEASE %p", finh->unique, state->fd)do { do { if (0) printf ("%""ll" "u"": RELEASE %p", finh-> unique, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2268, GF_LOG_TRACE, "%""ll" "u" ": RELEASE %p", finh->unique, state->fd); } while (0); |
2269 | |
2270 | ret = fd_ctx_del (fd, this, &val); |
2271 | if (!ret) { |
2272 | fdctx = (fuse_fd_ctx_t *)(unsigned long)val; |
2273 | if (fdctx) { |
2274 | activefd = fdctx->activefd; |
2275 | if (activefd) { |
2276 | fd_unref (activefd); |
2277 | } |
2278 | |
2279 | GF_FREE (fdctx)__gf_free (fdctx); |
2280 | } |
2281 | } |
2282 | fd_unref (fd); |
2283 | |
2284 | state->fd = NULL((void*)0); |
2285 | |
2286 | gf_fdptr_put (priv->fdtable, fd); |
2287 | |
2288 | send_fuse_err (this, finh, 0); |
2289 | |
2290 | free_fuse_state (state); |
2291 | return; |
2292 | } |
2293 | |
2294 | void |
2295 | fuse_fsync_resume (fuse_state_t *state) |
2296 | { |
2297 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": FSYNC %p", state->finh ->unique, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2299, GF_LOG_TRACE, "%""ll" "u" ": FSYNC %p", state->finh->unique, state->fd); } while (0) |
2298 | "%"PRIu64": FSYNC %p", state->finh->unique,do { do { if (0) printf ("%""ll" "u"": FSYNC %p", state->finh ->unique, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2299, GF_LOG_TRACE, "%""ll" "u" ": FSYNC %p", state->finh->unique, state->fd); } while (0) |
2299 | state->fd)do { do { if (0) printf ("%""ll" "u"": FSYNC %p", state->finh ->unique, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2299, GF_LOG_TRACE, "%""ll" "u" ": FSYNC %p", state->finh->unique, state->fd); } while (0); |
2300 | |
2301 | /* fsync_flags: 1 means "datasync" (no defines for this) */ |
2302 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2303, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 2303, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_FSYNC == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2303, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2303, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 2303, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2303, 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) |
2303 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2303, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 2303, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_FSYNC == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2303, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2303, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 2303, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2303, 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); |
2304 | } |
2305 | |
2306 | static void |
2307 | fuse_fsync (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2308 | { |
2309 | struct fuse_fsync_in *fsi = msg; |
2310 | |
2311 | fuse_state_t *state = NULL((void*)0); |
2312 | fd_t *fd = NULL((void*)0); |
2313 | |
2314 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2314, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2315 | fd = FH_TO_FD (fsi->fh)((((fd_t *)(uintptr_t)(fsi->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fsi->fh)))):((fd_t *) 0)); |
2316 | state->fd = fd; |
2317 | |
2318 | fuse_resolve_fd_init (state, &state->resolve, fd); |
2319 | |
2320 | state->flags = fsi->fsync_flags; |
2321 | fuse_resolve_and_resume (state, fuse_fsync_resume); |
2322 | return; |
2323 | } |
2324 | |
2325 | void |
2326 | fuse_opendir_resume (fuse_state_t *state) |
2327 | { |
2328 | fd_t *fd = NULL((void*)0); |
2329 | fuse_private_t *priv = NULL((void*)0); |
2330 | fuse_fd_ctx_t *fdctx = NULL((void*)0); |
2331 | |
2332 | priv = state->this->private; |
2333 | |
2334 | if (!state->loc.inode) { |
2335 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": OPENDIR (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2337, GF_LOG_WARNING, "%""ll" "u"": OPENDIR (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0) |
2336 | "%"PRIu64": OPENDIR (%s) resolution failed",do { do { if (0) printf ("%""ll" "u"": OPENDIR (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2337, GF_LOG_WARNING, "%""ll" "u"": OPENDIR (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0) |
2337 | state->finh->unique, uuid_utoa (state->resolve.gfid))do { do { if (0) printf ("%""ll" "u"": OPENDIR (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2337, GF_LOG_WARNING, "%""ll" "u"": OPENDIR (%s) resolution failed" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); |
2338 | send_fuse_err (state->this, state->finh, ENOENT2); |
2339 | free_fuse_state (state); |
2340 | return; |
2341 | } |
2342 | |
2343 | fd = fd_create (state->loc.inode, state->finh->pid); |
2344 | if (fd == NULL((void*)0)) { |
2345 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": OPENDIR fd creation failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2347, GF_LOG_WARNING, "%""ll" "u"": OPENDIR fd creation failed", state->finh->unique ); } while (0) |
2346 | "%"PRIu64": OPENDIR fd creation failed",do { do { if (0) printf ("%""ll" "u"": OPENDIR fd creation failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2347, GF_LOG_WARNING, "%""ll" "u"": OPENDIR fd creation failed", state->finh->unique ); } while (0) |
2347 | state->finh->unique)do { do { if (0) printf ("%""ll" "u"": OPENDIR fd creation failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2347, GF_LOG_WARNING, "%""ll" "u"": OPENDIR fd creation failed", state->finh->unique ); } while (0); |
2348 | send_fuse_err (state->this, state->finh, ENOMEM12); |
2349 | free_fuse_state (state); |
2350 | } |
2351 | |
2352 | fdctx = fuse_fd_ctx_check_n_create (state->this, fd); |
2353 | if (fdctx == NULL((void*)0)) { |
2354 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": OPENDIR creation of fdctx failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2356, GF_LOG_WARNING, "%""ll" "u"": OPENDIR creation of fdctx failed", state->finh-> unique); } while (0) |
2355 | "%"PRIu64": OPENDIR creation of fdctx failed",do { do { if (0) printf ("%""ll" "u"": OPENDIR creation of fdctx failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2356, GF_LOG_WARNING, "%""ll" "u"": OPENDIR creation of fdctx failed", state->finh-> unique); } while (0) |
2356 | state->finh->unique)do { do { if (0) printf ("%""ll" "u"": OPENDIR creation of fdctx failed" , state->finh->unique); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2356, GF_LOG_WARNING, "%""ll" "u"": OPENDIR creation of fdctx failed", state->finh-> unique); } while (0); |
2357 | fd_unref (fd); |
2358 | send_fuse_err (state->this, state->finh, ENOMEM12); |
2359 | free_fuse_state (state); |
2360 | return; |
2361 | } |
2362 | |
2363 | state->fd = fd_ref (fd); |
2364 | state->fd_no = gf_fd_unused_get (priv->fdtable, fd); |
2365 | |
2366 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": OPENDIR %s", state-> finh->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2368, GF_LOG_TRACE, "%""ll" "u" ": OPENDIR %s", state->finh->unique, state->loc.path ); } while (0) |
2367 | "%"PRIu64": OPENDIR %s", state->finh->unique,do { do { if (0) printf ("%""ll" "u"": OPENDIR %s", state-> finh->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2368, GF_LOG_TRACE, "%""ll" "u" ": OPENDIR %s", state->finh->unique, state->loc.path ); } while (0) |
2368 | state->loc.path)do { do { if (0) printf ("%""ll" "u"": OPENDIR %s", state-> finh->unique, state->loc.path); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2368, GF_LOG_TRACE, "%""ll" "u" ": OPENDIR %s", state->finh->unique, state->loc.path ); } while (0); |
2369 | |
2370 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2371, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 2371, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_OPENDIR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2371, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2371, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 2371, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2371, 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) |
2371 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2371, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 2371, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_OPENDIR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2371, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2371, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 2371, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2371, 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); |
2372 | } |
2373 | |
2374 | static void |
2375 | fuse_opendir (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2376 | { |
2377 | /* |
2378 | struct fuse_open_in *foi = msg; |
2379 | */ |
2380 | |
2381 | fuse_state_t *state = NULL((void*)0); |
2382 | |
2383 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2383, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2384 | |
2385 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
2386 | |
2387 | fuse_resolve_and_resume (state, fuse_opendir_resume); |
2388 | } |
2389 | |
2390 | unsigned char |
2391 | d_type_from_stat (struct iatt *buf) |
2392 | { |
2393 | unsigned char d_type; |
2394 | |
2395 | if (IA_ISLNK (buf->ia_type)(buf->ia_type == IA_IFLNK)) { |
2396 | d_type = DT_LNKDT_LNK; |
2397 | |
2398 | } else if (IA_ISDIR (buf->ia_type)(buf->ia_type == IA_IFDIR)) { |
2399 | d_type = DT_DIRDT_DIR; |
2400 | |
2401 | } else if (IA_ISFIFO (buf->ia_type)(buf->ia_type == IA_IFIFO)) { |
2402 | d_type = DT_FIFODT_FIFO; |
2403 | |
2404 | } else if (IA_ISSOCK (buf->ia_type)(buf->ia_type == IA_IFSOCK)) { |
2405 | d_type = DT_SOCKDT_SOCK; |
2406 | |
2407 | } else if (IA_ISCHR (buf->ia_type)(buf->ia_type == IA_IFCHR)) { |
2408 | d_type = DT_CHRDT_CHR; |
2409 | |
2410 | } else if (IA_ISBLK (buf->ia_type)(buf->ia_type == IA_IFBLK)) { |
2411 | d_type = DT_BLKDT_BLK; |
2412 | |
2413 | } else if (IA_ISREG (buf->ia_type)(buf->ia_type == IA_IFREG)) { |
2414 | d_type = DT_REGDT_REG; |
2415 | |
2416 | } else { |
2417 | d_type = DT_UNKNOWNDT_UNKNOWN; |
2418 | } |
2419 | |
2420 | return d_type; |
2421 | } |
2422 | |
2423 | static int |
2424 | fuse_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
2425 | int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, |
2426 | dict_t *xdata) |
2427 | { |
2428 | fuse_state_t *state = NULL((void*)0); |
2429 | fuse_in_header_t *finh = NULL((void*)0); |
2430 | int size = 0; |
2431 | char *buf = NULL((void*)0); |
2432 | gf_dirent_t *entry = NULL((void*)0); |
2433 | struct fuse_dirent *fde = NULL((void*)0); |
2434 | fuse_private_t *priv = NULL((void*)0); |
2435 | |
2436 | state = frame->root->state; |
2437 | finh = state->finh; |
2438 | priv = state->this->private; |
2439 | |
2440 | 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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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); |
2441 | |
2442 | if (op_ret < 0) { |
2443 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": READDIR => -1 (%s)" , frame->root->unique, strerror (op_errno)); } while (0 ); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2445 , GF_LOG_WARNING, "%""ll" "u"": READDIR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0) |
2444 | "%"PRIu64": READDIR => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""ll" "u"": READDIR => -1 (%s)" , frame->root->unique, strerror (op_errno)); } while (0 ); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2445 , GF_LOG_WARNING, "%""ll" "u"": READDIR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0) |
2445 | strerror (op_errno))do { do { if (0) printf ("%""ll" "u"": READDIR => -1 (%s)" , frame->root->unique, strerror (op_errno)); } while (0 ); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2445 , GF_LOG_WARNING, "%""ll" "u"": READDIR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); |
2446 | |
2447 | send_fuse_err (this, finh, op_errno); |
2448 | goto out; |
2449 | } |
2450 | |
2451 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": READDIR => %d/%""zu" ",%""ll" "d", frame->root->unique, op_ret, state->size , state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2453, GF_LOG_TRACE, "%""ll" "u"": READDIR => %d/%" "zu"",%""ll" "d", frame->root->unique, op_ret, state-> size, state->off); } while (0) |
2452 | "%"PRIu64": READDIR => %d/%"GF_PRI_SIZET",%"PRId64,do { do { if (0) printf ("%""ll" "u"": READDIR => %d/%""zu" ",%""ll" "d", frame->root->unique, op_ret, state->size , state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2453, GF_LOG_TRACE, "%""ll" "u"": READDIR => %d/%" "zu"",%""ll" "d", frame->root->unique, op_ret, state-> size, state->off); } while (0) |
2453 | frame->root->unique, op_ret, state->size, state->off)do { do { if (0) printf ("%""ll" "u"": READDIR => %d/%""zu" ",%""ll" "d", frame->root->unique, op_ret, state->size , state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2453, GF_LOG_TRACE, "%""ll" "u"": READDIR => %d/%" "zu"",%""ll" "d", frame->root->unique, op_ret, state-> size, state->off); } while (0); |
2454 | |
2455 | 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)))) { |
2456 | 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)) |
2457 | strlen (entry->d_name))(((__builtin_offsetof(struct fuse_dirent, name) + strlen (entry ->d_name)) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t ) - 1)); |
2458 | } |
2459 | |
2460 | if (size <= 0) { |
2461 | send_fuse_data (this, finh, 0, 0); |
2462 | goto out; |
2463 | } |
2464 | |
2465 | buf = GF_CALLOC (1, size, gf_fuse_mt_char)__gf_calloc (1, size, gf_fuse_mt_char); |
2466 | if (!buf) { |
2467 | gf_log ("glusterfs-fuse", GF_LOG_DEBUG,do { do { if (0) printf ("%""ll" "u"": READDIR => -1 (%s)" , frame->root->unique, strerror (12)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2469, GF_LOG_DEBUG , "%""ll" "u"": READDIR => -1 (%s)", frame->root->unique , strerror (12)); } while (0) |
2468 | "%"PRIu64": READDIR => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""ll" "u"": READDIR => -1 (%s)" , frame->root->unique, strerror (12)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2469, GF_LOG_DEBUG , "%""ll" "u"": READDIR => -1 (%s)", frame->root->unique , strerror (12)); } while (0) |
2469 | strerror (ENOMEM))do { do { if (0) printf ("%""ll" "u"": READDIR => -1 (%s)" , frame->root->unique, strerror (12)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2469, GF_LOG_DEBUG , "%""ll" "u"": READDIR => -1 (%s)", frame->root->unique , strerror (12)); } while (0); |
2470 | send_fuse_err (this, finh, ENOMEM12); |
2471 | goto out; |
2472 | } |
2473 | |
2474 | size = 0; |
2475 | 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)))) { |
2476 | fde = (struct fuse_dirent *)(buf + size); |
2477 | gf_fuse_fill_dirent (entry, fde, priv->enable_ino32); |
2478 | size += FUSE_DIRENT_SIZE (fde)(((__builtin_offsetof(struct fuse_dirent, name) + (fde)->namelen ) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1)); |
2479 | } |
2480 | |
2481 | send_fuse_data (this, finh, buf, size); |
2482 | |
2483 | /* TODO: */ |
2484 | /* gf_link_inodes_from_dirent (this, state->fd->inode, entries); */ |
2485 | |
2486 | out: |
2487 | free_fuse_state (state); |
2488 | STACK_DESTROY (frame->root); |
2489 | GF_FREE (buf)__gf_free (buf); |
2490 | return 0; |
2491 | |
2492 | } |
2493 | |
2494 | void |
2495 | fuse_readdir_resume (fuse_state_t *state) |
2496 | { |
2497 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": READDIR (%p, size=%zu, offset=%" "ll" "d"")", state->finh->unique, state->fd, state-> size, state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2499, GF_LOG_TRACE, "%""ll" "u" ": READDIR (%p, size=%zu, offset=%""ll" "d"")", state->finh ->unique, state->fd, state->size, state->off); } while (0) |
2498 | "%"PRIu64": READDIR (%p, size=%zu, offset=%"PRId64")",do { do { if (0) printf ("%""ll" "u"": READDIR (%p, size=%zu, offset=%" "ll" "d"")", state->finh->unique, state->fd, state-> size, state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2499, GF_LOG_TRACE, "%""ll" "u" ": READDIR (%p, size=%zu, offset=%""ll" "d"")", state->finh ->unique, state->fd, state->size, state->off); } while (0) |
2499 | state->finh->unique, state->fd, state->size, state->off)do { do { if (0) printf ("%""ll" "u"": READDIR (%p, size=%zu, offset=%" "ll" "d"")", state->finh->unique, state->fd, state-> size, state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2499, GF_LOG_TRACE, "%""ll" "u" ": READDIR (%p, size=%zu, offset=%""ll" "d"")", state->finh ->unique, state->fd, state->size, state->off); } while (0); |
2500 | |
2501 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2502, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 2502, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_READDIR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2502, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2502, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 2502, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2502, 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) |
2502 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2502, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 2502, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_READDIR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2502, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2502, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 2502, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2502, 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); |
2503 | } |
2504 | |
2505 | static void |
2506 | fuse_readdir (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2507 | { |
2508 | struct fuse_read_in *fri = msg; |
2509 | |
2510 | fuse_state_t *state = NULL((void*)0); |
2511 | fd_t *fd = NULL((void*)0); |
2512 | |
2513 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2513, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2514 | state->size = fri->size; |
2515 | state->off = fri->offset; |
2516 | fd = FH_TO_FD (fri->fh)((((fd_t *)(uintptr_t)(fri->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fri->fh)))):((fd_t *) 0)); |
2517 | state->fd = fd; |
2518 | |
2519 | fuse_resolve_fd_init (state, &state->resolve, fd); |
2520 | |
2521 | fuse_resolve_and_resume (state, fuse_readdir_resume); |
2522 | } |
2523 | |
2524 | |
2525 | static int |
2526 | fuse_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
2527 | int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, |
2528 | dict_t *xdata) |
2529 | { |
2530 | fuse_state_t *state = NULL((void*)0); |
2531 | fuse_in_header_t *finh = NULL((void*)0); |
2532 | int size = 0; |
2533 | char *buf = NULL((void*)0); |
2534 | gf_dirent_t *entry = NULL((void*)0); |
2535 | struct fuse_direntplus *fde = NULL((void*)0); |
2536 | struct fuse_entry_out *feo = NULL((void*)0); |
2537 | fuse_private_t *priv = NULL((void*)0); |
2538 | |
2539 | state = frame->root->state; |
2540 | finh = state->finh; |
2541 | priv = this->private; |
2542 | |
2543 | if (op_ret < 0) { |
2544 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": READDIRP => -1 (%s)" , frame->root->unique, strerror (op_errno)); } while (0 ); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2546 , GF_LOG_WARNING, "%""ll" "u"": READDIRP => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0) |
2545 | "%"PRIu64": READDIRP => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""ll" "u"": READDIRP => -1 (%s)" , frame->root->unique, strerror (op_errno)); } while (0 ); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2546 , GF_LOG_WARNING, "%""ll" "u"": READDIRP => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0) |
2546 | strerror (op_errno))do { do { if (0) printf ("%""ll" "u"": READDIRP => -1 (%s)" , frame->root->unique, strerror (op_errno)); } while (0 ); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2546 , GF_LOG_WARNING, "%""ll" "u"": READDIRP => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); |
2547 | |
2548 | send_fuse_err (this, finh, op_errno); |
2549 | goto out; |
2550 | } |
2551 | |
2552 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": READDIRP => %d/%""zu" ",%""ll" "d", frame->root->unique, op_ret, state->size , state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2554, GF_LOG_TRACE, "%""ll" "u"": READDIRP => %d/%" "zu"",%""ll" "d", frame->root->unique, op_ret, state-> size, state->off); } while (0) |
2553 | "%"PRIu64": READDIRP => %d/%"GF_PRI_SIZET",%"PRId64,do { do { if (0) printf ("%""ll" "u"": READDIRP => %d/%""zu" ",%""ll" "d", frame->root->unique, op_ret, state->size , state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2554, GF_LOG_TRACE, "%""ll" "u"": READDIRP => %d/%" "zu"",%""ll" "d", frame->root->unique, op_ret, state-> size, state->off); } while (0) |
2554 | frame->root->unique, op_ret, state->size, state->off)do { do { if (0) printf ("%""ll" "u"": READDIRP => %d/%""zu" ",%""ll" "d", frame->root->unique, op_ret, state->size , state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2554, GF_LOG_TRACE, "%""ll" "u"": READDIRP => %d/%" "zu"",%""ll" "d", frame->root->unique, op_ret, state-> size, state->off); } while (0); |
2555 | |
2556 | 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)))) { |
2557 | 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)) |
2558 | strlen (entry->d_name))(((__builtin_offsetof(struct fuse_direntplus, dirent.name) + strlen (entry->d_name)) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t ) - 1)); |
2559 | } |
2560 | |
2561 | if (size <= 0) { |
2562 | send_fuse_data (this, finh, 0, 0); |
2563 | goto out; |
2564 | } |
2565 | |
2566 | buf = GF_CALLOC (1, size, gf_fuse_mt_char)__gf_calloc (1, size, gf_fuse_mt_char); |
2567 | if (!buf) { |
2568 | gf_log ("glusterfs-fuse", GF_LOG_DEBUG,do { do { if (0) printf ("%""ll" "u"": READDIRP => -1 (%s)" , frame->root->unique, strerror (12)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2570, GF_LOG_DEBUG , "%""ll" "u"": READDIRP => -1 (%s)", frame->root->unique , strerror (12)); } while (0) |
2569 | "%"PRIu64": READDIRP => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""ll" "u"": READDIRP => -1 (%s)" , frame->root->unique, strerror (12)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2570, GF_LOG_DEBUG , "%""ll" "u"": READDIRP => -1 (%s)", frame->root->unique , strerror (12)); } while (0) |
2570 | strerror (ENOMEM))do { do { if (0) printf ("%""ll" "u"": READDIRP => -1 (%s)" , frame->root->unique, strerror (12)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2570, GF_LOG_DEBUG , "%""ll" "u"": READDIRP => -1 (%s)", frame->root->unique , strerror (12)); } while (0); |
2571 | send_fuse_err (this, finh, ENOMEM12); |
2572 | goto out; |
2573 | } |
2574 | |
2575 | size = 0; |
2576 | 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)))) { |
2577 | inode_t *linked_inode; |
2578 | |
2579 | fde = (struct fuse_direntplus *)(buf + size); |
2580 | feo = &fde->entry_out; |
2581 | fde->dirent.ino = entry->d_ino; |
2582 | fde->dirent.off = entry->d_off; |
2583 | fde->dirent.type = entry->d_type; |
2584 | fde->dirent.namelen = strlen (entry->d_name); |
2585 | strncpy (fde->dirent.name, entry->d_name, fde->dirent.namelen); |
2586 | size += FUSE_DIRENTPLUS_SIZE (fde)(((__builtin_offsetof(struct fuse_direntplus, dirent.name) + ( fde)->dirent.namelen) + sizeof(uint64_t) - 1) & ~(sizeof (uint64_t) - 1)); |
2587 | |
2588 | if (!entry->inode) |
2589 | continue; |
2590 | |
2591 | entry->d_stat.ia_blksize = this->ctx->page_size; |
2592 | gf_fuse_stat2attr (&entry->d_stat, &feo->attr, priv->enable_ino32); |
2593 | |
2594 | linked_inode = inode_link (entry->inode, state->fd->inode, |
2595 | entry->d_name, &entry->d_stat); |
2596 | if (!linked_inode) |
2597 | continue; |
2598 | |
2599 | inode_lookup (linked_inode); |
2600 | |
2601 | feo->nodeid = inode_to_fuse_nodeid (linked_inode); |
2602 | |
2603 | inode_unref (linked_inode); |
2604 | |
2605 | feo->entry_valid = |
2606 | calc_timeout_sec (priv->entry_timeout); |
2607 | feo->entry_valid_nsec = |
2608 | calc_timeout_nsec (priv->entry_timeout); |
2609 | feo->attr_valid = |
2610 | calc_timeout_sec (priv->attribute_timeout); |
2611 | feo->attr_valid_nsec = |
2612 | calc_timeout_nsec (priv->attribute_timeout); |
2613 | } |
2614 | |
2615 | send_fuse_data (this, finh, buf, size); |
2616 | out: |
2617 | free_fuse_state (state); |
2618 | STACK_DESTROY (frame->root); |
2619 | GF_FREE (buf)__gf_free (buf); |
2620 | return 0; |
2621 | |
2622 | } |
2623 | |
2624 | |
2625 | void |
2626 | fuse_readdirp_resume (fuse_state_t *state) |
2627 | { |
2628 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": READDIRP (%p, size=%zu, offset=%" "ll" "d"")", state->finh->unique, state->fd, state-> size, state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2630, GF_LOG_TRACE, "%""ll" "u" ": READDIRP (%p, size=%zu, offset=%""ll" "d"")", state->finh ->unique, state->fd, state->size, state->off); } while (0) |
2629 | "%"PRIu64": READDIRP (%p, size=%zu, offset=%"PRId64")",do { do { if (0) printf ("%""ll" "u"": READDIRP (%p, size=%zu, offset=%" "ll" "d"")", state->finh->unique, state->fd, state-> size, state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2630, GF_LOG_TRACE, "%""ll" "u" ": READDIRP (%p, size=%zu, offset=%""ll" "d"")", state->finh ->unique, state->fd, state->size, state->off); } while (0) |
2630 | state->finh->unique, state->fd, state->size, state->off)do { do { if (0) printf ("%""ll" "u"": READDIRP (%p, size=%zu, offset=%" "ll" "d"")", state->finh->unique, state->fd, state-> size, state->off); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2630, GF_LOG_TRACE, "%""ll" "u" ": READDIRP (%p, size=%zu, offset=%""ll" "d"")", state->finh ->unique, state->fd, state->size, state->off); } while (0); |
2631 | |
2632 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2633, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 2633, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_READDIRP == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2633, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2633, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 2633, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2633, 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) |
2633 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2633, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 2633, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_READDIRP == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2633, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2633, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 2633, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2633, 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); |
2634 | } |
2635 | |
2636 | |
2637 | static void |
2638 | fuse_readdirp (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2639 | { |
2640 | struct fuse_read_in *fri = msg; |
2641 | |
2642 | fuse_state_t *state = NULL((void*)0); |
2643 | fd_t *fd = NULL((void*)0); |
2644 | |
2645 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2645, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2646 | state->size = fri->size; |
2647 | state->off = fri->offset; |
2648 | fd = FH_TO_FD (fri->fh)((((fd_t *)(uintptr_t)(fri->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fri->fh)))):((fd_t *) 0)); |
2649 | state->fd = fd; |
2650 | |
2651 | fuse_resolve_fd_init (state, &state->resolve, fd); |
2652 | |
2653 | fuse_resolve_and_resume (state, fuse_readdirp_resume); |
2654 | } |
2655 | |
2656 | |
2657 | static void |
2658 | fuse_releasedir (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2659 | { |
2660 | struct fuse_release_in *fri = msg; |
2661 | fd_t *activefd = NULL((void*)0); |
2662 | uint64_t val = 0; |
2663 | int ret = 0; |
2664 | fuse_state_t *state = NULL((void*)0); |
2665 | fuse_fd_ctx_t *fdctx = NULL((void*)0); |
2666 | fuse_private_t *priv = NULL((void*)0); |
2667 | |
2668 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2668, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2669 | state->fd = FH_TO_FD (fri->fh)((((fd_t *)(uintptr_t)(fri->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fri->fh)))):((fd_t *) 0)); |
2670 | |
2671 | priv = this->private; |
2672 | |
2673 | fuse_log_eh (this, "RELEASEDIR (): %"PRIu64": fd: %p, gfid: %s",do { if (this->history) do { do { if (0) printf ("RELEASEDIR (): %" "ll" "u"": fd: %p, gfid: %s", finh->unique, state->fd, uuid_utoa (state->fd->inode->gfid)); } while (0); _gf_log_eh ( __FUNCTION__,"RELEASEDIR (): %""ll" "u"": fd: %p, gfid: %s", finh ->unique, state->fd, uuid_utoa (state->fd->inode-> gfid)); } while (0); } while (0) |
2674 | finh->unique, state->fd,do { if (this->history) do { do { if (0) printf ("RELEASEDIR (): %" "ll" "u"": fd: %p, gfid: %s", finh->unique, state->fd, uuid_utoa (state->fd->inode->gfid)); } while (0); _gf_log_eh ( __FUNCTION__,"RELEASEDIR (): %""ll" "u"": fd: %p, gfid: %s", finh ->unique, state->fd, uuid_utoa (state->fd->inode-> gfid)); } while (0); } while (0) |
2675 | uuid_utoa (state->fd->inode->gfid))do { if (this->history) do { do { if (0) printf ("RELEASEDIR (): %" "ll" "u"": fd: %p, gfid: %s", finh->unique, state->fd, uuid_utoa (state->fd->inode->gfid)); } while (0); _gf_log_eh ( __FUNCTION__,"RELEASEDIR (): %""ll" "u"": fd: %p, gfid: %s", finh ->unique, state->fd, uuid_utoa (state->fd->inode-> gfid)); } while (0); } while (0); |
2676 | |
2677 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": RELEASEDIR %p", finh-> unique, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2678, GF_LOG_TRACE, "%""ll" "u" ": RELEASEDIR %p", finh->unique, state->fd); } while (0 ) |
2678 | "%"PRIu64": RELEASEDIR %p", finh->unique, state->fd)do { do { if (0) printf ("%""ll" "u"": RELEASEDIR %p", finh-> unique, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2678, GF_LOG_TRACE, "%""ll" "u" ": RELEASEDIR %p", finh->unique, state->fd); } while (0 ); |
2679 | |
2680 | ret = fd_ctx_del (state->fd, this, &val); |
2681 | |
2682 | if (!ret) { |
2683 | fdctx = (fuse_fd_ctx_t *)(unsigned long)val; |
2684 | if (fdctx) { |
2685 | activefd = fdctx->activefd; |
2686 | if (activefd) { |
2687 | fd_unref (activefd); |
2688 | } |
2689 | |
2690 | GF_FREE (fdctx)__gf_free (fdctx); |
2691 | } |
2692 | } |
2693 | |
2694 | fd_unref (state->fd); |
2695 | |
2696 | gf_fdptr_put (priv->fdtable, state->fd); |
2697 | |
2698 | state->fd = NULL((void*)0); |
2699 | |
2700 | send_fuse_err (this, finh, 0); |
2701 | |
2702 | free_fuse_state (state); |
2703 | |
2704 | return; |
2705 | } |
2706 | |
2707 | void |
2708 | fuse_fsyncdir_resume (fuse_state_t *state) |
2709 | { |
2710 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2711, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 2711, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_FSYNCDIR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2711, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2711, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 2711, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2711, 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) |
2711 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2711, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 2711, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_FSYNCDIR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2711, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2711, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 2711, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2711, 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); |
2712 | |
2713 | } |
2714 | |
2715 | static void |
2716 | fuse_fsyncdir (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2717 | { |
2718 | struct fuse_fsync_in *fsi = msg; |
2719 | |
2720 | fuse_state_t *state = NULL((void*)0); |
2721 | fd_t *fd = NULL((void*)0); |
2722 | |
2723 | fd = FH_TO_FD (fsi->fh)((((fd_t *)(uintptr_t)(fsi->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fsi->fh)))):((fd_t *) 0)); |
2724 | |
2725 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2725, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2726 | state->fd = fd; |
2727 | |
2728 | fuse_resolve_fd_init (state, &state->resolve, fd); |
2729 | |
2730 | state->flags = fsi->fsync_flags; |
2731 | fuse_resolve_and_resume (state, fuse_fsyncdir_resume); |
2732 | |
2733 | return; |
2734 | } |
2735 | |
2736 | static int |
2737 | fuse_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
2738 | int32_t op_ret, int32_t op_errno, struct statvfs *buf, |
2739 | dict_t *xdata) |
2740 | { |
2741 | fuse_state_t *state = NULL((void*)0); |
2742 | fuse_in_header_t *finh = NULL((void*)0); |
2743 | fuse_private_t *priv = NULL((void*)0); |
2744 | struct fuse_statfs_out fso = {{0, }, }; |
2745 | |
2746 | state = frame->root->state; |
2747 | priv = this->private; |
2748 | finh = state->finh; |
2749 | |
2750 | 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, %" "ll" "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, %""ll" "u"": %s()", op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op]); } while (0); } while (0) |
2751 | op_ret, op_errno, frame->root->unique,do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "ll" "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, %""ll" "u"": %s()", op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op]); } while (0); } while (0) |
2752 | gf_fop_list[frame->root->op])do { if (this->history) do { do { if (0) printf ("op_ret: %d, op_errno: %d, %" "ll" "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, %""ll" "u"": %s()", op_ret, op_errno, frame->root->unique, gf_fop_list[frame ->root->op]); } while (0); } while (0); |
2753 | |
2754 | if (op_ret == 0) { |
2755 | #ifndef GF_DARWIN_HOST_OS |
2756 | /* MacFUSE doesn't respect anyof these tweaks */ |
2757 | buf->f_blocks *= buf->f_frsize; |
2758 | buf->f_blocks /= this->ctx->page_size; |
2759 | |
2760 | buf->f_bavail *= buf->f_frsize; |
2761 | buf->f_bavail /= this->ctx->page_size; |
2762 | |
2763 | buf->f_bfree *= buf->f_frsize; |
2764 | buf->f_bfree /= this->ctx->page_size; |
2765 | |
2766 | buf->f_frsize = buf->f_bsize =this->ctx->page_size; |
2767 | #endif /* GF_DARWIN_HOST_OS */ |
2768 | fso.st.bsize = buf->f_bsize; |
2769 | fso.st.frsize = buf->f_frsize; |
2770 | fso.st.blocks = buf->f_blocks; |
2771 | fso.st.bfree = buf->f_bfree; |
2772 | fso.st.bavail = buf->f_bavail; |
2773 | fso.st.files = buf->f_files; |
2774 | fso.st.ffree = buf->f_ffree; |
2775 | fso.st.namelen = buf->f_namemax; |
2776 | |
2777 | priv->proto_minor >= 4 ? |
2778 | send_fuse_obj (this, finh, &fso)send_fuse_data (this, finh, &fso, sizeof (*(&fso))) : |
2779 | send_fuse_data (this, finh, &fso, FUSE_COMPAT_STATFS_SIZE48); |
2780 | } else { |
2781 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": ERR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2783, GF_LOG_WARNING , "%""ll" "u"": ERR => -1 (%s)", frame->root->unique , strerror (op_errno)); } while (0) |
2782 | "%"PRIu64": ERR => -1 (%s)", frame->root->unique,do { do { if (0) printf ("%""ll" "u"": ERR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2783, GF_LOG_WARNING , "%""ll" "u"": ERR => -1 (%s)", frame->root->unique , strerror (op_errno)); } while (0) |
2783 | strerror (op_errno))do { do { if (0) printf ("%""ll" "u"": ERR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2783, GF_LOG_WARNING , "%""ll" "u"": ERR => -1 (%s)", frame->root->unique , strerror (op_errno)); } while (0); |
2784 | send_fuse_err (this, finh, op_errno); |
2785 | } |
2786 | |
2787 | free_fuse_state (state); |
2788 | STACK_DESTROY (frame->root); |
2789 | |
2790 | return 0; |
2791 | } |
2792 | |
2793 | void |
2794 | fuse_statfs_resume (fuse_state_t *state) |
2795 | { |
2796 | if (!state->loc.inode) { |
2797 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": STATFS (%s) resolution fail" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2799, GF_LOG_WARNING, "%""ll" "u"": STATFS (%s) resolution fail" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0) |
2798 | "%"PRIu64": STATFS (%s) resolution fail",do { do { if (0) printf ("%""ll" "u"": STATFS (%s) resolution fail" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2799, GF_LOG_WARNING, "%""ll" "u"": STATFS (%s) resolution fail" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0) |
2799 | state->finh->unique, uuid_utoa (state->resolve.gfid))do { do { if (0) printf ("%""ll" "u"": STATFS (%s) resolution fail" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2799, GF_LOG_WARNING, "%""ll" "u"": STATFS (%s) resolution fail" , state->finh->unique, uuid_utoa (state->resolve.gfid )); } while (0); |
2800 | |
2801 | send_fuse_err (state->this, state->finh, ENOENT2); |
2802 | free_fuse_state (state); |
2803 | return; |
2804 | } |
2805 | |
2806 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": STATFS", state->finh ->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2807, GF_LOG_TRACE, "%""ll" "u"": STATFS", state ->finh->unique); } while (0) |
2807 | "%"PRIu64": STATFS", state->finh->unique)do { do { if (0) printf ("%""ll" "u"": STATFS", state->finh ->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2807, GF_LOG_TRACE, "%""ll" "u"": STATFS", state ->finh->unique); } while (0); |
2808 | |
2809 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2810, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 2810, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_STATFS == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2810, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2810, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 2810, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2810, 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) |
2810 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2810, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 2810, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_STATFS == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2810, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2810, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 2810, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2810, 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); |
2811 | } |
2812 | |
2813 | |
2814 | static void |
2815 | fuse_statfs (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2816 | { |
2817 | fuse_state_t *state = NULL((void*)0); |
2818 | |
2819 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2819, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2820 | |
2821 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
2822 | |
2823 | fuse_resolve_and_resume (state, fuse_statfs_resume); |
2824 | } |
2825 | |
2826 | |
2827 | void |
2828 | fuse_setxattr_resume (fuse_state_t *state) |
2829 | { |
2830 | if (!state->loc.inode) { |
2831 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": SETXATTR %s/%""ll" "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__, 2835, GF_LOG_WARNING, "%""ll" "u"": SETXATTR %s/%" "ll" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0) |
2832 | "%"PRIu64": SETXATTR %s/%"PRIu64" (%s) "do { do { if (0) printf ("%""ll" "u"": SETXATTR %s/%""ll" "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__, 2835, GF_LOG_WARNING, "%""ll" "u"": SETXATTR %s/%" "ll" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0) |
2833 | "resolution failed",do { do { if (0) printf ("%""ll" "u"": SETXATTR %s/%""ll" "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__, 2835, GF_LOG_WARNING, "%""ll" "u"": SETXATTR %s/%" "ll" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0) |
2834 | state->finh->unique, uuid_utoa (state->resolve.gfid),do { do { if (0) printf ("%""ll" "u"": SETXATTR %s/%""ll" "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__, 2835, GF_LOG_WARNING, "%""ll" "u"": SETXATTR %s/%" "ll" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0) |
2835 | state->finh->nodeid, state->name)do { do { if (0) printf ("%""ll" "u"": SETXATTR %s/%""ll" "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__, 2835, GF_LOG_WARNING, "%""ll" "u"": SETXATTR %s/%" "ll" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0); |
2836 | send_fuse_err (state->this, state->finh, ENOENT2); |
2837 | free_fuse_state (state); |
2838 | return; |
2839 | } |
2840 | |
2841 | #ifdef GF_TEST_FFOP |
2842 | state->fd = fd_lookup (state->loc.inode, state->finh->pid); |
2843 | #endif /* GF_TEST_FFOP */ |
2844 | |
2845 | if (state->fd) { |
2846 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": SETXATTR %p/%""ll" "u" " (%s)", state->finh->unique, state->fd, state->finh ->nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2848, GF_LOG_TRACE, "%""ll" "u" ": SETXATTR %p/%""ll" "u"" (%s)", state->finh->unique, state ->fd, state->finh->nodeid, state->name); } while ( 0) |
2847 | "%"PRIu64": SETXATTR %p/%"PRIu64" (%s)", state->finh->unique,do { do { if (0) printf ("%""ll" "u"": SETXATTR %p/%""ll" "u" " (%s)", state->finh->unique, state->fd, state->finh ->nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2848, GF_LOG_TRACE, "%""ll" "u" ": SETXATTR %p/%""ll" "u"" (%s)", state->finh->unique, state ->fd, state->finh->nodeid, state->name); } while ( 0) |
2848 | state->fd, state->finh->nodeid, state->name)do { do { if (0) printf ("%""ll" "u"": SETXATTR %p/%""ll" "u" " (%s)", state->finh->unique, state->fd, state->finh ->nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2848, GF_LOG_TRACE, "%""ll" "u" ": SETXATTR %p/%""ll" "u"" (%s)", state->finh->unique, state ->fd, state->finh->nodeid, state->name); } while ( 0); |
2849 | |
2850 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2852, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 2852, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_FSETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2852, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2852, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 2852, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2852, 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) |
2851 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2852, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 2852, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_FSETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2852, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2852, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 2852, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2852, 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) |
2852 | state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2852, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 2852, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_FSETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2852, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2852, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 2852, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2852, 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); |
2853 | } else { |
2854 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": SETXATTR %s/%""ll" "u" " (%s)", state->finh->unique, state->loc.path, state ->finh->nodeid, state->name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2856, GF_LOG_TRACE , "%""ll" "u"": SETXATTR %s/%""ll" "u"" (%s)", state->finh ->unique, state->loc.path, state->finh->nodeid, state ->name); } while (0) |
2855 | "%"PRIu64": SETXATTR %s/%"PRIu64" (%s)", state->finh->unique,do { do { if (0) printf ("%""ll" "u"": SETXATTR %s/%""ll" "u" " (%s)", state->finh->unique, state->loc.path, state ->finh->nodeid, state->name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2856, GF_LOG_TRACE , "%""ll" "u"": SETXATTR %s/%""ll" "u"" (%s)", state->finh ->unique, state->loc.path, state->finh->nodeid, state ->name); } while (0) |
2856 | state->loc.path, state->finh->nodeid, state->name)do { do { if (0) printf ("%""ll" "u"": SETXATTR %s/%""ll" "u" " (%s)", state->finh->unique, state->loc.path, state ->finh->nodeid, state->name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2856, GF_LOG_TRACE , "%""ll" "u"": SETXATTR %s/%""ll" "u"" (%s)", state->finh ->unique, state->loc.path, state->finh->nodeid, state ->name); } while (0); |
2857 | |
2858 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2860, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 2860, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_SETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2860, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2860, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 2860, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2860, 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) |
2859 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2860, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 2860, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_SETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2860, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2860, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 2860, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2860, 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) |
2860 | state->xdata)do { call_frame_t *frame = ((void*)0); xlator_t *xl = ((void* )0); int32_t op_ret = 0, op_errno = 0; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2860, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 2860, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_SETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 2860, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2860, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 2860, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 2860, 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); |
2861 | } |
2862 | } |
2863 | |
2864 | |
2865 | static void |
2866 | fuse_setxattr (xlator_t *this, fuse_in_header_t *finh, void *msg) |
2867 | { |
2868 | struct fuse_setxattr_in *fsi = msg; |
2869 | char *name = (char *)(fsi + 1); |
2870 | char *value = name + strlen (name) + 1; |
2871 | struct fuse_private *priv = NULL((void*)0); |
2872 | |
2873 | fuse_state_t *state = NULL((void*)0); |
2874 | char *dict_value = NULL((void*)0); |
2875 | int32_t ret = -1; |
2876 | char *newkey = NULL((void*)0); |
2877 | |
2878 | priv = this->private; |
2879 | |
2880 | #ifdef GF_DARWIN_HOST_OS |
2881 | if (fsi->position) { |
2882 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": SETXATTR %s/%""ll" "u" " (%s):" "refusing positioned setxattr", finh->unique, state ->loc.path, finh->nodeid, name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2885, GF_LOG_WARNING , "%""ll" "u"": SETXATTR %s/%""ll" "u"" (%s):" "refusing positioned setxattr" , finh->unique, state->loc.path, finh->nodeid, name) ; } while (0) |
2883 | "%"PRIu64": SETXATTR %s/%"PRIu64" (%s):"do { do { if (0) printf ("%""ll" "u"": SETXATTR %s/%""ll" "u" " (%s):" "refusing positioned setxattr", finh->unique, state ->loc.path, finh->nodeid, name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2885, GF_LOG_WARNING , "%""ll" "u"": SETXATTR %s/%""ll" "u"" (%s):" "refusing positioned setxattr" , finh->unique, state->loc.path, finh->nodeid, name) ; } while (0) |
2884 | "refusing positioned setxattr",do { do { if (0) printf ("%""ll" "u"": SETXATTR %s/%""ll" "u" " (%s):" "refusing positioned setxattr", finh->unique, state ->loc.path, finh->nodeid, name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2885, GF_LOG_WARNING , "%""ll" "u"": SETXATTR %s/%""ll" "u"" (%s):" "refusing positioned setxattr" , finh->unique, state->loc.path, finh->nodeid, name) ; } while (0) |
2885 | finh->unique, state->loc.path, finh->nodeid, name)do { do { if (0) printf ("%""ll" "u"": SETXATTR %s/%""ll" "u" " (%s):" "refusing positioned setxattr", finh->unique, state ->loc.path, finh->nodeid, name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 2885, GF_LOG_WARNING , "%""ll" "u"": SETXATTR %s/%""ll" "u"" (%s):" "refusing positioned setxattr" , finh->unique, state->loc.path, finh->nodeid, name) ; } while (0); |
2886 | send_fuse_err (this, finh, EINVAL22); |
2887 | FREE (finh)if (finh != ((void*)0)) { free ((void *)finh); finh = (void * )0xeeeeeeee; }; |
2888 | return; |
2889 | } |
2890 | #endif |
2891 | |
2892 | if (fuse_ignore_xattr_set (priv, name)) { |
2893 | (void) send_fuse_err (this, finh, 0); |
2894 | return; |
2895 | } |
2896 | |
2897 | if (!priv->acl) { |
2898 | if ((strcmp (name, "system.posix_acl_access") == 0) || |
2899 | (strcmp (name, "system.posix_acl_default") == 0)) { |
2900 | send_fuse_err (this, finh, EOPNOTSUPP95); |
2901 | GF_FREE (finh)__gf_free (finh); |
2902 | return; |
2903 | } |
2904 | } |
2905 | |
2906 | if (!priv->selinux) { |
2907 | if (strncmp (name, "security.", 9) == 0) { |
2908 | send_fuse_err (this, finh, EOPNOTSUPP95); |
2909 | GF_FREE (finh)__gf_free (finh); |
2910 | return; |
2911 | } |
2912 | } |
2913 | |
2914 | /* Check if the command is for changing the log |
2915 | level of process or specific xlator */ |
2916 | ret = is_gf_log_command (this, name, value); |
2917 | if (ret >= 0) { |
2918 | send_fuse_err (this, finh, ret); |
2919 | GF_FREE (finh)__gf_free (finh); |
2920 | return; |
2921 | } |
2922 | |
2923 | if (!strcmp ("inode-invalidate", name)) { |
2924 | gf_log ("fuse", GF_LOG_TRACE,do { do { if (0) printf ("got request to invalidate %""ll" "u" , finh->nodeid); } while (0); _gf_log ("fuse", "fuse-bridge.c" , __FUNCTION__, 2925, GF_LOG_TRACE, "got request to invalidate %" "ll" "u", finh->nodeid); } while (0) |
2925 | "got request to invalidate %"PRIu64, finh->nodeid)do { do { if (0) printf ("got request to invalidate %""ll" "u" , finh->nodeid); } while (0); _gf_log ("fuse", "fuse-bridge.c" , __FUNCTION__, 2925, GF_LOG_TRACE, "got request to invalidate %" "ll" "u", finh->nodeid); } while (0); |
2926 | send_fuse_err (this, finh, 0); |
2927 | fuse_invalidate_entry (this, finh->nodeid); |
2928 | GF_FREE (finh)__gf_free (finh); |
2929 | return; |
2930 | } |
2931 | |
2932 | if (!strcmp (GFID_XATTR_KEY"trusted.gfid", name)) { |
2933 | send_fuse_err (this, finh, EPERM1); |
2934 | GF_FREE (finh)__gf_free (finh); |
2935 | return; |
2936 | } |
2937 | |
2938 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 2938, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
2939 | state->size = fsi->size; |
2940 | |
2941 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
2942 | |
2943 | state->xattr = get_new_dict (); |
2944 | if (!state->xattr) { |
2945 | gf_log ("glusterfs-fuse", GF_LOG_ERROR,do { do { if (0) printf ("%""ll" "u"": SETXATTR dict allocation failed" , finh->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2947, GF_LOG_ERROR, "%""ll" "u"": SETXATTR dict allocation failed" , finh->unique); } while (0) |
2946 | "%"PRIu64": SETXATTR dict allocation failed",do { do { if (0) printf ("%""ll" "u"": SETXATTR dict allocation failed" , finh->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2947, GF_LOG_ERROR, "%""ll" "u"": SETXATTR dict allocation failed" , finh->unique); } while (0) |
2947 | finh->unique)do { do { if (0) printf ("%""ll" "u"": SETXATTR dict allocation failed" , finh->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 2947, GF_LOG_ERROR, "%""ll" "u"": SETXATTR dict allocation failed" , finh->unique); } while (0); |
2948 | |
2949 | send_fuse_err (this, finh, ENOMEM12); |
2950 | free_fuse_state (state); |
2951 | return; |
2952 | } |
2953 | |
2954 | ret = fuse_flip_xattr_ns (priv, name, &newkey); |
2955 | if (ret) { |
2956 | send_fuse_err (this, finh, ENOMEM12); |
2957 | free_fuse_state (state); |
2958 | return; |
2959 | } |
2960 | |
2961 | if (fsi->size > 0) { |
2962 | dict_value = memdup (value, fsi->size); |
2963 | } else { |
2964 | 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__ , 2964, GF_LOG_ERROR, "value size zero"); } while (0); |
2965 | dict_value = NULL((void*)0); |
2966 | } |
2967 | dict_set (state->xattr, newkey, |
2968 | data_from_dynptr ((void *)dict_value, fsi->size)); |
2969 | dict_ref (state->xattr); |
2970 | |
2971 | state->flags = fsi->flags; |
2972 | state->name = newkey; |
2973 | |
2974 | fuse_resolve_and_resume (state, fuse_setxattr_resume); |
2975 | |
2976 | return; |
2977 | } |
2978 | |
2979 | |
2980 | static void |
2981 | send_fuse_xattr (xlator_t *this, fuse_in_header_t *finh, const char *value, |
2982 | size_t size, size_t expected) |
2983 | { |
2984 | struct fuse_getxattr_out fgxo; |
2985 | |
2986 | /* linux kernel limits the size of xattr value to 64k */ |
2987 | if (size > GLUSTERFS_XATTR_LEN_MAX65536) |
2988 | send_fuse_err (this, finh, E2BIG7); |
2989 | else if (expected) { |
2990 | /* if callback for getxattr and asks for value */ |
2991 | if (size > expected) |
2992 | /* reply would be bigger than |
2993 | * what was asked by kernel */ |
2994 | send_fuse_err (this, finh, ERANGE34); |
2995 | else |
2996 | send_fuse_data (this, finh, (void *)value, size); |
2997 | } else { |
2998 | fgxo.size = size; |
2999 | send_fuse_obj (this, finh, &fgxo)send_fuse_data (this, finh, &fgxo, sizeof (*(&fgxo))); |
3000 | } |
3001 | } |
3002 | |
3003 | /* filter out xattrs that need not be visible on the |
3004 | * mount point. this is _specifically_ for geo-rep |
3005 | * as of now, to prevent Rsync from crying out loud |
3006 | * when it tries to setxattr() for selinux xattrs |
3007 | */ |
3008 | static int |
3009 | fuse_filter_xattr(char *key) |
3010 | { |
3011 | int need_filter = 0; |
3012 | struct fuse_private *priv = THIS(*__glusterfs_this_location())->private; |
3013 | |
3014 | if ((priv->client_pid == GF_CLIENT_PID_GSYNCD) |
3015 | && fnmatch ("*.selinux*", key, FNM_PERIOD(1 << 2)) == 0) |
3016 | need_filter = 1; |
3017 | |
3018 | return need_filter; |
3019 | } |
3020 | |
3021 | |
3022 | static int |
3023 | fuse_xattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
3024 | int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata) |
3025 | { |
3026 | int need_to_free_dict = 0; |
3027 | char *value = ""; |
3028 | fuse_state_t *state = NULL((void*)0); |
3029 | fuse_in_header_t *finh = NULL((void*)0); |
3030 | data_t *value_data = NULL((void*)0); |
3031 | int ret = -1; |
3032 | int32_t len = 0; |
3033 | int32_t len_next = 0; |
3034 | |
3035 | state = frame->root->state; |
3036 | finh = state->finh; |
3037 | |
3038 | 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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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); |
3039 | |
3040 | if (op_ret >= 0) { |
3041 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "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__, 3043, GF_LOG_TRACE, "%""ll" "u" ": %s() %s => %d", frame->root->unique, gf_fop_list[ frame->root->op], state->loc.path, op_ret); } while ( 0) |
3042 | "%"PRIu64": %s() %s => %d", frame->root->unique,do { do { if (0) printf ("%""ll" "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__, 3043, GF_LOG_TRACE, "%""ll" "u" ": %s() %s => %d", frame->root->unique, gf_fop_list[ frame->root->op], state->loc.path, op_ret); } while ( 0) |
3043 | gf_fop_list[frame->root->op], state->loc.path, op_ret)do { do { if (0) printf ("%""ll" "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__, 3043, GF_LOG_TRACE, "%""ll" "u" ": %s() %s => %d", frame->root->unique, gf_fop_list[ frame->root->op], state->loc.path, op_ret); } while ( 0); |
3044 | |
3045 | /* if successful */ |
3046 | if (state->name) { |
3047 | /* if callback for getxattr */ |
3048 | value_data = dict_get (dict, state->name); |
3049 | if (value_data) { |
3050 | |
3051 | ret = value_data->len; /* Don't return the value for '\0' */ |
3052 | value = value_data->data; |
3053 | |
3054 | send_fuse_xattr (this, finh, value, ret, state->size); |
3055 | /* if(ret >...)...else if...else */ |
3056 | } else { |
3057 | send_fuse_err (this, finh, ENODATA61); |
3058 | } /* if(value_data)...else */ |
3059 | } else { |
3060 | /* if callback for listxattr */ |
3061 | /* we need to invoke fuse_filter_xattr() twice. Once |
3062 | * while counting size and then while filling buffer |
3063 | */ |
3064 | len = dict_keys_join (NULL((void*)0), 0, dict, fuse_filter_xattr); |
3065 | if (len < 0) |
3066 | goto out; |
3067 | |
3068 | value = alloca (len + 1)__builtin_alloca (len + 1); |
3069 | if (!value) |
3070 | goto out; |
3071 | |
3072 | len_next = dict_keys_join (value, len, dict, |
3073 | fuse_filter_xattr); |
3074 | if (len_next != len) |
3075 | 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__, 3077, GF_LOG_ERROR, "sizes not equal %d != %d" , len, len_next); } while (0) |
3076 | "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__, 3077, GF_LOG_ERROR, "sizes not equal %d != %d" , len, len_next); } while (0) |
3077 | 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__, 3077, GF_LOG_ERROR, "sizes not equal %d != %d" , len, len_next); } while (0); |
3078 | |
3079 | send_fuse_xattr (this, finh, value, len, state->size); |
3080 | } /* if(state->name)...else */ |
3081 | } else { |
3082 | /* if failure - no need to check if listxattr or getxattr */ |
3083 | if (op_errno != ENODATA61) { |
3084 | if (op_errno == ENOTSUP95) { |
3085 | 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__ , 3090, GF_LOG_ERROR, "extended attribute not " "supported by the backend " "storage"); } while (0); } |
3086 | "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__ , 3090, GF_LOG_ERROR, "extended attribute not " "supported by the backend " "storage"); } while (0); } |
3087 | 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__ , 3090, GF_LOG_ERROR, "extended attribute not " "supported by the backend " "storage"); } while (0); } |
3088 | "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__ , 3090, GF_LOG_ERROR, "extended attribute not " "supported by the backend " "storage"); } while (0); } |
3089 | "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__ , 3090, GF_LOG_ERROR, "extended attribute not " "supported by the backend " "storage"); } while (0); } |
3090 | "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__ , 3090, GF_LOG_ERROR, "extended attribute not " "supported by the backend " "storage"); } while (0); }; |
3091 | } else { |
3092 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "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__ , 3096, GF_LOG_WARNING, "%""ll" "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) |
3093 | "%"PRIu64": %s(%s) %s => -1 (%s)",do { do { if (0) printf ("%""ll" "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__ , 3096, GF_LOG_WARNING, "%""ll" "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) |
3094 | frame->root->unique,do { do { if (0) printf ("%""ll" "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__ , 3096, GF_LOG_WARNING, "%""ll" "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) |
3095 | gf_fop_list[frame->root->op], state->name,do { do { if (0) printf ("%""ll" "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__ , 3096, GF_LOG_WARNING, "%""ll" "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) |
3096 | state->loc.path, strerror (op_errno))do { do { if (0) printf ("%""ll" "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__ , 3096, GF_LOG_WARNING, "%""ll" "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); |
3097 | } |
3098 | } else { |
3099 | gf_log ("glusterfs-fuse", GF_LOG_DEBUG,do { do { if (0) printf ("%""ll" "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__ , 3103, GF_LOG_DEBUG, "%""ll" "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) |
3100 | "%"PRIu64": %s(%s) %s => -1 (%s)",do { do { if (0) printf ("%""ll" "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__ , 3103, GF_LOG_DEBUG, "%""ll" "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) |
3101 | frame->root->unique,do { do { if (0) printf ("%""ll" "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__ , 3103, GF_LOG_DEBUG, "%""ll" "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) |
3102 | gf_fop_list[frame->root->op], state->name,do { do { if (0) printf ("%""ll" "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__ , 3103, GF_LOG_DEBUG, "%""ll" "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) |
3103 | state->loc.path, strerror (op_errno))do { do { if (0) printf ("%""ll" "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__ , 3103, GF_LOG_DEBUG, "%""ll" "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); |
3104 | } /* if(op_errno!= ENODATA)...else */ |
3105 | |
3106 | send_fuse_err (this, finh, op_errno); |
3107 | } /* if(op_ret>=0)...else */ |
3108 | |
3109 | out: |
3110 | if (need_to_free_dict) |
3111 | dict_unref (dict); |
3112 | |
3113 | free_fuse_state (state); |
3114 | STACK_DESTROY (frame->root); |
3115 | |
3116 | return 0; |
3117 | } |
3118 | |
3119 | |
3120 | void |
3121 | fuse_getxattr_resume (fuse_state_t *state) |
3122 | { |
3123 | if (!state->loc.inode) { |
3124 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": GETXATTR %s/%""ll" "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__, 3129, GF_LOG_WARNING, "%""ll" "u"": GETXATTR %s/%" "ll" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0) |
3125 | "%"PRIu64": GETXATTR %s/%"PRIu64" (%s) "do { do { if (0) printf ("%""ll" "u"": GETXATTR %s/%""ll" "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__, 3129, GF_LOG_WARNING, "%""ll" "u"": GETXATTR %s/%" "ll" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0) |
3126 | "resolution failed",do { do { if (0) printf ("%""ll" "u"": GETXATTR %s/%""ll" "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__, 3129, GF_LOG_WARNING, "%""ll" "u"": GETXATTR %s/%" "ll" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0) |
3127 | state->finh->unique,do { do { if (0) printf ("%""ll" "u"": GETXATTR %s/%""ll" "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__, 3129, GF_LOG_WARNING, "%""ll" "u"": GETXATTR %s/%" "ll" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0) |
3128 | uuid_utoa (state->resolve.gfid),do { do { if (0) printf ("%""ll" "u"": GETXATTR %s/%""ll" "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__, 3129, GF_LOG_WARNING, "%""ll" "u"": GETXATTR %s/%" "ll" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0) |
3129 | state->finh->nodeid, state->name)do { do { if (0) printf ("%""ll" "u"": GETXATTR %s/%""ll" "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__, 3129, GF_LOG_WARNING, "%""ll" "u"": GETXATTR %s/%" "ll" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0); |
3130 | |
3131 | send_fuse_err (state->this, state->finh, ENOENT2); |
3132 | free_fuse_state (state); |
3133 | return; |
3134 | } |
3135 | |
3136 | #ifdef GF_TEST_FFOP |
3137 | state->fd = fd_lookup (state->loc.inode, state->finh->pid); |
3138 | #endif /* GF_TEST_FFOP */ |
3139 | |
3140 | if (state->fd) { |
3141 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": GETXATTR %p/%""ll" "u" " (%s)", state->finh->unique, state->fd, state->finh ->nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3143, GF_LOG_TRACE, "%""ll" "u" ": GETXATTR %p/%""ll" "u"" (%s)", state->finh->unique, state ->fd, state->finh->nodeid, state->name); } while ( 0) |
3142 | "%"PRIu64": GETXATTR %p/%"PRIu64" (%s)", state->finh->unique,do { do { if (0) printf ("%""ll" "u"": GETXATTR %p/%""ll" "u" " (%s)", state->finh->unique, state->fd, state->finh ->nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3143, GF_LOG_TRACE, "%""ll" "u" ": GETXATTR %p/%""ll" "u"" (%s)", state->finh->unique, state ->fd, state->finh->nodeid, state->name); } while ( 0) |
3143 | state->fd, state->finh->nodeid, state->name)do { do { if (0) printf ("%""ll" "u"": GETXATTR %p/%""ll" "u" " (%s)", state->finh->unique, state->fd, state->finh ->nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3143, GF_LOG_TRACE, "%""ll" "u" ": GETXATTR %p/%""ll" "u"" (%s)", state->finh->unique, state ->fd, state->finh->nodeid, state->name); } while ( 0); |
3144 | |
3145 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3146, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 3146, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_FGETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3146, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3146, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 3146, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 3146, 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) |
3146 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3146, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 3146, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_FGETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3146, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3146, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 3146, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 3146, 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); |
3147 | } else { |
3148 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": GETXATTR %s/%""ll" "u" " (%s)", state->finh->unique, state->loc.path, state ->finh->nodeid, state->name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3150, GF_LOG_TRACE , "%""ll" "u"": GETXATTR %s/%""ll" "u"" (%s)", state->finh ->unique, state->loc.path, state->finh->nodeid, state ->name); } while (0) |
3149 | "%"PRIu64": GETXATTR %s/%"PRIu64" (%s)", state->finh->unique,do { do { if (0) printf ("%""ll" "u"": GETXATTR %s/%""ll" "u" " (%s)", state->finh->unique, state->loc.path, state ->finh->nodeid, state->name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3150, GF_LOG_TRACE , "%""ll" "u"": GETXATTR %s/%""ll" "u"" (%s)", state->finh ->unique, state->loc.path, state->finh->nodeid, state ->name); } while (0) |
3150 | state->loc.path, state->finh->nodeid, state->name)do { do { if (0) printf ("%""ll" "u"": GETXATTR %s/%""ll" "u" " (%s)", state->finh->unique, state->loc.path, state ->finh->nodeid, state->name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3150, GF_LOG_TRACE , "%""ll" "u"": GETXATTR %s/%""ll" "u"" (%s)", state->finh ->unique, state->loc.path, state->finh->nodeid, state ->name); } while (0); |
3151 | |
3152 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3153, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 3153, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_GETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3153, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3153, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 3153, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 3153, 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) |
3153 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3153, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 3153, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_GETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3153, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3153, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 3153, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 3153, 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); |
3154 | } |
3155 | } |
3156 | |
3157 | |
3158 | static void |
3159 | fuse_getxattr (xlator_t *this, fuse_in_header_t *finh, void *msg) |
3160 | { |
3161 | struct fuse_getxattr_in *fgxi = msg; |
3162 | char *name = (char *)(fgxi + 1); |
3163 | |
3164 | fuse_state_t *state = NULL((void*)0); |
3165 | struct fuse_private *priv = NULL((void*)0); |
3166 | int rv = 0; |
3167 | char *newkey = NULL((void*)0); |
3168 | |
3169 | priv = this->private; |
3170 | |
3171 | #ifdef GF_DARWIN_HOST_OS |
3172 | if (fgxi->position) { |
3173 | /* position can be used only for |
3174 | * resource fork queries which we |
3175 | * don't support anyway... so handling |
3176 | * it separately is just sort of a |
3177 | * matter of aesthetics, not strictly |
3178 | * necessary. |
3179 | */ |
3180 | |
3181 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": GETXATTR %s/%""ll" "u" " (%s):" "refusing positioned getxattr", finh->unique, state ->loc.path, finh->nodeid, name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3184, GF_LOG_WARNING , "%""ll" "u"": GETXATTR %s/%""ll" "u"" (%s):" "refusing positioned getxattr" , finh->unique, state->loc.path, finh->nodeid, name) ; } while (0) |
3182 | "%"PRIu64": GETXATTR %s/%"PRIu64" (%s):"do { do { if (0) printf ("%""ll" "u"": GETXATTR %s/%""ll" "u" " (%s):" "refusing positioned getxattr", finh->unique, state ->loc.path, finh->nodeid, name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3184, GF_LOG_WARNING , "%""ll" "u"": GETXATTR %s/%""ll" "u"" (%s):" "refusing positioned getxattr" , finh->unique, state->loc.path, finh->nodeid, name) ; } while (0) |
3183 | "refusing positioned getxattr",do { do { if (0) printf ("%""ll" "u"": GETXATTR %s/%""ll" "u" " (%s):" "refusing positioned getxattr", finh->unique, state ->loc.path, finh->nodeid, name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3184, GF_LOG_WARNING , "%""ll" "u"": GETXATTR %s/%""ll" "u"" (%s):" "refusing positioned getxattr" , finh->unique, state->loc.path, finh->nodeid, name) ; } while (0) |
3184 | finh->unique, state->loc.path, finh->nodeid, name)do { do { if (0) printf ("%""ll" "u"": GETXATTR %s/%""ll" "u" " (%s):" "refusing positioned getxattr", finh->unique, state ->loc.path, finh->nodeid, name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3184, GF_LOG_WARNING , "%""ll" "u"": GETXATTR %s/%""ll" "u"" (%s):" "refusing positioned getxattr" , finh->unique, state->loc.path, finh->nodeid, name) ; } while (0); |
3185 | send_fuse_err (this, finh, EINVAL22); |
3186 | FREE (finh)if (finh != ((void*)0)) { free ((void *)finh); finh = (void * )0xeeeeeeee; }; |
3187 | return; |
3188 | } |
3189 | #endif |
3190 | |
3191 | if (!priv->acl) { |
3192 | if ((strcmp (name, "system.posix_acl_access") == 0) || |
3193 | (strcmp (name, "system.posix_acl_default") == 0)) { |
3194 | send_fuse_err (this, finh, ENOTSUP95); |
3195 | GF_FREE (finh)__gf_free (finh); |
3196 | return; |
3197 | } |
3198 | } |
3199 | |
3200 | if (!priv->selinux) { |
3201 | if (strncmp (name, "security.", 9) == 0) { |
3202 | send_fuse_err (this, finh, ENODATA61); |
3203 | GF_FREE (finh)__gf_free (finh); |
3204 | return; |
3205 | } |
3206 | } |
3207 | |
3208 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3208, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
3209 | |
3210 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
3211 | |
3212 | rv = fuse_flip_xattr_ns (priv, name, &newkey); |
3213 | if (rv) { |
3214 | send_fuse_err (this, finh, ENOMEM12); |
3215 | free_fuse_state (state); |
3216 | goto out; |
3217 | } |
3218 | |
3219 | state->size = fgxi->size; |
3220 | state->name = newkey; |
3221 | |
3222 | fuse_resolve_and_resume (state, fuse_getxattr_resume); |
3223 | out: |
3224 | return; |
3225 | } |
3226 | |
3227 | |
3228 | void |
3229 | fuse_listxattr_resume (fuse_state_t *state) |
3230 | { |
3231 | if (!state->loc.inode) { |
3232 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": LISTXATTR %s/%""ll" "u" "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3235, GF_LOG_WARNING , "%""ll" "u"": LISTXATTR %s/%""ll" "u" "resolution failed", state ->finh->unique, uuid_utoa (state->resolve.gfid), state ->finh->nodeid); } while (0) |
3233 | "%"PRIu64": LISTXATTR %s/%"PRIu64do { do { if (0) printf ("%""ll" "u"": LISTXATTR %s/%""ll" "u" "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3235, GF_LOG_WARNING , "%""ll" "u"": LISTXATTR %s/%""ll" "u" "resolution failed", state ->finh->unique, uuid_utoa (state->resolve.gfid), state ->finh->nodeid); } while (0) |
3234 | "resolution failed", state->finh->unique,do { do { if (0) printf ("%""ll" "u"": LISTXATTR %s/%""ll" "u" "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3235, GF_LOG_WARNING , "%""ll" "u"": LISTXATTR %s/%""ll" "u" "resolution failed", state ->finh->unique, uuid_utoa (state->resolve.gfid), state ->finh->nodeid); } while (0) |
3235 | uuid_utoa (state->resolve.gfid), state->finh->nodeid)do { do { if (0) printf ("%""ll" "u"": LISTXATTR %s/%""ll" "u" "resolution failed", state->finh->unique, uuid_utoa (state ->resolve.gfid), state->finh->nodeid); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3235, GF_LOG_WARNING , "%""ll" "u"": LISTXATTR %s/%""ll" "u" "resolution failed", state ->finh->unique, uuid_utoa (state->resolve.gfid), state ->finh->nodeid); } while (0); |
3236 | |
3237 | send_fuse_err (state->this, state->finh, ENOENT2); |
3238 | free_fuse_state (state); |
3239 | return; |
3240 | } |
3241 | |
3242 | #ifdef GF_TEST_FFOP |
3243 | state->fd = fd_lookup (state->loc.inode, state->finh->pid); |
3244 | #endif /* GF_TEST_FFOP */ |
3245 | |
3246 | if (state->fd) { |
3247 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": LISTXATTR %p/%""ll" "u" , state->finh->unique, state->fd, state->finh-> nodeid); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3249, GF_LOG_TRACE, "%""ll" "u"": LISTXATTR %p/%" "ll" "u", state->finh->unique, state->fd, state-> finh->nodeid); } while (0) |
3248 | "%"PRIu64": LISTXATTR %p/%"PRIu64, state->finh->unique,do { do { if (0) printf ("%""ll" "u"": LISTXATTR %p/%""ll" "u" , state->finh->unique, state->fd, state->finh-> nodeid); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3249, GF_LOG_TRACE, "%""ll" "u"": LISTXATTR %p/%" "ll" "u", state->finh->unique, state->fd, state-> finh->nodeid); } while (0) |
3249 | state->fd, state->finh->nodeid)do { do { if (0) printf ("%""ll" "u"": LISTXATTR %p/%""ll" "u" , state->finh->unique, state->fd, state->finh-> nodeid); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3249, GF_LOG_TRACE, "%""ll" "u"": LISTXATTR %p/%" "ll" "u", state->finh->unique, state->fd, state-> finh->nodeid); } while (0); |
3250 | |
3251 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3252, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 3252, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_FGETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3252, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3252, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 3252, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 3252, 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) |
3252 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3252, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 3252, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_FGETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3252, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3252, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 3252, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 3252, 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); |
3253 | } else { |
3254 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": LISTXATTR %s/%""ll" "u" , state->finh->unique, state->loc.path, state->finh ->nodeid); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3256, GF_LOG_TRACE, "%""ll" "u"": LISTXATTR %s/%" "ll" "u", state->finh->unique, state->loc.path, state ->finh->nodeid); } while (0) |
3255 | "%"PRIu64": LISTXATTR %s/%"PRIu64, state->finh->unique,do { do { if (0) printf ("%""ll" "u"": LISTXATTR %s/%""ll" "u" , state->finh->unique, state->loc.path, state->finh ->nodeid); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3256, GF_LOG_TRACE, "%""ll" "u"": LISTXATTR %s/%" "ll" "u", state->finh->unique, state->loc.path, state ->finh->nodeid); } while (0) |
3256 | state->loc.path, state->finh->nodeid)do { do { if (0) printf ("%""ll" "u"": LISTXATTR %s/%""ll" "u" , state->finh->unique, state->loc.path, state->finh ->nodeid); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3256, GF_LOG_TRACE, "%""ll" "u"": LISTXATTR %s/%" "ll" "u", state->finh->unique, state->loc.path, state ->finh->nodeid); } while (0); |
3257 | |
3258 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3259, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 3259, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_GETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3259, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3259, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 3259, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 3259, 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) |
3259 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3259, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 3259, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_GETXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique , gf_fop_list[frame->root->op], state->resolve.resolve_loc .path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3259, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3259, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 3259, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 3259, 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); |
3260 | } |
3261 | } |
3262 | |
3263 | |
3264 | static void |
3265 | fuse_listxattr (xlator_t *this, fuse_in_header_t *finh, void *msg) |
3266 | { |
3267 | struct fuse_getxattr_in *fgxi = msg; |
3268 | fuse_state_t *state = NULL((void*)0); |
3269 | |
3270 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3270, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
3271 | |
3272 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
3273 | |
3274 | state->size = fgxi->size; |
3275 | |
3276 | fuse_resolve_and_resume (state, fuse_listxattr_resume); |
3277 | |
3278 | return; |
3279 | } |
3280 | |
3281 | |
3282 | void |
3283 | fuse_removexattr_resume (fuse_state_t *state) |
3284 | { |
3285 | if (!state->loc.inode) { |
3286 | gf_log ("glusterfs-fuse", GF_LOG_DEBUG,do { do { if (0) printf ("%""ll" "u"": REMOVEXATTR %s/%""ll" "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__, 3290, GF_LOG_DEBUG, "%""ll" "u"": REMOVEXATTR %s/%" "ll" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0) |
3287 | "%"PRIu64": REMOVEXATTR %s/%"PRIu64" (%s) "do { do { if (0) printf ("%""ll" "u"": REMOVEXATTR %s/%""ll" "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__, 3290, GF_LOG_DEBUG, "%""ll" "u"": REMOVEXATTR %s/%" "ll" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0) |
3288 | "resolution failed",do { do { if (0) printf ("%""ll" "u"": REMOVEXATTR %s/%""ll" "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__, 3290, GF_LOG_DEBUG, "%""ll" "u"": REMOVEXATTR %s/%" "ll" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0) |
3289 | state->finh->unique, uuid_utoa (state->resolve.gfid),do { do { if (0) printf ("%""ll" "u"": REMOVEXATTR %s/%""ll" "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__, 3290, GF_LOG_DEBUG, "%""ll" "u"": REMOVEXATTR %s/%" "ll" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0) |
3290 | state->finh->nodeid, state->name)do { do { if (0) printf ("%""ll" "u"": REMOVEXATTR %s/%""ll" "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__, 3290, GF_LOG_DEBUG, "%""ll" "u"": REMOVEXATTR %s/%" "ll" "u"" (%s) " "resolution failed", state->finh->unique , uuid_utoa (state->resolve.gfid), state->finh->nodeid , state->name); } while (0); |
3291 | |
3292 | send_fuse_err (state->this, state->finh, ENOENT2); |
3293 | free_fuse_state (state); |
3294 | return; |
3295 | } |
3296 | |
3297 | #ifdef GF_TEST_FFOP |
3298 | state->fd = fd_lookup (state->loc.inode, state->finh->pid); |
3299 | #endif /* GF_TEST_FFOP */ |
3300 | |
3301 | if (state->fd) { |
3302 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": REMOVEXATTR %p/%""ll" "u" " (%s)", state->finh->unique, state->fd, state->finh ->nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3304, GF_LOG_TRACE, "%""ll" "u" ": REMOVEXATTR %p/%""ll" "u"" (%s)", state->finh->unique , state->fd, state->finh->nodeid, state->name); } while (0) |
3303 | "%"PRIu64": REMOVEXATTR %p/%"PRIu64" (%s)", state->finh->unique,do { do { if (0) printf ("%""ll" "u"": REMOVEXATTR %p/%""ll" "u" " (%s)", state->finh->unique, state->fd, state->finh ->nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3304, GF_LOG_TRACE, "%""ll" "u" ": REMOVEXATTR %p/%""ll" "u"" (%s)", state->finh->unique , state->fd, state->finh->nodeid, state->name); } while (0) |
3304 | state->fd, state->finh->nodeid, state->name)do { do { if (0) printf ("%""ll" "u"": REMOVEXATTR %p/%""ll" "u" " (%s)", state->finh->unique, state->fd, state->finh ->nodeid, state->name); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3304, GF_LOG_TRACE, "%""ll" "u" ": REMOVEXATTR %p/%""ll" "u"" (%s)", state->finh->unique , state->fd, state->finh->nodeid, state->name); } while (0); |
3305 | |
3306 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3307, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 3307, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (state-> resolve.op_ret < 0) { op_errno = state->resolve.op_errno ; op_ret = -1; if (GF_FOP_FREMOVEXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3307, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3307, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 3307, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 3307, 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) |
3307 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3307, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 3307, GF_LOG_ERROR, "xl is NULL" ); } while (0); op_errno = 2; op_ret = -1; } else if (state-> resolve.op_ret < 0) { op_errno = state->resolve.op_errno ; op_ret = -1; if (GF_FOP_FREMOVEXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3307, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3307, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 3307, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 3307, 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); |
3308 | } else { |
3309 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": REMOVEXATTR %s/%""ll" "u" " (%s)", state->finh->unique, state->loc.path, state ->finh->nodeid, state->name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3311, GF_LOG_TRACE , "%""ll" "u"": REMOVEXATTR %s/%""ll" "u"" (%s)", state->finh ->unique, state->loc.path, state->finh->nodeid, state ->name); } while (0) |
3310 | "%"PRIu64": REMOVEXATTR %s/%"PRIu64" (%s)", state->finh->unique,do { do { if (0) printf ("%""ll" "u"": REMOVEXATTR %s/%""ll" "u" " (%s)", state->finh->unique, state->loc.path, state ->finh->nodeid, state->name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3311, GF_LOG_TRACE , "%""ll" "u"": REMOVEXATTR %s/%""ll" "u"" (%s)", state->finh ->unique, state->loc.path, state->finh->nodeid, state ->name); } while (0) |
3311 | state->loc.path, state->finh->nodeid, state->name)do { do { if (0) printf ("%""ll" "u"": REMOVEXATTR %s/%""ll" "u" " (%s)", state->finh->unique, state->loc.path, state ->finh->nodeid, state->name); } while (0); _gf_log ( "glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3311, GF_LOG_TRACE , "%""ll" "u"": REMOVEXATTR %s/%""ll" "u"" (%s)", state->finh ->unique, state->loc.path, state->finh->nodeid, state ->name); } while (0); |
3312 | |
3313 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3314, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 3314, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_REMOVEXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], state->resolve .resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3314, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3314, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 3314, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 3314, 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) |
3314 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3314, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__, 3314, GF_LOG_ERROR, "xl is NULL"); } while (0 ); op_errno = 2; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1 ; if (GF_FOP_REMOVEXATTR == GF_FOP_LOOKUP) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)", frame->root ->unique, gf_fop_list[frame->root->op], state->resolve .resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3314, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ("%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3314, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->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 ("%""ll" "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__ , 3314, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 3314, 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); |
3315 | } |
3316 | } |
3317 | |
3318 | |
3319 | static void |
3320 | fuse_removexattr (xlator_t *this, fuse_in_header_t *finh, void *msg) |
3321 | { |
3322 | char *name = msg; |
3323 | |
3324 | fuse_state_t *state = NULL((void*)0); |
3325 | fuse_private_t *priv = NULL((void*)0); |
3326 | int32_t ret = -1; |
3327 | char *newkey = NULL((void*)0); |
3328 | |
3329 | if (!strcmp (GFID_XATTR_KEY"trusted.gfid", name)) { |
3330 | send_fuse_err (this, finh, EPERM1); |
3331 | GF_FREE (finh)__gf_free (finh); |
3332 | return; |
3333 | } |
3334 | |
3335 | priv = this->private; |
3336 | |
3337 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3337, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
3338 | |
3339 | fuse_resolve_inode_init (state, &state->resolve, finh->nodeid); |
3340 | |
3341 | ret = fuse_flip_xattr_ns (priv, name, &newkey); |
3342 | if (ret) { |
3343 | send_fuse_err (this, finh, ENOMEM12); |
3344 | free_fuse_state (state); |
3345 | return; |
3346 | } |
3347 | |
3348 | state->name = newkey; |
3349 | |
3350 | fuse_resolve_and_resume (state, fuse_removexattr_resume); |
3351 | return; |
3352 | } |
3353 | |
3354 | |
3355 | static int gf_fuse_lk_enosys_log; |
3356 | |
3357 | static int |
3358 | fuse_getlk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
3359 | int32_t op_ret, int32_t op_errno, struct gf_flock *lock, |
3360 | dict_t *xdata) |
3361 | { |
3362 | fuse_state_t *state = NULL((void*)0); |
3363 | |
3364 | state = frame->root->state; |
3365 | struct fuse_lk_out flo = {{0, }, }; |
3366 | |
3367 | 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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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); |
3368 | |
3369 | if (op_ret == 0) { |
3370 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": ERR => 0", frame-> root->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3371, GF_LOG_TRACE, "%""ll" "u"": ERR => 0" , frame->root->unique); } while (0) |
3371 | "%"PRIu64": ERR => 0", frame->root->unique)do { do { if (0) printf ("%""ll" "u"": ERR => 0", frame-> root->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3371, GF_LOG_TRACE, "%""ll" "u"": ERR => 0" , frame->root->unique); } while (0); |
3372 | flo.lk.type = lock->l_type; |
3373 | flo.lk.pid = lock->l_pid; |
3374 | if (lock->l_type == F_UNLCK2) |
3375 | flo.lk.start = flo.lk.end = 0; |
3376 | else { |
3377 | flo.lk.start = lock->l_start; |
3378 | flo.lk.end = lock->l_len ? |
3379 | (lock->l_start + lock->l_len - 1) : |
3380 | OFFSET_MAX0x7fffffffffffffffLL; |
3381 | } |
3382 | send_fuse_obj (this, state->finh, &flo)send_fuse_data (this, state->finh, &flo, sizeof (*(& flo))); |
3383 | } else { |
3384 | if (op_errno == ENOSYS38) { |
3385 | gf_fuse_lk_enosys_log++; |
3386 | if (!(gf_fuse_lk_enosys_log % GF_UNIVERSAL_ANSWER42)) { |
3387 | 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__, 3390, GF_LOG_ERROR, "GETLK not supported. loading " "'features/posix-locks' on server side " "will add GETLK support." ); } while (0) |
3388 | "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__, 3390, GF_LOG_ERROR, "GETLK not supported. loading " "'features/posix-locks' on server side " "will add GETLK support." ); } while (0) |
3389 | "'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__, 3390, GF_LOG_ERROR, "GETLK not supported. loading " "'features/posix-locks' on server side " "will add GETLK support." ); } while (0) |
3390 | "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__, 3390, GF_LOG_ERROR, "GETLK not supported. loading " "'features/posix-locks' on server side " "will add GETLK support." ); } while (0); |
3391 | } |
3392 | } else { |
3393 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": ERR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3395, GF_LOG_WARNING , "%""ll" "u"": ERR => -1 (%s)", frame->root->unique , strerror (op_errno)); } while (0) |
3394 | "%"PRIu64": ERR => -1 (%s)",do { do { if (0) printf ("%""ll" "u"": ERR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3395, GF_LOG_WARNING , "%""ll" "u"": ERR => -1 (%s)", frame->root->unique , strerror (op_errno)); } while (0) |
3395 | frame->root->unique, strerror (op_errno))do { do { if (0) printf ("%""ll" "u"": ERR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3395, GF_LOG_WARNING , "%""ll" "u"": ERR => -1 (%s)", frame->root->unique , strerror (op_errno)); } while (0); |
3396 | } |
3397 | send_fuse_err (this, state->finh, op_errno); |
3398 | } |
3399 | |
3400 | free_fuse_state (state); |
3401 | STACK_DESTROY (frame->root); |
3402 | |
3403 | return 0; |
3404 | } |
3405 | |
3406 | |
3407 | void |
3408 | fuse_getlk_resume (fuse_state_t *state) |
3409 | { |
3410 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": GETLK %p", state->finh ->unique, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3411, GF_LOG_TRACE, "%""ll" "u" ": GETLK %p", state->finh->unique, state->fd); } while (0) |
3411 | "%"PRIu64": GETLK %p", state->finh->unique, state->fd)do { do { if (0) printf ("%""ll" "u"": GETLK %p", state->finh ->unique, state->fd); } while (0); _gf_log ("glusterfs-fuse" , "fuse-bridge.c", __FUNCTION__, 3411, GF_LOG_TRACE, "%""ll" "u" ": GETLK %p", state->finh->unique, state->fd); } while (0); |
3412 | |
3413 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3414, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 3414, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_LK == GF_FOP_LOOKUP ) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3414, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3414, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 3414, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 3414, 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, 12, &state ->lk_lock, state->xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); } } while (0) |
3414 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3414, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 3414, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_LK == GF_FOP_LOOKUP ) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3414, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3414, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 3414, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 3414, 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, 12, &state ->lk_lock, state->xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); } } while (0); |
3415 | } |
3416 | |
3417 | |
3418 | static void |
3419 | fuse_getlk (xlator_t *this, fuse_in_header_t *finh, void *msg) |
3420 | { |
3421 | struct fuse_lk_in *fli = msg; |
3422 | |
3423 | fuse_state_t *state = NULL((void*)0); |
3424 | fd_t *fd = NULL((void*)0); |
3425 | |
3426 | fd = FH_TO_FD (fli->fh)((((fd_t *)(uintptr_t)(fli->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fli->fh)))):((fd_t *) 0)); |
3427 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3427, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
3428 | state->fd = fd; |
3429 | |
3430 | fuse_resolve_fd_init (state, &state->resolve, fd); |
3431 | |
3432 | convert_fuse_file_lock (&fli->lk, &state->lk_lock, |
3433 | fli->owner); |
3434 | |
3435 | state->lk_owner = fli->owner; |
3436 | |
3437 | fuse_resolve_and_resume (state, fuse_getlk_resume); |
3438 | |
3439 | return; |
3440 | } |
3441 | |
3442 | |
3443 | static int |
3444 | fuse_setlk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
3445 | int32_t op_ret, int32_t op_errno, struct gf_flock *lock, |
3446 | dict_t *xdata) |
3447 | { |
3448 | uint32_t op = 0; |
3449 | fuse_state_t *state = NULL((void*)0); |
3450 | |
3451 | state = frame->root->state; |
3452 | op = state->finh->opcode; |
3453 | |
3454 | 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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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, " "%""ll" "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); |
3455 | |
3456 | if (op_ret == 0) { |
3457 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "u"": ERR => 0", frame-> root->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3458, GF_LOG_TRACE, "%""ll" "u"": ERR => 0" , frame->root->unique); } while (0) |
3458 | "%"PRIu64": ERR => 0", frame->root->unique)do { do { if (0) printf ("%""ll" "u"": ERR => 0", frame-> root->unique); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3458, GF_LOG_TRACE, "%""ll" "u"": ERR => 0" , frame->root->unique); } while (0); |
3459 | fd_lk_insert_and_merge (state->fd, |
3460 | (op == FUSE_SETLK) ? F_SETLK13 : F_SETLKW14, |
3461 | &state->lk_lock); |
3462 | |
3463 | send_fuse_err (this, state->finh, 0); |
3464 | } else { |
3465 | if (op_errno == ENOSYS38) { |
3466 | gf_fuse_lk_enosys_log++; |
3467 | if (!(gf_fuse_lk_enosys_log % GF_UNIVERSAL_ANSWER42)) { |
3468 | 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__, 3471, GF_LOG_ERROR, "SETLK not supported. loading " "'features/posix-locks' on server side " "will add SETLK support." ); } while (0) |
3469 | "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__, 3471, GF_LOG_ERROR, "SETLK not supported. loading " "'features/posix-locks' on server side " "will add SETLK support." ); } while (0) |
3470 | "'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__, 3471, GF_LOG_ERROR, "SETLK not supported. loading " "'features/posix-locks' on server side " "will add SETLK support." ); } while (0) |
3471 | "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__, 3471, GF_LOG_ERROR, "SETLK not supported. loading " "'features/posix-locks' on server side " "will add SETLK support." ); } while (0); |
3472 | } |
3473 | } else if (op_errno == EAGAIN11) { |
3474 | 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__ , 3480, 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) |
3475 | "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__ , 3480, 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) |
3476 | "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__ , 3480, 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) |
3477 | (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__ , 3480, 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) |
3478 | (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__ , 3480, 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) |
3479 | (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__ , 3480, 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) |
3480 | 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__ , 3480, 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); |
3481 | } else { |
3482 | gf_log ("glusterfs-fuse", GF_LOG_WARNING,do { do { if (0) printf ("%""ll" "u"": ERR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3484, GF_LOG_WARNING , "%""ll" "u"": ERR => -1 (%s)", frame->root->unique , strerror (op_errno)); } while (0) |
3483 | "%"PRIu64": ERR => -1 (%s)",do { do { if (0) printf ("%""ll" "u"": ERR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3484, GF_LOG_WARNING , "%""ll" "u"": ERR => -1 (%s)", frame->root->unique , strerror (op_errno)); } while (0) |
3484 | frame->root->unique, strerror (op_errno))do { do { if (0) printf ("%""ll" "u"": ERR => -1 (%s)", frame ->root->unique, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3484, GF_LOG_WARNING , "%""ll" "u"": ERR => -1 (%s)", frame->root->unique , strerror (op_errno)); } while (0); |
3485 | } |
3486 | |
3487 | send_fuse_err (this, state->finh, op_errno); |
3488 | } |
3489 | |
3490 | free_fuse_state (state); |
3491 | STACK_DESTROY (frame->root); |
3492 | |
3493 | return 0; |
3494 | } |
3495 | |
3496 | |
3497 | void |
3498 | fuse_setlk_resume (fuse_state_t *state) |
3499 | { |
3500 | gf_log ("glusterfs-fuse", GF_LOG_TRACE,do { do { if (0) printf ("%""ll" "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__, 3502, GF_LOG_TRACE, "%""ll" "u" ": SETLK%s %p", state->finh->unique, state->finh-> opcode == FUSE_SETLK ? "" : "W", state->fd); } while (0) |
3501 | "%"PRIu64": SETLK%s %p", state->finh->unique,do { do { if (0) printf ("%""ll" "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__, 3502, GF_LOG_TRACE, "%""ll" "u" ": SETLK%s %p", state->finh->unique, state->finh-> opcode == FUSE_SETLK ? "" : "W", state->fd); } while (0) |
3502 | state->finh->opcode == FUSE_SETLK ? "" : "W", state->fd)do { do { if (0) printf ("%""ll" "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__, 3502, GF_LOG_TRACE, "%""ll" "u" ": SETLK%s %p", state->finh->unique, state->finh-> opcode == FUSE_SETLK ? "" : "W", state->fd); } while (0); |
3503 | |
3504 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3506, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 3506, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_LK == GF_FOP_LOOKUP ) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3506, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3506, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 3506, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 3506, 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 ? 13 : 14, &state->lk_lock, state ->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0) |
3505 | 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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3506, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 3506, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_LK == GF_FOP_LOOKUP ) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3506, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3506, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 3506, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 3506, 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 ? 13 : 14, &state->lk_lock, state ->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0) |
3506 | &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; frame = get_call_frame_for_req (state); if (!frame) { do { do { if (0) printf ("FUSE message" " unique %""ll" "u"" opcode %d:" " frame allocation failed", state->finh->unique, state->finh->opcode); } while (0); _gf_log_callingfn ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3506, GF_LOG_ERROR, "FUSE message" " unique %""ll" "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; 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__ , 3506, GF_LOG_ERROR, "xl is NULL"); } while (0); op_errno = 2 ; op_ret = -1; } else if (state->resolve.op_ret < 0) { op_errno = state->resolve.op_errno; op_ret = -1; if (GF_FOP_LK == GF_FOP_LOOKUP ) { do { do { if (0) printf ("%""ll" "u"": %s() %s => -1 (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3506, (op_errno == 2 ? GF_LOG_TRACE : GF_LOG_WARNING), "%""ll" "u"": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list [frame->root->op], state->resolve.resolve_loc.path, strerror (op_errno)); } while (0); } else { do { do { if (0) printf ( "%""ll" "u"": %s() inode " "migration of %s failed (%s)", frame ->root->unique, gf_fop_list[frame->root->op], state ->resolve.resolve_loc.path, strerror (op_errno)); } while ( 0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 3506, GF_LOG_WARNING, "%""ll" "u"": %s() inode " "migration of %s failed (%s)" , frame->root->unique, gf_fop_list[frame->root->op ], state->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 ("%""ll" "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__ , 3506, GF_LOG_WARNING, "%""ll" "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 ("%""ll" "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__,"%""ll" "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__, 3506, 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 ? 13 : 14, &state->lk_lock, state ->xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); } } while (0); |
3507 | } |
3508 | |
3509 | |
3510 | static void |
3511 | fuse_setlk (xlator_t *this, fuse_in_header_t *finh, void *msg) |
3512 | { |
3513 | struct fuse_lk_in *fli = msg; |
3514 | |
3515 | fuse_state_t *state = NULL((void*)0); |
3516 | fd_t *fd = NULL((void*)0); |
3517 | |
3518 | fd = FH_TO_FD (fli->fh)((((fd_t *)(uintptr_t)(fli->fh)))?(fd_ref (((fd_t *)(uintptr_t )(fli->fh)))):((fd_t *) 0)); |
3519 | GET_STATE (this, finh, state)do { state = get_fuse_state (this, finh); if (!state) { do { do { if (0) printf ("FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3519, GF_LOG_ERROR, "FUSE message unique %""ll" "u"" opcode %d:" " state allocation failed", finh->unique, finh->opcode ); } while (0); send_fuse_err (this, finh, 12); __gf_free (finh ); return; } } while (0); |
3520 | state->finh = finh; |
3521 | state->fd = fd; |
3522 | |
3523 | fuse_resolve_fd_init (state, &state->resolve, fd); |
3524 | |
3525 | convert_fuse_file_lock (&fli->lk, &state->lk_lock, |
3526 | fli->owner); |
3527 | |
3528 | state->lk_owner = fli->owner; |
3529 | |
3530 | fuse_resolve_and_resume (state, fuse_setlk_resume); |
3531 | |
3532 | return; |
3533 | } |
3534 | |
3535 | |
3536 | static void * |
3537 | notify_kernel_loop (void *data) |
3538 | { |
3539 | xlator_t *this = NULL((void*)0); |
3540 | fuse_private_t *priv = NULL((void*)0); |
3541 | struct fuse_out_header *fouh = NULL((void*)0); |
3542 | int rv = 0; |
3543 | |
3544 | 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,}; |
3545 | |
3546 | this = data; |
3547 | priv = this->private; |
3548 | |
3549 | for (;;) { |
3550 | rv = read (priv->revchan_in, inval_buf, sizeof (*fouh)); |
3551 | if (rv != sizeof (*fouh)) |
3552 | break; |
3553 | fouh = (struct fuse_out_header *)inval_buf; |
3554 | rv = read (priv->revchan_in, inval_buf + sizeof (*fouh), |
3555 | fouh->len - sizeof (*fouh)); |
3556 | if (rv != fouh->len - sizeof (*fouh)) |
3557 | break; |
3558 | rv = write (priv->fd, inval_buf, fouh->len); |
3559 | if (rv != fouh->len && !(rv == -1 && errno(*__errno_location ()) == ENOENT2)) |
3560 | break; |
3561 | } |
3562 | |
3563 | close (priv->revchan_in); |
3564 | close (priv->revchan_out); |
3565 | |
3566 | 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__ , 3567, GF_LOG_INFO, "kernel notifier loop terminated"); } while (0) |
3567 | "kernel notifier loop terminated")do { do { if (0) printf ("kernel notifier loop terminated"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 3567, GF_LOG_INFO, "kernel notifier loop terminated"); } while (0); |
3568 | |
3569 | return NULL((void*)0); |
3570 | } |
3571 | |
3572 | |
3573 | static void |
3574 | fuse_init (xlator_t *this, fuse_in_header_t *finh, void *msg) |
3575 | { |
3576 | struct fuse_init_in *fini = msg; |
3577 | struct fuse_init_out fino = {0,}; |
3578 | fuse_private_t *priv = NULL((void*)0); |
3579 | int ret = 0; |
3580 | int pfd[2] = {0,}; |
3581 | pthread_t messenger; |
3582 | |
3583 | priv = this->private; |
3584 | |
3585 | if (priv->init_recvd) { |
3586 | 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__ , 3587, GF_LOG_ERROR, "got INIT after first message"); } while (0) |
3587 | "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__ , 3587, GF_LOG_ERROR, "got INIT after first message"); } while (0); |
3588 | |
3589 | close (priv->fd); |
3590 | goto out; |
3591 | } |
3592 | |
3593 | priv->init_recvd = 1; |
3594 | |
3595 | if (fini->major != FUSE_KERNEL_VERSION7) { |
3596 | 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__, 3598, GF_LOG_ERROR, "unsupported FUSE protocol version %d.%d" , fini->major, fini->minor); } while (0) |
3597 | "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__, 3598, GF_LOG_ERROR, "unsupported FUSE protocol version %d.%d" , fini->major, fini->minor); } while (0) |
3598 | 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__, 3598, GF_LOG_ERROR, "unsupported FUSE protocol version %d.%d" , fini->major, fini->minor); } while (0); |
3599 | |
3600 | close (priv->fd); |
3601 | goto out; |
3602 | } |
3603 | priv->proto_minor = fini->minor; |
3604 | |
3605 | fino.major = FUSE_KERNEL_VERSION7; |
3606 | fino.minor = FUSE_KERNEL_MINOR_VERSION13; |
3607 | fino.max_readahead = 1 << 17; |
3608 | fino.max_write = 1 << 17; |
3609 | fino.flags = FUSE_ASYNC_READ(1 << 0) | FUSE_POSIX_LOCKS(1 << 1); |
3610 | #if FUSE_KERNEL_MINOR_VERSION13 >= 12 |
3611 | if (fini->minor >= 12) { |
3612 | /* let fuse leave the umask processing to us, so that it does not |
3613 | * break extended POSIX ACL defaults on server */ |
3614 | fino.flags |= FUSE_DONT_MASK(1 << 6); |
3615 | } |
3616 | #endif |
3617 | #if FUSE_KERNEL_MINOR_VERSION13 >= 9 |
3618 | if (fini->minor >= 6 /* fuse_init_in has flags */ && |
3619 | fini->flags & FUSE_BIG_WRITES(1 << 5)) { |
3620 | /* no need for direct I/O mode by default if big writes are supported */ |
3621 | if (priv->direct_io_mode == 2) |
3622 | priv->direct_io_mode = 0; |
3623 | fino.flags |= FUSE_BIG_WRITES(1 << 5); |
3624 | } |
3625 | |
3626 | /* Used for 'reverse invalidation of inode' */ |
3627 | if (fini->minor >= 12) { |
3628 | if (pipe(pfd) == -1) { |
3629 | 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__, 3631, GF_LOG_ERROR, "cannot create pipe pair (%s)" , strerror((*__errno_location ()))); } while (0) |
3630 | "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__, 3631, GF_LOG_ERROR, "cannot create pipe pair (%s)" , strerror((*__errno_location ()))); } while (0) |
3631 | 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__, 3631, GF_LOG_ERROR, "cannot create pipe pair (%s)" , strerror((*__errno_location ()))); } while (0); |
3632 | |
3633 | close (priv->fd); |
3634 | goto out; |
3635 | } |
3636 | priv->revchan_in = pfd[0]; |
3637 | priv->revchan_out = pfd[1]; |
3638 | ret = pthread_create (&messenger, NULL((void*)0), notify_kernel_loop, |
3639 | this); |
3640 | if (ret != 0) { |
3641 | 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__, 3643, GF_LOG_ERROR, "failed to start messenger daemon (%s)" , strerror((*__errno_location ()))); } while (0) |
3642 | "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__, 3643, GF_LOG_ERROR, "failed to start messenger daemon (%s)" , strerror((*__errno_location ()))); } while (0) |
3643 | 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__, 3643, GF_LOG_ERROR, "failed to start messenger daemon (%s)" , strerror((*__errno_location ()))); } while (0); |
3644 | |
3645 | close (priv->fd); |
3646 | goto out; |
3647 | } |
3648 | priv->reverse_fuse_thread_started = _gf_true; |
3649 | } else { |
3650 | /* |
3651 | * FUSE minor < 12 does not implement invalidate notifications. |
3652 | * This mechanism is required for fopen-keep-cache to operate |
3653 | * correctly. Disable and warn the user. |
3654 | */ |
3655 | if (priv->fopen_keep_cache) { |
3656 | 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__ , 3659, GF_LOG_WARNING, "FUSE version " "%d.%d does not support inval notifications. " "fopen-keep-cache disabled.", fini->major, fini->minor ); } while (0) |
3657 | "%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__ , 3659, GF_LOG_WARNING, "FUSE version " "%d.%d does not support inval notifications. " "fopen-keep-cache disabled.", fini->major, fini->minor ); } while (0) |
3658 | "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__ , 3659, GF_LOG_WARNING, "FUSE version " "%d.%d does not support inval notifications. " "fopen-keep-cache disabled.", fini->major, fini->minor ); } while (0) |
3659 | 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__ , 3659, GF_LOG_WARNING, "FUSE version " "%d.%d does not support inval notifications. " "fopen-keep-cache disabled.", fini->major, fini->minor ); } while (0); |
3660 | priv->fopen_keep_cache = 0; |
3661 | } |
3662 | } |
3663 | |
3664 | if (fini->minor >= 13) { |
3665 | fino.max_background = priv->background_qlen; |
3666 | fino.congestion_threshold = priv->congestion_threshold; |
3667 | } |
3668 | if (fini->minor < 9) |
3669 | *priv->msg0_len_p = sizeof(*finh) + FUSE_COMPAT_WRITE_IN_SIZE24; |
3670 | #endif |
3671 | if (fini->flags & FUSE_DO_READDIRPLUS(1 << 13)) |
3672 | fino.flags |= FUSE_DO_READDIRPLUS(1 << 13); |
3673 | |
3674 | ret = send_fuse_obj (this, finh, &fino)send_fuse_data (this, finh, &fino, sizeof (*(&fino))); |
3675 | if (ret == 0) |
3676 | gf_log ("glusterfs-fuse", GF_LOG_INFO,do { do { if (0) printf ("FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 13, fini->major, fini ->minor); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3680, GF_LOG_INFO, "FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 13, fini->major, fini ->minor); } while (0) |
3677 | "FUSE inited with protocol versions:"do { do { if (0) printf ("FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 13, fini->major, fini ->minor); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3680, GF_LOG_INFO, "FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 13, fini->major, fini ->minor); } while (0) |
3678 | " glusterfs %d.%d kernel %d.%d",do { do { if (0) printf ("FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 13, fini->major, fini ->minor); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3680, GF_LOG_INFO, "FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 13, fini->major, fini ->minor); } while (0) |
3679 | FUSE_KERNEL_VERSION, FUSE_KERNEL_MINOR_VERSION,do { do { if (0) printf ("FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 13, fini->major, fini ->minor); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3680, GF_LOG_INFO, "FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 13, fini->major, fini ->minor); } while (0) |
3680 | fini->major, fini->minor)do { do { if (0) printf ("FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 13, fini->major, fini ->minor); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c" , __FUNCTION__, 3680, GF_LOG_INFO, "FUSE inited with protocol versions:" " glusterfs %d.%d kernel %d.%d", 7, 13, fini->major, fini ->minor); } while (0); |
3681 | else { |
3682 | 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__ , 3683, GF_LOG_ERROR, "FUSE init failed (%s)", strerror (ret) ); } while (0) |
3683 | "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__ , 3683, GF_LOG_ERROR, "FUSE init failed (%s)", strerror (ret) ); } while (0); |
3684 | |
3685 | close (priv->fd); |
3686 | } |
3687 | |
3688 | out: |
3689 | GF_FREE (finh)__gf_free (finh); |
3690 | } |
3691 | |
3692 | |
3693 | static void |
3694 | fuse_enosys (xlator_t *this, fuse_in_header_t *finh, void *msg) |
3695 | { |
3696 | send_fuse_err (this, finh, ENOSYS38); |
3697 | |
3698 | GF_FREE (finh)__gf_free (finh); |
3699 | } |
3700 | |
3701 | |
3702 | static void |
3703 | fuse_destroy (xlator_t *this, fuse_in_header_t *finh, void *msg) |
3704 | { |
3705 | send_fuse_err (this, finh, 0); |
3706 | |
3707 | GF_FREE (finh)__gf_free (finh); |
3708 | } |
3709 | |
3710 | |
3711 | |
3712 | struct fuse_first_lookup { |
3713 | pthread_mutex_t mutex; |
3714 | pthread_cond_t cond; |
3715 | char fin; |
3716 | }; |
3717 | |
3718 | int |
3719 | fuse_first_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, |
3720 | int32_t op_ret, int32_t op_errno, |
3721 | inode_t *inode, struct iatt *buf, dict_t *xattr, |
3722 | struct iatt *postparent) |
3723 | { |
3724 | struct fuse_first_lookup *stub = NULL((void*)0); |
3725 | |
3726 | stub = frame->local; |
3727 | |
3728 | if (op_ret == 0) { |
3729 | 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__ , 3730, GF_LOG_TRACE, "first lookup on root succeeded."); } while (0) |
3730 | "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__ , 3730, GF_LOG_TRACE, "first lookup on root succeeded."); } while (0); |
3731 | } else { |
3732 | 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__, 3733 , GF_LOG_DEBUG, "first lookup on root failed."); } while (0) |
3733 | "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__, 3733 , GF_LOG_DEBUG, "first lookup on root failed."); } while (0); |
3734 | } |
3735 | |
3736 | pthread_mutex_lock (&stub->mutex); |
3737 | { |
3738 | stub->fin = 1; |
3739 | pthread_cond_broadcast (&stub->cond); |
3740 | } |
3741 | pthread_mutex_unlock (&stub->mutex); |
3742 | |
3743 | return 0; |
3744 | } |
3745 | |
3746 | |
3747 | int |
3748 | fuse_first_lookup (xlator_t *this) |
3749 | { |
3750 | fuse_private_t *priv = NULL((void*)0); |
3751 | loc_t loc = {0, }; |
3752 | call_frame_t *frame = NULL((void*)0); |
3753 | xlator_t *xl = NULL((void*)0); |
3754 | dict_t *dict = NULL((void*)0); |
3755 | struct fuse_first_lookup stub; |
3756 | uuid_t gfid; |
3757 | int ret; |
3758 | |
3759 | priv = this->private; |
3760 | |
3761 | loc.path = "/"; |
3762 | loc.name = ""; |
3763 | loc.inode = fuse_ino_to_inode (1, this); |
3764 | uuid_copy (loc.gfid, loc.inode->gfid); |
3765 | loc.parent = NULL((void*)0); |
3766 | |
3767 | dict = dict_new (); |
3768 | frame = create_frame (this, this->ctx->pool); |
3769 | frame->root->type = GF_OP_TYPE_FOP; |
3770 | |
3771 | xl = priv->active_subvol; |
3772 | |
3773 | pthread_mutex_init (&stub.mutex, NULL((void*)0)); |
3774 | pthread_cond_init (&stub.cond, NULL((void*)0)); |
3775 | stub.fin = 0; |
3776 | |
3777 | frame->local = &stub; |
3778 | |
3779 | memset (gfid, 0, 16); |
3780 | gfid[15] = 1; |
3781 | ret = dict_set_static_bin (dict, "gfid-req", gfid, 16); |
3782 | if (ret) |
3783 | 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__, 3783 , GF_LOG_ERROR, "failed to set 'gfid-req'"); } while (0); |
3784 | |
3785 | 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__, 3786, 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) |
3786 | &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__, 3786, 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); |
3787 | dict_unref (dict); |
3788 | |
3789 | pthread_mutex_lock (&stub.mutex); |
3790 | { |
3791 | while (!stub.fin) { |
3792 | pthread_cond_wait (&stub.cond, &stub.mutex); |
3793 | } |
3794 | } |
3795 | pthread_mutex_unlock (&stub.mutex); |
3796 | |
3797 | pthread_mutex_destroy (&stub.mutex); |
3798 | pthread_cond_destroy (&stub.cond); |
3799 | |
3800 | frame->local = NULL((void*)0); |
3801 | STACK_DESTROY (frame->root); |
3802 | |
3803 | return 0; |
3804 | } |
3805 | |
3806 | |
3807 | int |
3808 | fuse_nameless_lookup (xlator_t *xl, uuid_t gfid, loc_t *loc) |
3809 | { |
3810 | int ret = -1; |
3811 | dict_t *xattr_req = NULL((void*)0); |
3812 | struct iatt iatt = {0, }; |
3813 | inode_t *linked_inode = NULL((void*)0); |
3814 | |
3815 | if ((loc == NULL((void*)0)) || (xl == NULL((void*)0))) { |
3816 | goto out; |
3817 | } |
3818 | |
3819 | if (loc->inode == NULL((void*)0)) { |
3820 | loc->inode = inode_new (xl->itable); |
3821 | if (loc->inode == NULL((void*)0)) { |
3822 | goto out; |
3823 | } |
3824 | } |
3825 | |
3826 | uuid_copy (loc->gfid, gfid); |
3827 | |
3828 | xattr_req = dict_new (); |
3829 | if (xattr_req == NULL((void*)0)) { |
3830 | goto out; |
3831 | } |
3832 | |
3833 | ret = syncop_lookup (xl, loc, xattr_req, &iatt, NULL((void*)0), NULL((void*)0)); |
3834 | if (ret < 0) { |
3835 | goto out; |
3836 | } |
3837 | |
3838 | linked_inode = inode_link (loc->inode, NULL((void*)0), NULL((void*)0), &iatt); |
3839 | inode_unref (loc->inode); |
3840 | loc->inode = linked_inode; |
3841 | |
3842 | ret = 0; |
3843 | out: |
3844 | if (xattr_req != NULL((void*)0)) { |
3845 | dict_unref (xattr_req); |
3846 | } |
3847 | |
3848 | return ret; |
3849 | } |
3850 | |
3851 | |
3852 | int |
3853 | fuse_migrate_fd_open (xlator_t *this, fd_t *basefd, fd_t *oldfd, |
3854 | xlator_t *old_subvol, xlator_t *new_subvol) |
3855 | { |
3856 | loc_t loc = {0, }; |
3857 | fd_t *newfd = NULL((void*)0), *old_activefd = NULL((void*)0); |
3858 | fuse_fd_ctx_t *basefd_ctx = NULL((void*)0); |
3859 | fuse_fd_ctx_t *newfd_ctx = NULL((void*)0); |
3860 | int ret = 0, flags = 0; |
3861 | |
3862 | ret = inode_path (basefd->inode, NULL((void*)0), (char **)&loc.path); |
3863 | if (ret < 0) { |
3864 | 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__ , 3869, 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) |
3865 | "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__ , 3869, 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) |
3866 | "(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__ , 3869, 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) |
3867 | 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__ , 3869, 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) |
3868 | 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__ , 3869, 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) |
3869 | 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__ , 3869, 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); |
3870 | goto out; |
3871 | } |
3872 | |
3873 | uuid_copy (loc.gfid, basefd->inode->gfid); |
3874 | |
3875 | loc.inode = inode_find (new_subvol->itable, basefd->inode->gfid); |
3876 | |
3877 | if (loc.inode == NULL((void*)0)) { |
3878 | ret = fuse_nameless_lookup (new_subvol, basefd->inode->gfid, |
3879 | &loc); |
3880 | if (ret < 0) { |
3881 | 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__, 3887, 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) |
3882 | "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__, 3887, 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) |
3883 | "(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__, 3887, 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) |
3884 | 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__, 3887, 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) |
3885 | 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__, 3887, 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) |
3886 | 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__, 3887, 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) |
3887 | 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__, 3887, 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); |
3888 | goto out; |
3889 | } |
3890 | |
3891 | } |
3892 | |
3893 | basefd_ctx = fuse_fd_ctx_get (this, basefd); |
3894 | 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__ , 3894, GF_LOG_ERROR, "invalid argument: " "basefd_ctx"); } while (0); goto out; } } while (0); |
3895 | |
3896 | newfd = fd_create (loc.inode, basefd->pid); |
3897 | if (newfd == NULL((void*)0)) { |
3898 | 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__, 3904, 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) |
3899 | "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__, 3904, 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) |
3900 | "(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__, 3904, 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) |
3901 | "(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__, 3904, 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) |
3902 | 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__, 3904, 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) |
3903 | 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__, 3904, 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) |
3904 | 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__, 3904, 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); |
3905 | goto out; |
3906 | } |
3907 | |
3908 | if (newfd->lk_ctx) |
3909 | fd_lk_ctx_unref (newfd->lk_ctx); |
3910 | |
3911 | newfd->lk_ctx = fd_lk_ctx_ref (oldfd->lk_ctx); |
3912 | |
3913 | newfd_ctx = fuse_fd_ctx_check_n_create (this, newfd); |
3914 | 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__ , 3914, GF_LOG_ERROR, "invalid argument: " "newfd_ctx"); } while (0); goto out; } } while (0); |
3915 | |
3916 | if (IA_ISDIR (basefd->inode->ia_type)(basefd->inode->ia_type == IA_IFDIR)) { |
3917 | ret = syncop_opendir (new_subvol, &loc, newfd); |
3918 | } else { |
3919 | flags = basefd->flags & ~(O_CREAT0100 | O_EXCL0200 | O_TRUNC01000); |
3920 | ret = syncop_open (new_subvol, &loc, flags, newfd); |
3921 | } |
3922 | |
3923 | if (ret < 0) { |
3924 | 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__, 3929, 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) |
3925 | "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__, 3929, 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) |
3926 | "(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__, 3929, 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) |
3927 | 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__, 3929, 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) |
3928 | 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__, 3929, 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) |
3929 | 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__, 3929, 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); |
3930 | goto out; |
3931 | } |
3932 | |
3933 | fd_bind (newfd); |
3934 | |
3935 | LOCK (&basefd->lock)pthread_spin_lock (&basefd->lock); |
3936 | { |
3937 | if (basefd_ctx->activefd != NULL((void*)0)) { |
3938 | old_activefd = basefd_ctx->activefd; |
3939 | } |
3940 | |
3941 | basefd_ctx->activefd = newfd; |
3942 | } |
3943 | UNLOCK (&basefd->lock)pthread_spin_unlock (&basefd->lock); |
3944 | |
3945 | if (old_activefd != NULL((void*)0)) { |
3946 | fd_unref (old_activefd); |
3947 | } |
3948 | |
3949 | 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__, 3954, 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) |
3950 | "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__, 3954, 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) |
3951 | "(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__, 3954, 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) |
3952 | 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__, 3954, 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) |
3953 | 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__, 3954, 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) |
3954 | 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__, 3954, 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); |
3955 | |
3956 | ret = 0; |
3957 | |
3958 | out: |
3959 | loc_wipe (&loc); |
3960 | |
3961 | return ret; |
3962 | } |
3963 | |
3964 | int |
3965 | fuse_migrate_locks (xlator_t *this, fd_t *basefd, fd_t *oldfd, |
3966 | xlator_t *old_subvol, xlator_t *new_subvol) |
3967 | { |
3968 | int ret = -1; |
3969 | dict_t *lockinfo = NULL((void*)0); |
3970 | void *ptr = NULL((void*)0); |
3971 | fd_t *newfd = NULL((void*)0); |
3972 | fuse_fd_ctx_t *basefd_ctx = NULL((void*)0); |
3973 | |
3974 | |
3975 | if (!oldfd->lk_ctx || fd_lk_ctx_empty (oldfd->lk_ctx)) |
3976 | return 0; |
3977 | |
3978 | basefd_ctx = fuse_fd_ctx_get (this, basefd); |
3979 | 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__ , 3979, GF_LOG_ERROR, "invalid argument: " "basefd_ctx"); } while (0); goto out; } } while (0); |
3980 | |
3981 | LOCK (&basefd->lock)pthread_spin_lock (&basefd->lock); |
3982 | { |
3983 | newfd = fd_ref (basefd_ctx->activefd); |
3984 | } |
3985 | UNLOCK (&basefd->lock)pthread_spin_unlock (&basefd->lock); |
3986 | |
3987 | ret = syncop_fgetxattr (old_subvol, oldfd, &lockinfo, |
3988 | GF_XATTR_LOCKINFO_KEY"trusted.glusterfs.lockinfo"); |
3989 | if (ret < 0) { |
3990 | 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__, 3996, 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) |
3991 | "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__, 3996, 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) |
3992 | "(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__, 3996, 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) |
3993 | "(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__, 3996, 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) |
3994 | 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__, 3996, 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) |
3995 | 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__, 3996, 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) |
3996 | 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__, 3996, 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); |
3997 | goto out; |
3998 | } |
3999 | |
4000 | ret = dict_get_ptr (lockinfo, GF_XATTR_LOCKINFO_KEY"trusted.glusterfs.lockinfo", &ptr); |
Value stored to 'ret' is never read | |
4001 | if (ptr == NULL((void*)0)) { |
4002 | ret = 0; |
4003 | 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__, 4009, 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) |
4004 | "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__, 4009, 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) |
4005 | "(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__, 4009, 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) |
4006 | "(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__, 4009, 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) |
4007 | 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__, 4009, 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) |
4008 | 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__, 4009, 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) |
4009 | 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__, 4009, 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); |
4010 | |
4011 | goto out; |
4012 | } |
4013 | |
4014 | ret = syncop_fsetxattr (new_subvol, newfd, lockinfo, 0); |
4015 | if (ret < 0) { |
4016 | 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__, 4021, 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) |
4017 | "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__, 4021, 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) |
4018 | "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__, 4021, 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) |
4019 | 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__, 4021, 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) |
4020 | 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__, 4021, 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) |
4021 | 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__, 4021, 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); |
4022 | goto out; |
4023 | } |
4024 | |
4025 | out: |
4026 | if (newfd) |
4027 | fd_unref (newfd); |
4028 | |
4029 | if (lockinfo != NULL((void*)0)) { |
4030 | dict_unref (lockinfo); |
4031 | } |
4032 | |
4033 | return ret; |
4034 | } |
4035 | |
4036 | |
4037 | int |
4038 | fuse_migrate_fd (xlator_t *this, fd_t *basefd, xlator_t *old_subvol, |
4039 | xlator_t *new_subvol) |
4040 | { |
4041 | int ret = -1; |
4042 | char create_in_progress = 0; |
4043 | fuse_fd_ctx_t *basefd_ctx = NULL((void*)0); |
4044 | fd_t *oldfd = NULL((void*)0); |
4045 | |
4046 | basefd_ctx = fuse_fd_ctx_get (this, basefd); |
4047 | 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__ , 4047, GF_LOG_ERROR, "invalid argument: " "basefd_ctx"); } while (0); goto out; } } while (0); |
4048 | |
4049 | LOCK (&basefd->lock)pthread_spin_lock (&basefd->lock); |
4050 | { |
4051 | oldfd = basefd_ctx->activefd ? basefd_ctx->activefd |
4052 | : basefd; |
4053 | fd_ref (oldfd); |
4054 | } |
4055 | UNLOCK (&basefd->lock)pthread_spin_unlock (&basefd->lock); |
4056 | |
4057 | LOCK (&oldfd->inode->lock)pthread_spin_lock (&oldfd->inode->lock); |
4058 | { |
4059 | if (uuid_is_null (oldfd->inode->gfid)) { |
4060 | create_in_progress = 1; |
4061 | } else { |
4062 | create_in_progress = 0; |
4063 | } |
4064 | } |
4065 | UNLOCK (&oldfd->inode->lock)pthread_spin_unlock (&oldfd->inode->lock); |
4066 | |
4067 | if (create_in_progress) { |
4068 | 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__, 4076, 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) |
4069 | "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__, 4076, 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) |
4070 | "(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__, 4076, 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) |
4071 | "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__, 4076, 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) |
4072 | "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__, 4076, 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) |
4073 | "(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__, 4076, 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) |
4074 | 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__, 4076, 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) |
4075 | 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__, 4076, 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) |
4076 | 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__, 4076, 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); |
4077 | |
4078 | ret = 0; |
4079 | goto out; |
4080 | } |
4081 | |
4082 | if (oldfd->inode->table->xl == old_subvol) { |
4083 | ret = syncop_fsync (old_subvol, oldfd, 0); |
4084 | if (ret < 0) { |
4085 | 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__, 4092, 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) |
4086 | "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__, 4092, 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) |
4087 | "(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__, 4092, 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) |
4088 | "(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__, 4092, 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) |
4089 | 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__, 4092, 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) |
4090 | 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__, 4092, 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) |
4091 | 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__, 4092, 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) |
4092 | 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__, 4092, 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); |
4093 | } |
4094 | } else { |
4095 | 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__, 4101, 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) |
4096 | "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__, 4101, 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) |
4097 | "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__, 4101, 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) |
4098 | "(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__, 4101, 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) |
4099 | 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__, 4101, 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) |
4100 | 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__, 4101, 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) |
4101 | 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__, 4101, 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); |
4102 | } |
4103 | |
4104 | ret = fuse_migrate_fd_open (this, basefd, oldfd, old_subvol, |
4105 | new_subvol); |
4106 | if (ret < 0) { |
4107 | 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__ , 4112, 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) |
4108 | "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__ , 4112, 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) |
4109 | "(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__ , 4112, 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) |
4110 | 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__ , 4112, 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) |
4111 | 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__ , 4112, 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) |
4112 | 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__ , 4112, 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); |
4113 | goto out; |
4114 | } |
4115 | |
4116 | ret = fuse_migrate_locks (this, basefd, oldfd, old_subvol, |
4117 | new_subvol); |
4118 | if (ret < 0) { |
4119 | 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__, 4124, 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) |
4120 | "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__, 4124, 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) |
4121 | "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__, 4124, 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) |
4122 | "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__, 4124, 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) |
4123 | 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__, 4124, 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) |
4124 | 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__, 4124, 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); |
4125 | |
4126 | } |
4127 | out: |
4128 | if (ret < 0) { |
4129 | 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__, 4134, 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) |
4130 | "(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__, 4134, 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) |
4131 | "(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__, 4134, 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) |
4132 | 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__, 4134, 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) |
4133 | 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__, 4134, 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) |
4134 | 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__, 4134, 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); |
4135 | } |
4136 | |
4137 | fd_unref (oldfd); |
4138 | |
4139 | return ret; |
4140 | } |
4141 | |
4142 | |
4143 | int |
4144 | fuse_handle_opened_fds (xlator_t *this, xlator_t *old_subvol, |
4145 | xlator_t *new_subvol) |
4146 | { |
4147 | fuse_private_t *priv = NULL((void*)0); |
4148 | fdentry_t *fdentries = NULL((void*)0); |
4149 | uint32_t count = 0; |
4150 | fdtable_t *fdtable = NULL((void*)0); |
4151 | int i = 0; |
4152 | fd_t *fd = NULL((void*)0); |
4153 | int32_t ret = 0; |
4154 | fuse_fd_ctx_t *fdctx = NULL((void*)0); |
4155 | |
4156 | priv = this->private; |
4157 | |
4158 | fdtable = priv->fdtable; |
4159 | |
4160 | fdentries = gf_fd_fdtable_copy_all_fds (fdtable, &count); |
4161 | if (fdentries != NULL((void*)0)) { |
4162 | for (i = 0; i < count; i++) { |
4163 | fd = fdentries[i].fd; |
4164 | if (fd == NULL((void*)0)) |
4165 | continue; |
4166 | |
4167 | ret = fuse_migrate_fd (this, fd, old_subvol, |
4168 | new_subvol); |
4169 | |
4170 | fdctx = fuse_fd_ctx_get (this, fd); |
4171 | if (fdctx) { |
4172 | LOCK (&fd->lock)pthread_spin_lock (&fd->lock); |
4173 | { |
4174 | if (ret < 0) { |
4175 | fdctx->migration_failed = 1; |
4176 | } else { |
4177 | fdctx->migration_failed = 0; |
4178 | } |
4179 | } |
4180 | UNLOCK (&fd->lock)pthread_spin_unlock (&fd->lock); |
4181 | } |
4182 | } |
4183 | |
4184 | for (i = 0; i < count ; i++) { |
4185 | fd = fdentries[i].fd; |
4186 | if (fd) |
4187 | fd_unref (fd); |
4188 | } |
4189 | |
4190 | GF_FREE (fdentries)__gf_free (fdentries); |
4191 | } |
4192 | |
4193 | return 0; |
4194 | } |
4195 | |
4196 | |
4197 | static int |
4198 | fuse_handle_blocked_locks (xlator_t *this, xlator_t *old_subvol, |
4199 | xlator_t *new_subvol) |
4200 | { |
4201 | return 0; |
4202 | } |
4203 | |
4204 | |
4205 | static int |
4206 | fuse_graph_switch_task (void *data) |
4207 | { |
4208 | fuse_graph_switch_args_t *args = NULL((void*)0); |
4209 | |
4210 | args = data; |
4211 | if (args == NULL((void*)0)) { |
4212 | goto out; |
4213 | } |
4214 | |
4215 | /* don't change the order of handling open fds and blocked locks, since |
4216 | * the act of opening files also reacquires granted locks in new graph. |
4217 | */ |
4218 | fuse_handle_opened_fds (args->this, args->old_subvol, args->new_subvol); |
4219 | |
4220 | fuse_handle_blocked_locks (args->this, args->old_subvol, |
4221 | args->new_subvol); |
4222 | |
4223 | out: |
4224 | return 0; |
4225 | } |
4226 | |
4227 | |
4228 | fuse_graph_switch_args_t * |
4229 | fuse_graph_switch_args_alloc (void) |
4230 | { |
4231 | fuse_graph_switch_args_t *args = NULL((void*)0); |
4232 | |
4233 | 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 ); |
4234 | if (args == NULL((void*)0)) { |
4235 | goto out; |
4236 | } |
4237 | |
4238 | out: |
4239 | return args; |
4240 | } |
4241 | |
4242 | |
4243 | void |
4244 | fuse_graph_switch_args_destroy (fuse_graph_switch_args_t *args) |
4245 | { |
4246 | if (args == NULL((void*)0)) { |
4247 | goto out; |
4248 | } |
4249 | |
4250 | GF_FREE (args)__gf_free (args); |
4251 | out: |
4252 | return; |
4253 | } |
4254 | |
4255 | |
4256 | int |
4257 | fuse_handle_graph_switch (xlator_t *this, xlator_t *old_subvol, |
4258 | xlator_t *new_subvol) |
4259 | { |
4260 | call_frame_t *frame = NULL((void*)0); |
4261 | int32_t ret = -1; |
4262 | fuse_graph_switch_args_t *args = NULL((void*)0); |
4263 | |
4264 | frame = create_frame (this, this->ctx->pool); |
4265 | if (frame == NULL((void*)0)) { |
4266 | goto out; |
4267 | } |
4268 | |
4269 | args = fuse_graph_switch_args_alloc (); |
4270 | if (args == NULL((void*)0)) { |
4271 | goto out; |
4272 | } |
4273 | |
4274 | args->this = this; |
4275 | args->old_subvol = old_subvol; |
4276 | args->new_subvol = new_subvol; |
4277 | |
4278 | ret = synctask_new (this->ctx->env, fuse_graph_switch_task, NULL((void*)0), frame, |
4279 | args); |
4280 | if (ret == -1) { |
4281 | 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__ , 4282, GF_LOG_WARNING, "starting sync-task to " "handle graph switch failed" ); } while (0) |
4282 | "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__ , 4282, GF_LOG_WARNING, "starting sync-task to " "handle graph switch failed" ); } while (0); |
4283 | goto out; |
4284 | } |
4285 | |
4286 | ret = 0; |
4287 | out: |
4288 | if (args != NULL((void*)0)) { |
4289 | fuse_graph_switch_args_destroy (args); |
4290 | } |
4291 | |
4292 | if (frame != NULL((void*)0)) { |
4293 | STACK_DESTROY (frame->root); |
4294 | } |
4295 | |
4296 | return ret; |
4297 | } |
4298 | |
4299 | |
4300 | int |
4301 | fuse_graph_sync (xlator_t *this) |
4302 | { |
4303 | fuse_private_t *priv = NULL((void*)0); |
4304 | int need_first_lookup = 0; |
4305 | int ret = 0; |
4306 | xlator_t *old_subvol = NULL((void*)0), *new_subvol = NULL((void*)0); |
4307 | uint64_t winds_on_old_subvol = 0; |
4308 | |
4309 | priv = this->private; |
4310 | |
4311 | pthread_mutex_lock (&priv->sync_mutex); |
4312 | { |
4313 | if (!priv->next_graph) |
4314 | goto unlock; |
4315 | |
4316 | old_subvol = priv->active_subvol; |
4317 | new_subvol = priv->active_subvol = priv->next_graph->top; |
4318 | priv->next_graph = NULL((void*)0); |
4319 | need_first_lookup = 1; |
4320 | |
4321 | while (!priv->event_recvd) { |
4322 | ret = pthread_cond_wait (&priv->sync_cond, |
4323 | &priv->sync_mutex); |
4324 | if (ret != 0) { |
4325 | 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__, 4327 , GF_LOG_DEBUG, "timedwait returned non zero value " "ret: %d errno: %d" , ret, (*__errno_location ())); } while (0) |
4326 | "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__, 4327 , GF_LOG_DEBUG, "timedwait returned non zero value " "ret: %d errno: %d" , ret, (*__errno_location ())); } while (0) |
4327 | "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__, 4327 , GF_LOG_DEBUG, "timedwait returned non zero value " "ret: %d errno: %d" , ret, (*__errno_location ())); } while (0); |
4328 | break; |
4329 | } |
4330 | } |
4331 | } |
4332 | unlock: |
4333 | pthread_mutex_unlock (&priv->sync_mutex); |
4334 | |
4335 | if (need_first_lookup) { |
4336 | fuse_first_lookup (this); |
4337 | } |
4338 | |
4339 | if ((old_subvol != NULL((void*)0)) && (new_subvol != NULL((void*)0))) { |
4340 | fuse_handle_graph_switch (this, old_subvol, new_subvol); |
4341 | |
4342 | pthread_mutex_lock (&priv->sync_mutex); |
4343 | { |
4344 | old_subvol->switched = 1; |
4345 | winds_on_old_subvol = old_subvol->winds; |
4346 | } |
4347 | pthread_mutex_unlock (&priv->sync_mutex); |
4348 | |
4349 | if (winds_on_old_subvol == 0) { |
4350 | xlator_notify (old_subvol, GF_EVENT_PARENT_DOWN, |
4351 | old_subvol, NULL((void*)0)); |
4352 | } |
4353 | } |
4354 | |
4355 | return 0; |
4356 | } |
4357 | |
4358 | int |
4359 | fuse_get_mount_status (xlator_t *this) |
4360 | { |
4361 | int kid_status = -1; |
4362 | fuse_private_t *priv = this->private; |
4363 | |
4364 | if (read(priv->status_pipe[0],&kid_status, sizeof(kid_status)) < 0) { |
4365 | 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__, 4365 , GF_LOG_ERROR, "could not get mount status"); } while (0); |
4366 | kid_status = -1; |
4367 | } |
4368 | 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__ , 4368, GF_LOG_DEBUG, "mount status is %d", kid_status); } while (0); |
4369 | |
4370 | close(priv->status_pipe[0]); |
4371 | close(priv->status_pipe[1]); |
4372 | return kid_status; |
4373 | } |
4374 | |
4375 | static void * |
4376 | fuse_thread_proc (void *data) |
4377 | { |
4378 | char *mount_point = NULL((void*)0); |
4379 | xlator_t *this = NULL((void*)0); |
4380 | fuse_private_t *priv = NULL((void*)0); |
4381 | ssize_t res = 0; |
4382 | struct iobuf *iobuf = NULL((void*)0); |
4383 | fuse_in_header_t *finh; |
4384 | struct iovec iov_in[2]; |
4385 | void *msg = NULL((void*)0); |
4386 | const size_t msg0_size = sizeof (*finh) + 128; |
4387 | fuse_handler_t **fuse_ops = NULL((void*)0); |
4388 | struct pollfd pfd[2] = {{0,}}; |
4389 | gf_boolean_t mount_finished = _gf_false; |
4390 | |
4391 | this = data; |
4392 | priv = this->private; |
4393 | fuse_ops = priv->fuse_ops; |
4394 | |
4395 | THIS(*__glusterfs_this_location()) = this; |
4396 | |
4397 | iov_in[0].iov_len = sizeof (*finh) + sizeof (struct fuse_write_in); |
4398 | iov_in[1].iov_len = ((struct iobuf_pool *)this->ctx->iobuf_pool) |
4399 | ->default_page_size; |
4400 | priv->msg0_len_p = &iov_in[0].iov_len; |
4401 | |
4402 | for (;;) { |
4403 | /* THIS has to be reset here */ |
4404 | THIS(*__glusterfs_this_location()) = this; |
4405 | |
4406 | if (!mount_finished) { |
4407 | memset(pfd,0,sizeof(pfd)); |
4408 | pfd[0].fd = priv->status_pipe[0]; |
4409 | pfd[0].events = POLLIN0x001 | POLLHUP0x010 | POLLERR0x008; |
4410 | pfd[1].fd = priv->fd; |
4411 | pfd[1].events = POLLIN0x001 | POLLHUP0x010 | POLLERR0x008; |
4412 | if (poll(pfd,2,-1) < 0) { |
4413 | 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__, 4414, GF_LOG_ERROR, "poll error %s", strerror( (*__errno_location ()))); } while (0) |
4414 | "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__, 4414, GF_LOG_ERROR, "poll error %s", strerror( (*__errno_location ()))); } while (0); |
4415 | break; |
4416 | } |
4417 | if (pfd[0].revents & POLLIN0x001) { |
4418 | if (fuse_get_mount_status(this) != 0) { |
4419 | break; |
4420 | } |
4421 | mount_finished = _gf_true; |
4422 | } |
4423 | else if (pfd[0].revents) { |
4424 | 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__ , 4425, GF_LOG_ERROR, "mount pipe closed without status"); } while (0) |
4425 | "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__ , 4425, GF_LOG_ERROR, "mount pipe closed without status"); } while (0); |
4426 | break; |
4427 | } |
4428 | if (!pfd[1].revents) { |
4429 | continue; |
4430 | } |
4431 | } |
4432 | |
4433 | /* |
4434 | * We don't want to block on readv while we're still waiting |
4435 | * for mount status. That means we only want to get here if |
4436 | * mount_status is true (meaning that our wait completed |
4437 | * already) or if we already called poll(2) on priv->fd to |
4438 | * make sure it's ready. |
4439 | */ |
4440 | |
4441 | if (priv->init_recvd) |
4442 | fuse_graph_sync (this); |
4443 | |
4444 | /* TODO: This place should always get maximum supported buffer |
4445 | size from 'fuse', which is as of today 128KB. If we bring in |
4446 | support for higher block sizes support, then we should be |
4447 | changing this one too */ |
4448 | iobuf = iobuf_get (this->ctx->iobuf_pool); |
4449 | |
4450 | /* Add extra 128 byte to the first iov so that it can |
4451 | * accommodate "ordinary" non-write requests. It's not |
4452 | * guaranteed to be big enough, as SETXATTR and namespace |
4453 | * operations with very long names may grow behind it, |
4454 | * but it's good enough in most cases (and we can handle |
4455 | * rest via realloc). |
4456 | */ |
4457 | iov_in[0].iov_base = GF_CALLOC (1, msg0_size,__gf_calloc (1, msg0_size, gf_fuse_mt_iov_base) |
4458 | gf_fuse_mt_iov_base)__gf_calloc (1, msg0_size, gf_fuse_mt_iov_base); |
4459 | |
4460 | if (!iobuf || !iov_in[0].iov_base) { |
4461 | 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__, 4462, GF_LOG_ERROR , "Out of memory"); } while (0) |
4462 | "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__, 4462, GF_LOG_ERROR , "Out of memory"); } while (0); |
4463 | if (iobuf) |
4464 | iobuf_unref (iobuf); |
4465 | GF_FREE (iov_in[0].iov_base)__gf_free (iov_in[0].iov_base); |
4466 | sleep (10); |
4467 | continue; |
4468 | } |
4469 | |
4470 | iov_in[1].iov_base = iobuf->ptr; |
4471 | |
4472 | res = readv (priv->fd, iov_in, 2); |
4473 | |
4474 | if (res == -1) { |
4475 | if (errno(*__errno_location ()) == ENODEV19 || errno(*__errno_location ()) == EBADF9) { |
4476 | 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__ , 4479, GF_LOG_DEBUG, "terminating upon getting %s when " "reading /dev/fuse" , (*__errno_location ()) == 19 ? "ENODEV" : "EBADF"); } while (0) |
4477 | "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__ , 4479, GF_LOG_DEBUG, "terminating upon getting %s when " "reading /dev/fuse" , (*__errno_location ()) == 19 ? "ENODEV" : "EBADF"); } while (0) |
4478 | "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__ , 4479, GF_LOG_DEBUG, "terminating upon getting %s when " "reading /dev/fuse" , (*__errno_location ()) == 19 ? "ENODEV" : "EBADF"); } while (0) |
4479 | 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__ , 4479, GF_LOG_DEBUG, "terminating upon getting %s when " "reading /dev/fuse" , (*__errno_location ()) == 19 ? "ENODEV" : "EBADF"); } while (0); |
4480 | 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) |
4481 | " 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) |
4482 | "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) |
4483 | 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) |
4484 | "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); |
4485 | break; |
4486 | } |
4487 | if (errno(*__errno_location ()) != EINTR4) { |
4488 | 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__, 4490, GF_LOG_WARNING, "read from /dev/fuse returned -1 (%s)" , strerror ((*__errno_location ()))); } while (0) |
4489 | "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__, 4490, GF_LOG_WARNING, "read from /dev/fuse returned -1 (%s)" , strerror ((*__errno_location ()))); } while (0) |
4490 | 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__, 4490, GF_LOG_WARNING, "read from /dev/fuse returned -1 (%s)" , strerror ((*__errno_location ()))); } while (0); |
4491 | 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) |
4492 | "/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) |
4493 | 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); |
4494 | } |
4495 | |
4496 | goto cont_err; |
4497 | } |
4498 | if (res < sizeof (finh)) { |
4499 | 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__, 4500, GF_LOG_WARNING, "short read on /dev/fuse"); } while (0 ) |
4500 | "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__, 4500, GF_LOG_WARNING, "short read on /dev/fuse"); } while (0 ); |
4501 | 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) |
4502 | "/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); |
4503 | break; |
4504 | } |
4505 | |
4506 | finh = (fuse_in_header_t *)iov_in[0].iov_base; |
4507 | |
4508 | if (res != finh->len |
4509 | #ifdef GF_DARWIN_HOST_OS |
4510 | /* work around fuse4bsd/MacFUSE msg size miscalculation bug, |
4511 | * that is, payload size is not taken into account for |
4512 | * buffered writes |
4513 | */ |
4514 | && !(finh->opcode == FUSE_WRITE && |
4515 | finh->len == sizeof(*finh) + sizeof(struct fuse_write_in) && |
4516 | res == finh->len + ((struct fuse_write_in *)(finh + 1))->size) |
4517 | #endif |
4518 | ) { |
4519 | 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__ , 4520, GF_LOG_WARNING, "inconsistent read on /dev/fuse"); } while (0) |
4520 | "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__ , 4520, GF_LOG_WARNING, "inconsistent read on /dev/fuse"); } while (0); |
4521 | 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) |
4522 | "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); |
4523 | break; |
4524 | } |
4525 | |
4526 | priv->iobuf = iobuf; |
4527 | |
4528 | if (finh->opcode == FUSE_WRITE) |
4529 | msg = iov_in[1].iov_base; |
4530 | else { |
4531 | if (res > msg0_size) { |
4532 | void *b = GF_REALLOC (iov_in[0].iov_base, res)__gf_realloc (iov_in[0].iov_base, res); |
4533 | if (b) { |
4534 | iov_in[0].iov_base = b; |
4535 | finh = (fuse_in_header_t *) |
4536 | iov_in[0].iov_base; |
4537 | } |
4538 | else { |
4539 | 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__, 4540, GF_LOG_ERROR , "Out of memory"); } while (0) |
4540 | "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4540, GF_LOG_ERROR , "Out of memory"); } while (0); |
4541 | send_fuse_err (this, finh, ENOMEM12); |
4542 | |
4543 | goto cont_err; |
4544 | } |
4545 | } |
4546 | |
4547 | if (res > iov_in[0].iov_len) |
4548 | memcpy (iov_in[0].iov_base + iov_in[0].iov_len, |
4549 | iov_in[1].iov_base, |
4550 | res - iov_in[0].iov_len); |
4551 | |
4552 | msg = finh + 1; |
4553 | } |
4554 | if (priv->uid_map_root && |
4555 | finh->uid == priv->uid_map_root) |
4556 | finh->uid = 0; |
4557 | |
4558 | if (finh->opcode >= FUSE_OP_HIGH(FUSE_READDIRPLUS + 1)) |
4559 | /* turn down MacFUSE specific messages */ |
4560 | fuse_enosys (this, finh, msg); |
4561 | else |
4562 | fuse_ops[finh->opcode] (this, finh, msg); |
4563 | |
4564 | iobuf_unref (iobuf); |
4565 | continue; |
4566 | |
4567 | cont_err: |
4568 | iobuf_unref (iobuf); |
4569 | GF_FREE (iov_in[0].iov_base)__gf_free (iov_in[0].iov_base); |
4570 | } |
4571 | |
4572 | /* |
4573 | * We could be in all sorts of states with respect to iobuf and iov_in |
4574 | * by the time we get here, and it's just not worth untangling them if |
4575 | * we're about to kill ourselves anyway. |
4576 | */ |
4577 | |
4578 | if (dict_get (this->options, ZR_MOUNTPOINT_OPT"mountpoint")) |
4579 | mount_point = data_to_str (dict_get (this->options, |
4580 | ZR_MOUNTPOINT_OPT"mountpoint")); |
4581 | if (mount_point) { |
4582 | 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__, 4583 , GF_LOG_INFO, "unmounting %s", mount_point); } while (0) |
4583 | "unmounting %s", mount_point)do { do { if (0) printf ("unmounting %s", mount_point); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__, 4583 , GF_LOG_INFO, "unmounting %s", mount_point); } while (0); |
4584 | } |
4585 | |
4586 | /* Kill the whole process, not just this thread. */ |
4587 | kill (getpid(), SIGTERM15); |
4588 | return NULL((void*)0); |
4589 | } |
4590 | |
4591 | |
4592 | int32_t |
4593 | fuse_itable_dump (xlator_t *this) |
4594 | { |
4595 | if (!this) |
4596 | return -1; |
4597 | |
4598 | gf_proc_dump_add_section("xlator.mount.fuse.itable"); |
4599 | inode_table_dump(this->itable, "xlator.mount.fuse.itable"); |
4600 | |
4601 | return 0; |
4602 | } |
4603 | |
4604 | int32_t |
4605 | fuse_priv_dump (xlator_t *this) |
4606 | { |
4607 | fuse_private_t *private = NULL((void*)0); |
4608 | |
4609 | if (!this) |
4610 | return -1; |
4611 | |
4612 | private = this->private; |
4613 | |
4614 | if (!private) |
4615 | return -1; |
4616 | |
4617 | gf_proc_dump_add_section("xlator.mount.fuse.priv"); |
4618 | |
4619 | gf_proc_dump_write("fd", "%d", private->fd); |
4620 | gf_proc_dump_write("proto_minor", "%u", |
4621 | private->proto_minor); |
4622 | gf_proc_dump_write("volfile", "%s", |
4623 | private->volfile?private->volfile:"None"); |
4624 | gf_proc_dump_write("volfile_size", "%d", |
4625 | private->volfile_size); |
4626 | gf_proc_dump_write("mount_point", "%s", |
4627 | private->mount_point); |
4628 | gf_proc_dump_write("iobuf", "%u", |
4629 | private->iobuf); |
4630 | gf_proc_dump_write("fuse_thread_started", "%d", |
4631 | (int)private->fuse_thread_started); |
4632 | gf_proc_dump_write("direct_io_mode", "%d", |
4633 | private->direct_io_mode); |
4634 | gf_proc_dump_write("entry_timeout", "%lf", |
4635 | private->entry_timeout); |
4636 | gf_proc_dump_write("attribute_timeout", "%lf", |
4637 | private->attribute_timeout); |
4638 | gf_proc_dump_write("init_recvd", "%d", |
4639 | (int)private->init_recvd); |
4640 | gf_proc_dump_write("strict_volfile_check", "%d", |
4641 | (int)private->strict_volfile_check); |
4642 | gf_proc_dump_write("reverse_thread_started", "%d", |
4643 | (int)private->reverse_fuse_thread_started); |
4644 | |
4645 | return 0; |
4646 | } |
4647 | |
4648 | int |
4649 | fuse_history_dump (xlator_t *this) |
4650 | { |
4651 | int ret = -1; |
4652 | char key_prefix[GF_DUMP_MAX_BUF_LEN4096] = {0,}; |
4653 | |
4654 | 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__, 4654, GF_LOG_ERROR, "invalid argument: " "this"); } while (0); goto out; } } while (0); |
4655 | 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__, 4655, GF_LOG_ERROR, "invalid argument: " "this->history" ); } while (0); goto out; } } while (0); |
4656 | |
4657 | gf_proc_dump_build_key (key_prefix, "xlator.mount.fuse",{ _gf_proc_dump_build_key(key_prefix, "xlator.mount.fuse", "history" ); } |
4658 | "history"){ _gf_proc_dump_build_key(key_prefix, "xlator.mount.fuse", "history" ); }; |
4659 | gf_proc_dump_add_section (key_prefix); |
4660 | eh_dump (this->history, NULL((void*)0), dump_history_fuse); |
4661 | |
4662 | ret = 0; |
4663 | out: |
4664 | return ret; |
4665 | } |
4666 | |
4667 | int |
4668 | dump_history_fuse (circular_buffer_t *cb, void *data) |
4669 | { |
4670 | char *string = NULL((void*)0); |
4671 | struct tm *tm = NULL((void*)0); |
4672 | char timestr[256] = {0,}; |
4673 | |
4674 | string = (char *)cb->data; |
4675 | tm = localtime (&cb->tv.tv_sec); |
4676 | |
4677 | if (tm) { |
4678 | strftime (timestr, 256, "%Y-%m-%d %H:%M:%S", tm); |
4679 | snprintf (timestr + strlen (timestr), 256 - strlen (timestr), |
4680 | ".%"GF_PRI_SUSECONDS"06ld", cb->tv.tv_usec); |
4681 | gf_proc_dump_write ("TIME", "%s", timestr); |
4682 | } |
4683 | |
4684 | gf_proc_dump_write ("message", "%s\n", string); |
4685 | |
4686 | return 0; |
4687 | } |
4688 | |
4689 | int |
4690 | fuse_graph_setup (xlator_t *this, glusterfs_graph_t *graph) |
4691 | { |
4692 | inode_table_t *itable = NULL((void*)0); |
4693 | int ret = 0; |
4694 | fuse_private_t *priv = NULL((void*)0); |
4695 | |
4696 | priv = this->private; |
4697 | |
4698 | /* handle the case of more than one CHILD_UP on same graph */ |
4699 | if (priv->active_subvol == graph->top) |
4700 | return 0; /* This is a valid case */ |
4701 | |
4702 | if (graph->used) |
4703 | return 0; |
4704 | |
4705 | graph->used = 1; |
4706 | |
4707 | itable = inode_table_new (0, graph->top); |
4708 | if (!itable) |
4709 | return -1; |
4710 | |
4711 | ((xlator_t *)graph->top)->itable = itable; |
4712 | |
4713 | pthread_mutex_lock (&priv->sync_mutex); |
4714 | { |
4715 | priv->next_graph = graph; |
4716 | priv->event_recvd = 0; |
4717 | |
4718 | pthread_cond_signal (&priv->sync_cond); |
4719 | } |
4720 | pthread_mutex_unlock (&priv->sync_mutex); |
4721 | |
4722 | 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__, 4723, GF_LOG_INFO, "switched to graph %d", ((graph ) ? graph->id : 0)); } while (0) |
4723 | ((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__, 4723, GF_LOG_INFO, "switched to graph %d", ((graph ) ? graph->id : 0)); } while (0); |
4724 | |
4725 | return ret; |
4726 | } |
4727 | |
4728 | |
4729 | int |
4730 | notify (xlator_t *this, int32_t event, void *data, ...) |
4731 | { |
4732 | int32_t ret = 0; |
4733 | fuse_private_t *private = NULL((void*)0); |
4734 | glusterfs_graph_t *graph = NULL((void*)0); |
4735 | |
4736 | private = this->private; |
4737 | |
4738 | graph = data; |
4739 | |
4740 | 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__, 4741, GF_LOG_DEBUG, "got event %d on graph %d" , event, ((graph) ? graph->id : 0)); } while (0) |
4741 | 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__, 4741, GF_LOG_DEBUG, "got event %d on graph %d" , event, ((graph) ? graph->id : 0)); } while (0); |
4742 | |
4743 | switch (event) |
4744 | { |
4745 | case GF_EVENT_GRAPH_NEW: |
4746 | break; |
4747 | |
4748 | case GF_EVENT_CHILD_UP: |
4749 | case GF_EVENT_CHILD_DOWN: |
4750 | case GF_EVENT_CHILD_CONNECTING: |
4751 | { |
4752 | if (graph) { |
4753 | ret = fuse_graph_setup (this, graph); |
4754 | if (ret) |
4755 | 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__, 4756 , GF_LOG_WARNING, "failed to setup the graph"); } while (0) |
4756 | "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__, 4756 , GF_LOG_WARNING, "failed to setup the graph"); } while (0); |
4757 | } |
4758 | |
4759 | if ((event == GF_EVENT_CHILD_UP) |
4760 | || (event == GF_EVENT_CHILD_DOWN)) { |
4761 | pthread_mutex_lock (&private->sync_mutex); |
4762 | { |
4763 | private->event_recvd = 1; |
4764 | pthread_cond_broadcast (&private->sync_cond); |
4765 | } |
4766 | pthread_mutex_unlock (&private->sync_mutex); |
4767 | } |
4768 | |
4769 | if (!private->fuse_thread_started) { |
4770 | private->fuse_thread_started = 1; |
4771 | |
4772 | ret = pthread_create (&private->fuse_thread, NULL((void*)0), |
4773 | fuse_thread_proc, this); |
4774 | if (ret != 0) { |
4775 | 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__, 4777, GF_LOG_DEBUG, "pthread_create() failed (%s)" , strerror ((*__errno_location ()))); } while (0) |
4776 | "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__, 4777, GF_LOG_DEBUG, "pthread_create() failed (%s)" , strerror ((*__errno_location ()))); } while (0) |
4777 | strerror (errno))do { do { if (0) printf ("pthread_create() failed (%s)", strerror ((*__errno_location ()))); } while (0); _gf_log (this->name , "fuse-bridge.c", __FUNCTION__, 4777, GF_LOG_DEBUG, "pthread_create() failed (%s)" , strerror ((*__errno_location ()))); } while (0); |
4778 | break; |
4779 | } |
4780 | } |
4781 | |
4782 | break; |
4783 | } |
4784 | |
4785 | case GF_EVENT_AUTH_FAILED: |
4786 | { |
4787 | /* Authentication failure is an error and glusterfs should stop */ |
4788 | 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__ , 4788, GF_LOG_ERROR, "Server authenication failed. Shutting down." ); } while (0); |
4789 | fini (this); |
4790 | break; |
4791 | } |
4792 | |
4793 | default: |
4794 | break; |
4795 | } |
4796 | |
4797 | return ret; |
4798 | } |
4799 | |
4800 | int32_t |
4801 | mem_acct_init (xlator_t *this) |
4802 | { |
4803 | int ret = -1; |
4804 | |
4805 | if (!this) |
4806 | return ret; |
4807 | |
4808 | ret = xlator_mem_acct_init (this, gf_fuse_mt_end + 1); |
4809 | |
4810 | if (ret != 0) { |
4811 | 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__ , 4812, GF_LOG_ERROR, "Memory accounting init" "failed"); } while (0) |
4812 | "failed")do { do { if (0) printf ("Memory accounting init" "failed"); } while (0); _gf_log (this->name, "fuse-bridge.c", __FUNCTION__ , 4812, GF_LOG_ERROR, "Memory accounting init" "failed"); } while (0); |
4813 | return ret; |
4814 | } |
4815 | |
4816 | return ret; |
4817 | } |
4818 | |
4819 | |
4820 | static fuse_handler_t *fuse_std_ops[FUSE_OP_HIGH(FUSE_READDIRPLUS + 1)] = { |
4821 | [FUSE_LOOKUP] = fuse_lookup, |
4822 | [FUSE_FORGET] = fuse_forget, |
4823 | [FUSE_GETATTR] = fuse_getattr, |
4824 | [FUSE_SETATTR] = fuse_setattr, |
4825 | [FUSE_READLINK] = fuse_readlink, |
4826 | [FUSE_SYMLINK] = fuse_symlink, |
4827 | [FUSE_MKNOD] = fuse_mknod, |
4828 | [FUSE_MKDIR] = fuse_mkdir, |
4829 | [FUSE_UNLINK] = fuse_unlink, |
4830 | [FUSE_RMDIR] = fuse_rmdir, |
4831 | [FUSE_RENAME] = fuse_rename, |
4832 | [FUSE_LINK] = fuse_link, |
4833 | [FUSE_OPEN] = fuse_open, |
4834 | [FUSE_READ] = fuse_readv, |
4835 | [FUSE_WRITE] = fuse_write, |
4836 | [FUSE_STATFS] = fuse_statfs, |
4837 | [FUSE_RELEASE] = fuse_release, |
4838 | [FUSE_FSYNC] = fuse_fsync, |
4839 | [FUSE_SETXATTR] = fuse_setxattr, |
4840 | [FUSE_GETXATTR] = fuse_getxattr, |
4841 | [FUSE_LISTXATTR] = fuse_listxattr, |
4842 | [FUSE_REMOVEXATTR] = fuse_removexattr, |
4843 | [FUSE_FLUSH] = fuse_flush, |
4844 | [FUSE_INIT] = fuse_init, |
4845 | [FUSE_OPENDIR] = fuse_opendir, |
4846 | [FUSE_READDIR] = fuse_readdir, |
4847 | [FUSE_RELEASEDIR] = fuse_releasedir, |
4848 | [FUSE_FSYNCDIR] = fuse_fsyncdir, |
4849 | [FUSE_GETLK] = fuse_getlk, |
4850 | [FUSE_SETLK] = fuse_setlk, |
4851 | [FUSE_SETLKW] = fuse_setlk, |
4852 | [FUSE_ACCESS] = fuse_access, |
4853 | [FUSE_CREATE] = fuse_create, |
4854 | /* [FUSE_INTERRUPT] */ |
4855 | /* [FUSE_BMAP] */ |
4856 | [FUSE_DESTROY] = fuse_destroy, |
4857 | /* [FUSE_IOCTL] */ |
4858 | /* [FUSE_POLL] */ |
4859 | /* [FUSE_NOTIFY_REPLY] */ |
4860 | /* [FUSE_BATCH_FORGET] */ |
4861 | /* [FUSE_FALLOCATE] */ |
4862 | [FUSE_READDIRPLUS] = fuse_readdirp, |
4863 | }; |
4864 | |
4865 | |
4866 | static fuse_handler_t *fuse_dump_ops[FUSE_OP_HIGH(FUSE_READDIRPLUS + 1)]; |
4867 | |
4868 | |
4869 | static void |
4870 | fuse_dumper (xlator_t *this, fuse_in_header_t *finh, void *msg) |
4871 | { |
4872 | fuse_private_t *priv = NULL((void*)0); |
4873 | struct iovec diov[3]; |
4874 | char r = 'R'; |
4875 | int ret = 0; |
4876 | |
4877 | priv = this->private; |
4878 | |
4879 | diov[0].iov_base = &r; |
4880 | diov[0].iov_len = 1; |
4881 | diov[1].iov_base = finh; |
4882 | diov[1].iov_len = sizeof (*finh); |
4883 | diov[2].iov_base = msg; |
4884 | diov[2].iov_len = finh->len - sizeof (*finh); |
4885 | |
4886 | pthread_mutex_lock (&priv->fuse_dump_mutex); |
4887 | ret = writev (priv->fuse_dump_fd, diov, 3); |
4888 | pthread_mutex_unlock (&priv->fuse_dump_mutex); |
4889 | if (ret == -1) |
4890 | 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__, 4892, GF_LOG_ERROR, "failed to dump fuse message (R): %s" , strerror ((*__errno_location ()))); } while (0) |
4891 | "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__, 4892, GF_LOG_ERROR, "failed to dump fuse message (R): %s" , strerror ((*__errno_location ()))); } while (0) |
4892 | 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__, 4892, GF_LOG_ERROR, "failed to dump fuse message (R): %s" , strerror ((*__errno_location ()))); } while (0); |
4893 | |
4894 | priv->fuse_ops0[finh->opcode] (this, finh, msg); |
4895 | } |
4896 | |
4897 | |
4898 | int |
4899 | init (xlator_t *this_xl) |
4900 | { |
4901 | int ret = 0; |
4902 | dict_t *options = NULL((void*)0); |
4903 | char *value_string = NULL((void*)0); |
4904 | cmd_args_t *cmd_args = NULL((void*)0); |
4905 | char *fsname = NULL((void*)0); |
4906 | fuse_private_t *priv = NULL((void*)0); |
4907 | struct stat stbuf = {0,}; |
4908 | int i = 0; |
4909 | int xl_name_allocated = 0; |
4910 | int fsname_allocated = 0; |
4911 | glusterfs_ctx_t *ctx = NULL((void*)0); |
4912 | gf_boolean_t sync_to_mount = _gf_false; |
4913 | unsigned long mntflags = 0; |
4914 | char *mnt_args = NULL((void*)0); |
4915 | eh_t *event = NULL((void*)0); |
4916 | |
4917 | if (this_xl == NULL((void*)0)) |
4918 | return -1; |
4919 | |
4920 | if (this_xl->options == NULL((void*)0)) |
4921 | return -1; |
4922 | |
4923 | ctx = this_xl->ctx; |
4924 | if (!ctx) |
4925 | return -1; |
4926 | |
4927 | options = this_xl->options; |
4928 | |
4929 | if (this_xl->name == NULL((void*)0)) { |
4930 | this_xl->name = gf_strdup ("fuse"); |
4931 | if (!this_xl->name) { |
4932 | 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__, 4933, GF_LOG_ERROR , "Out of memory"); } while (0) |
4933 | "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4933, GF_LOG_ERROR , "Out of memory"); } while (0); |
4934 | |
4935 | goto cleanup_exit; |
4936 | } |
4937 | xl_name_allocated = 1; |
4938 | } |
4939 | |
4940 | priv = GF_CALLOC (1, sizeof (*priv), gf_fuse_mt_fuse_private_t)__gf_calloc (1, sizeof (*priv), gf_fuse_mt_fuse_private_t); |
4941 | if (!priv) { |
4942 | 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__, 4943, GF_LOG_ERROR , "Out of memory"); } while (0) |
4943 | "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4943, GF_LOG_ERROR , "Out of memory"); } while (0); |
4944 | |
4945 | goto cleanup_exit; |
4946 | } |
4947 | this_xl->private = (void *) priv; |
4948 | priv->mount_point = NULL((void*)0); |
4949 | priv->fd = -1; |
4950 | priv->revchan_in = -1; |
4951 | priv->revchan_out = -1; |
4952 | |
4953 | /* get options from option dictionary */ |
4954 | ret = dict_get_str (options, ZR_MOUNTPOINT_OPT"mountpoint", &value_string); |
4955 | if (ret == -1 || value_string == NULL((void*)0)) { |
4956 | 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__ , 4957, GF_LOG_ERROR, "Mandatory option 'mountpoint' is not specified." ); } while (0) |
4957 | "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__ , 4957, GF_LOG_ERROR, "Mandatory option 'mountpoint' is not specified." ); } while (0); |
4958 | goto cleanup_exit; |
4959 | } |
4960 | |
4961 | if (stat (value_string, &stbuf) != 0) { |
4962 | if (errno(*__errno_location ()) == ENOENT2) { |
4963 | 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__, 4965, GF_LOG_ERROR, "%s %s does not exist", "mountpoint" , value_string); } while (0) |
4964 | "%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__, 4965, GF_LOG_ERROR, "%s %s does not exist", "mountpoint" , value_string); } while (0) |
4965 | 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__, 4965, GF_LOG_ERROR, "%s %s does not exist", "mountpoint" , value_string); } while (0); |
4966 | } else if (errno(*__errno_location ()) == ENOTCONN107) { |
4967 | 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__ , 4970, GF_LOG_ERROR, "Mountpoint %s seems to have a stale " "mount, run 'umount %s' and try again." , value_string, value_string); } while (0) |
4968 | "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__ , 4970, GF_LOG_ERROR, "Mountpoint %s seems to have a stale " "mount, run 'umount %s' and try again." , value_string, value_string); } while (0) |
4969 | "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__ , 4970, GF_LOG_ERROR, "Mountpoint %s seems to have a stale " "mount, run 'umount %s' and try again." , value_string, value_string); } while (0) |
4970 | 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__ , 4970, GF_LOG_ERROR, "Mountpoint %s seems to have a stale " "mount, run 'umount %s' and try again." , value_string, value_string); } while (0); |
4971 | } else { |
4972 | 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__, 4975, GF_LOG_DEBUG, "%s %s : stat returned %s", "mountpoint" , value_string, strerror ((*__errno_location ()))); } while ( 0) |
4973 | "%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__, 4975, GF_LOG_DEBUG, "%s %s : stat returned %s", "mountpoint" , value_string, strerror ((*__errno_location ()))); } while ( 0) |
4974 | 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__, 4975, GF_LOG_DEBUG, "%s %s : stat returned %s", "mountpoint" , value_string, strerror ((*__errno_location ()))); } while ( 0) |
4975 | 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__, 4975, GF_LOG_DEBUG, "%s %s : stat returned %s", "mountpoint" , value_string, strerror ((*__errno_location ()))); } while ( 0); |
4976 | } |
4977 | goto cleanup_exit; |
4978 | } |
4979 | |
4980 | if (S_ISDIR (stbuf.st_mode)((((stbuf.st_mode)) & 0170000) == (0040000)) == 0) { |
4981 | 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__, 4983, GF_LOG_ERROR, "%s %s is not a directory" , "mountpoint", value_string); } while (0) |
4982 | "%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__, 4983, GF_LOG_ERROR, "%s %s is not a directory" , "mountpoint", value_string); } while (0) |
4983 | 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__, 4983, GF_LOG_ERROR, "%s %s is not a directory" , "mountpoint", value_string); } while (0); |
4984 | goto cleanup_exit; |
4985 | } |
4986 | priv->mount_point = gf_strdup (value_string); |
4987 | if (!priv->mount_point) { |
4988 | 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__, 4989, GF_LOG_ERROR , "Out of memory"); } while (0) |
4989 | "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 4989, GF_LOG_ERROR , "Out of memory"); } while (0); |
4990 | |
4991 | goto cleanup_exit; |
4992 | } |
4993 | |
4994 | 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) |
4995 | 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); |
4996 | |
4997 | 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) |
4998 | 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); |
4999 | |
5000 | 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) |
5001 | 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); |
5002 | |
5003 | 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); |
5004 | /* have to check & register the presence of client-pid manually */ |
5005 | priv->client_pid_set = !!dict_get (this_xl->options, "client-pid"); |
5006 | |
5007 | 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) |
5008 | 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); |
5009 | |
5010 | priv->direct_io_mode = 2; |
5011 | ret = dict_get_str (options, ZR_DIRECT_IO_OPT"direct-io-mode", &value_string); |
5012 | if (ret == 0) { |
5013 | ret = gf_string2boolean (value_string, &priv->direct_io_mode); |
5014 | 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__, 5014, GF_LOG_ERROR, "Assertion failed: " "ret == 0" ); } while (0); } } while (0); |
5015 | } |
5016 | |
5017 | 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) |
5018 | 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); |
5019 | |
5020 | 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); |
5021 | |
5022 | if (priv->uid_map_root) |
5023 | priv->acl = 1; |
5024 | |
5025 | 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); |
5026 | |
5027 | 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); |
5028 | |
5029 | 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); |
5030 | |
5031 | priv->fuse_dump_fd = -1; |
5032 | ret = dict_get_str (options, "dump-fuse", &value_string); |
5033 | if (ret == 0) { |
5034 | ret = unlink (value_string); |
5035 | if (ret != -1 || errno(*__errno_location ()) == ENOENT2) |
5036 | ret = open (value_string, O_RDWR02|O_CREAT0100|O_EXCL0200, |
5037 | S_IRUSR0400|S_IWUSR0200); |
5038 | if (ret == -1) { |
5039 | 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__ , 5041, GF_LOG_ERROR, "cannot open fuse dump file %s", value_string ); } while (0) |
5040 | "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__ , 5041, GF_LOG_ERROR, "cannot open fuse dump file %s", value_string ); } while (0) |
5041 | 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__ , 5041, GF_LOG_ERROR, "cannot open fuse dump file %s", value_string ); } while (0); |
5042 | |
5043 | goto cleanup_exit; |
5044 | } |
5045 | priv->fuse_dump_fd = ret; |
5046 | } |
5047 | |
5048 | sync_to_mount = _gf_false; |
5049 | ret = dict_get_str (options, "sync-to-mount", &value_string); |
5050 | if (ret == 0) { |
5051 | ret = gf_string2boolean (value_string, |
5052 | &sync_to_mount); |
5053 | 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__, 5053, GF_LOG_ERROR, "Assertion failed: " "ret == 0" ); } while (0); } } while (0); |
5054 | } |
5055 | |
5056 | GF_OPTION_INIT("fopen-keep-cache", priv->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" , &(priv->fopen_keep_cache)); if (val_ret) goto cleanup_exit ; } while (0) |
5057 | cleanup_exit)do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "fopen-keep-cache" , &(priv->fopen_keep_cache)); if (val_ret) goto cleanup_exit ; } while (0); |
5058 | |
5059 | 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) |
5060 | 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); |
5061 | |
5062 | 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); |
5063 | |
5064 | if (gid_cache_init(&priv->gid_cache, priv->gid_cache_timeout) < 0) { |
5065 | 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__ , 5066, GF_LOG_ERROR, "Failed to initialize " "group cache.") ; } while (0) |
5066 | "group cache.")do { do { if (0) printf ("Failed to initialize " "group cache." ); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__ , 5066, GF_LOG_ERROR, "Failed to initialize " "group cache.") ; } while (0); |
5067 | goto cleanup_exit; |
5068 | } |
5069 | |
5070 | /* default values seemed to work fine during testing */ |
5071 | 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) |
5072 | 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); |
5073 | 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) |
5074 | 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); |
5075 | |
5076 | /* user has set only background-qlen, not congestion-threshold, |
5077 | use the fuse kernel driver formula to set congestion. ie, 75% */ |
5078 | if (dict_get (this_xl->options, "background-qlen") && |
5079 | !dict_get (this_xl->options, "congestion-threshold")) { |
5080 | priv->congestion_threshold = (priv->background_qlen * 3) / 4; |
5081 | 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__, 5084, GF_LOG_INFO, "setting congestion control as 75%% of " "background-queue length (ie, (.75 * %d) = %d", priv->background_qlen , priv->congestion_threshold); } while (0) |
5082 | "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__, 5084, GF_LOG_INFO, "setting congestion control as 75%% of " "background-queue length (ie, (.75 * %d) = %d", priv->background_qlen , priv->congestion_threshold); } while (0) |
5083 | "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__, 5084, GF_LOG_INFO, "setting congestion control as 75%% of " "background-queue length (ie, (.75 * %d) = %d", priv->background_qlen , priv->congestion_threshold); } while (0) |
5084 | 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__, 5084, GF_LOG_INFO, "setting congestion control as 75%% of " "background-queue length (ie, (.75 * %d) = %d", priv->background_qlen , priv->congestion_threshold); } while (0); |
5085 | } |
5086 | |
5087 | /* congestion should not be higher than background queue length */ |
5088 | if (priv->congestion_threshold > priv->background_qlen) { |
5089 | 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__ , 5092, GF_LOG_INFO, "setting congestion control same as " "background-queue length (%d)" , priv->background_qlen); } while (0) |
5090 | "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__ , 5092, GF_LOG_INFO, "setting congestion control same as " "background-queue length (%d)" , priv->background_qlen); } while (0) |
5091 | "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__ , 5092, GF_LOG_INFO, "setting congestion control same as " "background-queue length (%d)" , priv->background_qlen); } while (0) |
5092 | 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__ , 5092, GF_LOG_INFO, "setting congestion control same as " "background-queue length (%d)" , priv->background_qlen); } while (0); |
5093 | priv->congestion_threshold = priv->background_qlen; |
5094 | } |
5095 | |
5096 | cmd_args = &this_xl->ctx->cmd_args; |
5097 | fsname = cmd_args->volfile; |
5098 | if (!fsname && cmd_args->volfile_server) { |
5099 | if (cmd_args->volfile_id) { |
5100 | fsname = GF_MALLOC (__gf_malloc (strlen (cmd_args->volfile_server) + 1 + strlen (cmd_args->volfile_id) + 1, gf_fuse_mt_fuse_private_t) |
5101 | 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) |
5102 | 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) |
5103 | 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); |
5104 | if (!fsname) { |
5105 | 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__, 5106, GF_LOG_ERROR , "Out of memory"); } while (0) |
5106 | "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log ("glusterfs-fuse", "fuse-bridge.c", __FUNCTION__, 5106, GF_LOG_ERROR , "Out of memory"); } while (0); |
5107 | goto cleanup_exit; |
5108 | } |
5109 | fsname_allocated = 1; |
5110 | strcpy (fsname, cmd_args->volfile_server); |
5111 | strcat (fsname, ":"); |
5112 | strcat (fsname, cmd_args->volfile_id); |
5113 | } else |
5114 | fsname = cmd_args->volfile_server; |
5115 | } |
5116 | if (!fsname) |
5117 | fsname = "glusterfs"; |
5118 | |
5119 | priv->fdtable = gf_fd_fdtable_alloc (); |
5120 | if (priv->fdtable == NULL((void*)0)) { |
5121 | 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__, 5121, GF_LOG_ERROR , "Out of memory"); } while (0); |
5122 | goto cleanup_exit; |
5123 | } |
5124 | |
5125 | if (priv->read_only) |
5126 | mntflags |= MS_RDONLYMS_RDONLY; |
5127 | gf_asprintf (&mnt_args, "%s%s%sallow_other,max_read=131072", |
5128 | priv->acl ? "" : "default_permissions,", |
5129 | priv->fuse_mountopts ? priv->fuse_mountopts : "", |
5130 | priv->fuse_mountopts ? "," : ""); |
5131 | if (!mnt_args) |
5132 | goto cleanup_exit; |
5133 | |
5134 | if (pipe(priv->status_pipe) < 0) { |
5135 | 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__ , 5136, GF_LOG_ERROR, "could not create pipe to separate mount process" ); } while (0) |
5136 | "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__ , 5136, GF_LOG_ERROR, "could not create pipe to separate mount process" ); } while (0); |
5137 | goto cleanup_exit; |
5138 | } |
5139 | |
5140 | priv->fd = gf_fuse_mount (priv->mount_point, fsname, mntflags, mnt_args, |
5141 | sync_to_mount ? &ctx->mnt_pid : NULL((void*)0), |
5142 | priv->status_pipe[1]); |
5143 | if (priv->fd == -1) |
5144 | goto cleanup_exit; |
5145 | |
5146 | event = eh_new (FUSE_EVENT_HISTORY_SIZE1024, _gf_false); |
5147 | if (!event) { |
5148 | 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__ , 5149, GF_LOG_ERROR, "could not create a new event history") ; } while (0) |
5149 | "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__ , 5149, GF_LOG_ERROR, "could not create a new event history") ; } while (0); |
5150 | goto cleanup_exit; |
5151 | } |
5152 | |
5153 | this_xl->history = event; |
5154 | |
5155 | pthread_mutex_init (&priv->fuse_dump_mutex, NULL((void*)0)); |
5156 | pthread_cond_init (&priv->sync_cond, NULL((void*)0)); |
5157 | pthread_mutex_init (&priv->sync_mutex, NULL((void*)0)); |
5158 | priv->event_recvd = 0; |
5159 | |
5160 | for (i = 0; i < FUSE_OP_HIGH(FUSE_READDIRPLUS + 1); i++) { |
5161 | if (!fuse_std_ops[i]) |
5162 | fuse_std_ops[i] = fuse_enosys; |
5163 | if (!fuse_dump_ops[i]) |
5164 | fuse_dump_ops[i] = fuse_dumper; |
5165 | } |
5166 | priv->fuse_ops = fuse_std_ops; |
5167 | if (priv->fuse_dump_fd != -1) { |
5168 | priv->fuse_ops0 = priv->fuse_ops; |
5169 | priv->fuse_ops = fuse_dump_ops; |
5170 | } |
5171 | |
5172 | if (fsname_allocated) |
5173 | GF_FREE (fsname)__gf_free (fsname); |
5174 | GF_FREE (mnt_args)__gf_free (mnt_args); |
5175 | return 0; |
5176 | |
5177 | cleanup_exit: |
5178 | if (xl_name_allocated) |
5179 | GF_FREE (this_xl->name)__gf_free (this_xl->name); |
5180 | if (fsname_allocated) |
5181 | GF_FREE (fsname)__gf_free (fsname); |
5182 | if (priv) { |
5183 | GF_FREE (priv->mount_point)__gf_free (priv->mount_point); |
5184 | if (priv->fd != -1) |
5185 | close (priv->fd); |
5186 | if (priv->fuse_dump_fd != -1) |
5187 | close (priv->fuse_dump_fd); |
5188 | GF_FREE (priv)__gf_free (priv); |
5189 | } |
5190 | GF_FREE (mnt_args)__gf_free (mnt_args); |
5191 | return -1; |
5192 | } |
5193 | |
5194 | |
5195 | void |
5196 | fini (xlator_t *this_xl) |
5197 | { |
5198 | fuse_private_t *priv = NULL((void*)0); |
5199 | char *mount_point = NULL((void*)0); |
5200 | |
5201 | if (this_xl == NULL((void*)0)) |
5202 | return; |
5203 | |
5204 | if ((priv = this_xl->private) == NULL((void*)0)) |
5205 | return; |
5206 | |
5207 | if (dict_get (this_xl->options, ZR_MOUNTPOINT_OPT"mountpoint")) |
5208 | mount_point = data_to_str (dict_get (this_xl->options, |
5209 | ZR_MOUNTPOINT_OPT"mountpoint")); |
5210 | if (mount_point != NULL((void*)0)) { |
5211 | 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__ , 5212, GF_LOG_INFO, "Unmounting '%s'.", mount_point); } while (0) |
5212 | "Unmounting '%s'.", mount_point)do { do { if (0) printf ("Unmounting '%s'.", mount_point); } while (0); _gf_log (this_xl->name, "fuse-bridge.c", __FUNCTION__ , 5212, GF_LOG_INFO, "Unmounting '%s'.", mount_point); } while (0); |
5213 | |
5214 | gf_fuse_unmount (mount_point, priv->fd); |
5215 | close (priv->fuse_dump_fd); |
5216 | dict_del (this_xl->options, ZR_MOUNTPOINT_OPT"mountpoint"); |
5217 | } |
5218 | /* Process should terminate once fuse xlator is finished. |
5219 | * Required for AUTH_FAILED event. |
5220 | */ |
5221 | kill (getpid (), SIGTERM15); |
5222 | } |
5223 | |
5224 | struct xlator_fops fops; |
5225 | |
5226 | struct xlator_cbks cbks = { |
5227 | .invalidate = fuse_invalidate, |
5228 | }; |
5229 | |
5230 | |
5231 | struct xlator_dumpops dumpops = { |
5232 | .priv = fuse_priv_dump, |
5233 | .inode = fuse_itable_dump, |
5234 | .history = fuse_history_dump, |
5235 | }; |
5236 | |
5237 | struct volume_options options[] = { |
5238 | { .key = {"direct-io-mode"}, |
5239 | .type = GF_OPTION_TYPE_BOOL |
5240 | }, |
5241 | { .key = {ZR_MOUNTPOINT_OPT"mountpoint", "mount-point"}, |
5242 | .type = GF_OPTION_TYPE_PATH |
5243 | }, |
5244 | { .key = {ZR_DUMP_FUSE"dump-fuse", "fuse-dumpfile"}, |
5245 | .type = GF_OPTION_TYPE_PATH |
5246 | }, |
5247 | { .key = {ZR_ATTR_TIMEOUT_OPT"attribute-timeout"}, |
5248 | .type = GF_OPTION_TYPE_DOUBLE, |
5249 | .default_value = "1.0" |
5250 | }, |
5251 | { .key = {ZR_ENTRY_TIMEOUT_OPT"entry-timeout"}, |
5252 | .type = GF_OPTION_TYPE_DOUBLE, |
5253 | .default_value = "1.0" |
5254 | }, |
5255 | { .key = {ZR_NEGATIVE_TIMEOUT_OPT"negative-timeout"}, |
5256 | .type = GF_OPTION_TYPE_DOUBLE, |
5257 | .default_value = "0.0" |
5258 | }, |
5259 | { .key = {ZR_STRICT_VOLFILE_CHECK"strict-volfile-check"}, |
5260 | .type = GF_OPTION_TYPE_BOOL, |
5261 | .default_value = "false" |
5262 | }, |
5263 | { .key = {"client-pid"}, |
5264 | .type = GF_OPTION_TYPE_INT |
5265 | }, |
5266 | { .key = {"uid-map-root"}, |
5267 | .type = GF_OPTION_TYPE_INT |
5268 | }, |
5269 | { .key = {"sync-to-mount"}, |
5270 | .type = GF_OPTION_TYPE_BOOL |
5271 | }, |
5272 | { .key = {"read-only"}, |
5273 | .type = GF_OPTION_TYPE_BOOL |
5274 | }, |
5275 | { .key = {"fopen-keep-cache"}, |
5276 | .type = GF_OPTION_TYPE_BOOL, |
5277 | .default_value = "false" |
5278 | }, |
5279 | { .key = {"gid-timeout"}, |
5280 | .type = GF_OPTION_TYPE_INT, |
5281 | .default_value = "2" |
5282 | }, |
5283 | { .key = {"acl"}, |
5284 | .type = GF_OPTION_TYPE_BOOL, |
5285 | .default_value = "false" |
5286 | }, |
5287 | { .key = {"selinux"}, |
5288 | .type = GF_OPTION_TYPE_BOOL, |
5289 | .default_value = "false" |
5290 | }, |
5291 | { .key = {"enable-ino32"}, |
5292 | .type = GF_OPTION_TYPE_BOOL, |
5293 | .default_value = "false" |
5294 | }, |
5295 | { .key = {"background-qlen"}, |
5296 | .type = GF_OPTION_TYPE_INT, |
5297 | .default_value = "64", |
5298 | .min = 16, |
5299 | .max = (64 * GF_UNIT_KB1024ULL), |
5300 | }, |
5301 | { .key = {"congestion-threshold"}, |
5302 | .type = GF_OPTION_TYPE_INT, |
5303 | .default_value = "48", |
5304 | .min = 12, |
5305 | .max = (64 * GF_UNIT_KB1024ULL), |
5306 | }, |
5307 | { .key = {"fuse-mountopts"}, |
5308 | .type = GF_OPTION_TYPE_STR |
5309 | }, |
5310 | { .key = {NULL((void*)0)} }, |
5311 | }; |